@pieai/swimmer-ui-kit 2.7.2 → 2.8.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
@@ -3,6 +3,12 @@
3
3
  All notable changes to `@pieai/swimmer-ui-kit`.
4
4
  Format: [Keep a Changelog](https://keepachangelog.com); versioning: semver.
5
5
 
6
+ ## 2.8.0 — 2026-09-18
7
+
8
+ - Add optional `GameModal keepMounted` for unfinished form state that should
9
+ survive close/reopen. Closed modal content remains inert and keyboard
10
+ unreachable; the default still unmounts `children` on close.
11
+
6
12
  ## 2.7.2 — 2026-09-16
7
13
 
8
14
  - Use readable muted ink for editable input and textarea placeholders. Empty
package/dist/index.d.ts CHANGED
@@ -1840,7 +1840,7 @@ export declare interface GameMaterialSwatchesProps {
1840
1840
  'data-testid'?: string | undefined;
1841
1841
  }
1842
1842
 
1843
- export declare function GameModal({ children, className, closeLabel, closeOnBackdrop, footer, onClose, open, position, size, title, }: GameModalProps): ReactNode;
1843
+ export declare function GameModal({ children, className, closeLabel, closeOnBackdrop, footer, keepMounted, onClose, open, position, size, title, }: GameModalProps): ReactNode;
1844
1844
 
1845
1845
  export declare interface GameModalProps {
1846
1846
  children: ReactNode;
@@ -1852,6 +1852,8 @@ export declare interface GameModalProps {
1852
1852
  /** Called for every close intent: Esc, backdrop click, and close button. */
1853
1853
  onClose: () => void;
1854
1854
  open: boolean;
1855
+ /** Keep children mounted while closed to preserve their local state. Closed content stays inert. */
1856
+ keepMounted?: boolean;
1855
1857
  /**
1856
1858
  * `'bottom'` anchors the frame to the viewport's bottom edge (rounded top
1857
1859
  * corners only, safe-area-aware padding, slide-up entrance) for mobile
package/dist/index.js CHANGED
@@ -7029,43 +7029,52 @@ function Va({ allowMaximize: e = !0, allowMinimize: t = !0, children: n, classNa
7029
7029
  })]
7030
7030
  });
7031
7031
  }
7032
- function Ha({ children: e, className: t, closeLabel: n = "Close", closeOnBackdrop: r = !0, footer: i, onClose: a, open: o, position: l = "center", size: u = "md", title: f }) {
7033
- let p = d(null), m = c();
7032
+ function Ha({ children: e, className: t, closeLabel: n = "Close", closeOnBackdrop: r = !0, footer: i, keepMounted: a = !1, onClose: o, open: l, position: u = "center", size: p = "md", title: m }) {
7033
+ let _ = d(null), v = d(null), y = c(), [b, x] = f(!l);
7034
7034
  return s(() => {
7035
- let e = p.current;
7036
- e && (o && !e.open && e.showModal(), !o && e.open && e.close());
7037
- }, [o]), /* @__PURE__ */ h("dialog", {
7038
- "aria-labelledby": m,
7035
+ let e = _.current, t = v.current;
7036
+ if (!(!e || !t)) {
7037
+ if (l) {
7038
+ b && (t.removeAttribute("aria-hidden"), t.removeAttribute("inert")), e.open || e.showModal(), x(!1);
7039
+ return;
7040
+ }
7041
+ e.open && e.close(), t.setAttribute("aria-hidden", "true"), t.setAttribute("inert", ""), x(!0);
7042
+ }
7043
+ }, [b, l]), /* @__PURE__ */ h("dialog", {
7044
+ "aria-labelledby": y,
7039
7045
  className: Ia("game-ui-modal", t),
7040
- "data-position": l,
7041
- "data-size": u,
7046
+ "data-position": u,
7047
+ "data-size": p,
7042
7048
  onCancel: (e) => {
7043
- e.preventDefault(), a();
7049
+ e.preventDefault(), o();
7044
7050
  },
7045
7051
  onClick: (e) => {
7046
- r && e.target === p.current && a();
7052
+ r && e.target === _.current && o();
7047
7053
  },
7048
- ref: p,
7054
+ ref: _,
7049
7055
  children: /* @__PURE__ */ g("div", {
7056
+ "aria-hidden": b ? !0 : void 0,
7050
7057
  className: "game-ui-modal-frame",
7058
+ inert: b || void 0,
7059
+ ref: v,
7051
7060
  children: [
7052
7061
  /* @__PURE__ */ g("header", {
7053
7062
  className: "game-ui-modal-header",
7054
7063
  children: [/* @__PURE__ */ h("h2", {
7055
7064
  className: "game-ui-modal-title",
7056
- id: m,
7057
- children: f
7065
+ id: y,
7066
+ children: m
7058
7067
  }), /* @__PURE__ */ h("button", {
7059
7068
  "aria-label": n,
7060
7069
  className: "game-ui-icon-button game-ui-window-button",
7061
- onClick: a,
7070
+ onClick: o,
7062
7071
  type: "button",
7063
7072
  children: /* @__PURE__ */ h(Ba, { kind: "close" })
7064
7073
  })]
7065
7074
  }),
7066
7075
  /* @__PURE__ */ h("div", {
7067
7076
  className: "game-ui-modal-body",
7068
- children: o ? e : null
7077
+ children: l || a ? e : null
7069
7078
  }),
7070
7079
  i ? /* @__PURE__ */ h("footer", {
7071
7080
  className: "game-ui-modal-footer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pieai/swimmer-ui-kit",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "description": "Token-driven React game UI kit for web and wrapped PieAI game surfaces.",
5
5
  "keywords": [
6
6
  "design-system",