isotone 1.0.2 → 1.0.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
@@ -789,7 +789,6 @@ ${APPEARANCE_CSS}
789
789
  .isotone-root .isotone-vars > .isotone-panel-head:not(:has(.isotone-save)) { display: none; }
790
790
  .isotone-root .isotone-vars > .isotone-panel-head :is(h2, .isotone-icon) { display: none; }
791
791
  .isotone-root .isotone-axis-menu { top: var(--iso-menu-top, 6px); max-height: calc(100% - var(--iso-menu-top, 6px) - 6px); }
792
- .isotone-root .isotone-save-state { top: auto; bottom: 27px; }
793
792
  .isotone-panel-head h2 { font-size: 12px; font-weight: 600; letter-spacing: -.01em; }
794
793
  .isotone-head-actions { display: flex; align-items: center; gap: 6px; margin-right: auto; }
795
794
  .isotone-icon { width: 28px; height: 28px; display: inline-grid; place-items: center; flex: none; color: var(--iso-muted); border-radius: 6px; }
@@ -838,9 +837,10 @@ ${APPEARANCE_CSS}
838
837
  .isotone-pick[aria-pressed='true'] { background: var(--iso-selected-face); box-shadow: var(--iso-selected-shadow); }
839
838
  ${PILL_ACTIVE_CSS}
840
839
  .isotone-secondary { padding: 6px 9px; font-size: 11px; font-weight: 500; white-space: nowrap; }
841
- .isotone-save { min-height: 24px; padding: 2px 7px; font-size: 11px; white-space: nowrap; }
840
+ .isotone-save { min-height: 24px; padding: 2px 7px; font-size: 11px; white-space: nowrap; overflow: hidden; }
842
841
  .isotone-save-row { position: relative; }
843
- .isotone-save-state { position: absolute; right: 0; top: 27px; z-index: 3; background: var(--iso-bg); border-radius: 4px; white-space: nowrap; font-size: 9px; color: var(--iso-muted); pointer-events: none; }
842
+ .isotone-save-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
843
+ .isotone-save-label { display: block; }
844
844
  /* A local action sheet overlays controls, preserving every underlying position. */
845
845
  .isotone-axis-menu { position: absolute; inset: 48px 6px auto; z-index: 2; background: var(--iso-popup-face); border-radius: 6px; max-height: calc(100% - 54px); box-shadow: var(--iso-popup-shadow); display: flex; flex-direction: column; transform-origin: top left; opacity: 0; transform: translateY(-4px) scale(.97); visibility: hidden; transition: opacity var(--iso-exit) var(--iso-ease-out), transform var(--iso-exit) var(--iso-ease-out), visibility 0s var(--iso-exit); }
846
846
  .isotone-axis-menu[data-open='true'] { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
@@ -1428,17 +1428,42 @@ function SaveDefaults({
1428
1428
  setState("Could not save. Try again.");
1429
1429
  }
1430
1430
  clearTimeout(timer.current);
1431
- timer.current = setTimeout(() => setState(""), 2500);
1431
+ timer.current = setTimeout(() => setState(""), 3e3);
1432
1432
  }
1433
+ const label = state && state !== "Saving\u2026" ? state : "Save as defaults";
1434
+ const button = useRef3(null);
1435
+ const text = useRef3(null);
1436
+ const width = useRef3(0);
1437
+ useLayoutEffect2(() => {
1438
+ const node = button.current;
1439
+ if (!node) return;
1440
+ node.style.width = "";
1441
+ const next = node.offsetWidth;
1442
+ const previous = width.current;
1443
+ width.current = next;
1444
+ const instant = node.closest('[data-instant="true"]') || typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
1445
+ if (!previous || instant || typeof node.animate !== "function") return;
1446
+ text.current?.animate(
1447
+ [{ opacity: 0, transform: "translateY(3px)" }, { opacity: 1, transform: "translateY(0)" }],
1448
+ { duration: MOTION.enter, easing: MOTION.easeOut }
1449
+ );
1450
+ if (Math.abs(previous - next) < 0.5) return;
1451
+ node.animate(
1452
+ [{ width: `${previous}px` }, { width: `${next}px` }],
1453
+ { duration: MOTION.reflow, easing: MOTION.easeOut }
1454
+ );
1455
+ }, [label]);
1433
1456
  return /* @__PURE__ */ jsxs2("div", { className: "isotone-save-row", children: [
1434
1457
  /* @__PURE__ */ jsx3(
1435
1458
  "button",
1436
1459
  {
1460
+ ref: button,
1437
1461
  type: "button",
1438
1462
  className: "isotone-save",
1439
1463
  disabled: state === "Saving\u2026",
1464
+ "aria-busy": state === "Saving\u2026",
1440
1465
  onClick: () => void save(),
1441
- children: "Save as defaults"
1466
+ children: /* @__PURE__ */ jsx3("span", { className: "isotone-save-label", ref: text, children: label })
1442
1467
  }
1443
1468
  ),
1444
1469
  /* @__PURE__ */ jsx3("span", { className: "isotone-save-state", role: "status", children: state })