@ai-matrx/sharing 0.1.8 → 0.1.9

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,10 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.8
3
+ ## 0.1.9
4
4
 
5
5
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
6
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/sharing/src`.
7
7
 
8
+ ## 0.1.8
9
+
10
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff ece1023750 ed3f4f552d -- apps/shared/sharing/src`
11
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
12
+
8
13
  ## 0.1.7
9
14
 
10
15
  Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 553373dbe5 ece1023750 -- apps/shared/sharing/src`
package/dist/react.cjs CHANGED
@@ -403,7 +403,7 @@ var useAppDispatch = () => import_core4.passThroughDispatch;
403
403
 
404
404
  // src/react/sheet/ShareModal.tsx
405
405
  var import_core34 = require("@ai-matrx/sharing/core");
406
- var import_react17 = require("react");
406
+ var import_react18 = require("react");
407
407
 
408
408
  // src/react/sheet/ui/dialog.tsx
409
409
  var import_design_system2 = require("@ai-matrx/design-system");
@@ -4333,6 +4333,35 @@ function SecureLinkForm({ resourceType, resourceId, resourceName }) {
4333
4333
  ] });
4334
4334
  }
4335
4335
 
4336
+ // src/react/sheet/useKeepFocusInDialog.ts
4337
+ var import_react17 = require("react");
4338
+ function useKeepFocusInDialog() {
4339
+ const [element, setElement] = (0, import_react17.useState)(null);
4340
+ (0, import_react17.useEffect)(() => {
4341
+ if (!element) return void 0;
4342
+ let frame = 0;
4343
+ const settle = () => {
4344
+ cancelAnimationFrame(frame);
4345
+ frame = requestAnimationFrame(() => {
4346
+ if (!element.isConnected) return;
4347
+ const now = document.activeElement;
4348
+ if (now && now !== document.body && now !== document.documentElement) return;
4349
+ const target = element.querySelector(
4350
+ "input:not([disabled]):not([type=hidden]), button:not([disabled]), [href], [tabindex]:not([tabindex='-1'])"
4351
+ );
4352
+ (target ?? element).focus({ preventScroll: true });
4353
+ });
4354
+ };
4355
+ const observer = new MutationObserver(settle);
4356
+ observer.observe(element, { subtree: true, childList: true, attributes: true, attributeFilter: ["disabled"] });
4357
+ return () => {
4358
+ cancelAnimationFrame(frame);
4359
+ observer.disconnect();
4360
+ };
4361
+ }, [element]);
4362
+ return setElement;
4363
+ }
4364
+
4336
4365
  // src/react/sheet/ShareModal.tsx
4337
4366
  var import_jsx_runtime20 = require("react/jsx-runtime");
4338
4367
  function ShareModal({
@@ -4347,11 +4376,12 @@ function ShareModal({
4347
4376
  isOwner: isOwnerOverride,
4348
4377
  outsideShare
4349
4378
  }) {
4350
- const [activeTab, setActiveTab] = (0, import_react17.useState)("users");
4351
- const [outsidePending, setOutsidePending] = (0, import_react17.useState)(0);
4352
- const [emailingLink, setEmailingLink] = (0, import_react17.useState)(false);
4353
- const [emailSent, setEmailSent] = (0, import_react17.useState)(false);
4379
+ const [activeTab, setActiveTab] = (0, import_react18.useState)("users");
4380
+ const [outsidePending, setOutsidePending] = (0, import_react18.useState)(0);
4381
+ const [emailingLink, setEmailingLink] = (0, import_react18.useState)(false);
4382
+ const [emailSent, setEmailSent] = (0, import_react18.useState)(false);
4354
4383
  const { toast } = useToast();
4384
+ const keepFocusInside = useKeepFocusInDialog();
4355
4385
  const getShareUrl = () => {
4356
4386
  const path = (0, import_core35.getResourceSharePath)(resourceType, resourceId);
4357
4387
  if (!path) return null;
@@ -4504,7 +4534,7 @@ function ShareModal({
4504
4534
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react15.Lock, { className: "h-4 w-4 text-muted-foreground flex-shrink-0 mt-0.5" }),
4505
4535
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm", children: grantable.error ?? grantable.levels.viewer ?? "You need Edit or Full access on this to share it." })
4506
4536
  ] });
4507
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system2.Dialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_design_system2.DialogContent, { className: "max-w-2xl max-h-[90dvh] flex flex-col", children: [
4537
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system2.Dialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_design_system2.DialogContent, { ref: keepFocusInside, className: "max-w-2xl max-h-[90dvh] flex flex-col", children: [
4508
4538
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system2.DialogHeader, { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-start justify-between gap-2 pr-10", children: [
4509
4539
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 min-w-0", children: [
4510
4540
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_design_system2.DialogTitle, { className: "flex items-center gap-1.5", children: [