@homebound/beam 2.416.2 → 2.416.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.cjs CHANGED
@@ -14499,19 +14499,20 @@ function Accordion(props) {
14499
14499
  const id = (0, import_utils68.useId)();
14500
14500
  const [expanded, setExpanded] = (0, import_react75.useState)(defaultExpanded && !disabled);
14501
14501
  const { isFocusVisible, focusProps } = (0, import_react_aria40.useFocusRing)();
14502
- const contentRef = (0, import_react75.useRef)(null);
14502
+ const [contentEl, setContentEl] = (0, import_react75.useState)(null);
14503
+ const contentRef = (0, import_react75.useMemo)(() => ({ current: contentEl }), [contentEl]);
14503
14504
  const [contentHeight, setContentHeight] = (0, import_react75.useState)(expanded ? "auto" : "0");
14504
14505
  (0, import_react75.useEffect)(() => {
14505
14506
  setExpanded(defaultExpanded && !disabled);
14506
14507
  }, [defaultExpanded, disabled]);
14507
14508
  (0, import_react75.useEffect)(() => {
14508
- setContentHeight(expanded && contentRef.current ? `${contentRef.current.scrollHeight}px` : "0");
14509
- }, [expanded]);
14509
+ setContentHeight(expanded && contentEl ? `${contentEl.scrollHeight}px` : "0");
14510
+ }, [expanded, contentEl]);
14510
14511
  const onResize = (0, import_react75.useCallback)(() => {
14511
- if (contentRef.current && expanded) {
14512
- setContentHeight(`${contentRef.current.scrollHeight}px`);
14512
+ if (contentEl && expanded) {
14513
+ setContentHeight(`${contentEl.scrollHeight}px`);
14513
14514
  }
14514
- }, [expanded, setContentHeight]);
14515
+ }, [expanded, contentEl, setContentHeight]);
14515
14516
  (0, import_utils68.useResizeObserver)({ ref: contentRef, onResize });
14516
14517
  const toggle = (0, import_react75.useCallback)(() => {
14517
14518
  setExpanded((prev) => !prev);
@@ -14573,7 +14574,7 @@ function Accordion(props) {
14573
14574
  id,
14574
14575
  "aria-hidden": !expanded,
14575
14576
  css: Css.oh.h(contentHeight).add("transition", "height 250ms ease-in-out").$,
14576
- children: expanded && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: Css.px2.pb2.pt1.if(omitPadding).p0.$, ref: contentRef, ...tid.content, children })
14577
+ children: expanded && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: Css.px2.pb2.pt1.if(omitPadding).p0.$, ref: setContentEl, ...tid.content, children })
14577
14578
  }
14578
14579
  )
14579
14580
  ]