@geomak/ui 7.4.1 → 7.4.3

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.d.cts CHANGED
@@ -2065,18 +2065,21 @@ interface ScalableContainerProps {
2065
2065
  * Bounding element the expansion is allowed to grow within. When the
2066
2066
  * container sits in size-constrained flex-item wrappers (where width /
2067
2067
  * height 100% makes expand-in-place a no-op), providing this ref switches
2068
- * to PUSH expansion: every flex item between the container and this
2069
- * element gets its `flex-grow` raised (animated), so this container takes
2070
- * most of the space while its siblings shrink but stay visible.
2071
- * Collapsing restores the wrappers' original sizing. Omit for the classic
2068
+ * to PUSH expansion: the container's row becomes `flex-wrap: wrap` and the
2069
+ * container takes the FULL parent width (`flex-basis: 100%`), so sibling
2070
+ * charts reflow below it at full widthpushed, visible, and intact.
2071
+ * Column levels between the container and this element get `flex-grow`
2072
+ * raised so the expanded row dominates vertically too. Collapsing
2073
+ * restores the wrappers' original sizing exactly. Omit for the classic
2072
2074
  * expand-in-place behaviour.
2073
2075
  */
2074
2076
  expandContainerRef?: react__default.RefObject<HTMLElement | null>;
2075
2077
  /**
2076
- * How dominant the pushed expansion is, as a flex-grow multiplier applied
2077
- * to the container's wrappers (push mode only). Default `5` — i.e. the
2078
- * expanded container takes roughly 5 parts for every 1 part a sibling
2079
- * keeps. Raise for a more fullscreen feel, lower for a gentler split.
2078
+ * Vertical dominance of the pushed expansion (push mode only). Default
2079
+ * `3` the expanded chart keeps expandRatio/(expandRatio+1) of its row's
2080
+ * height (and its row takes expandRatio parts per sibling row), leaving
2081
+ * the reflowed siblings the remainder. Raise for a more fullscreen feel,
2082
+ * lower for a gentler split.
2080
2083
  */
2081
2084
  expandRatio?: number;
2082
2085
  /** Extra classes merged onto the container root. */
@@ -2092,10 +2095,12 @@ interface ScalableContainerProps {
2092
2095
  * - **In place** (default): animates the container's own width/height to
2093
2096
  * `expandedWidth`/`expandedHeight`.
2094
2097
  * - **Push** (`expandContainerRef` set): for containers whose resting size is
2095
- * owned by flex-item wrappers. Expanding raises `flex-grow` on every flex
2096
- * item between the container and the bounding element, so the container
2097
- * grows to dominate the section while sibling containers shrink but remain
2098
- * visible. Collapsing restores the original layout.
2098
+ * owned by flex-item wrappers. Expanding makes the container span the FULL
2099
+ * parent width (its row becomes `flex-wrap: wrap` and the wrapper takes
2100
+ * `flex-basis: 100%`), with sibling charts reflowing below it at full
2101
+ * width — visible and intact, not squeezed. Column levels raise `flex-grow`
2102
+ * so the expanded row also dominates vertically. Collapsing restores the
2103
+ * original layout exactly.
2099
2104
  *
2100
2105
  * @example
2101
2106
  * ```tsx
package/dist/index.d.ts CHANGED
@@ -2065,18 +2065,21 @@ interface ScalableContainerProps {
2065
2065
  * Bounding element the expansion is allowed to grow within. When the
2066
2066
  * container sits in size-constrained flex-item wrappers (where width /
2067
2067
  * height 100% makes expand-in-place a no-op), providing this ref switches
2068
- * to PUSH expansion: every flex item between the container and this
2069
- * element gets its `flex-grow` raised (animated), so this container takes
2070
- * most of the space while its siblings shrink but stay visible.
2071
- * Collapsing restores the wrappers' original sizing. Omit for the classic
2068
+ * to PUSH expansion: the container's row becomes `flex-wrap: wrap` and the
2069
+ * container takes the FULL parent width (`flex-basis: 100%`), so sibling
2070
+ * charts reflow below it at full widthpushed, visible, and intact.
2071
+ * Column levels between the container and this element get `flex-grow`
2072
+ * raised so the expanded row dominates vertically too. Collapsing
2073
+ * restores the wrappers' original sizing exactly. Omit for the classic
2072
2074
  * expand-in-place behaviour.
2073
2075
  */
2074
2076
  expandContainerRef?: react__default.RefObject<HTMLElement | null>;
2075
2077
  /**
2076
- * How dominant the pushed expansion is, as a flex-grow multiplier applied
2077
- * to the container's wrappers (push mode only). Default `5` — i.e. the
2078
- * expanded container takes roughly 5 parts for every 1 part a sibling
2079
- * keeps. Raise for a more fullscreen feel, lower for a gentler split.
2078
+ * Vertical dominance of the pushed expansion (push mode only). Default
2079
+ * `3` the expanded chart keeps expandRatio/(expandRatio+1) of its row's
2080
+ * height (and its row takes expandRatio parts per sibling row), leaving
2081
+ * the reflowed siblings the remainder. Raise for a more fullscreen feel,
2082
+ * lower for a gentler split.
2080
2083
  */
2081
2084
  expandRatio?: number;
2082
2085
  /** Extra classes merged onto the container root. */
@@ -2092,10 +2095,12 @@ interface ScalableContainerProps {
2092
2095
  * - **In place** (default): animates the container's own width/height to
2093
2096
  * `expandedWidth`/`expandedHeight`.
2094
2097
  * - **Push** (`expandContainerRef` set): for containers whose resting size is
2095
- * owned by flex-item wrappers. Expanding raises `flex-grow` on every flex
2096
- * item between the container and the bounding element, so the container
2097
- * grows to dominate the section while sibling containers shrink but remain
2098
- * visible. Collapsing restores the original layout.
2098
+ * owned by flex-item wrappers. Expanding makes the container span the FULL
2099
+ * parent width (its row becomes `flex-wrap: wrap` and the wrapper takes
2100
+ * `flex-basis: 100%`), with sibling charts reflowing below it at full
2101
+ * width — visible and intact, not squeezed. Column levels raise `flex-grow`
2102
+ * so the expanded row also dominates vertically. Collapsing restores the
2103
+ * original layout exactly.
2099
2104
  *
2100
2105
  * @example
2101
2106
  * ```tsx
package/dist/index.js CHANGED
@@ -4559,7 +4559,7 @@ function ScalableContainer({
4559
4559
  collapseIcon,
4560
4560
  togglePosition = "top-right",
4561
4561
  expandContainerRef,
4562
- expandRatio = 5,
4562
+ expandRatio = 3,
4563
4563
  className = ""
4564
4564
  }) {
4565
4565
  const containerRef = useRef(null);
@@ -4569,6 +4569,15 @@ function ScalableContainer({
4569
4569
  const usePush = expandContainerRef != null;
4570
4570
  const grownRef = useRef([]);
4571
4571
  const prevScaled = useRef(isScaled);
4572
+ const kickResizeDuringTransition = () => {
4573
+ if (typeof window === "undefined") return;
4574
+ const kick = () => window.dispatchEvent(new Event("resize"));
4575
+ const interval = window.setInterval(kick, 80);
4576
+ window.setTimeout(() => {
4577
+ window.clearInterval(interval);
4578
+ kick();
4579
+ }, reduced ? 0 : 400);
4580
+ };
4572
4581
  const growAncestors = () => {
4573
4582
  const bound = expandContainerRef?.current;
4574
4583
  if (!bound || !containerRef.current) return;
@@ -4576,30 +4585,43 @@ function ScalableContainer({
4576
4585
  let el = containerRef.current.parentElement;
4577
4586
  while (el && el !== bound && bound.contains(el)) {
4578
4587
  const parent = el.parentElement;
4579
- if (parent && getComputedStyle(parent).display.includes("flex")) {
4588
+ const parentStyle = parent ? getComputedStyle(parent) : null;
4589
+ if (parent && parentStyle && parentStyle.display.includes("flex")) {
4580
4590
  grown.push({
4581
4591
  el,
4592
+ parent,
4582
4593
  prev: {
4583
4594
  flexGrow: el.style.flexGrow,
4584
4595
  flexBasis: el.style.flexBasis,
4585
- transition: el.style.transition
4596
+ height: el.style.height,
4597
+ transition: el.style.transition,
4598
+ parentFlexWrap: parent.style.flexWrap
4586
4599
  }
4587
4600
  });
4588
- 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)`;
4589
- el.style.transition = el.style.transition ? `${el.style.transition}, ${grow}` : grow;
4590
- el.style.flexBasis = "0%";
4591
- el.style.flexGrow = String(expandRatio);
4601
+ const t = (prop) => `${prop} ${reduced ? 0 : 0.32}s cubic-bezier(0.16, 1, 0.3, 1)`;
4602
+ const ours = `${t("flex-grow")}, ${t("flex-basis")}, ${t("height")}`;
4603
+ el.style.transition = el.style.transition ? `${el.style.transition}, ${ours}` : ours;
4604
+ if (parentStyle.flexDirection.startsWith("row")) {
4605
+ parent.style.flexWrap = "wrap";
4606
+ el.style.flexBasis = "100%";
4607
+ el.style.height = `${expandRatio / (expandRatio + 1) * 100}%`;
4608
+ } else {
4609
+ el.style.flexBasis = "0%";
4610
+ el.style.flexGrow = String(expandRatio);
4611
+ }
4592
4612
  }
4593
4613
  el = parent;
4594
4614
  }
4595
4615
  grownRef.current = grown;
4596
4616
  };
4597
4617
  const restoreAncestors = () => {
4598
- for (const { el, prev } of grownRef.current) {
4618
+ for (const { el, parent, prev } of grownRef.current) {
4599
4619
  el.style.flexGrow = prev.flexGrow;
4600
4620
  el.style.flexBasis = prev.flexBasis;
4621
+ el.style.height = prev.height;
4601
4622
  window.setTimeout(() => {
4602
4623
  el.style.transition = prev.transition;
4624
+ parent.style.flexWrap = prev.parentFlexWrap;
4603
4625
  }, reduced ? 0 : 360);
4604
4626
  }
4605
4627
  grownRef.current = [];
@@ -4609,12 +4631,15 @@ function ScalableContainer({
4609
4631
  prevScaled.current = isScaled;
4610
4632
  if (isScaled) growAncestors();
4611
4633
  else restoreAncestors();
4634
+ kickResizeDuringTransition();
4612
4635
  }, [isScaled, usePush]);
4613
4636
  useEffect(() => () => {
4614
- for (const { el, prev } of grownRef.current) {
4637
+ for (const { el, parent, prev } of grownRef.current) {
4615
4638
  el.style.flexGrow = prev.flexGrow;
4616
4639
  el.style.flexBasis = prev.flexBasis;
4640
+ el.style.height = prev.height;
4617
4641
  el.style.transition = prev.transition;
4642
+ parent.style.flexWrap = prev.parentFlexWrap;
4618
4643
  }
4619
4644
  }, []);
4620
4645
  const onToggle = () => {
@@ -4633,6 +4658,10 @@ function ScalableContainer({
4633
4658
  motion.div,
4634
4659
  {
4635
4660
  ref: containerRef,
4661
+ style: {
4662
+ width: isScaled && !usePush ? expandedWidth : width,
4663
+ height: isScaled && !usePush ? expandedHeight : height
4664
+ },
4636
4665
  animate: {
4637
4666
  // Push mode keeps the container filling its (now growing)
4638
4667
  // wrapper — the wrapper's flex-grow does the work.