@open-mercato/ui 0.10.1-develop.8123.1.acf6ca6db8 → 0.10.1-develop.8125.1.825240d58b

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.
@@ -125,6 +125,17 @@ function evaluateFieldVisibility(visibleWhen, values) {
125
125
  if (!visibleWhen) return true;
126
126
  return values[visibleWhen.field] === visibleWhen.equals;
127
127
  }
128
+ function isVerticalScrollContainer(element) {
129
+ const { overflowY } = window.getComputedStyle(element);
130
+ return overflowY === "auto" || overflowY === "scroll";
131
+ }
132
+ function isScrolledByPaddedDialog(root, dialog) {
133
+ for (let node = root; node && node !== dialog; node = node.parentElement) {
134
+ if (isVerticalScrollContainer(node)) return false;
135
+ }
136
+ if (!isVerticalScrollContainer(dialog)) return false;
137
+ return Number.parseFloat(window.getComputedStyle(dialog).paddingBottom) > 0;
138
+ }
128
139
  function isFormControlTarget(target) {
129
140
  if (!target || typeof target.tagName !== "string") return false;
130
141
  const el = target;
@@ -481,6 +492,7 @@ function CrudFormImpl({
481
492
  const [customFieldDefsVersion, setCustomFieldDefsVersion] = React.useState(0);
482
493
  const [fieldsetEditorTarget, setFieldsetEditorTarget] = React.useState(null);
483
494
  const [isInDialog, setIsInDialog] = React.useState(false);
495
+ const [scrolledByPaddedDialog, setScrolledByPaddedDialog] = React.useState(false);
484
496
  const rootRef = React.useRef(null);
485
497
  const collapsibleGroupsEnabled = Boolean(collapsibleGroups);
486
498
  const collapsiblePageType = typeof collapsibleGroups === "object" ? collapsibleGroups.pageType : formId;
@@ -949,9 +961,11 @@ function CrudFormImpl({
949
961
  React.useEffect(() => {
950
962
  const root = rootRef.current;
951
963
  if (!root) return;
952
- setIsInDialog(Boolean(root.closest("[data-dialog-content]")));
964
+ const dialog = root.closest("[data-dialog-content]");
965
+ setIsInDialog(Boolean(dialog));
966
+ setScrolledByPaddedDialog(dialog ? isScrolledByPaddedDialog(root, dialog) : false);
953
967
  }, []);
954
- const dialogFooterClass = isInDialog ? "sticky bottom-0 left-0 right-0 z-20 -mx-6 px-6 bg-card border-t border-border/70 py-2 sm:-mx-6 sm:px-6" : "";
968
+ const dialogFooterClass = !isInDialog ? "" : scrolledByPaddedDialog ? "sticky -bottom-6 left-0 right-0 z-20 -mx-6 -mb-6 px-6 pt-2 pb-8 bg-card border-t border-border/70 sm:-mx-6 sm:px-6" : "sticky bottom-0 left-0 right-0 z-20 -mx-6 px-6 bg-card border-t border-border/70 py-2 sm:-mx-6 sm:px-6";
955
969
  const dialogFormPadding = "";
956
970
  const isCompactDensity = density === "compact";
957
971
  const densityStackLg = isCompactDensity ? "space-y-3" : "space-y-4";