@ai-matrx/design-system 0.15.2 → 0.16.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.0 — 2026-09-11
4
+
5
+ `ConfirmDialogHost` now rides the shared opener primitive instead of its own
6
+ copy of the machinery: `useOpenerHost` from `@ai-matrx/kit/opener-react`
7
+ (kit 0.10.0) supplies the host registration, the ref-backed request queue, the
8
+ drain effect and the settle-once callback, and this package keeps only what was
9
+ ever its own — the dialog body, its motion layer and the themed scrim.
10
+
11
+ The same twenty lines lived here AND in three matrx-frontend dialog hosts;
12
+ package logic is never duplicated outside the package, and a host registry in
13
+ particular must never be re-implemented, because module-level host state
14
+ silently splits across ESM/CJS loader graphs.
15
+
16
+ Behaviour is unchanged and proven unchanged: all 17 confirm-surface tests —
17
+ imperative queueing, pre-mount calls, sequential presentation, the
18
+ never-resolve-silently rule, the destructive variant and the consequence-first
19
+ copy contract — pass untouched against the new host.
20
+
21
+ ### Consumer action
22
+
23
+ None. `<ConfirmDialogHost />` mounts and behaves exactly as before. Requires
24
+ `@ai-matrx/kit` 0.10.0 or later.
25
+
3
26
  ## 0.15.2 — 2026-09-11
4
27
 
5
28
  Editable append tables retain unsaved drafts by source identity. Returning to the
package/dist/index.cjs CHANGED
@@ -1650,51 +1650,28 @@ function ConfirmDialog({
1650
1650
 
1651
1651
  // src/confirm-host.tsx
1652
1652
  var import_confirm_opener = require("@ai-matrx/kit/confirm-opener");
1653
+ var import_opener_react = require("@ai-matrx/kit/opener-react");
1653
1654
  var React14 = __toESM(require("react"), 1);
1654
1655
  var import_jsx_runtime17 = require("react/jsx-runtime");
1655
1656
  function ConfirmDialogHost() {
1656
- const [active, setActive] = React14.useState(null);
1657
- const [tick, setTick] = React14.useState(0);
1658
- const queueRef = React14.useRef([]);
1659
- React14.useEffect(() => {
1660
- const controller = {
1661
- show: (opts, resolve) => {
1662
- queueRef.current.push({ opts, resolve });
1663
- setTick((n) => n + 1);
1664
- }
1665
- };
1666
- (0, import_confirm_opener._registerHost)(controller);
1667
- return () => (0, import_confirm_opener._unregisterHost)(controller);
1668
- }, []);
1669
- React14.useEffect(() => {
1670
- if (active === null && queueRef.current.length > 0) {
1671
- setActive(queueRef.current.shift());
1672
- }
1673
- }, [active, tick]);
1674
- const handleConfirm = React14.useCallback(() => {
1675
- if (!active) return;
1676
- active.resolve(true);
1677
- setActive(null);
1678
- }, [active]);
1657
+ const { request, open, settle } = (0, import_opener_react.useOpenerHost)(import_confirm_opener.confirmOpener);
1658
+ const handleConfirm = React14.useCallback(() => settle(true), [settle]);
1679
1659
  const handleOpenChange = React14.useCallback(
1680
- (open) => {
1681
- if (!open && active) {
1682
- active.resolve(false);
1683
- setActive(null);
1684
- }
1660
+ (next) => {
1661
+ if (!next) settle(false);
1685
1662
  },
1686
- [active]
1663
+ [settle]
1687
1664
  );
1688
1665
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1689
1666
  ConfirmDialog,
1690
1667
  {
1691
- open: !!active,
1668
+ open,
1692
1669
  onOpenChange: handleOpenChange,
1693
- title: active?.opts.title ?? "",
1694
- description: active?.opts.description,
1695
- confirmLabel: active?.opts.confirmLabel,
1696
- cancelLabel: active?.opts.cancelLabel,
1697
- variant: active?.opts.variant,
1670
+ title: request?.title ?? "",
1671
+ description: request?.description,
1672
+ confirmLabel: request?.confirmLabel,
1673
+ cancelLabel: request?.cancelLabel,
1674
+ variant: request?.variant,
1698
1675
  onConfirm: handleConfirm
1699
1676
  }
1700
1677
  );