playbook_ui_docs 16.3.0 → 16.4.0.pre.alpha.PLAY2846reactadvancedtablecalcheaderpinnedrows15356

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 (79) 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/example.yml +3 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  10. data/app/pb_kits/playbook/pb_button/docs/_button_full_width_rails.md +19 -0
  11. data/app/pb_kits/playbook/pb_button/docs/_button_full_width_react.md +23 -0
  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_multi_level_select/docs/_multi_level_select_placeholder.html.erb +109 -0
  30. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.jsx +127 -0
  31. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.md +1 -0
  32. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
  33. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
  34. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement.jsx +81 -0
  35. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement_react.md +1 -0
  36. data/app/pb_kits/playbook/pb_popover/docs/_popover_position.html.erb +128 -0
  37. data/app/pb_kits/playbook/pb_popover/docs/_popover_position_rails.md +1 -0
  38. data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_popover/docs/index.js +2 -1
  40. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +56 -0
  41. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.md +1 -0
  42. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +13 -21
  43. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -10
  44. data/app/pb_kits/playbook/pb_table/docs/_sections.yml +1 -0
  45. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb +45 -0
  46. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +39 -0
  47. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +2 -1
  48. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.jsx +152 -0
  49. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.md +17 -0
  50. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.html.erb +121 -0
  51. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.md +17 -0
  52. data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
  53. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  54. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +20 -8
  55. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.md +3 -0
  56. metadata +33 -25
  57. data/app/pb_kits/playbook/pb_button/docs/_button_full_width.md +0 -1
  58. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
  59. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +0 -15
  60. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
  61. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
  62. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +0 -17
  63. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
  64. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
  65. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +0 -28
  66. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +0 -1
  67. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
  68. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +0 -45
  69. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
  70. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +0 -22
  71. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +0 -3
  72. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
  73. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +0 -13
  74. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
  75. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +0 -15
  76. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
  77. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +0 -42
  78. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
  79. 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,109 @@
1
+ <%
2
+ tree_base = [{
3
+ label: "Power Home Remodeling",
4
+ value: "powerHomeRemodeling",
5
+ id: "100",
6
+ expanded: true,
7
+ children: [
8
+ {
9
+ label: "People",
10
+ value: "people",
11
+ id: "101",
12
+ expanded: true,
13
+ children: [
14
+ {
15
+ label: "Talent Acquisition",
16
+ value: "talentAcquisition",
17
+ id: "102",
18
+ },
19
+ {
20
+ label: "Business Affairs",
21
+ value: "business Affairs",
22
+ id: "103",
23
+ children: [
24
+ {
25
+ label: "Initiatives",
26
+ value: "initiatives",
27
+ id: "104",
28
+ },
29
+ {
30
+ label: "Learning & Development",
31
+ value: "learningAndDevelopment",
32
+ id: "105",
33
+ },
34
+ ],
35
+ },
36
+ {
37
+ label: "People Experience",
38
+ value: "peopleExperience",
39
+ id: "106",
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ label: "Contact Center",
45
+ value: "contactCenter",
46
+ id: "107",
47
+ children: [
48
+ {
49
+ label: "Appointment Management",
50
+ value: "appointmentManagement",
51
+ id: "108",
52
+ },
53
+ {
54
+ label: "Customer Service",
55
+ value: "customerService",
56
+ id: "109",
57
+ },
58
+ {
59
+ label: "Energy",
60
+ value: "energy",
61
+ id: "110",
62
+ },
63
+ ],
64
+ },
65
+ ],
66
+ }]
67
+
68
+ prefix_mls_ids = nil
69
+ prefix_mls_ids = ->(nodes, pfx) {
70
+ nodes.map do |n|
71
+ h = n.dup
72
+ h[:id] = "#{pfx}#{n[:id]}"
73
+ h[:children] = prefix_mls_ids.call(n[:children], pfx) if n[:children].present?
74
+ h
75
+ end
76
+ }
77
+
78
+ tree_multi = prefix_mls_ids.call(tree_base, "phm_")
79
+ tree_return_all = prefix_mls_ids.call(tree_base, "phr_")
80
+ tree_single = prefix_mls_ids.call(tree_base, "phs_")
81
+ %>
82
+
83
+ <%= pb_rails("multi_level_select", props: {
84
+ id: "multi-level-select-placeholder-multi-rails",
85
+ label: "Multi (default)",
86
+ margin_bottom: "sm",
87
+ name: "placeholder_multi",
88
+ tree_data: tree_multi,
89
+ placeholder: "Search or choose options…",
90
+ }) %>
91
+
92
+ <%= pb_rails("multi_level_select", props: {
93
+ id: "multi-level-select-placeholder-return-all-rails",
94
+ label: "Multi (return all selected)",
95
+ margin_bottom: "sm",
96
+ name: "placeholder_return_all",
97
+ placeholder: "Departments...",
98
+ return_all_selected: true,
99
+ tree_data: tree_return_all,
100
+ }) %>
101
+
102
+ <%= pb_rails("multi_level_select", props: {
103
+ id: "multi-level-select-placeholder-single-rails",
104
+ label: "Single",
105
+ name: "placeholder_single",
106
+ placeholder: "Select one option…",
107
+ tree_data: tree_single,
108
+ variant: "single",
109
+ }) %>
@@ -0,0 +1,127 @@
1
+ import React from "react";
2
+
3
+ import MultiLevelSelect from "../_multi_level_select";
4
+
5
+ const treeTemplate = [
6
+ {
7
+ label: "Power Home Remodeling",
8
+ value: "powerHomeRemodeling",
9
+ id: "powerhome1",
10
+ expanded: true,
11
+ children: [
12
+ {
13
+ label: "People",
14
+ value: "people",
15
+ id: "people1",
16
+ expanded: true,
17
+ children: [
18
+ {
19
+ label: "Talent Acquisition",
20
+ value: "talentAcquisition",
21
+ id: "talent1",
22
+ },
23
+ {
24
+ label: "Business Affairs",
25
+ value: "businessAffairs",
26
+ id: "business1",
27
+ children: [
28
+ {
29
+ label: "Initiatives",
30
+ value: "initiatives",
31
+ id: "initiative1",
32
+ },
33
+ {
34
+ label: "Learning & Development",
35
+ value: "learningAndDevelopment",
36
+ id: "development1",
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ label: "People Experience",
42
+ value: "peopleExperience",
43
+ id: "experience1",
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ label: "Contact Center",
49
+ value: "contactCenter",
50
+ id: "contact1",
51
+ children: [
52
+ {
53
+ label: "Appointment Management",
54
+ value: "appointmentManagement",
55
+ id: "appointment1",
56
+ },
57
+ {
58
+ label: "Customer Service",
59
+ value: "customerService",
60
+ id: "customer1",
61
+ },
62
+ {
63
+ label: "Energy",
64
+ value: "energy",
65
+ id: "energy1",
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ ];
72
+
73
+ function prefixTreeIds(nodes, prefix) {
74
+ return nodes.map((node) => ({
75
+ ...node,
76
+ id: `${prefix}${node.id}`,
77
+ children:
78
+ node.children && node.children.length > 0
79
+ ? prefixTreeIds(node.children, prefix)
80
+ : node.children,
81
+ }));
82
+ }
83
+
84
+ const treeDataMulti = prefixTreeIds(treeTemplate, "phm_");
85
+ const treeDataReturnAll = prefixTreeIds(treeTemplate, "phr_");
86
+ const treeDataSingle = prefixTreeIds(treeTemplate, "phs_");
87
+
88
+ const MultiLevelSelectPlaceholder = () => (
89
+ <>
90
+ <MultiLevelSelect
91
+ id="multi-level-select-placeholder-multi"
92
+ label="Multi (default)"
93
+ marginBottom="sm"
94
+ name="placeholder_multi"
95
+ onSelect={(selectedNodes) =>
96
+ console.log("Multi — default", selectedNodes)
97
+ }
98
+ placeholder="Search or choose options…"
99
+ treeData={treeDataMulti}
100
+ />
101
+ <MultiLevelSelect
102
+ id="multi-level-select-placeholder-return-all"
103
+ label="Multi (return all selected)"
104
+ marginBottom="sm"
105
+ name="placeholder_return_all"
106
+ onSelect={(selectedNodes) =>
107
+ console.log("Multi — return all selected", selectedNodes)
108
+ }
109
+ placeholder="Departments..."
110
+ returnAllSelected
111
+ treeData={treeDataReturnAll}
112
+ />
113
+ <MultiLevelSelect
114
+ id="multi-level-select-placeholder-single"
115
+ label="Single"
116
+ name="placeholder_single"
117
+ onSelect={(selectedNodes) =>
118
+ console.log("Single", selectedNodes)
119
+ }
120
+ placeholder="Select one option…"
121
+ treeData={treeDataSingle}
122
+ variant="single"
123
+ />
124
+ </>
125
+ );
126
+
127
+ export default MultiLevelSelectPlaceholder;
@@ -0,0 +1 @@
1
+ Use the `placeholder` prop to customize the initial text shown in the input when nothing is selected. The default is `Start typing...`.
@@ -18,6 +18,7 @@ examples:
18
18
  - multi_level_select_disabled_options_parent: Disabled Parent Option (Return All Selected)
19
19
  - multi_level_select_single_disabled: Disabled Options (Single Select)
20
20
  - multi_level_select_required_indicator: Required Indicator
21
+ - multi_level_select_placeholder: Placeholder
21
22
 
22
23
  react:
23
24
  - multi_level_select_default: Default
@@ -40,3 +41,4 @@ examples:
40
41
  - multi_level_select_single_disabled: Disabled Options (Single Select)
41
42
  - multi_level_select_required_indicator: Required Indicator
42
43
  - multi_level_select_react_reset_key: Reset with Key (React)
44
+ - multi_level_select_placeholder: Placeholder
@@ -18,3 +18,4 @@ export { default as MultiLevelSelectLabel } from "./_multi_level_select_label.js
18
18
  export { default as MultiLevelSelectSingleDisabled } from "./_multi_level_select_single_disabled.jsx"
19
19
  export { default as MultiLevelSelectRequiredIndicator } from "./_multi_level_select_required_indicator.jsx"
20
20
  export { default as MultiLevelSelectReactResetKey } from "./_multi_level_select_react_reset_key.jsx"
21
+ export { default as MultiLevelSelectPlaceholder } from "./_multi_level_select_placeholder.jsx"