playbook_ui_docs 16.3.0 → 16.4.0.pre.alpha.PLAY2718containerfalseborderradiusresponsiveonly15164

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx +50 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md +1 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +57 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +7 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.jsx +175 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.md +5 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +31 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +93 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  12. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +6 -3
  14. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.html.erb +3 -3
  15. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +6 -3
  16. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.html.erb +3 -3
  17. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +6 -3
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.html.erb +16 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.md +1 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +224 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +7 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.html.erb +46 -0
  24. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.jsx +42 -0
  25. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_rails.md +1 -0
  26. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_react.md +1 -0
  27. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  28. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +2 -1
  29. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement.jsx +81 -0
  30. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement_react.md +1 -0
  31. data/app/pb_kits/playbook/pb_popover/docs/_popover_position.html.erb +128 -0
  32. data/app/pb_kits/playbook/pb_popover/docs/_popover_position_rails.md +1 -0
  33. data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -0
  34. data/app/pb_kits/playbook/pb_popover/docs/index.js +2 -1
  35. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +56 -0
  36. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.md +1 -0
  37. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +13 -21
  38. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -10
  39. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.jsx +152 -0
  40. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.md +17 -0
  41. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.html.erb +121 -0
  42. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.md +17 -0
  43. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  44. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  45. metadata +25 -24
  46. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
  47. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +0 -15
  48. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
  49. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
  50. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +0 -17
  51. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
  52. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
  53. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +0 -28
  54. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +0 -1
  55. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
  56. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +0 -45
  57. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
  58. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +0 -22
  59. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +0 -3
  60. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
  61. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +0 -13
  62. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
  63. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +0 -15
  64. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
  65. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +0 -42
  66. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
  67. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
@@ -0,0 +1,224 @@
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>
@@ -0,0 +1,7 @@
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.
@@ -25,6 +25,7 @@ examples:
25
25
  - dropdown_separators_hidden: Separators Hidden
26
26
  - dropdown_with_clearable: Clearable
27
27
  - dropdown_with_constrain_height_rails: Constrain Height
28
+ - dropdown_closing_options_rails: Closing Options
28
29
  - dropdown_quickpick_rails: Quick Pick Variant
29
30
  - dropdown_quickpick_range_end_rails: Quick Pick Variant (Range Ends Today)
30
31
  - dropdown_quickpick_default_dates: Quick Pick Variant (Default Dates)
@@ -32,6 +33,7 @@ examples:
32
33
  - dropdown_quickpick_with_date_pickers_rails: Quick Pick with Date Pickers
33
34
  - dropdown_quickpick_with_date_pickers_default_rails: Quick Pick with Date Pickers (Default Value)
34
35
  - dropdown_required_indicator: Required Indicator
36
+ - dropdown_custom_event_type: Custom Event Type
35
37
 
36
38
  react:
37
39
  - dropdown_default: Default
@@ -0,0 +1,46 @@
1
+ <%= pb_rails("button", props: { text: "Top Nav Toast", variant: "secondary", data: { toast: "#top-nav" } }) %>
2
+
3
+ <%= pb_rails("fixed_confirmation_toast", props: {
4
+ classname: "top-nav-margin",
5
+ closeable: true,
6
+ id: "top-nav",
7
+ multi_line: true,
8
+ text: "Top nav Margin.",
9
+ status: "tip",
10
+ vertical: "top",
11
+ horizontal: "center",
12
+ nav_margin_top: true
13
+ }) %>
14
+
15
+
16
+
17
+ <script type="text/javascript">
18
+ const navtoast = document.querySelectorAll(".top-nav-margin")
19
+ const navbutton = document.querySelectorAll("button[data-toast]")
20
+
21
+ const hideNavToast = () => {
22
+ navtoast.forEach((toast) => {
23
+ toast.style.display = "none"
24
+ })
25
+ }
26
+
27
+ // Hide toasts immediately
28
+ hideNavToast()
29
+
30
+ // Handle various page load/restore events
31
+ window.addEventListener('pageshow', hideNavToast)
32
+ document.addEventListener('DOMContentLoaded', hideNavToast)
33
+ document.addEventListener('turbolinks:load', hideNavToast)
34
+ document.addEventListener('turbo:load', hideNavToast)
35
+
36
+ navbutton.forEach((button) => {
37
+ button.onclick = () => {
38
+ hideNavToast()
39
+ let toast = document.querySelector(button.getAttribute("data-toast"))
40
+
41
+ if (toast) {
42
+ toast.style.display = "flex"
43
+ }
44
+ }
45
+ })
46
+ </script>
@@ -0,0 +1,42 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Button from '../../pb_button/_button'
4
+ import FixedConfirmationToast from '../_fixed_confirmation_toast'
5
+
6
+ const FixedConfirmationToastNavMargin = (props) => {
7
+ const [openToast, setOpenToast] = useState(false)
8
+
9
+
10
+ const handleClickShort = () => {
11
+ setOpenToast(true)
12
+ }
13
+
14
+ const handleCloseShort = () => {
15
+ setOpenToast(false)
16
+ }
17
+
18
+ return (
19
+ <div>
20
+ <Button
21
+ onClick={handleClickShort}
22
+ text="Top Nav Margin"
23
+ variant="secondary"
24
+ {...props}
25
+ />
26
+
27
+ <FixedConfirmationToast
28
+ closeable
29
+ horizontal='center'
30
+ navMarginTop
31
+ onClose={handleCloseShort}
32
+ open={openToast}
33
+ status="tip"
34
+ text="Top nav Margin."
35
+ vertical='top'
36
+ {...props}
37
+ />
38
+ </div>
39
+ )
40
+ }
41
+
42
+ export default FixedConfirmationToastNavMargin
@@ -0,0 +1 @@
1
+ Use the `nav_margin_top` prop to position the toast lower on the page. This is useful for cases where we want to position the toast below a header or nav.
@@ -0,0 +1 @@
1
+ Use the `navMarginTop` prop to position the toast lower on the page. This is useful for cases where we want to position the toast below a header or nav.
@@ -2,6 +2,7 @@ examples:
2
2
 
3
3
  rails:
4
4
  - fixed_confirmation_toast_default: Default
5
+ - fixed_confirmation_toast_nav_margin: Nav Margin Top
5
6
  - fixed_confirmation_toast_multi_line: Multi Line
6
7
  - fixed_confirmation_toast_close: Click to Close
7
8
  - fixed_confirmation_toast_positions: Click to Show Positions
@@ -12,6 +13,7 @@ examples:
12
13
 
13
14
  react:
14
15
  - fixed_confirmation_toast_default: Default
16
+ - fixed_confirmation_toast_nav_margin: Nav Margin Top
15
17
  - fixed_confirmation_toast_multi_line: Multi Line
16
18
  - fixed_confirmation_toast_close: Click to Close
17
19
  - fixed_confirmation_toast_positions: Click to Show Positions
@@ -5,4 +5,5 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
5
5
  export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
6
6
  export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
7
7
  export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
8
- export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
8
+ export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
9
+ export { default as FixedConfirmationToastNavMargin } from './_fixed_confirmation_toast_nav_margin.jsx'
@@ -0,0 +1,81 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Button from '../../pb_button/_button'
4
+ import Flex from '../../pb_flex/_flex'
5
+ import PbReactPopover from '../../pb_popover/_popover'
6
+
7
+ const ROWS = [
8
+ [
9
+ { placement: 'top', label: 'Top' },
10
+ { placement: 'top-start', label: 'Top start' },
11
+ { placement: 'top-end', label: 'Top end' },
12
+ ],
13
+ [
14
+ { placement: 'bottom', label: 'Bottom' },
15
+ { placement: 'bottom-start', label: 'Bottom start' },
16
+ { placement: 'bottom-end', label: 'Bottom end' },
17
+ ],
18
+ [
19
+ { placement: 'left', label: 'Left' },
20
+ { placement: 'left-start', label: 'Left start' },
21
+ { placement: 'left-end', label: 'Left end' },
22
+ ],
23
+ [
24
+ { placement: 'right', label: 'Right' },
25
+ { placement: 'right-start', label: 'Right start' },
26
+ { placement: 'right-end', label: 'Right end' },
27
+ ],
28
+ ]
29
+
30
+ const PopoverPlacement = (props) => {
31
+ const [open, setOpen] = useState({})
32
+
33
+ const isOpen = (placement) => open[placement] === true
34
+ const setOpenFor = (placement) => (value) => setOpen((prev) => ({ ...prev, [placement]: value }))
35
+ const toggle = (placement) => setOpenFor(placement)(!isOpen(placement))
36
+ const handleShouldClose = (placement) => (shouldClose) => {
37
+ if (shouldClose) setOpenFor(placement)(false)
38
+ }
39
+
40
+ return (
41
+ <>
42
+ {ROWS.map((placements, rowIndex) => (
43
+ <Flex
44
+ justify="around"
45
+ key={placements[0].placement}
46
+ marginBottom={rowIndex < ROWS.length - 1 ? 'sm' : undefined}
47
+ orientation="row"
48
+ wrap
49
+ {...props}
50
+ >
51
+ {placements.map(({ placement, label }) => {
52
+ const trigger = (
53
+ <Button
54
+ key={placement}
55
+ onClick={() => toggle(placement)}
56
+ text={label}
57
+ variant="secondary"
58
+ />
59
+ )
60
+ return (
61
+ <PbReactPopover
62
+ closeOnClick="outside"
63
+ key={placement}
64
+ offset
65
+ placement={placement}
66
+ reference={trigger}
67
+ shouldClosePopover={handleShouldClose(placement)}
68
+ show={isOpen(placement)}
69
+ {...props}
70
+ >
71
+ {`Popover: ${label.toLowerCase()}`}
72
+ </PbReactPopover>
73
+ )
74
+ })}
75
+ </Flex>
76
+ ))}
77
+ </>
78
+ )
79
+ }
80
+
81
+ export default PopoverPlacement
@@ -0,0 +1 @@
1
+ Use the `placement` prop to control where the popover appears relative to its trigger. Valid values include `top`, `bottom`, `left`, `right`, and aligned variants such as `top-start`, `top-end`, `bottom-start`, `bottom-end`, `left-start`, `left-end`, `right-start`, and `right-end`.
@@ -0,0 +1,128 @@
1
+ <%= pb_rails("flex", props: { justify: "around", margin_bottom: "sm", orientation: "row", wrap: true }) do %>
2
+ <%= pb_rails("button", props: { text: "Top", variant: "secondary", id: "placement-popover-top" }) %>
3
+ <%= pb_rails("popover", props: {
4
+ close_on_click: "outside",
5
+ trigger_element_id: "placement-popover-top",
6
+ tooltip_id: "placement-tooltip-top",
7
+ position: "top",
8
+ offset: true
9
+ }) do %>
10
+ Popover: top
11
+ <% end %>
12
+ <%= pb_rails("button", props: { text: "Top start", variant: "secondary", id: "placement-popover-top-start" }) %>
13
+ <%= pb_rails("popover", props: {
14
+ close_on_click: "outside",
15
+ trigger_element_id: "placement-popover-top-start",
16
+ tooltip_id: "placement-tooltip-top-start",
17
+ position: "top-start",
18
+ offset: true
19
+ }) do %>
20
+ Popover: top start
21
+ <% end %>
22
+ <%= pb_rails("button", props: { text: "Top end", variant: "secondary", id: "placement-popover-top-end" }) %>
23
+ <%= pb_rails("popover", props: {
24
+ close_on_click: "outside",
25
+ trigger_element_id: "placement-popover-top-end",
26
+ tooltip_id: "placement-tooltip-top-end",
27
+ position: "top-end",
28
+ offset: true
29
+ }) do %>
30
+ Popover: top end
31
+ <% end %>
32
+ <% end %>
33
+ <%= pb_rails("flex", props: { justify: "around", margin_bottom: "sm", orientation: "row", wrap: true }) do %>
34
+ <%= pb_rails("button", props: { text: "Bottom", variant: "secondary", id: "placement-popover-bottom" }) %>
35
+ <%= pb_rails("popover", props: {
36
+ close_on_click: "outside",
37
+ trigger_element_id: "placement-popover-bottom",
38
+ tooltip_id: "placement-tooltip-bottom",
39
+ position: "bottom",
40
+ offset: true
41
+ }) do %>
42
+ Popover: bottom
43
+ <% end %>
44
+ <%= pb_rails("button", props: { text: "Bottom start", variant: "secondary", id: "placement-popover-bottom-start" }) %>
45
+ <%= pb_rails("popover", props: {
46
+ close_on_click: "outside",
47
+ trigger_element_id: "placement-popover-bottom-start",
48
+ tooltip_id: "placement-tooltip-bottom-start",
49
+ position: "bottom-start",
50
+ offset: true
51
+ }) do %>
52
+ Popover: bottom start
53
+ <% end %>
54
+ <%= pb_rails("button", props: { text: "Bottom end", variant: "secondary", id: "placement-popover-bottom-end" }) %>
55
+ <%= pb_rails("popover", props: {
56
+ close_on_click: "outside",
57
+ trigger_element_id: "placement-popover-bottom-end",
58
+ tooltip_id: "placement-tooltip-bottom-end",
59
+ position: "bottom-end",
60
+ offset: true
61
+ }) do %>
62
+ Popover: bottom end
63
+ <% end %>
64
+ <% end %>
65
+ <%= pb_rails("flex", props: { justify: "around", margin_bottom: "sm", orientation: "row", wrap: true }) do %>
66
+ <%= pb_rails("button", props: { text: "Left", variant: "secondary", id: "placement-popover-left" }) %>
67
+ <%= pb_rails("popover", props: {
68
+ close_on_click: "outside",
69
+ trigger_element_id: "placement-popover-left",
70
+ tooltip_id: "placement-tooltip-left",
71
+ position: "left",
72
+ offset: true
73
+ }) do %>
74
+ Popover: left
75
+ <% end %>
76
+ <%= pb_rails("button", props: { text: "Left start", variant: "secondary", id: "placement-popover-left-start" }) %>
77
+ <%= pb_rails("popover", props: {
78
+ close_on_click: "outside",
79
+ trigger_element_id: "placement-popover-left-start",
80
+ tooltip_id: "placement-tooltip-left-start",
81
+ position: "left-start",
82
+ offset: true
83
+ }) do %>
84
+ Popover: left start
85
+ <% end %>
86
+ <%= pb_rails("button", props: { text: "Left end", variant: "secondary", id: "placement-popover-left-end" }) %>
87
+ <%= pb_rails("popover", props: {
88
+ close_on_click: "outside",
89
+ trigger_element_id: "placement-popover-left-end",
90
+ tooltip_id: "placement-tooltip-left-end",
91
+ position: "left-end",
92
+ offset: true
93
+ }) do %>
94
+ Popover: left end
95
+ <% end %>
96
+ <% end %>
97
+ <%= pb_rails("flex", props: { justify: "around", orientation: "row", wrap: true }) do %>
98
+ <%= pb_rails("button", props: { text: "Right", variant: "secondary", id: "placement-popover-right" }) %>
99
+ <%= pb_rails("popover", props: {
100
+ close_on_click: "outside",
101
+ trigger_element_id: "placement-popover-right",
102
+ tooltip_id: "placement-tooltip-right",
103
+ position: "right",
104
+ offset: true
105
+ }) do %>
106
+ Popover: right
107
+ <% end %>
108
+ <%= pb_rails("button", props: { text: "Right start", variant: "secondary", id: "placement-popover-right-start" }) %>
109
+ <%= pb_rails("popover", props: {
110
+ close_on_click: "outside",
111
+ trigger_element_id: "placement-popover-right-start",
112
+ tooltip_id: "placement-tooltip-right-start",
113
+ position: "right-start",
114
+ offset: true
115
+ }) do %>
116
+ Popover: right start
117
+ <% end %>
118
+ <%= pb_rails("button", props: { text: "Right end", variant: "secondary", id: "placement-popover-right-end" }) %>
119
+ <%= pb_rails("popover", props: {
120
+ close_on_click: "outside",
121
+ trigger_element_id: "placement-popover-right-end",
122
+ tooltip_id: "placement-tooltip-right-end",
123
+ position: "right-end",
124
+ offset: true
125
+ }) do %>
126
+ Popover: right end
127
+ <% end %>
128
+ <% end %>
@@ -0,0 +1 @@
1
+ Use the `position` prop to control where the popover appears relative to its trigger. Valid values include `top`, `bottom`, `left`, `right`, and aligned variants such as `top-start`, `top-end`, `bottom-start`, `bottom-end`, `left-start`, `left-end`, `right-start`, and `right-end`.
@@ -7,6 +7,7 @@ examples:
7
7
  - popover_scroll_height: Scroll and Height Settings
8
8
  - popover_actionable_content: With Actionable Content
9
9
  - popover_append_to: Append To
10
+ - popover_position: Position
10
11
 
11
12
  react:
12
13
  - popover_default: Default
@@ -16,3 +17,4 @@ examples:
16
17
  - popover_scroll_height: Scroll and Height Settings
17
18
  - popover_actionable_content: With Actionable Content
18
19
  - popover_append_to: Append To
20
+ - popover_placement: Placement
@@ -4,4 +4,5 @@ export { default as PopoverClose } from './_popover_close.jsx'
4
4
  export { default as PopoverZIndex } from './_popover_z_index.jsx'
5
5
  export { default as PopoverScrollHeight } from './_popover_scroll_height.jsx'
6
6
  export { default as PopoverActionableContent } from './_popover_actionable_content.jsx'
7
- export { default as PopoverAppendTo } from './_popover_append_to.jsx'
7
+ export { default as PopoverAppendTo } from './_popover_append_to.jsx'
8
+ export { default as PopoverPlacement } from './_popover_placement.jsx'