@bayonai/mui-design 1.0.0 → 1.2.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +124 -7
  3. package/dist/cjs/actions/ActionMenu.js +36 -0
  4. package/dist/cjs/actions/DialogActionButtons.js +33 -0
  5. package/dist/cjs/actions/LoadingIconButton.js +10 -0
  6. package/dist/cjs/actions/StickyActionFooter.js +27 -0
  7. package/dist/cjs/actions/StickySubmitButton.js +10 -0
  8. package/dist/cjs/actions/index.js +18 -0
  9. package/dist/cjs/drawers/BottomDrawer.js +43 -0
  10. package/dist/cjs/drawers/MobileBottomDrawer.js +102 -0
  11. package/dist/cjs/drawers/MobileBottomDrawerHeader.js +36 -0
  12. package/dist/cjs/drawers/ResponsiveDrawer.js +22 -0
  13. package/dist/cjs/drawers/drawerAppearance.js +10 -0
  14. package/dist/cjs/drawers/index.js +17 -0
  15. package/dist/cjs/drawers/useVisualViewportBottomInset.js +33 -0
  16. package/dist/cjs/feedback/StatusNotice.js +62 -0
  17. package/dist/cjs/feedback/index.js +7 -0
  18. package/dist/cjs/links/LinkAddressPreview.js +80 -0
  19. package/dist/cjs/links/index.js +9 -0
  20. package/dist/cjs/links/useLinkAddressPreview.js +152 -0
  21. package/dist/cjs/pending/PendingChangesDialogShell.js +16 -0
  22. package/dist/cjs/pending/PendingChangesDialogView.js +130 -0
  23. package/dist/cjs/pending/PendingChangesIndicatorView.js +27 -0
  24. package/dist/cjs/pending/index.js +9 -0
  25. package/dist/cjs/pending/types.js +2 -0
  26. package/dist/cjs/pricing/PricingTable.js +58 -0
  27. package/dist/cjs/pricing/index.js +6 -0
  28. package/dist/cjs/providers/BayonThemeProvider.js +51 -11
  29. package/dist/cjs/sections/ExpandableSectionToggle.js +32 -0
  30. package/dist/cjs/sections/index.js +7 -0
  31. package/dist/cjs/swipe/SwipeActionRow.js +123 -0
  32. package/dist/cjs/swipe/index.js +8 -0
  33. package/dist/cjs/toasts/ActionToast.js +12 -0
  34. package/dist/cjs/toasts/Toast.js +55 -0
  35. package/dist/cjs/toasts/index.js +12 -0
  36. package/dist/cjs/toasts/useUpwardToastDismiss.js +73 -0
  37. package/dist/cjs/uploads/CameraCaptureDialog.js +187 -0
  38. package/dist/cjs/uploads/FileRow.js +23 -0
  39. package/dist/cjs/uploads/FileSwipeActionRow.js +11 -0
  40. package/dist/cjs/uploads/FileThumbnail.js +104 -0
  41. package/dist/cjs/uploads/FileUpload.js +98 -0
  42. package/dist/cjs/uploads/FileViewer.js +151 -0
  43. package/dist/cjs/uploads/ImageCropDialog.js +215 -0
  44. package/dist/cjs/uploads/UploadProgressRing.js +32 -0
  45. package/dist/cjs/uploads/cameraCropPresentation.js +12 -0
  46. package/dist/cjs/uploads/index.js +20 -0
  47. package/dist/esm/actions/ActionMenu.js +30 -0
  48. package/dist/esm/actions/DialogActionButtons.js +24 -0
  49. package/dist/esm/actions/LoadingIconButton.js +7 -0
  50. package/dist/esm/actions/StickyActionFooter.js +24 -0
  51. package/dist/esm/actions/StickySubmitButton.js +7 -0
  52. package/dist/esm/actions/index.js +7 -0
  53. package/dist/esm/drawers/BottomDrawer.js +37 -0
  54. package/dist/esm/drawers/MobileBottomDrawer.js +95 -0
  55. package/dist/esm/drawers/MobileBottomDrawerHeader.js +30 -0
  56. package/dist/esm/drawers/ResponsiveDrawer.js +19 -0
  57. package/dist/esm/drawers/drawerAppearance.js +7 -0
  58. package/dist/esm/drawers/index.js +7 -0
  59. package/dist/esm/drawers/useVisualViewportBottomInset.js +29 -0
  60. package/dist/esm/feedback/StatusNotice.js +56 -0
  61. package/dist/esm/feedback/index.js +3 -0
  62. package/dist/esm/links/LinkAddressPreview.js +74 -0
  63. package/dist/esm/links/index.js +4 -0
  64. package/dist/esm/links/useLinkAddressPreview.js +149 -0
  65. package/dist/esm/pending/PendingChangesDialogShell.js +10 -0
  66. package/dist/esm/pending/PendingChangesDialogView.js +124 -0
  67. package/dist/esm/pending/PendingChangesIndicatorView.js +21 -0
  68. package/dist/esm/pending/index.js +4 -0
  69. package/dist/esm/pending/types.js +1 -0
  70. package/dist/esm/pricing/PricingTable.js +52 -0
  71. package/dist/esm/pricing/index.js +2 -0
  72. package/dist/esm/providers/BayonThemeProvider.js +51 -11
  73. package/dist/esm/sections/ExpandableSectionToggle.js +26 -0
  74. package/dist/esm/sections/index.js +3 -0
  75. package/dist/esm/swipe/SwipeActionRow.js +116 -0
  76. package/dist/esm/swipe/index.js +3 -0
  77. package/dist/esm/toasts/ActionToast.js +9 -0
  78. package/dist/esm/toasts/Toast.js +52 -0
  79. package/dist/esm/toasts/index.js +5 -0
  80. package/dist/esm/toasts/useUpwardToastDismiss.js +69 -0
  81. package/dist/esm/uploads/CameraCaptureDialog.js +181 -0
  82. package/dist/esm/uploads/FileRow.js +17 -0
  83. package/dist/esm/uploads/FileSwipeActionRow.js +7 -0
  84. package/dist/esm/uploads/FileThumbnail.js +98 -0
  85. package/dist/esm/uploads/FileUpload.js +92 -0
  86. package/dist/esm/uploads/FileViewer.js +145 -0
  87. package/dist/esm/uploads/ImageCropDialog.js +212 -0
  88. package/dist/esm/uploads/UploadProgressRing.js +29 -0
  89. package/dist/esm/uploads/cameraCropPresentation.js +5 -0
  90. package/dist/esm/uploads/index.js +9 -0
  91. package/dist/types/actions/ActionMenu.d.ts +24 -0
  92. package/dist/types/actions/DialogActionButtons.d.ts +22 -0
  93. package/dist/types/actions/LoadingIconButton.d.ts +11 -0
  94. package/dist/types/actions/StickyActionFooter.d.ts +14 -0
  95. package/dist/types/actions/StickySubmitButton.d.ts +10 -0
  96. package/dist/types/actions/index.d.ts +5 -0
  97. package/dist/types/drawers/BottomDrawer.d.ts +16 -0
  98. package/dist/types/drawers/MobileBottomDrawer.d.ts +20 -0
  99. package/dist/types/drawers/MobileBottomDrawerHeader.d.ts +11 -0
  100. package/dist/types/drawers/ResponsiveDrawer.d.ts +25 -0
  101. package/dist/types/drawers/drawerAppearance.d.ts +8 -0
  102. package/dist/types/drawers/index.d.ts +6 -0
  103. package/dist/types/drawers/useVisualViewportBottomInset.d.ts +6 -0
  104. package/dist/types/feedback/StatusNotice.d.ts +13 -0
  105. package/dist/types/feedback/index.d.ts +1 -0
  106. package/dist/types/links/LinkAddressPreview.d.ts +19 -0
  107. package/dist/types/links/index.d.ts +3 -0
  108. package/dist/types/links/useLinkAddressPreview.d.ts +24 -0
  109. package/dist/types/pending/PendingChangesDialogShell.d.ts +2 -0
  110. package/dist/types/pending/PendingChangesDialogView.d.ts +2 -0
  111. package/dist/types/pending/PendingChangesIndicatorView.d.ts +10 -0
  112. package/dist/types/pending/index.d.ts +3 -0
  113. package/dist/types/pending/types.d.ts +53 -0
  114. package/dist/types/pricing/PricingTable.d.ts +25 -0
  115. package/dist/types/pricing/index.d.ts +2 -0
  116. package/dist/types/sections/ExpandableSectionToggle.d.ts +12 -0
  117. package/dist/types/sections/index.d.ts +2 -0
  118. package/dist/types/swipe/SwipeActionRow.d.ts +8 -0
  119. package/dist/types/swipe/index.d.ts +1 -0
  120. package/dist/types/toasts/ActionToast.d.ts +11 -0
  121. package/dist/types/toasts/Toast.d.ts +16 -0
  122. package/dist/types/toasts/index.d.ts +5 -0
  123. package/dist/types/toasts/useUpwardToastDismiss.d.ts +15 -0
  124. package/dist/types/uploads/CameraCaptureDialog.d.ts +22 -0
  125. package/dist/types/uploads/FileRow.d.ts +10 -0
  126. package/dist/types/uploads/FileSwipeActionRow.d.ts +1 -0
  127. package/dist/types/uploads/FileThumbnail.d.ts +5 -0
  128. package/dist/types/uploads/FileUpload.d.ts +26 -0
  129. package/dist/types/uploads/FileViewer.d.ts +9 -0
  130. package/dist/types/uploads/ImageCropDialog.d.ts +26 -0
  131. package/dist/types/uploads/UploadProgressRing.d.ts +24 -0
  132. package/dist/types/uploads/cameraCropPresentation.d.ts +2 -0
  133. package/dist/types/uploads/index.d.ts +10 -0
  134. package/docs/camera-crop-contract.md +50 -0
  135. package/docs/pending-contract.md +11 -0
  136. package/docs/uploads-contract.md +40 -0
  137. package/package.json +115 -48
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getVisualViewportBottomInset = getVisualViewportBottomInset;
5
+ exports.useVisualViewportBottomInset = useVisualViewportBottomInset;
6
+ const react_1 = require("react");
7
+ function getVisualViewportBottomInset({ layoutViewportHeight, visualViewportHeight, visualViewportOffsetTop, }) {
8
+ return Math.max(0, Math.round(layoutViewportHeight - visualViewportHeight - visualViewportOffsetTop));
9
+ }
10
+ function useVisualViewportBottomInset() {
11
+ const [bottomInset, setBottomInset] = (0, react_1.useState)(0);
12
+ (0, react_1.useEffect)(() => {
13
+ const visualViewport = window.visualViewport;
14
+ if (!visualViewport) {
15
+ return;
16
+ }
17
+ const updateBottomInset = () => {
18
+ setBottomInset(getVisualViewportBottomInset({
19
+ layoutViewportHeight: window.innerHeight,
20
+ visualViewportHeight: visualViewport.height,
21
+ visualViewportOffsetTop: visualViewport.offsetTop,
22
+ }));
23
+ };
24
+ updateBottomInset();
25
+ visualViewport.addEventListener("resize", updateBottomInset);
26
+ visualViewport.addEventListener("scroll", updateBottomInset);
27
+ return () => {
28
+ visualViewport.removeEventListener("resize", updateBottomInset);
29
+ visualViewport.removeEventListener("scroll", updateBottomInset);
30
+ };
31
+ }, []);
32
+ return bottomInset;
33
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.StatusNotice = StatusNotice;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const ErrorOutlineOutlined_1 = __importDefault(require("@mui/icons-material/ErrorOutlineOutlined"));
10
+ const InfoOutlined_1 = __importDefault(require("@mui/icons-material/InfoOutlined"));
11
+ const TaskAltOutlined_1 = __importDefault(require("@mui/icons-material/TaskAltOutlined"));
12
+ const WarningAmberOutlined_1 = __importDefault(require("@mui/icons-material/WarningAmberOutlined"));
13
+ const material_1 = require("@mui/material");
14
+ function StatusNotice({ action, compact = false, dataComponent, message, role, sx, tone = "info", }) {
15
+ const toneConfig = getStatusNoticeTone(tone);
16
+ const Icon = toneConfig.Icon;
17
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { "data-component": dataComponent, component: compact ? "span" : "div", direction: "row", role: role !== null && role !== void 0 ? role : (tone === "error" ? "status" : undefined), spacing: compact ? 2 : 1.25, sx: [
18
+ {
19
+ alignItems: "center",
20
+ alignSelf: "flex-start",
21
+ borderRadius: 1,
22
+ boxShadow: "0 10px 28px rgba(0, 0, 0, 0.12)",
23
+ maxWidth: "100%",
24
+ minWidth: 0,
25
+ px: compact ? 0 : 1.25,
26
+ py: compact ? 0 : 0.875,
27
+ },
28
+ ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
29
+ ], children: [(0, jsx_runtime_1.jsx)(material_1.Box, { "data-status-notice-part": "icon", component: compact ? "span" : "div", sx: {
30
+ alignItems: "center",
31
+ borderRadius: 999,
32
+ color: toneConfig.iconColor,
33
+ display: "flex",
34
+ flex: "0 0 auto",
35
+ height: compact ? 20 : 26,
36
+ justifyContent: "center",
37
+ width: compact ? 20 : 26,
38
+ }, children: (0, jsx_runtime_1.jsx)(Icon, { fontSize: compact ? "inherit" : "small" }) }), typeof message === "string" ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.secondary", ...(compact ? { component: "span" } : {}), "data-status-notice-part": "message", sx: {
39
+ fontSize: compact ? "0.75rem" : undefined,
40
+ lineHeight: compact ? 1.35 : 1.55,
41
+ minWidth: 0,
42
+ overflowWrap: "anywhere",
43
+ }, variant: "body2", children: message })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { "data-status-notice-part": "message", component: compact ? "span" : "div", sx: {
44
+ color: "text.secondary",
45
+ fontSize: compact ? "0.75rem" : undefined,
46
+ lineHeight: compact ? 1.35 : 1.55,
47
+ minWidth: 0,
48
+ overflowWrap: "anywhere",
49
+ }, children: message })), action ? ((0, jsx_runtime_1.jsx)(material_1.Box, { "data-status-notice-part": "action", sx: { alignItems: "center", display: "flex", flex: "0 0 auto" }, children: action })) : null] }));
50
+ }
51
+ function getStatusNoticeTone(tone) {
52
+ if (tone === "error") {
53
+ return { Icon: ErrorOutlineOutlined_1.default, iconColor: "error.main" };
54
+ }
55
+ if (tone === "warning") {
56
+ return { Icon: WarningAmberOutlined_1.default, iconColor: "warning.main" };
57
+ }
58
+ if (tone === "success") {
59
+ return { Icon: TaskAltOutlined_1.default, iconColor: "success.main" };
60
+ }
61
+ return { Icon: InfoOutlined_1.default, iconColor: "text.secondary" };
62
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StatusNotice = void 0;
5
+ // TL-M249: preserve the established MUI presentation under its owning package.
6
+ var StatusNotice_js_1 = require("./StatusNotice.js");
7
+ Object.defineProperty(exports, "StatusNotice", { enumerable: true, get: function () { return StatusNotice_js_1.StatusNotice; } });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.LinkAddressPreview = LinkAddressPreview;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const LinkRounded_1 = __importDefault(require("@mui/icons-material/LinkRounded"));
10
+ const OpenInNewRounded_1 = __importDefault(require("@mui/icons-material/OpenInNewRounded"));
11
+ const material_1 = require("@mui/material");
12
+ /**
13
+ * Shared presentation of the editor's destination card. Hosts own validated
14
+ * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
15
+ */
16
+ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel = `Open ${link.href} in a new tab`, sx, ...events }) {
17
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "a", href: link.href, target: "_blank", rel: "noopener noreferrer", title: openLabel, "aria-label": ariaLabel, "data-link-address-preview": "true", ...events, sx: [
18
+ {
19
+ alignItems: "center",
20
+ bgcolor: "background.paper",
21
+ border: 1,
22
+ borderColor: "divider",
23
+ borderRadius: "10px",
24
+ boxShadow: 8,
25
+ color: "text.primary",
26
+ display: "flex",
27
+ textDecoration: "none",
28
+ cursor: "pointer",
29
+ "&:focus-visible": {
30
+ outline: "2px solid",
31
+ outlineColor: "primary.main",
32
+ outlineOffset: 2,
33
+ },
34
+ gap: "10px",
35
+ left: link.left,
36
+ maxWidth: "calc(100vw - 24px)",
37
+ minHeight: 64,
38
+ p: "8px 10px",
39
+ position: "fixed",
40
+ top: link.top,
41
+ width: 360,
42
+ boxSizing: "border-box",
43
+ zIndex: (theme) => theme.zIndex.tooltip + 100,
44
+ },
45
+ ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
46
+ ], children: [(0, jsx_runtime_1.jsx)(material_1.Box, { "aria-hidden": "true", "data-link-preview-part": "icon", sx: {
47
+ alignItems: "center",
48
+ bgcolor: "action.selected",
49
+ borderRadius: "8px",
50
+ color: "primary.main",
51
+ display: "flex",
52
+ flex: "0 0 36px",
53
+ height: 36,
54
+ justifyContent: "center",
55
+ }, children: (0, jsx_runtime_1.jsx)(LinkRounded_1.default, { sx: { fontSize: 16 } }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { flex: 1, minWidth: 0 }, "data-link-preview-part": "text", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", dir: "auto", sx: {
56
+ fontSize: "0.92rem",
57
+ fontWeight: 600,
58
+ lineHeight: 1.35,
59
+ overflow: "hidden",
60
+ textOverflow: "ellipsis",
61
+ whiteSpace: "nowrap",
62
+ }, children: link.label }), (0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", dir: "ltr", title: link.href, sx: {
63
+ color: "text.secondary",
64
+ fontSize: "0.8rem",
65
+ lineHeight: 1.4,
66
+ overflow: "hidden",
67
+ textAlign: "start",
68
+ textOverflow: "ellipsis",
69
+ whiteSpace: "nowrap",
70
+ }, children: link.href })] }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: openLabel, children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: "span", "aria-hidden": "true", "data-link-preview-part": "open", sx: {
71
+ display: "inline-flex",
72
+ alignItems: "center",
73
+ justifyContent: "center",
74
+ color: "text.primary",
75
+ flex: "0 0 44px",
76
+ height: 44,
77
+ width: 44,
78
+ borderRadius: "6px",
79
+ }, children: (0, jsx_runtime_1.jsx)(OpenInNewRounded_1.default, { sx: { fontSize: 18 } }) }) })] }));
80
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useLinkAddressPreview = exports.LinkAddressPreview = void 0;
5
+ // TL-M249: preserve the established MUI presentation under its owning package.
6
+ var LinkAddressPreview_js_1 = require("./LinkAddressPreview.js");
7
+ Object.defineProperty(exports, "LinkAddressPreview", { enumerable: true, get: function () { return LinkAddressPreview_js_1.LinkAddressPreview; } });
8
+ var useLinkAddressPreview_js_1 = require("./useLinkAddressPreview.js");
9
+ Object.defineProperty(exports, "useLinkAddressPreview", { enumerable: true, get: function () { return useLinkAddressPreview_js_1.useLinkAddressPreview; } });
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useLinkAddressPreview = useLinkAddressPreview;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const LinkAddressPreview_js_1 = require("./LinkAddressPreview.js");
7
+ const react_1 = require("react");
8
+ const react_dom_1 = require("react-dom");
9
+ /** Product decision: hosts own link interaction; the shared UI card only displays
10
+ * a validated destination. The source previews/edits; the card navigates. */
11
+ function useLinkAddressPreview(enabled = true, onEdit) {
12
+ const id = (0, react_1.useId)();
13
+ const activated = (0, react_1.useRef)(null);
14
+ const [preview, setPreview] = (0, react_1.useState)(null);
15
+ const closeTimer = (0, react_1.useRef)(null);
16
+ const focusFrame = (0, react_1.useRef)(null);
17
+ function cancelClose() {
18
+ if (closeTimer.current !== null)
19
+ clearTimeout(closeTimer.current);
20
+ closeTimer.current = null;
21
+ }
22
+ function close() {
23
+ cancelClose();
24
+ setPreview(null);
25
+ activated.current = null;
26
+ }
27
+ function contains(target) {
28
+ var _a;
29
+ return (target instanceof Node &&
30
+ ((preview === null || preview === void 0 ? void 0 : preview.anchor.contains(target)) ||
31
+ ((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target))));
32
+ }
33
+ function show(anchor, href, label) {
34
+ if (!enabled)
35
+ return;
36
+ cancelClose();
37
+ const rect = anchor.getBoundingClientRect();
38
+ const width = Math.min(360, window.innerWidth - 24);
39
+ setPreview({
40
+ anchor,
41
+ href,
42
+ label,
43
+ left: Math.max(12, Math.min(rect.left, window.innerWidth - width - 12)),
44
+ top: Math.max(12, Math.min(rect.bottom + 8, window.innerHeight - 88)),
45
+ });
46
+ }
47
+ function scheduleClose() {
48
+ cancelClose();
49
+ // Allow pointer travel between the inline link and its portal card.
50
+ closeTimer.current = setTimeout(() => {
51
+ if (!contains(document.activeElement))
52
+ setPreview(null);
53
+ }, 180);
54
+ }
55
+ function blur(event) {
56
+ if (!contains(event.relatedTarget))
57
+ close();
58
+ }
59
+ function escape(event) {
60
+ if (event.key !== "Escape")
61
+ return;
62
+ event.preventDefault();
63
+ event.stopPropagation();
64
+ preview === null || preview === void 0 ? void 0 : preview.anchor.focus({ preventScroll: true });
65
+ close();
66
+ }
67
+ (0, react_1.useEffect)(() => () => {
68
+ if (closeTimer.current !== null)
69
+ clearTimeout(closeTimer.current);
70
+ if (focusFrame.current !== null)
71
+ cancelAnimationFrame(focusFrame.current);
72
+ }, []);
73
+ (0, react_1.useEffect)(() => {
74
+ if (!preview)
75
+ return;
76
+ const dismiss = () => setPreview(null);
77
+ const outside = (event) => {
78
+ var _a;
79
+ const target = event.target;
80
+ if (target instanceof Node &&
81
+ !preview.anchor.contains(target) &&
82
+ !((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target)))
83
+ dismiss();
84
+ };
85
+ window.addEventListener("resize", dismiss);
86
+ window.addEventListener("scroll", dismiss, true);
87
+ document.addEventListener("pointerdown", outside);
88
+ return () => {
89
+ window.removeEventListener("resize", dismiss);
90
+ window.removeEventListener("scroll", dismiss, true);
91
+ document.removeEventListener("pointerdown", outside);
92
+ };
93
+ }, [preview, id]);
94
+ return {
95
+ linkProps(href, label) {
96
+ return enabled
97
+ ? {
98
+ "aria-controls": (preview === null || preview === void 0 ? void 0 : preview.href) === href ? id : undefined,
99
+ "aria-keyshortcuts": "ArrowDown",
100
+ onMouseEnter: (event) => show(event.currentTarget, href, label),
101
+ onMouseLeave: scheduleClose,
102
+ onFocus: (event) => show(event.currentTarget, href, label),
103
+ onBlur: blur,
104
+ onKeyDown: (event) => {
105
+ // Links inside editable titles must not trigger the parent's Enter handler.
106
+ event.stopPropagation();
107
+ if (event.key === "ArrowDown") {
108
+ event.preventDefault();
109
+ show(event.currentTarget, href, label);
110
+ if (focusFrame.current !== null)
111
+ cancelAnimationFrame(focusFrame.current);
112
+ focusFrame.current = requestAnimationFrame(() => {
113
+ var _a;
114
+ (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.focus();
115
+ });
116
+ }
117
+ else
118
+ escape(event);
119
+ },
120
+ }
121
+ : {};
122
+ },
123
+ onClick(event, href, label) {
124
+ event.stopPropagation();
125
+ if (!enabled ||
126
+ event.metaKey ||
127
+ event.ctrlKey ||
128
+ event.shiftKey ||
129
+ event.altKey ||
130
+ event.button !== 0)
131
+ return;
132
+ // The source is an editing affordance after preview; the card owns navigation.
133
+ event.preventDefault();
134
+ if ((preview === null || preview === void 0 ? void 0 : preview.anchor) === event.currentTarget &&
135
+ activated.current === event.currentTarget &&
136
+ onEdit) {
137
+ close();
138
+ onEdit();
139
+ }
140
+ else {
141
+ activated.current = event.currentTarget;
142
+ show(event.currentTarget, href, label);
143
+ }
144
+ },
145
+ card: preview
146
+ ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(LinkAddressPreview_js_1.LinkAddressPreview, { id: id, link: preview, onMouseEnter: cancelClose, onMouseLeave: scheduleClose, onFocusCapture: cancelClose, onBlurCapture: blur, onKeyDown: (event) => {
147
+ event.stopPropagation();
148
+ escape(event);
149
+ }, onClick: (event) => event.stopPropagation() }), document.body)
150
+ : null,
151
+ };
152
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PendingChangesDialogShell = PendingChangesDialogShell;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const material_1 = require("@mui/material");
10
+ const CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
11
+ const react_1 = require("react");
12
+ function PendingChangesDialogShell({ children, open, onClose, title, titleIcon, contentHeader, contentTouchHandlers, contentSx, onEntered, closeLabel = "Close pending changes", }) {
13
+ const headerId = (0, react_1.useId)();
14
+ const titleId = `${headerId}-title`;
15
+ return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, { open: open, onClose: onClose, fullWidth: true, maxWidth: "sm", "aria-labelledby": titleId, slotProps: { transition: { onEntered } }, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { id: headerId, component: "div", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, children: [titleIcon, (0, jsx_runtime_1.jsx)("span", { id: titleId, style: { flex: 1 }, children: title }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: closeLabel, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": closeLabel, onClick: onClose, sx: { width: 44, height: 44 }, children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) }) })] }) }), contentHeader ? ((0, jsx_runtime_1.jsx)("div", { style: { padding: "0 24px 16px" }, children: contentHeader })) : null, (0, jsx_runtime_1.jsx)(material_1.DialogContent, { ...contentTouchHandlers, sx: contentSx, children: children })] }));
16
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PendingChangesDialogView = PendingChangesDialogView;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const material_1 = require("@mui/material");
10
+ const ArrowForwardRounded_1 = __importDefault(require("@mui/icons-material/ArrowForwardRounded"));
11
+ const DeleteOutlineRounded_1 = __importDefault(require("@mui/icons-material/DeleteOutlineRounded"));
12
+ const CloudUploadOutlined_1 = __importDefault(require("@mui/icons-material/CloudUploadOutlined"));
13
+ const react_1 = require("react");
14
+ const PendingChangesDialogShell_js_1 = require("./PendingChangesDialogShell.js");
15
+ const pageSize = 10;
16
+ function PendingChangesDialogView({ groups, open, onClose, title, summary, emptyMessage = "All changes are saved.", accountKey, onOpenItem, onDiscardRequest, discardLabel = "Discard a change", focusGroupKey, navigationError, contentHeader, contentTouchHandlers, shell: Shell = PendingChangesDialogShell_js_1.PendingChangesDialogShell, }) {
17
+ const returnItemButton = (0, react_1.useRef)(null);
18
+ const [page, setPage] = (0, react_1.useState)(1);
19
+ const [actionPages, setActionPages] = (0, react_1.useState)({});
20
+ const pages = Math.max(1, Math.ceil(groups.length / pageSize));
21
+ const visiblePage = Math.min(page, pages);
22
+ const [previousGroups, setPreviousGroups] = (0, react_1.useState)(groups);
23
+ const [previousAccount, setPreviousAccount] = (0, react_1.useState)(accountKey);
24
+ // Adjust pagination only when the source view changes. Guarded render state
25
+ // keeps the first painted frame bounded and avoids effect-driven page jumps.
26
+ if (previousGroups !== groups || previousAccount !== accountKey) {
27
+ setPreviousGroups(groups);
28
+ setPreviousAccount(accountKey);
29
+ if (previousAccount !== accountKey) {
30
+ setPage(1);
31
+ setActionPages({});
32
+ }
33
+ else {
34
+ setPage((current) => Math.min(current, pages));
35
+ setActionPages((current) => {
36
+ const next = {};
37
+ for (const group of groups)
38
+ if (current[group.key] !== undefined)
39
+ next[group.key] = Math.min(current[group.key], Math.max(1, Math.ceil(group.rows.length / pageSize)));
40
+ return Object.keys(next).length === Object.keys(current).length &&
41
+ Object.keys(next).every((key) => next[key] === current[key])
42
+ ? current
43
+ : next;
44
+ });
45
+ }
46
+ }
47
+ return ((0, jsx_runtime_1.jsxs)(Shell, { autoFocusInput: false, closeLabel: "Close pending changes", closeTooltip: "Close pending changes", contentHeader: contentHeader !== null && contentHeader !== void 0 ? contentHeader : (groups.length ? (
48
+ // Product decision: the sync summary remains distinct and visible
49
+ // while the user scrolls through pending groups.
50
+ (0, jsx_runtime_1.jsxs)(material_1.Stack, { component: "section", "aria-label": "Pending changes summary", direction: "row", spacing: 1, sx: { p: 2, borderRadius: 1, bgcolor: "action.selected", alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: summary }), onDiscardRequest ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: discardLabel, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": discardLabel, onClick: onDiscardRequest, sx: { width: 44, height: 44 }, children: (0, jsx_runtime_1.jsx)(DeleteOutlineRounded_1.default, {}) }) })) : null] })) : undefined), contentTouchHandlers: contentTouchHandlers, contentSx: { pt: 0.5, pb: 3, overscrollBehaviorY: "contain" }, exclusive: false, onClose: onClose, onEntered: () => {
51
+ // Entry focus runs after MUI settles its focus trap, including a reopen
52
+ // of the same inspector. A removed group retains the shell's fallback.
53
+ const target = returnItemButton.current;
54
+ if ((target === null || target === void 0 ? void 0 : target.isConnected) && !target.disabled)
55
+ target.focus();
56
+ }, open: open, title: title, titleIcon: (0, jsx_runtime_1.jsx)(CloudUploadOutlined_1.default, {}), children: [navigationError ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { role: "alert", color: "error", variant: "body2", sx: { mb: 1 }, children: navigationError })) : null, groups.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.List, { "aria-label": "Pending changes", disablePadding: true, sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: groups
57
+ .slice((visiblePage - 1) * pageSize, visiblePage * pageSize)
58
+ .map((group) => {
59
+ var _a;
60
+ const title = group.title;
61
+ const unavailableReason = group.unavailableReason;
62
+ const actionPageCount = Math.max(1, Math.ceil(group.rows.length / pageSize));
63
+ const actionPage = Math.min((_a = actionPages[group.key]) !== null && _a !== void 0 ? _a : 1, actionPageCount);
64
+ return ((0, jsx_runtime_1.jsx)(material_1.ListItem, { disableGutters: true, sx: {
65
+ p: 2,
66
+ position: "relative",
67
+ alignItems: "flex-start",
68
+ border: 1,
69
+ borderColor: "divider",
70
+ borderRadius: 1,
71
+ }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 0, sx: { minWidth: 0, width: "100%" }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, sx: {
72
+ alignItems: "center",
73
+ justifyContent: "space-between",
74
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: title, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h3", "aria-label": title, tabIndex: 0, sx: {
75
+ flex: 1,
76
+ minWidth: 0,
77
+ fontWeight: 600,
78
+ // The item name owns one row; CSS handles the
79
+ // available width, while the tooltip retains it all.
80
+ overflow: "hidden",
81
+ textOverflow: "ellipsis",
82
+ whiteSpace: "nowrap",
83
+ }, variant: "body2", children: title }) }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", spacing: 0.5, sx: { alignItems: "center", flexShrink: 0, position: "absolute", right: 8, top: group.rows.length ? 32 : 4 }, children: group.openLabel && onOpenItem ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: unavailableReason || group.openLabel, children: (0, jsx_runtime_1.jsx)("span", { tabIndex: unavailableReason ? 0 : undefined, "aria-label": unavailableReason
84
+ ? `${group.openLabel} unavailable. ${unavailableReason}`
85
+ : undefined, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": `${group.openLabel}: ${title}`, disabled: Boolean(unavailableReason), ref: focusGroupKey === group.key
86
+ ? returnItemButton
87
+ : undefined, onClick: () => onOpenItem(group.key), size: "small", sx: { width: 44, height: 44 }, children: (0, jsx_runtime_1.jsx)(ArrowForwardRounded_1.default, { fontSize: "small" }) }) }) })) : null })] }), (0, jsx_runtime_1.jsx)(material_1.List, { "aria-label": `Changes for ${group.title}`, disablePadding: true, children: group.rows
88
+ .slice((actionPage - 1) * pageSize, actionPage * pageSize)
89
+ .map((item, index) => {
90
+ const presentation = item;
91
+ const exception = item.exception;
92
+ if (!presentation.action &&
93
+ !exception &&
94
+ !presentation.targetLabel &&
95
+ !presentation.elapsedText &&
96
+ presentation.attemptedText === undefined)
97
+ return null;
98
+ return ((0, jsx_runtime_1.jsx)(material_1.ListItem, { disableGutters: true, sx: {
99
+ display: "block",
100
+ py: 1,
101
+ borderTop: index > 0 ? 1 : 0,
102
+ borderColor: "divider",
103
+ }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 0.75, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, sx: {
104
+ alignItems: "baseline",
105
+ justifyContent: "space-between",
106
+ flexWrap: "wrap",
107
+ pr: index === 0 && group.openLabel && onOpenItem ? 5 : 0,
108
+ }, children: [presentation.action ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h4", color: "text.secondary", variant: "caption", children: presentation.action })) : null, exception ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: item.needsAttention
109
+ ? "error"
110
+ : "text.secondary", variant: "caption", children: exception })) : null] }), presentation.elapsedText ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", sx: { fontSize: "0.6875rem", color: "text.primary", opacity: 0.78 }, children: presentation.elapsedText })) : null, presentation.targetLabel ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.secondary", variant: "caption", sx: {
111
+ overflowWrap: "anywhere",
112
+ whiteSpace: "pre-wrap",
113
+ }, children: presentation.targetLabel })) : null, presentation.attemptedText !== undefined ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", sx: {
114
+ whiteSpace: "pre-wrap",
115
+ overflowWrap: "anywhere",
116
+ }, children: presentation.attemptedText })) : null] }) }, item.id));
117
+ }) }), actionPageCount > 1 ? ((0, jsx_runtime_1.jsx)(material_1.Pagination, { "aria-label": `Change pages for ${group.title}`, count: actionPageCount, page: actionPage, onChange: (_event, nextPage) => setActionPages((previous) => ({
118
+ ...previous,
119
+ [group.key]: nextPage,
120
+ })), sx: {
121
+ "& .MuiPaginationItem-root": {
122
+ minWidth: 44,
123
+ minHeight: 44,
124
+ },
125
+ } })) : null] }) }, group.key));
126
+ }) }), pages > 1 ? ((0, jsx_runtime_1.jsx)(material_1.Pagination, { "aria-label": "Pending changes pages", count: pages, onChange: (_event, nextPage) => setPage(nextPage), page: visiblePage, sx: {
127
+ mt: 2,
128
+ "& .MuiPaginationItem-root": { minWidth: 44, minHeight: 44 },
129
+ } })) : null] })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { role: "status", sx: { py: 2 }, children: emptyMessage }))] }));
130
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PendingChangesIndicatorView = PendingChangesIndicatorView;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const material_1 = require("@mui/material");
10
+ const styles_1 = require("@mui/material/styles");
11
+ const CloudOffOutlined_1 = __importDefault(require("@mui/icons-material/CloudOffOutlined"));
12
+ const CloudUploadOutlined_1 = __importDefault(require("@mui/icons-material/CloudUploadOutlined"));
13
+ function PendingChangesIndicatorView({ count, isOffline = false, label = `${count} pending ${count === 1 ? "change" : "changes"}`, explanation = "View pending changes", onOpen, sx, }) {
14
+ return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: `${isOffline ? "Offline. " : ""}${label}. ${explanation}`, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": `${isOffline ? "Offline. " : ""}${label}. View pending changes`, "aria-haspopup": "dialog", onClick: onOpen, sx: [
15
+ {
16
+ width: 44,
17
+ height: 44,
18
+ borderRadius: "50%",
19
+ color: "primary.main",
20
+ bgcolor: "background.paper",
21
+ "&:hover": {
22
+ bgcolor: (theme) => (0, styles_1.alpha)(theme.palette.primary.main, 0.18),
23
+ },
24
+ },
25
+ ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
26
+ ], children: (0, jsx_runtime_1.jsx)(material_1.Badge, { badgeContent: count, color: "primary", max: Number.MAX_SAFE_INTEGER, slotProps: { badge: { "aria-hidden": true } }, children: isOffline ? (0, jsx_runtime_1.jsx)(CloudOffOutlined_1.default, {}) : (0, jsx_runtime_1.jsx)(CloudUploadOutlined_1.default, {}) }) }) }));
27
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PendingChangesIndicatorView = exports.PendingChangesDialogView = void 0;
5
+ // TL-M249: preserve the established MUI presentation under its owning package.
6
+ var PendingChangesDialogView_js_1 = require("./PendingChangesDialogView.js");
7
+ Object.defineProperty(exports, "PendingChangesDialogView", { enumerable: true, get: function () { return PendingChangesDialogView_js_1.PendingChangesDialogView; } });
8
+ var PendingChangesIndicatorView_js_1 = require("./PendingChangesIndicatorView.js");
9
+ Object.defineProperty(exports, "PendingChangesIndicatorView", { enumerable: true, get: function () { return PendingChangesIndicatorView_js_1.PendingChangesIndicatorView; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PricingTable = PricingTable;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const CheckRounded_1 = __importDefault(require("@mui/icons-material/CheckRounded"));
10
+ const material_1 = require("@mui/material");
11
+ // Product decision: callers own plan content and actions; this component only
12
+ // presents the supplied plans and never determines prices or availability.
13
+ function PricingTable({ label, plans, className, interactiveClassName, colors, }) {
14
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { "aria-label": label, className: className, sx: {
15
+ display: "grid",
16
+ gap: 1.5,
17
+ gridTemplateColumns: {
18
+ xs: "1fr",
19
+ md: `repeat(${plans.length}, minmax(0, 1fr))`,
20
+ },
21
+ }, children: plans.map((plan) => {
22
+ const highlighted = Boolean(plan.highlighted);
23
+ const secondary = highlighted ? "rgba(255,255,255,0.86)" : colors.muted;
24
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: interactiveClassName, spacing: 2.25, sx: {
25
+ bgcolor: highlighted ? colors.accent : "#FFFFFF",
26
+ boxShadow: highlighted
27
+ ? "0 8px 18px rgba(23, 106, 168, 0.22)"
28
+ : "none",
29
+ color: highlighted ? "#FFFFFF" : colors.text,
30
+ minHeight: { md: 430 },
31
+ p: { xs: 2.5, sm: 3 },
32
+ position: "relative",
33
+ borderRadius: 2,
34
+ ...(highlighted
35
+ ? {}
36
+ : { border: "1px solid rgba(23, 38, 56, 0.12)" }),
37
+ "&:hover": {
38
+ ...(highlighted
39
+ ? { boxShadow: "0 10px 22px rgba(23, 106, 168, 0.28)" }
40
+ : { bgcolor: "#FCFEFF" }),
41
+ transform: "translateY(-2px)",
42
+ },
43
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-between" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: 21, fontWeight: 780 }, children: plan.label }), plan.badge] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: {
44
+ color: secondary,
45
+ fontSize: 14,
46
+ lineHeight: 1.5,
47
+ minHeight: { md: 42 },
48
+ }, children: plan.description }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { sx: {
49
+ fontSize: { xs: 25, sm: 28 },
50
+ fontWeight: 780,
51
+ letterSpacing: "-0.03em",
52
+ }, children: plan.price }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { color: secondary, fontSize: 13 }, children: plan.priceNote })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { component: "ul", spacing: 1.1, sx: { listStyle: "none", m: 0, p: 0 }, children: plan.features.map((feature, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { component: "li", direction: "row", spacing: 1, children: [(0, jsx_runtime_1.jsx)(CheckRounded_1.default, { sx: {
53
+ color: highlighted ? "#FFFFFF" : colors.accentDark,
54
+ fontSize: 18,
55
+ mt: "2px",
56
+ } }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: 14, lineHeight: 1.45 }, children: feature })] }, index))) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1 } }), plan.action] }, plan.id));
57
+ }) }));
58
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PricingTable = void 0;
5
+ var PricingTable_js_1 = require("./PricingTable.js");
6
+ Object.defineProperty(exports, "PricingTable", { enumerable: true, get: function () { return PricingTable_js_1.PricingTable; } });