@geomak/ui 7.4.2 → 7.4.4

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.
package/dist/index.cjs CHANGED
@@ -4622,30 +4622,43 @@ function ScalableContainer({
4622
4622
  let el = containerRef.current.parentElement;
4623
4623
  while (el && el !== bound && bound.contains(el)) {
4624
4624
  const parent = el.parentElement;
4625
- if (parent && getComputedStyle(parent).display.includes("flex")) {
4625
+ const parentStyle = parent ? getComputedStyle(parent) : null;
4626
+ if (parent && parentStyle && parentStyle.display.includes("flex")) {
4626
4627
  grown.push({
4627
4628
  el,
4629
+ parent,
4628
4630
  prev: {
4629
4631
  flexGrow: el.style.flexGrow,
4630
4632
  flexBasis: el.style.flexBasis,
4631
- transition: el.style.transition
4633
+ height: el.style.height,
4634
+ transition: el.style.transition,
4635
+ parentFlexWrap: parent.style.flexWrap
4632
4636
  }
4633
4637
  });
4634
- const grow = `flex-grow ${reduced ? 0 : 0.32}s cubic-bezier(0.16, 1, 0.3, 1), flex-basis ${reduced ? 0 : 0.32}s cubic-bezier(0.16, 1, 0.3, 1)`;
4635
- el.style.transition = el.style.transition ? `${el.style.transition}, ${grow}` : grow;
4636
- el.style.flexBasis = "0%";
4637
- el.style.flexGrow = String(expandRatio);
4638
+ const t = (prop) => `${prop} ${reduced ? 0 : 0.32}s cubic-bezier(0.16, 1, 0.3, 1)`;
4639
+ const ours = `${t("flex-grow")}, ${t("flex-basis")}, ${t("height")}`;
4640
+ el.style.transition = el.style.transition ? `${el.style.transition}, ${ours}` : ours;
4641
+ if (parentStyle.flexDirection.startsWith("row")) {
4642
+ parent.style.flexWrap = "wrap";
4643
+ el.style.flexBasis = "100%";
4644
+ el.style.height = `${expandRatio / (expandRatio + 1) * 100}%`;
4645
+ } else {
4646
+ el.style.flexBasis = "0%";
4647
+ el.style.flexGrow = String(expandRatio);
4648
+ }
4638
4649
  }
4639
4650
  el = parent;
4640
4651
  }
4641
4652
  grownRef.current = grown;
4642
4653
  };
4643
4654
  const restoreAncestors = () => {
4644
- for (const { el, prev } of grownRef.current) {
4655
+ for (const { el, parent, prev } of grownRef.current) {
4645
4656
  el.style.flexGrow = prev.flexGrow;
4646
4657
  el.style.flexBasis = prev.flexBasis;
4658
+ el.style.height = prev.height;
4647
4659
  window.setTimeout(() => {
4648
4660
  el.style.transition = prev.transition;
4661
+ parent.style.flexWrap = prev.parentFlexWrap;
4649
4662
  }, reduced ? 0 : 360);
4650
4663
  }
4651
4664
  grownRef.current = [];
@@ -4658,10 +4671,12 @@ function ScalableContainer({
4658
4671
  kickResizeDuringTransition();
4659
4672
  }, [isScaled, usePush]);
4660
4673
  React30.useEffect(() => () => {
4661
- for (const { el, prev } of grownRef.current) {
4674
+ for (const { el, parent, prev } of grownRef.current) {
4662
4675
  el.style.flexGrow = prev.flexGrow;
4663
4676
  el.style.flexBasis = prev.flexBasis;
4677
+ el.style.height = prev.height;
4664
4678
  el.style.transition = prev.transition;
4679
+ parent.style.flexWrap = prev.parentFlexWrap;
4665
4680
  }
4666
4681
  }, []);
4667
4682
  const onToggle = () => {