plainframe-ui 0.1.2 → 0.1.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.js CHANGED
@@ -1222,7 +1222,7 @@ var AccordionGroup = ({
1222
1222
  borderBottomLeftRadius: isLast ? radius2 : 0,
1223
1223
  borderBottomRightRadius: isLast ? radius2 : 0
1224
1224
  }) : css5({ width: "100%", marginBottom: 0 });
1225
- const separatorCss = !isFirst && count > 1 ? css5({
1225
+ const separatorCss = !isFirst && count > 1 && attached ? css5({
1226
1226
  borderTop: `${bw} solid ${borderColor}`
1227
1227
  }) : null;
1228
1228
  const killChildOutline = isOutlined ? css5({
@@ -1230,7 +1230,6 @@ var AccordionGroup = ({
1230
1230
  borderRight: "0 !important",
1231
1231
  borderBottom: "0 !important",
1232
1232
  outline: "0 !important"
1233
- // do not touch borderTop – that’s our separator
1234
1233
  }) : null;
1235
1234
  const injected = {
1236
1235
  variant: nextVariant,
@@ -2297,34 +2296,34 @@ var SubMenuContent = ({ children, css: userCss }) => {
2297
2296
  const menuGap = useContext3(GapCtx);
2298
2297
  const clipRef = useRef5(null);
2299
2298
  const innerRef = useRef5(null);
2300
- const readyRef = useRef5(false);
2301
2299
  const seqRef = useRef5(0);
2302
- useLayoutEffect2(() => {
2303
- const clip = clipRef.current;
2304
- if (!clip) return;
2305
- if (open) {
2306
- clip.style.maxHeight = "none";
2307
- clip.style.overflow = "visible";
2308
- } else {
2309
- clip.style.maxHeight = "0px";
2310
- clip.style.overflow = "hidden";
2311
- }
2312
- readyRef.current = true;
2313
- }, []);
2300
+ const firstRef = useRef5(true);
2314
2301
  useLayoutEffect2(() => {
2315
2302
  const clip = clipRef.current;
2316
2303
  const inner = innerRef.current;
2317
- if (!clip || !inner || !readyRef.current) return;
2304
+ if (!clip || !inner) return;
2318
2305
  const key = ++seqRef.current;
2319
2306
  const dur = "360ms cubic-bezier(.25,.8,.4,1)";
2320
- const current = clip.style.maxHeight === "none" ? inner.scrollHeight : parseFloat(clip.style.maxHeight || "0") || 0;
2321
- const target = open ? inner.scrollHeight : 0;
2307
+ if (firstRef.current) {
2308
+ firstRef.current = false;
2309
+ clip.style.transition = "none";
2310
+ if (open) {
2311
+ clip.style.maxHeight = "none";
2312
+ clip.style.overflow = "visible";
2313
+ } else {
2314
+ clip.style.maxHeight = "0px";
2315
+ clip.style.overflow = "hidden";
2316
+ }
2317
+ return;
2318
+ }
2319
+ const from = open ? 0 : inner.scrollHeight;
2320
+ const to = open ? inner.scrollHeight : 0;
2322
2321
  clip.style.transition = "none";
2323
2322
  clip.style.overflow = "hidden";
2324
- clip.style.maxHeight = `${current}px`;
2323
+ clip.style.maxHeight = `${from}px`;
2325
2324
  void clip.offsetHeight;
2326
2325
  clip.style.transition = `max-height ${dur}`;
2327
- clip.style.maxHeight = `${target}px`;
2326
+ clip.style.maxHeight = `${to}px`;
2328
2327
  const onEnd = (e) => {
2329
2328
  if (e.target !== clip || e.propertyName !== "max-height") return;
2330
2329
  if (key !== seqRef.current) return;
@@ -2354,17 +2353,19 @@ var SubMenuContent = ({ children, css: userCss }) => {
2354
2353
  useLayoutEffect2(() => {
2355
2354
  const clip = clipRef.current;
2356
2355
  const inner = innerRef.current;
2357
- if (!clip || !inner) return;
2356
+ if (!clip || !inner || !window.ResizeObserver) return;
2358
2357
  const ro = new window.ResizeObserver(() => {
2359
2358
  if (!open) return;
2360
- const h = inner.scrollHeight;
2361
- if (clip.style.maxHeight !== "none") {
2362
- clip.style.maxHeight = `${h}px`;
2359
+ const isAnimating = clip.style.maxHeight !== "none" && (clip.style.transition || "").includes("max-height");
2360
+ if (isAnimating) {
2361
+ clip.style.transition = "none";
2362
+ clip.style.maxHeight = "none";
2363
+ clip.style.overflow = "visible";
2363
2364
  }
2364
2365
  });
2365
- if (ro) ro.observe(inner);
2366
+ ro.observe(inner);
2366
2367
  return () => {
2367
- ro && ro.disconnect();
2368
+ ro.disconnect();
2368
2369
  };
2369
2370
  }, [open]);
2370
2371
  useEffect3(() => {
@@ -2429,7 +2430,7 @@ var SubMenuContent = ({ children, css: userCss }) => {
2429
2430
  margin: 0,
2430
2431
  padding: 0,
2431
2432
  opacity: open ? 1 : 0,
2432
- transform: open ? "translateY(0) scale(1)" : "translateY(1rem) scale(0.95)",
2433
+ transform: open ? "translateY(0) scale(1)" : "translateY(16px) scale(0.96)",
2433
2434
  transition: "opacity 0.35s ease, transform 0.28s ease",
2434
2435
  pointerEvents: open ? "auto" : "none",
2435
2436
  willChange: "opacity, transform"