@superleapai/flow-ui 2.4.5 → 2.4.6

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.
@@ -79,11 +79,7 @@
79
79
  const body = document.createElement("div");
80
80
  body.className =
81
81
  bodyClassName ||
82
- "text-reg-14 text-typography-secondary-text leading-5 [&_p]:mb-2 [&_p:last-child]:mb-0 max-h-[90vh] overflow-y-auto overflow-x-hidden min-h-0";
83
- body.style.maxHeight = "90vh";
84
- body.style.overflowY = "auto";
85
- body.style.overflowX = "hidden";
86
- body.style.minHeight = "0";
82
+ "text-reg-14 text-typography-secondary-text leading-5 [&_p]:mb-2 [&_p:last-child]:mb-0";
87
83
  if (panelClassName) {
88
84
  panel.className = panel.className + " " + panelClassName;
89
85
  }
@@ -98,6 +94,7 @@
98
94
  document.body.appendChild(wrapper);
99
95
 
100
96
  var backdropEl = null;
97
+ var resizeObserver = null;
101
98
 
102
99
  function onBackdropWheel(e) {
103
100
  e.preventDefault();
@@ -107,7 +104,7 @@
107
104
  if (!modal) return;
108
105
  if (!backdropEl) {
109
106
  backdropEl = document.createElement("div");
110
- backdropEl.className = "fixed inset-0 z-40 bg-transparent pointer-events-auto";
107
+ backdropEl.className = "fixed inset-0 z-[9998] bg-transparent pointer-events-auto";
111
108
  backdropEl.setAttribute("aria-hidden", "true");
112
109
  backdropEl.addEventListener("click", function () {
113
110
  hide();
@@ -115,7 +112,7 @@
115
112
  backdropEl.addEventListener("wheel", onBackdropWheel, { passive: false });
116
113
  }
117
114
  document.body.appendChild(backdropEl);
118
- wrapper.style.zIndex = "";
115
+ wrapper.style.zIndex = "999";
119
116
  }
120
117
 
121
118
  function applyModalClose() {
@@ -193,6 +190,10 @@
193
190
  wrapper.setAttribute("aria-hidden", "true");
194
191
  window.removeEventListener("scroll", onScrollOrResize, true);
195
192
  window.removeEventListener("resize", onScrollOrResize);
193
+ if (resizeObserver && panel) {
194
+ resizeObserver.disconnect();
195
+ resizeObserver = null;
196
+ }
196
197
  applyModalClose();
197
198
  if (onClose) onClose();
198
199
  }
@@ -211,6 +212,13 @@
211
212
  wrapper.setAttribute("aria-hidden", "false");
212
213
  window.addEventListener("scroll", onScrollOrResize, true);
213
214
  window.addEventListener("resize", onScrollOrResize);
215
+ // Re-position when panel content size changes (e.g. async record list load in record-select)
216
+ if (typeof ResizeObserver !== "undefined" && !resizeObserver) {
217
+ resizeObserver = new ResizeObserver(function () {
218
+ if (wrapper.classList.contains("visible")) position();
219
+ });
220
+ resizeObserver.observe(panel);
221
+ }
214
222
  requestAnimationFrame(function () {
215
223
  requestAnimationFrame(function () {
216
224
  panel.setAttribute("data-state", "open");
@@ -222,6 +230,10 @@
222
230
  function destroy() {
223
231
  hide();
224
232
  applyModalClose();
233
+ if (resizeObserver && panel) {
234
+ resizeObserver.disconnect();
235
+ resizeObserver = null;
236
+ }
225
237
  if (backdropEl && backdropEl.parentNode) {
226
238
  backdropEl.parentNode.removeChild(backdropEl);
227
239
  }
@@ -276,8 +288,6 @@
276
288
  show,
277
289
  hide,
278
290
  destroy,
279
- /** Re-run positioning (e.g. after async content load). Call when panel size changes. */
280
- updatePosition: position,
281
291
  setContent(newContent) {
282
292
  body.innerHTML = "";
283
293
  if (typeof newContent === "string") {
@@ -10,9 +10,17 @@
10
10
  (function (global) {
11
11
  "use strict";
12
12
 
13
- var Popover = global.Popover;
14
- var InputComponent = global.InputComponent;
15
- var Spinner = global.Spinner;
13
+ function getDep(name) {
14
+ if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
15
+ var c = global.FlowUI._getComponent(name);
16
+ if (c) return c;
17
+ }
18
+ return global[name];
19
+ }
20
+
21
+ var Popover = getDep("Popover");
22
+ var InputComponent = getDep("InputComponent");
23
+ var Spinner = getDep("Spinner");
16
24
 
17
25
  /** When objectSlug === USERS, show Vivid Avatar (name-based color) instead of static icon */
18
26
  var STANDARD_OBJECT_SLUGS_USERS = "user";
@@ -258,6 +266,7 @@
258
266
  // Dropdown content: search + list (same content pattern as Select)
259
267
  var content = document.createElement("div");
260
268
  content.setAttribute("role", "listbox");
269
+ content.setAttribute("data-field-id", fieldId);
261
270
  content.className = "record-select-content max-h-[45vh] overflow-hidden flex flex-col";
262
271
 
263
272
  var searchWrap = document.createElement("div");
@@ -354,6 +363,15 @@
354
363
  setTimeout(function () {
355
364
  if (searchInputEl) searchInputEl.focus();
356
365
  }, 0);
366
+ // Let consumers (e.g. BANT Questions "Add Contact") inject content into the dropdown
367
+ try {
368
+ var doc = global.document || (typeof document !== "undefined" ? document : null);
369
+ if (doc && typeof global.CustomEvent !== "undefined") {
370
+ doc.dispatchEvent(new global.CustomEvent("record-select:opened", {
371
+ detail: { fieldId: fieldId, content: content },
372
+ }));
373
+ }
374
+ } catch (e) {}
357
375
  },
358
376
  onClose: function () {
359
377
  isOpen = false;