@blerp/design 1.3.17 → 1.4.2

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 (128) hide show
  1. package/dist/cjs/Blerp/BlerpImageRow.js +176 -57
  2. package/dist/cjs/Blerp/BlerpSavePopup.js +44 -40
  3. package/dist/cjs/Blerp/BlerpTitleRow.js +36 -19
  4. package/dist/cjs/Blerp/BlerpTopRow.js +110 -44
  5. package/dist/cjs/Blerp.js +9 -16
  6. package/dist/cjs/BlerpAudioContextProvider.js +2 -2
  7. package/dist/cjs/BlerpListView.js +318 -168
  8. package/dist/cjs/BlerpListViewPremium.js +155 -130
  9. package/dist/cjs/BlerpListViewSkeleton.js +60 -13
  10. package/dist/cjs/BlerpSkeleton.js +32 -9
  11. package/dist/cjs/CollectionCard.js +139 -60
  12. package/dist/cjs/CollectionListViewPremium.js +368 -297
  13. package/dist/cjs/CollectionSkeleton.js +74 -13
  14. package/dist/cjs/Dropdown.js +272 -172
  15. package/dist/cjs/EllipsisLoader.js +66 -21
  16. package/dist/cjs/GroupCard.js +64 -57
  17. package/dist/cjs/Icons/Icons.js +288 -426
  18. package/dist/cjs/ImageEditor.js +247 -0
  19. package/dist/cjs/ImageUpload.js +226 -0
  20. package/dist/cjs/NewBlerp.js +354 -160
  21. package/dist/cjs/NewBlerpTest.js +10 -792
  22. package/dist/cjs/NewCollectionModal.js +294 -310
  23. package/dist/cjs/PremiumCollectionCard.js +191 -454
  24. package/dist/cjs/PurchaseModals/CheckoutModal.js +1 -1
  25. package/dist/cjs/PurchaseModals/PremiumBlerpCheckoutModal.js +1 -1
  26. package/dist/cjs/PurchaseModals/PremiumCollectionCheckoutModal.js +1 -1
  27. package/dist/cjs/PurchaseModals/PremiumSubscriptionCheckoutModal.js +1 -1
  28. package/dist/cjs/ReactionButtons.js +26 -13
  29. package/dist/cjs/SnackbarContextProvider.js +200 -116
  30. package/dist/cjs/Theme.js +217 -90
  31. package/dist/cjs/Toggle.js +86 -32
  32. package/dist/cjs/UserCard.js +13 -32
  33. package/dist/cjs/UserPage/LibraryControls.js +180 -93
  34. package/dist/cjs/UserPage/UserLibraryHeader.js +23 -14
  35. package/dist/cjs/UserPage/UserProfileHeader.js +120 -105
  36. package/dist/cjs/UsernameWithPopout.js +12 -8
  37. package/dist/cjs/colors.js +15 -8
  38. package/dist/cjs/helpers.js +131 -0
  39. package/dist/cjs/index.js +92 -58
  40. package/dist/cjs/neo-components/Autocomplete.js +285 -0
  41. package/dist/cjs/neo-components/BottomNavigation.js +120 -0
  42. package/dist/cjs/neo-components/Box.js +48 -0
  43. package/dist/cjs/neo-components/Button.js +206 -0
  44. package/dist/cjs/neo-components/CircularProgress.js +92 -0
  45. package/dist/cjs/neo-components/Container.js +75 -0
  46. package/dist/cjs/neo-components/Dialog.js +441 -0
  47. package/dist/cjs/neo-components/Fab.js +237 -0
  48. package/dist/cjs/neo-components/FormControls.js +1057 -0
  49. package/dist/cjs/neo-components/Grid.js +256 -0
  50. package/dist/cjs/neo-components/IconButton.js +111 -0
  51. package/dist/cjs/neo-components/Input.js +495 -0
  52. package/dist/cjs/neo-components/Layout.js +1214 -0
  53. package/dist/cjs/neo-components/Misc.js +868 -0
  54. package/dist/cjs/neo-components/Navigation.js +1616 -0
  55. package/dist/cjs/neo-components/Paper.js +256 -0
  56. package/dist/cjs/neo-components/Stack.js +194 -0
  57. package/dist/cjs/neo-components/Stepper.js +291 -0
  58. package/dist/cjs/neo-components/Text.js +290 -0
  59. package/dist/cjs/neo-components/ThemeProvider.js +731 -0
  60. package/dist/cjs/neo-components/ToggleButton.js +223 -0
  61. package/dist/cjs/neo-components/createTheme.js +306 -0
  62. package/dist/cjs/neo-components/withSx.js +171 -0
  63. package/dist/cjs/neo-utils/sxToStyle.js +508 -0
  64. package/dist/esm/Blerp/BlerpImageRow.js +166 -46
  65. package/dist/esm/Blerp/BlerpSavePopup.js +35 -27
  66. package/dist/esm/Blerp/BlerpTitleRow.js +32 -13
  67. package/dist/esm/Blerp/BlerpTopRow.js +85 -16
  68. package/dist/esm/Blerp.js +4 -12
  69. package/dist/esm/BlerpAudioContextProvider.js +1 -2
  70. package/dist/esm/BlerpListView.js +313 -160
  71. package/dist/esm/BlerpListViewPremium.js +135 -109
  72. package/dist/esm/BlerpListViewSkeleton.js +60 -11
  73. package/dist/esm/BlerpSkeleton.js +32 -7
  74. package/dist/esm/CollectionCard.js +118 -38
  75. package/dist/esm/CollectionListViewPremium.js +367 -294
  76. package/dist/esm/CollectionSkeleton.js +73 -11
  77. package/dist/esm/Dropdown.js +260 -161
  78. package/dist/esm/EllipsisLoader.js +63 -18
  79. package/dist/esm/GroupCard.js +54 -46
  80. package/dist/esm/Icons/Icons.js +226 -367
  81. package/dist/esm/ImageEditor.js +240 -0
  82. package/dist/esm/ImageUpload.js +217 -0
  83. package/dist/esm/NewBlerp.js +282 -79
  84. package/dist/esm/NewBlerpTest.js +11 -781
  85. package/dist/esm/NewCollectionModal.js +289 -304
  86. package/dist/esm/PremiumCollectionCard.js +192 -451
  87. package/dist/esm/PurchaseModals/CheckoutModal.js +1 -1
  88. package/dist/esm/PurchaseModals/PremiumBlerpCheckoutModal.js +1 -1
  89. package/dist/esm/PurchaseModals/PremiumCollectionCheckoutModal.js +1 -1
  90. package/dist/esm/PurchaseModals/PremiumSubscriptionCheckoutModal.js +1 -1
  91. package/dist/esm/ReactionButtons.js +23 -8
  92. package/dist/esm/SnackbarContextProvider.js +196 -110
  93. package/dist/esm/Theme.js +187 -66
  94. package/dist/esm/Toggle.js +84 -29
  95. package/dist/esm/UserCard.js +1 -20
  96. package/dist/esm/UserPage/LibraryControls.js +159 -65
  97. package/dist/esm/UserPage/UserLibraryHeader.js +18 -10
  98. package/dist/esm/UserPage/UserProfileHeader.js +100 -79
  99. package/dist/esm/UsernameWithPopout.js +7 -4
  100. package/dist/esm/colors.js +11 -9
  101. package/dist/esm/helpers.js +122 -0
  102. package/dist/esm/icons.js +1 -1
  103. package/dist/esm/index.js +32 -2
  104. package/dist/esm/neo-components/Autocomplete.js +274 -0
  105. package/dist/esm/neo-components/BottomNavigation.js +109 -0
  106. package/dist/esm/neo-components/Box.js +36 -0
  107. package/dist/esm/neo-components/Button.js +194 -0
  108. package/dist/esm/neo-components/CircularProgress.js +81 -0
  109. package/dist/esm/neo-components/Container.js +63 -0
  110. package/dist/esm/neo-components/Dialog.js +423 -0
  111. package/dist/esm/neo-components/Fab.js +225 -0
  112. package/dist/esm/neo-components/FormControls.js +1041 -0
  113. package/dist/esm/neo-components/Grid.js +244 -0
  114. package/dist/esm/neo-components/IconButton.js +99 -0
  115. package/dist/esm/neo-components/Input.js +480 -0
  116. package/dist/esm/neo-components/Layout.js +1180 -0
  117. package/dist/esm/neo-components/Misc.js +850 -0
  118. package/dist/esm/neo-components/Navigation.js +1594 -0
  119. package/dist/esm/neo-components/Paper.js +243 -0
  120. package/dist/esm/neo-components/Stack.js +182 -0
  121. package/dist/esm/neo-components/Stepper.js +278 -0
  122. package/dist/esm/neo-components/Text.js +277 -0
  123. package/dist/esm/neo-components/ThemeProvider.js +718 -0
  124. package/dist/esm/neo-components/ToggleButton.js +214 -0
  125. package/dist/esm/neo-components/createTheme.js +297 -0
  126. package/dist/esm/neo-components/withSx.js +160 -0
  127. package/dist/esm/neo-utils/sxToStyle.js +502 -0
  128. package/package.json +19 -15
@@ -0,0 +1,1594 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React, { useContext, useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect, createContext } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import { withSx } from './withSx.js';
7
+ import { useTheme } from './ThemeProvider.js';
8
+
9
+ const _excluded = ["open", "onClose", "anchorEl", "anchorOrigin", "transformOrigin", "children", "MenuListProps", "PaperProps", "disablePortal", "keepMounted", "autoFocus", "style"],
10
+ _excluded2 = ["selected", "disabled", "dense", "divider", "onClick", "children", "style"],
11
+ _excluded3 = ["value", "onChange", "children", "variant", "orientation", "centered", "textColor", "indicatorColor", "scrollButtons", "TabIndicatorProps", "style"],
12
+ _excluded4 = ["label", "value", "icon", "iconPosition", "disabled", "selected", "onClick", "textColor", "fullWidth", "wrapped", "disableRipple", "style"],
13
+ _excluded5 = ["severity", "variant", "color", "icon", "action", "onClose", "children", "style"],
14
+ _excluded6 = ["children", "style"],
15
+ _excluded7 = ["open", "onClose", "autoHideDuration", "message", "action", "anchorOrigin", "resumeHideDuration", "disableWindowBlurListener", "TransitionComponent", "transitionDuration", "children", "style"],
16
+ _excluded8 = ["open", "onClose", "anchorEl", "anchorOrigin", "transformOrigin", "anchorPosition", "anchorReference", "marginThreshold", "children", "PaperProps", "TransitionComponent", "transitionDuration", "disablePortal", "keepMounted", "onClick", "style"],
17
+ _excluded9 = ["open", "onClose", "anchor", "variant", "elevation", "hideBackdrop", "ModalProps", "PaperProps", "SlideProps", "transitionDuration", "children", "style"],
18
+ _excluded10 = ["children", "title", "placement", "arrow", "enterDelay", "leaveDelay", "disableHoverListener", "disableFocusListener", "disableTouchListener", "open", "onOpen", "onClose", "componentsProps", "slotProps", "PopperProps"],
19
+ _excluded11 = ["orientation", "variant", "flexItem", "light", "textAlign", "children", "component", "style"];
20
+
21
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
+
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
+
25
+ const canUseDOM = () => typeof window !== 'undefined' && typeof document !== 'undefined'; // Use useLayoutEffect only on client, useEffect on server
26
+
27
+
28
+ const useIsomorphicLayoutEffect = canUseDOM() ? useLayoutEffect : useEffect;
29
+ /**
30
+ * Context to detect if we're inside a Popover
31
+ */
32
+
33
+ const PopoverContext = /*#__PURE__*/createContext(false);
34
+ /**
35
+ * Context to track nested overlay elements (modals opened from popovers, etc.)
36
+ * This allows click-outside detection to ignore clicks on nested overlays
37
+ */
38
+
39
+ const OverlayStackContext = /*#__PURE__*/createContext({
40
+ registerOverlay: () => () => {},
41
+ isClickInsideOverlay: () => false
42
+ });
43
+ /**
44
+ * Hook to register an overlay element with the stack
45
+ */
46
+
47
+ const useOverlayStack = () => useContext(OverlayStackContext);
48
+ /**
49
+ * Resolve a theme color path like "grey7.real" to actual hex value
50
+ */
51
+
52
+ function resolveThemeColor(value, colors) {
53
+ if (typeof value !== "string") return value;
54
+ if (!value.includes(".")) return value;
55
+ if (value.startsWith("#") || value.startsWith("rgb") || value.startsWith("hsl")) return value;
56
+ if (value.startsWith("url(") || value.startsWith("http")) return value;
57
+ if (value.includes("px") || value.includes("%") || value.includes("rem") || value.includes("em")) return value;
58
+ const parts = value.split(".");
59
+ let result = colors;
60
+
61
+ for (const part of parts) {
62
+ if (result && typeof result === "object" && part in result) {
63
+ result = result[part];
64
+ } else {
65
+ return value; // Path not found, return original
66
+ }
67
+ }
68
+
69
+ return typeof result === "string" ? result : value;
70
+ }
71
+ /**
72
+ * Recursively resolve all theme color references in a style/sx object
73
+ */
74
+
75
+
76
+ function resolveStyleColors(style, colors) {
77
+ if (!style || typeof style !== "object") return style;
78
+ if (Array.isArray(style)) return style.map(s => resolveStyleColors(s, colors));
79
+ const result = {};
80
+
81
+ for (const [key, value] of Object.entries(style)) {
82
+ if (typeof value === "function") {
83
+ result[key] = value;
84
+ } else if (typeof value === "object" && value !== null) {
85
+ result[key] = resolveStyleColors(value, colors);
86
+ } else if (typeof value === "string") {
87
+ result[key] = resolveThemeColor(value, colors);
88
+ } else {
89
+ result[key] = value;
90
+ }
91
+ }
92
+
93
+ return result;
94
+ }
95
+ /**
96
+ * Helper function to check if a click target is inside a NESTED overlay/portal
97
+ * (i.e., a modal opened from within a popover)
98
+ * This should NOT detect the popover itself, only higher-level overlays like modals
99
+ */
100
+
101
+
102
+ function isClickInsideAnyOverlay(target, excludeElement) {
103
+ if (!canUseDOM()) return false;
104
+ let element = target;
105
+
106
+ while (element && element !== document.body) {
107
+ // Skip if this is the element we're checking from (the popover itself)
108
+ if (excludeElement && excludeElement.contains(element)) {
109
+ element = element.parentElement;
110
+ continue;
111
+ } // Check for role="dialog" or role="alertdialog" (modals - these are HIGHER than popovers)
112
+
113
+
114
+ const role = element.getAttribute("role");
115
+
116
+ if (role === "dialog" || role === "alertdialog") {
117
+ return true;
118
+ } // Check for data attributes commonly used for modals/overlays
119
+
120
+
121
+ if (element.hasAttribute("data-modal") || element.hasAttribute("data-overlay") || element.hasAttribute("data-radix-portal") || element.classList.contains("modal") || element.classList.contains("MuiModal-root") || element.classList.contains("MuiDialog-root")) {
122
+ return true;
123
+ } // Check for high z-index elements - but only ABOVE popover level (1400+)
124
+
125
+
126
+ const style = window.getComputedStyle(element);
127
+ const zIndex = parseInt(style.zIndex, 10);
128
+
129
+ if (zIndex >= 1400) {
130
+ return true;
131
+ }
132
+
133
+ element = element.parentElement;
134
+ }
135
+
136
+ return false;
137
+ }
138
+ /**
139
+ * Menu - Dropdown menu (replaces MUI Menu)
140
+ *
141
+ * When used standalone: creates its own portal and handles positioning
142
+ * When used inside Popover: just renders the menu list (no portal, no positioning)
143
+ */
144
+
145
+
146
+ const BaseMenu = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
147
+ let {
148
+ open,
149
+ onClose,
150
+ anchorEl,
151
+ anchorOrigin = {
152
+ vertical: "bottom",
153
+ horizontal: "left"
154
+ },
155
+ transformOrigin = {
156
+ vertical: "top",
157
+ horizontal: "left"
158
+ },
159
+ children,
160
+ MenuListProps = {},
161
+ PaperProps = {},
162
+ disablePortal = false,
163
+ keepMounted = false,
164
+ autoFocus = true,
165
+ style
166
+ } = _ref2,
167
+ props = _objectWithoutProperties(_ref2, _excluded);
168
+
169
+ const isInsidePopover = useContext(PopoverContext);
170
+ const {
171
+ colors
172
+ } = useTheme();
173
+ const menuRef = useRef(null);
174
+ const [position, setPosition] = useState({
175
+ top: 0,
176
+ left: 0
177
+ });
178
+ const [mounted, setMounted] = useState(false);
179
+ const {
180
+ registerOverlay,
181
+ isClickInsideOverlay
182
+ } = useOverlayStack(); // SSR safety
183
+
184
+ useEffect(() => {
185
+ setMounted(true);
186
+ }, []); // Combine refs
187
+
188
+ const combinedRef = useCallback(node => {
189
+ menuRef.current = node;
190
+
191
+ if (typeof ref === "function") {
192
+ ref(node);
193
+ } else if (ref) {
194
+ ref.current = node;
195
+ }
196
+ }, [ref]); // Register this menu with the overlay stack
197
+
198
+ useEffect(() => {
199
+ if (open && menuRef.current) {
200
+ return registerOverlay(menuRef.current);
201
+ }
202
+ }, [open, registerOverlay]); // Resolve PaperProps.sx colors
203
+
204
+ const resolvedPaperStyle = useMemo(() => {
205
+ const sxStyles = PaperProps.sx ? resolveStyleColors(PaperProps.sx, colors) : {};
206
+ return _objectSpread(_objectSpread({}, sxStyles), PaperProps.style);
207
+ }, [PaperProps.sx, PaperProps.style, colors]); // Calculate position (only when standalone)
208
+
209
+ useIsomorphicLayoutEffect(() => {
210
+ if (!canUseDOM() || isInsidePopover || !open || !anchorEl) return; // Safety check - make sure anchorEl is a valid DOM element
211
+
212
+ if (!(anchorEl instanceof Element)) return;
213
+ const rect = anchorEl.getBoundingClientRect();
214
+ const menuEl = menuRef.current;
215
+ let top = rect.bottom;
216
+ let left = rect.left; // Anchor origin
217
+
218
+ if (anchorOrigin.vertical === "top") top = rect.top;
219
+ if (anchorOrigin.vertical === "center") top = rect.top + rect.height / 2;
220
+ if (anchorOrigin.horizontal === "right") left = rect.right;
221
+ if (anchorOrigin.horizontal === "center") left = rect.left + rect.width / 2; // Transform origin adjustments
222
+
223
+ if (menuEl) {
224
+ const menuRect = menuEl.getBoundingClientRect();
225
+ if (transformOrigin.vertical === "bottom") top -= menuRect.height;
226
+ if (transformOrigin.vertical === "center") top -= menuRect.height / 2;
227
+ if (transformOrigin.horizontal === "right") left -= menuRect.width;
228
+ if (transformOrigin.horizontal === "center") left -= menuRect.width / 2; // Keep within viewport
229
+
230
+ const padding = 16;
231
+ const viewportWidth = window.innerWidth;
232
+ const viewportHeight = window.innerHeight;
233
+
234
+ if (left + menuRect.width > viewportWidth - padding) {
235
+ left = viewportWidth - menuRect.width - padding;
236
+ }
237
+
238
+ if (left < padding) left = padding;
239
+
240
+ if (top + menuRect.height > viewportHeight - padding) {
241
+ top = viewportHeight - menuRect.height - padding;
242
+ }
243
+
244
+ if (top < padding) top = padding;
245
+ } // Only update if position actually changed to prevent infinite loops
246
+
247
+
248
+ setPosition(prev => {
249
+ if (prev.top === top && prev.left === left) return prev;
250
+ return {
251
+ top,
252
+ left
253
+ };
254
+ });
255
+ }, [open, anchorEl, anchorOrigin, transformOrigin, isInsidePopover]); // Click outside and escape handling (only when standalone)
256
+
257
+ useEffect(() => {
258
+ if (!canUseDOM() || isInsidePopover || !open) return;
259
+
260
+ const handleClickOutside = e => {
261
+ // Don't close if clicking inside the menu itself
262
+ if (menuRef.current && menuRef.current.contains(e.target)) {
263
+ return;
264
+ } // Don't close if clicking on the anchor element
265
+
266
+
267
+ if (anchorEl && anchorEl.contains(e.target)) {
268
+ return;
269
+ } // Don't close if clicking inside any registered overlay (like modals)
270
+
271
+
272
+ if (isClickInsideOverlay(e.target)) {
273
+ return;
274
+ } // Don't close if clicking inside any overlay/portal (fallback check)
275
+ // Pass the menu element to exclude it from the check
276
+
277
+
278
+ if (isClickInsideAnyOverlay(e.target, menuRef.current)) {
279
+ return;
280
+ }
281
+
282
+ onClose === null || onClose === void 0 ? void 0 : onClose(e, "backdropClick");
283
+ };
284
+
285
+ const handleEscape = e => {
286
+ if (e.key === "Escape") {
287
+ onClose === null || onClose === void 0 ? void 0 : onClose(e, "escapeKeyDown");
288
+ }
289
+ }; // Delay to prevent immediate close from the click that opened it
290
+
291
+
292
+ const timer = setTimeout(() => {
293
+ document.addEventListener("mousedown", handleClickOutside);
294
+ document.addEventListener("keydown", handleEscape);
295
+ }, 0);
296
+ return () => {
297
+ clearTimeout(timer);
298
+ document.removeEventListener("mousedown", handleClickOutside);
299
+ document.removeEventListener("keydown", handleEscape);
300
+ };
301
+ }, [open, onClose, anchorEl, isInsidePopover, isClickInsideOverlay]); // Focus first item on open
302
+
303
+ useEffect(() => {
304
+ if (!canUseDOM() || !open || !autoFocus || !menuRef.current) return;
305
+ const firstItem = menuRef.current.querySelector('[role="menuitem"]:not([aria-disabled="true"])');
306
+ if (firstItem) firstItem.focus();
307
+ }, [open, autoFocus]);
308
+ if (!open && !keepMounted) return null;
309
+
310
+ const listStyle = _objectSpread({
311
+ listStyle: "none",
312
+ margin: 0
313
+ }, MenuListProps.style); // When inside a Popover, just render the menu list directly
314
+
315
+
316
+ if (isInsidePopover) {
317
+ return /*#__PURE__*/React.createElement("div", _extends({
318
+ ref: combinedRef,
319
+ role: "menu",
320
+ style: resolvedPaperStyle
321
+ }, props), /*#__PURE__*/React.createElement("ul", _extends({
322
+ style: listStyle
323
+ }, MenuListProps), children));
324
+ } // Standalone mode - create portal with positioning
325
+
326
+
327
+ const menuStyle = _objectSpread(_objectSpread(_objectSpread({
328
+ position: "fixed",
329
+ top: position.top,
330
+ left: position.left,
331
+ zIndex: 1300,
332
+ borderRadius: "4px",
333
+ boxShadow: "0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)",
334
+ minWidth: "120px",
335
+ maxHeight: "300px",
336
+ overflowY: "auto",
337
+ outline: 0,
338
+ opacity: open ? 1 : 0,
339
+ visibility: open ? "visible" : "hidden",
340
+ transform: open ? "scale(1)" : "scale(0.75)",
341
+ transformOrigin: "".concat(transformOrigin.horizontal, " ").concat(transformOrigin.vertical),
342
+ transition: "opacity 200ms, transform 200ms"
343
+ }, resolvedPaperStyle), style), {}, {
344
+ backgroundColor: "#2C3233" // Use dark theme color
345
+
346
+ });
347
+
348
+ const content = /*#__PURE__*/React.createElement("div", _extends({
349
+ ref: combinedRef,
350
+ style: menuStyle,
351
+ role: "menu"
352
+ }, props), /*#__PURE__*/React.createElement("ul", _extends({
353
+ style: listStyle
354
+ }, MenuListProps), children));
355
+ if (disablePortal) return content; // SSR safety - don't render portal until mounted
356
+
357
+ if (!mounted) return null;
358
+ return /*#__PURE__*/createPortal(content, document.body);
359
+ });
360
+ BaseMenu.displayName = "BaseMenu";
361
+ const Menu = withSx(BaseMenu);
362
+ /**
363
+ * MenuItem - Menu item (replaces MUI MenuItem)
364
+ */
365
+
366
+ const BaseMenuItem = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
367
+ var _colors$text, _colors$white;
368
+
369
+ let {
370
+ selected = false,
371
+ disabled = false,
372
+ dense = false,
373
+ divider = false,
374
+ onClick,
375
+ children,
376
+ style
377
+ } = _ref3,
378
+ props = _objectWithoutProperties(_ref3, _excluded2);
379
+
380
+ const [isHovered, setIsHovered] = useState(false);
381
+ const {
382
+ colors
383
+ } = useTheme();
384
+
385
+ const itemStyle = _objectSpread(_objectSpread(_objectSpread({
386
+ display: "flex",
387
+ alignItems: "center",
388
+ padding: dense ? "4px 16px" : "6px 16px",
389
+ minHeight: dense ? "32px" : "48px",
390
+ cursor: disabled ? "default" : "pointer",
391
+ backgroundColor: selected ? (colors === null || colors === void 0 ? void 0 : colors.selectedBackground) || "rgba(255, 255, 255, 0.12)" // Light overlay for dark bg
392
+ : isHovered ? "rgba(255, 255, 255, 0.08)" // Light overlay for dark bg
393
+ : "transparent",
394
+ transition: "background-color 150ms",
395
+ outline: "none",
396
+ border: "none",
397
+ width: "100%",
398
+ textAlign: "left",
399
+ font: "inherit",
400
+ color: (colors === null || colors === void 0 ? void 0 : (_colors$text = colors.text) === null || _colors$text === void 0 ? void 0 : _colors$text.primary) || (colors === null || colors === void 0 ? void 0 : (_colors$white = colors.white) === null || _colors$white === void 0 ? void 0 : _colors$white.main) || "#fff",
401
+ // White text for dark bg
402
+ overflow: "hidden",
403
+ textOverflow: "ellipsis",
404
+ whiteSpace: "nowrap"
405
+ }, disabled && {
406
+ opacity: 0.5,
407
+ pointerEvents: "none"
408
+ }), divider && {
409
+ borderBottom: "1px solid ".concat((colors === null || colors === void 0 ? void 0 : colors.borderColor) || "rgba(255, 255, 255, 0.12)")
410
+ }), style);
411
+
412
+ return /*#__PURE__*/React.createElement("li", _extends({
413
+ ref: ref,
414
+ role: "menuitem",
415
+ tabIndex: disabled ? -1 : 0,
416
+ style: itemStyle,
417
+ onClick: disabled ? undefined : onClick,
418
+ onMouseEnter: () => setIsHovered(true),
419
+ onMouseLeave: () => setIsHovered(false),
420
+ "aria-disabled": disabled
421
+ }, props), children);
422
+ });
423
+ BaseMenuItem.displayName = "BaseMenuItem";
424
+ const MenuItem = withSx(BaseMenuItem);
425
+ /**
426
+ * Tabs - Tab container (replaces MUI Tabs)
427
+ */
428
+
429
+ const BaseTabs = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
430
+ let {
431
+ value,
432
+ onChange,
433
+ children,
434
+ variant = "standard",
435
+ orientation = "horizontal",
436
+ centered = false,
437
+ textColor = "primary",
438
+ indicatorColor = "transparent",
439
+ scrollButtons = "auto",
440
+ TabIndicatorProps = {},
441
+ style
442
+ } = _ref4,
443
+ props = _objectWithoutProperties(_ref4, _excluded3);
444
+
445
+ const {
446
+ colors
447
+ } = useTheme();
448
+ const tabsRef = useRef(null);
449
+ const [indicatorStyle, setIndicatorStyle] = useState({});
450
+ const colorValue = (colors === null || colors === void 0 ? void 0 : colors[indicatorColor]) || (colors === null || colors === void 0 ? void 0 : colors.ibisRed);
451
+ typeof colorValue === "object" ? colorValue.main : colorValue || "ibisRed.main"; // Update indicator position
452
+
453
+ useIsomorphicLayoutEffect(() => {
454
+ if (!canUseDOM() || !tabsRef.current) return;
455
+ const tabs = tabsRef.current.querySelectorAll('[role="tab"]');
456
+ const selectedTab = Array.from(tabs).find((tab, index) => {
457
+ const tabValue = tab.dataset.value !== undefined ? tab.dataset.value : index;
458
+ return String(value) === String(tabValue);
459
+ });
460
+
461
+ if (selectedTab) {
462
+ const tabRect = selectedTab.getBoundingClientRect();
463
+ const containerRect = tabsRef.current.getBoundingClientRect();
464
+
465
+ if (orientation === "horizontal") {
466
+ setIndicatorStyle({
467
+ left: tabRect.left - containerRect.left,
468
+ width: tabRect.width,
469
+ height: 2,
470
+ bottom: 0
471
+ });
472
+ } else {
473
+ setIndicatorStyle({
474
+ top: tabRect.top - containerRect.top,
475
+ height: tabRect.height,
476
+ width: 2,
477
+ right: 0
478
+ });
479
+ }
480
+ }
481
+ }, [value, orientation, children]);
482
+
483
+ const containerStyle = _objectSpread({
484
+ display: "flex",
485
+ flexDirection: orientation === "horizontal" ? "column" : "row"
486
+ }, style);
487
+
488
+ const tabsListStyle = _objectSpread(_objectSpread(_objectSpread({
489
+ display: "flex",
490
+ flexDirection: orientation === "horizontal" ? "row" : "column",
491
+ position: "relative"
492
+ }, centered && {
493
+ justifyContent: "center"
494
+ }), variant === "fullWidth" && {
495
+ width: "100%"
496
+ }), {}, {
497
+ borderRight: orientation === "vertical" ? "1px solid ".concat((colors === null || colors === void 0 ? void 0 : colors.borderColor) || "rgba(0, 0, 0, 0.12)") : "none",
498
+ overflow: variant === "scrollable" ? "auto" : "visible"
499
+ });
500
+
501
+ const indicatorBaseStyle = _objectSpread(_objectSpread({
502
+ position: "absolute",
503
+ transition: "all 300ms cubic-bezier(0.4, 0, 0.2, 1)"
504
+ }, indicatorStyle), TabIndicatorProps.style); // Clone children to pass selected state
505
+
506
+
507
+ const childArray = React.Children.toArray(children);
508
+ const tabs = childArray.map((child, index) => {
509
+ if (! /*#__PURE__*/React.isValidElement(child)) return child;
510
+ const tabValue = child.props.value !== undefined ? child.props.value : index;
511
+ return /*#__PURE__*/React.cloneElement(child, {
512
+ key: tabValue,
513
+ selected: value === tabValue,
514
+ "data-value": tabValue,
515
+ onClick: e => {
516
+ var _child$props$onClick, _child$props;
517
+
518
+ onChange === null || onChange === void 0 ? void 0 : onChange(e, tabValue);
519
+ (_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 ? void 0 : _child$props$onClick.call(_child$props, e);
520
+ },
521
+ textColor,
522
+ fullWidth: variant === "fullWidth"
523
+ });
524
+ });
525
+ return /*#__PURE__*/React.createElement("div", _extends({
526
+ ref: ref,
527
+ style: containerStyle
528
+ }, props), /*#__PURE__*/React.createElement("div", {
529
+ ref: tabsRef,
530
+ style: tabsListStyle,
531
+ role: "tablist"
532
+ }, tabs, /*#__PURE__*/React.createElement("span", _extends({
533
+ style: indicatorBaseStyle
534
+ }, TabIndicatorProps))));
535
+ });
536
+ BaseTabs.displayName = "BaseTabs";
537
+ const Tabs = withSx(BaseTabs);
538
+ /**
539
+ * Tab - Individual tab (replaces MUI Tab)
540
+ */
541
+
542
+ const BaseTab = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
543
+ let {
544
+ label,
545
+ value,
546
+ icon,
547
+ iconPosition = "top",
548
+ disabled = false,
549
+ selected = false,
550
+ onClick,
551
+ textColor = "primary",
552
+ fullWidth = false,
553
+ wrapped = false,
554
+ disableRipple = false,
555
+ style
556
+ } = _ref5,
557
+ props = _objectWithoutProperties(_ref5, _excluded4);
558
+
559
+ const {
560
+ colors
561
+ } = useTheme();
562
+ const [isHovered, setIsHovered] = useState(false);
563
+ const colorValue = (colors === null || colors === void 0 ? void 0 : colors[textColor]) || (colors === null || colors === void 0 ? void 0 : colors.primary);
564
+ const mainColor = typeof colorValue === "object" ? colorValue.main : colorValue || "#7C4DFF";
565
+
566
+ const tabStyle = _objectSpread(_objectSpread(_objectSpread({
567
+ display: "inline-flex",
568
+ alignItems: "center",
569
+ justifyContent: "center",
570
+ flexDirection: iconPosition === "top" || iconPosition === "bottom" ? "column" : "row",
571
+ gap: "8px",
572
+ padding: "12px 16px",
573
+ minWidth: "90px",
574
+ minHeight: "48px",
575
+ textTransform: "uppercase",
576
+ fontSize: "0.875rem",
577
+ fontWeight: 500,
578
+ fontFamily: "inherit",
579
+ letterSpacing: "0.02857em",
580
+ color: selected ? mainColor : (colors === null || colors === void 0 ? void 0 : colors.secondaryText) || "rgba(0, 0, 0, 0.6)",
581
+ backgroundColor: isHovered && !disabled ? "rgba(0, 0, 0, 0.04)" : "transparent",
582
+ border: "none",
583
+ cursor: disabled ? "default" : "pointer",
584
+ transition: "color 250ms, background-color 250ms",
585
+ whiteSpace: wrapped ? "normal" : "nowrap",
586
+ outline: "none"
587
+ }, fullWidth && {
588
+ flex: 1
589
+ }), disabled && {
590
+ opacity: 0.5,
591
+ pointerEvents: "none"
592
+ }), style);
593
+
594
+ return /*#__PURE__*/React.createElement("button", _extends({
595
+ ref: ref,
596
+ role: "tab",
597
+ "aria-selected": selected,
598
+ "aria-disabled": disabled,
599
+ tabIndex: selected ? 0 : -1,
600
+ style: tabStyle,
601
+ onClick: disabled ? undefined : onClick,
602
+ onMouseEnter: () => setIsHovered(true),
603
+ onMouseLeave: () => setIsHovered(false)
604
+ }, props), (iconPosition === "top" || iconPosition === "start") && icon, label, (iconPosition === "bottom" || iconPosition === "end") && icon);
605
+ });
606
+ BaseTab.displayName = "BaseTab";
607
+ const Tab = withSx(BaseTab);
608
+ /**
609
+ * Alert - Alert message (replaces MUI Alert)
610
+ */
611
+
612
+ const BaseAlert = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
613
+ var _colors$error, _colors$warning, _colors$info, _colors$success;
614
+
615
+ let {
616
+ severity = "info",
617
+ variant = "standard",
618
+ color,
619
+ icon,
620
+ action,
621
+ onClose,
622
+ children,
623
+ style
624
+ } = _ref6,
625
+ props = _objectWithoutProperties(_ref6, _excluded5);
626
+
627
+ const {
628
+ colors
629
+ } = useTheme();
630
+ const severityColors = {
631
+ error: {
632
+ main: (colors === null || colors === void 0 ? void 0 : (_colors$error = colors.error) === null || _colors$error === void 0 ? void 0 : _colors$error.main) || colors.ibisRed,
633
+ light: "#FFD7E0",
634
+ dark: colors.ibisRedDark
635
+ },
636
+ warning: {
637
+ main: (colors === null || colors === void 0 ? void 0 : (_colors$warning = colors.warning) === null || _colors$warning === void 0 ? void 0 : _colors$warning.main) || colors.popnYellow,
638
+ light: "#FFF8B0",
639
+ dark: "#B38F00"
640
+ },
641
+ info: {
642
+ main: (colors === null || colors === void 0 ? void 0 : (_colors$info = colors.info) === null || _colors$info === void 0 ? void 0 : _colors$info.main) || colors.buntingBlue,
643
+ light: "#B3E0FF",
644
+ dark: "#1A7CCC"
645
+ },
646
+ success: {
647
+ main: (colors === null || colors === void 0 ? void 0 : (_colors$success = colors.success) === null || _colors$success === void 0 ? void 0 : _colors$success.main) || colors.seafoam,
648
+ light: "#B3FFF5",
649
+ dark: colors.seafoamDark
650
+ }
651
+ };
652
+ const colorSet = severityColors[color] || severityColors[severity] || severityColors.info;
653
+ const severityIcons = {
654
+ error: "✕",
655
+ warning: "⚠",
656
+ info: "ℹ",
657
+ success: "✓"
658
+ };
659
+
660
+ const alertStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
661
+ display: "flex",
662
+ alignItems: "flex-start",
663
+ padding: "6px 16px",
664
+ borderRadius: "4px",
665
+ fontSize: "0.875rem"
666
+ }, variant === "standard" && {
667
+ backgroundColor: colorSet.light,
668
+ color: colorSet.dark
669
+ }), variant === "filled" && {
670
+ backgroundColor: colorSet.main,
671
+ color: "#fff"
672
+ }), variant === "outlined" && {
673
+ backgroundColor: "transparent",
674
+ border: "1px solid ".concat(colorSet.main),
675
+ color: colorSet.dark
676
+ }), style);
677
+
678
+ const iconStyle = {
679
+ marginRight: "12px",
680
+ paddingTop: "8px",
681
+ fontSize: "1.25rem",
682
+ display: "flex",
683
+ alignItems: "center",
684
+ color: variant === "standard" ? colorSet.main : "inherit"
685
+ };
686
+ const contentStyle = {
687
+ flex: 1,
688
+ padding: "8px 0",
689
+ minWidth: 0
690
+ };
691
+ const actionStyle = {
692
+ marginLeft: "auto",
693
+ paddingLeft: "16px",
694
+ marginRight: "-8px",
695
+ display: "flex",
696
+ alignItems: "flex-start",
697
+ paddingTop: "4px"
698
+ };
699
+ return /*#__PURE__*/React.createElement("div", _extends({
700
+ ref: ref,
701
+ role: "alert",
702
+ style: alertStyle
703
+ }, props), icon !== false && /*#__PURE__*/React.createElement("span", {
704
+ style: iconStyle
705
+ }, icon || severityIcons[severity]), /*#__PURE__*/React.createElement("div", {
706
+ style: contentStyle
707
+ }, children), (action || onClose) && /*#__PURE__*/React.createElement("div", {
708
+ style: actionStyle
709
+ }, action, onClose && /*#__PURE__*/React.createElement("button", {
710
+ onClick: onClose,
711
+ "aria-label": "Close",
712
+ style: {
713
+ background: "none",
714
+ border: "none",
715
+ cursor: "pointer",
716
+ padding: "4px",
717
+ color: "inherit",
718
+ display: "flex",
719
+ alignItems: "center",
720
+ justifyContent: "center",
721
+ borderRadius: "50%"
722
+ }
723
+ }, "\u2715")));
724
+ });
725
+ BaseAlert.displayName = "BaseAlert";
726
+ const Alert = withSx(BaseAlert);
727
+ /**
728
+ * AlertTitle - Title for Alert (replaces MUI AlertTitle)
729
+ */
730
+
731
+ const AlertTitle = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
732
+ let {
733
+ children,
734
+ style
735
+ } = _ref7,
736
+ props = _objectWithoutProperties(_ref7, _excluded6);
737
+
738
+ return /*#__PURE__*/React.createElement("div", _extends({
739
+ ref: ref,
740
+ style: _objectSpread({
741
+ fontWeight: 500,
742
+ marginTop: "-2px",
743
+ marginBottom: "4px"
744
+ }, style)
745
+ }, props), children);
746
+ });
747
+ AlertTitle.displayName = "AlertTitle";
748
+ /**
749
+ * Snackbar - Toast notification (replaces MUI Snackbar)
750
+ */
751
+
752
+ const BaseSnackbar = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
753
+ var _colors$grey;
754
+
755
+ let {
756
+ open,
757
+ onClose,
758
+ autoHideDuration,
759
+ message,
760
+ action,
761
+ anchorOrigin = {
762
+ vertical: "bottom",
763
+ horizontal: "left"
764
+ },
765
+ resumeHideDuration,
766
+ disableWindowBlurListener = false,
767
+ TransitionComponent,
768
+ transitionDuration = 225,
769
+ children,
770
+ style
771
+ } = _ref8,
772
+ props = _objectWithoutProperties(_ref8, _excluded7);
773
+
774
+ const timerRef = useRef(null);
775
+ const {
776
+ colors
777
+ } = useTheme();
778
+ const [mounted, setMounted] = useState(false); // SSR safety
779
+
780
+ useEffect(() => {
781
+ setMounted(true);
782
+ }, []);
783
+ const startTimer = useCallback(() => {
784
+ if (autoHideDuration != null) {
785
+ timerRef.current = setTimeout(() => {
786
+ onClose === null || onClose === void 0 ? void 0 : onClose({}, "timeout");
787
+ }, autoHideDuration);
788
+ }
789
+ }, [autoHideDuration, onClose]);
790
+ const stopTimer = useCallback(() => {
791
+ if (timerRef.current) {
792
+ clearTimeout(timerRef.current);
793
+ timerRef.current = null;
794
+ }
795
+ }, []);
796
+ useEffect(() => {
797
+ if (open) {
798
+ startTimer();
799
+ }
800
+
801
+ return stopTimer;
802
+ }, [open, startTimer, stopTimer]); // Pause timer on window blur
803
+
804
+ useEffect(() => {
805
+ if (!canUseDOM() || disableWindowBlurListener || !open) return;
806
+
807
+ const handleBlur = () => stopTimer();
808
+
809
+ const handleFocus = () => {
810
+ stopTimer();
811
+ startTimer();
812
+ };
813
+
814
+ window.addEventListener("blur", handleBlur);
815
+ window.addEventListener("focus", handleFocus);
816
+ return () => {
817
+ window.removeEventListener("blur", handleBlur);
818
+ window.removeEventListener("focus", handleFocus);
819
+ };
820
+ }, [open, disableWindowBlurListener, startTimer, stopTimer]);
821
+ if (!open) return null; // SSR safety - don't render portal until mounted
822
+
823
+ if (!mounted || !canUseDOM()) return null;
824
+
825
+ const positionStyles = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
826
+ position: "fixed",
827
+ zIndex: 1400,
828
+ display: "flex"
829
+ }, anchorOrigin.vertical === "top" && {
830
+ top: "24px"
831
+ }), anchorOrigin.vertical === "bottom" && {
832
+ bottom: "24px"
833
+ }), anchorOrigin.horizontal === "left" && {
834
+ left: "24px",
835
+ justifyContent: "flex-start"
836
+ }), anchorOrigin.horizontal === "right" && {
837
+ right: "24px",
838
+ justifyContent: "flex-end"
839
+ }), anchorOrigin.horizontal === "center" && {
840
+ left: "50%",
841
+ transform: "translateX(-50%)"
842
+ });
843
+
844
+ const snackbarStyle = _objectSpread(_objectSpread({}, positionStyles), style);
845
+
846
+ const contentStyle = {
847
+ display: "flex",
848
+ alignItems: "center",
849
+ padding: "6px 16px",
850
+ backgroundColor: (colors === null || colors === void 0 ? void 0 : (_colors$grey = colors.grey8) === null || _colors$grey === void 0 ? void 0 : _colors$grey.main) || "#323232",
851
+ color: "#fff",
852
+ borderRadius: "4px",
853
+ boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)",
854
+ minWidth: "288px",
855
+ maxWidth: "568px",
856
+ flexWrap: "wrap"
857
+ };
858
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({
859
+ ref: ref,
860
+ style: snackbarStyle,
861
+ onMouseEnter: stopTimer,
862
+ onMouseLeave: startTimer
863
+ }, props), children || /*#__PURE__*/React.createElement("div", {
864
+ style: contentStyle
865
+ }, /*#__PURE__*/React.createElement("span", {
866
+ style: {
867
+ flex: 1,
868
+ padding: "8px 0"
869
+ }
870
+ }, message), action && /*#__PURE__*/React.createElement("div", {
871
+ style: {
872
+ marginLeft: "auto",
873
+ paddingLeft: "16px"
874
+ }
875
+ }, action))), document.body);
876
+ });
877
+ BaseSnackbar.displayName = "BaseSnackbar";
878
+ const Snackbar = withSx(BaseSnackbar);
879
+ /**
880
+ * Popover - Positioned popup (replaces MUI Popover)
881
+ * Provides PopoverContext so nested Menu components know not to create their own portal
882
+ */
883
+
884
+ const BasePopover = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
885
+ let {
886
+ open,
887
+ onClose,
888
+ anchorEl,
889
+ anchorOrigin = {
890
+ vertical: "bottom",
891
+ horizontal: "left"
892
+ },
893
+ transformOrigin = {
894
+ vertical: "top",
895
+ horizontal: "left"
896
+ },
897
+ anchorPosition,
898
+ anchorReference = "anchorEl",
899
+ marginThreshold = 16,
900
+ children,
901
+ PaperProps = {},
902
+ TransitionComponent,
903
+ transitionDuration = 225,
904
+ disablePortal = false,
905
+ keepMounted = false,
906
+ onClick,
907
+ style
908
+ } = _ref9,
909
+ props = _objectWithoutProperties(_ref9, _excluded8);
910
+
911
+ const {
912
+ colors
913
+ } = useTheme();
914
+ const popoverRef = useRef(null);
915
+ const [position, setPosition] = useState({
916
+ top: 0,
917
+ left: 0
918
+ });
919
+ const [mounted, setMounted] = useState(false);
920
+ const {
921
+ registerOverlay,
922
+ isClickInsideOverlay
923
+ } = useOverlayStack(); // SSR safety
924
+
925
+ useEffect(() => {
926
+ setMounted(true);
927
+ }, []);
928
+ const combinedRef = useCallback(node => {
929
+ popoverRef.current = node;
930
+
931
+ if (typeof ref === "function") {
932
+ ref(node);
933
+ } else if (ref) {
934
+ ref.current = node;
935
+ }
936
+ }, [ref]); // Register this popover with the overlay stack
937
+
938
+ useEffect(() => {
939
+ if (open && popoverRef.current) {
940
+ return registerOverlay(popoverRef.current);
941
+ }
942
+ }, [open, registerOverlay]); // Resolve PaperProps.sx colors
943
+
944
+ const resolvedPaperStyle = useMemo(() => {
945
+ const sxStyles = PaperProps.sx ? resolveStyleColors(PaperProps.sx, colors) : {};
946
+ return _objectSpread(_objectSpread({}, sxStyles), PaperProps.style);
947
+ }, [PaperProps.sx, PaperProps.style, colors]); // Calculate position
948
+
949
+ useIsomorphicLayoutEffect(() => {
950
+ if (!canUseDOM() || !open) return;
951
+ let top = 0;
952
+ let left = 0;
953
+
954
+ if (anchorReference === "anchorPosition" && anchorPosition) {
955
+ top = anchorPosition.top;
956
+ left = anchorPosition.left;
957
+ } else if (anchorEl) {
958
+ // Safety check - make sure anchorEl is a valid DOM element
959
+ if (!(anchorEl instanceof Element)) return;
960
+ const rect = anchorEl.getBoundingClientRect(); // Anchor origin
961
+
962
+ if (anchorOrigin.vertical === "top") top = rect.top;else if (anchorOrigin.vertical === "center") top = rect.top + rect.height / 2;else top = rect.bottom;
963
+ if (anchorOrigin.horizontal === "left") left = rect.left;else if (anchorOrigin.horizontal === "center") left = rect.left + rect.width / 2;else left = rect.right;
964
+ } // Transform origin adjustments
965
+
966
+
967
+ if (popoverRef.current) {
968
+ const popoverRect = popoverRef.current.getBoundingClientRect();
969
+ if (transformOrigin.vertical === "bottom") top -= popoverRect.height;else if (transformOrigin.vertical === "center") top -= popoverRect.height / 2;
970
+ if (transformOrigin.horizontal === "right") left -= popoverRect.width;else if (transformOrigin.horizontal === "center") left -= popoverRect.width / 2; // Keep within viewport
971
+
972
+ const viewportWidth = window.innerWidth;
973
+ const viewportHeight = window.innerHeight;
974
+
975
+ if (left + popoverRect.width > viewportWidth - marginThreshold) {
976
+ left = viewportWidth - popoverRect.width - marginThreshold;
977
+ }
978
+
979
+ if (left < marginThreshold) left = marginThreshold;
980
+
981
+ if (top + popoverRect.height > viewportHeight - marginThreshold) {
982
+ top = viewportHeight - popoverRect.height - marginThreshold;
983
+ }
984
+
985
+ if (top < marginThreshold) top = marginThreshold;
986
+ } // Only update if position actually changed to prevent infinite loops
987
+
988
+
989
+ setPosition(prev => {
990
+ if (prev.top === top && prev.left === left) return prev;
991
+ return {
992
+ top,
993
+ left
994
+ };
995
+ });
996
+ }, [open, anchorEl, anchorOrigin, transformOrigin, anchorPosition, anchorReference, marginThreshold]); // Click outside handling
997
+
998
+ useEffect(() => {
999
+ if (!canUseDOM() || !open) return;
1000
+
1001
+ const handleClickOutside = e => {
1002
+ // Use a small delay to ensure ref is populated after portal render
1003
+ const popoverElement = popoverRef.current; // Don't close if clicking inside the popover itself
1004
+
1005
+ if (popoverElement && popoverElement.contains(e.target)) {
1006
+ return;
1007
+ } // Don't close if clicking on the anchor element
1008
+
1009
+
1010
+ if (anchorEl && anchorEl.contains(e.target)) {
1011
+ return;
1012
+ } // Don't close if clicking inside any registered overlay (like modals)
1013
+
1014
+
1015
+ if (isClickInsideOverlay(e.target)) {
1016
+ return;
1017
+ } // Don't close if clicking inside any overlay/portal (fallback check)
1018
+
1019
+
1020
+ if (isClickInsideAnyOverlay(e.target, popoverElement)) {
1021
+ return;
1022
+ }
1023
+
1024
+ onClose === null || onClose === void 0 ? void 0 : onClose(e, "backdropClick");
1025
+ };
1026
+
1027
+ const handleEscape = e => {
1028
+ if (e.key === "Escape") {
1029
+ onClose === null || onClose === void 0 ? void 0 : onClose(e, "escapeKeyDown");
1030
+ }
1031
+ }; // Use 'click' instead of 'mousedown' and add listener on next tick
1032
+ // This prevents the click that opened the popover from immediately closing it
1033
+
1034
+
1035
+ const timer = setTimeout(() => {
1036
+ document.addEventListener("click", handleClickOutside, true); // Use capture phase
1037
+
1038
+ document.addEventListener("keydown", handleEscape);
1039
+ }, 10); // Small delay to ensure portal is rendered and ref is set
1040
+
1041
+ return () => {
1042
+ clearTimeout(timer);
1043
+ document.removeEventListener("click", handleClickOutside, true);
1044
+ document.removeEventListener("keydown", handleEscape);
1045
+ };
1046
+ }, [open, onClose, anchorEl, isClickInsideOverlay]);
1047
+ if (!open && !keepMounted) return null;
1048
+
1049
+ const popoverStyle = _objectSpread(_objectSpread({
1050
+ position: "fixed",
1051
+ top: position.top,
1052
+ left: position.left,
1053
+ zIndex: 1300,
1054
+ backgroundColor: (colors === null || colors === void 0 ? void 0 : colors.flyoutBackground) || "#fff",
1055
+ borderRadius: "4px",
1056
+ boxShadow: "0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)",
1057
+ outline: 0,
1058
+ opacity: open ? 1 : 0,
1059
+ visibility: open ? "visible" : "hidden",
1060
+ transform: open ? "scale(1)" : "scale(0.75)",
1061
+ transformOrigin: "".concat(transformOrigin.horizontal, " ").concat(transformOrigin.vertical),
1062
+ transition: "opacity ".concat(transitionDuration, "ms, transform ").concat(transitionDuration, "ms")
1063
+ }, resolvedPaperStyle), style);
1064
+
1065
+ const content = /*#__PURE__*/React.createElement(PopoverContext.Provider, {
1066
+ value: true
1067
+ }, /*#__PURE__*/React.createElement("div", _extends({
1068
+ ref: combinedRef,
1069
+ style: popoverStyle,
1070
+ onClick: onClick
1071
+ }, props), children));
1072
+ if (disablePortal) return content; // SSR safety - don't render portal until mounted
1073
+
1074
+ if (!mounted) return null;
1075
+ return /*#__PURE__*/createPortal(content, document.body);
1076
+ });
1077
+ BasePopover.displayName = "BasePopover";
1078
+ const Popover = withSx(BasePopover);
1079
+ /**
1080
+ * Drawer - Slide-out panel (replaces MUI Drawer)
1081
+ */
1082
+
1083
+ const BaseDrawer = /*#__PURE__*/React.forwardRef((_ref10, ref) => {
1084
+ var _PaperProps$style, _PaperProps$style2, _ModalProps$BackdropP;
1085
+
1086
+ let {
1087
+ open,
1088
+ onClose,
1089
+ anchor = "left",
1090
+ variant = "temporary",
1091
+ elevation = 16,
1092
+ hideBackdrop = false,
1093
+ ModalProps = {},
1094
+ PaperProps = {},
1095
+ SlideProps = {},
1096
+ transitionDuration = 225,
1097
+ children,
1098
+ style
1099
+ } = _ref10,
1100
+ props = _objectWithoutProperties(_ref10, _excluded9);
1101
+
1102
+ const {
1103
+ colors
1104
+ } = useTheme();
1105
+ const [isVisible, setIsVisible] = useState(open);
1106
+ const [mounted, setMounted] = useState(false);
1107
+ const {
1108
+ registerOverlay
1109
+ } = useOverlayStack();
1110
+ const drawerRef = useRef(null); // SSR safety
1111
+
1112
+ useEffect(() => {
1113
+ setMounted(true);
1114
+ }, []); // Resolve PaperProps.sx colors
1115
+
1116
+ const resolvedPaperStyle = useMemo(() => {
1117
+ const sxStyles = PaperProps.sx ? resolveStyleColors(PaperProps.sx, colors) : {};
1118
+ return _objectSpread(_objectSpread({}, sxStyles), PaperProps.style);
1119
+ }, [PaperProps.sx, PaperProps.style, colors]); // Register this drawer with the overlay stack
1120
+
1121
+ useEffect(() => {
1122
+ if (open && drawerRef.current) {
1123
+ return registerOverlay(drawerRef.current);
1124
+ }
1125
+ }, [open, registerOverlay]); // Handle visibility for transitions
1126
+
1127
+ useEffect(() => {
1128
+ if (open) {
1129
+ setIsVisible(true);
1130
+ } else {
1131
+ const timer = setTimeout(() => setIsVisible(false), transitionDuration);
1132
+ return () => clearTimeout(timer);
1133
+ }
1134
+ }, [open, transitionDuration]); // Lock body scroll for temporary drawers
1135
+
1136
+ useEffect(() => {
1137
+ if (!canUseDOM() || !open || variant !== "temporary") return;
1138
+ const originalOverflow = document.body.style.overflow;
1139
+ document.body.style.overflow = "hidden";
1140
+ return () => {
1141
+ document.body.style.overflow = originalOverflow;
1142
+ };
1143
+ }, [open, variant]);
1144
+ const drawerWidth = (resolvedPaperStyle === null || resolvedPaperStyle === void 0 ? void 0 : resolvedPaperStyle.width) || ((_PaperProps$style = PaperProps.style) === null || _PaperProps$style === void 0 ? void 0 : _PaperProps$style.width) || "240px";
1145
+ const drawerHeight = (resolvedPaperStyle === null || resolvedPaperStyle === void 0 ? void 0 : resolvedPaperStyle.height) || ((_PaperProps$style2 = PaperProps.style) === null || _PaperProps$style2 === void 0 ? void 0 : _PaperProps$style2.height) || "auto";
1146
+
1147
+ const getTransform = isOpen => {
1148
+ if (isOpen) return "translate(0, 0)";
1149
+
1150
+ switch (anchor) {
1151
+ case "left":
1152
+ return "translateX(-100%)";
1153
+
1154
+ case "right":
1155
+ return "translateX(100%)";
1156
+
1157
+ case "top":
1158
+ return "translateY(-100%)";
1159
+
1160
+ case "bottom":
1161
+ return "translateY(100%)";
1162
+
1163
+ default:
1164
+ return "translateX(-100%)";
1165
+ }
1166
+ };
1167
+
1168
+ const paperStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
1169
+ position: "fixed",
1170
+ zIndex: variant === "temporary" ? 1200 : 1100,
1171
+ backgroundColor: (colors === null || colors === void 0 ? void 0 : colors.flyoutBackground) || "#fff",
1172
+ boxShadow: variant === "temporary" ? "0px 8px 10px -5px rgba(0,0,0,0.2), 0px 16px 24px 2px rgba(0,0,0,0.14), 0px 6px 30px 5px rgba(0,0,0,0.12)" : "none",
1173
+ overflowY: "auto",
1174
+ display: "flex",
1175
+ flexDirection: "column",
1176
+ transform: getTransform(open),
1177
+ transition: "transform ".concat(transitionDuration, "ms cubic-bezier(0, 0, 0.2, 1)")
1178
+ }, anchor === "left" && {
1179
+ top: 0,
1180
+ left: 0,
1181
+ bottom: 0,
1182
+ width: drawerWidth
1183
+ }), anchor === "right" && {
1184
+ top: 0,
1185
+ right: 0,
1186
+ bottom: 0,
1187
+ width: drawerWidth
1188
+ }), anchor === "top" && {
1189
+ top: 0,
1190
+ left: 0,
1191
+ right: 0,
1192
+ height: drawerHeight
1193
+ }), anchor === "bottom" && {
1194
+ bottom: 0,
1195
+ left: 0,
1196
+ right: 0,
1197
+ height: drawerHeight
1198
+ }), resolvedPaperStyle); // Permanent drawer - always visible, no backdrop
1199
+
1200
+
1201
+ if (variant === "permanent") {
1202
+ return /*#__PURE__*/React.createElement("div", _extends({
1203
+ ref: node => {
1204
+ drawerRef.current = node;
1205
+ if (typeof ref === "function") ref(node);else if (ref) ref.current = node;
1206
+ },
1207
+ style: _objectSpread(_objectSpread({}, paperStyle), {}, {
1208
+ position: "relative",
1209
+ transform: "none"
1210
+ })
1211
+ }, props), children);
1212
+ } // Persistent drawer - can be toggled, no backdrop
1213
+
1214
+
1215
+ if (variant === "persistent") {
1216
+ if (!isVisible && !open) return null;
1217
+ return /*#__PURE__*/React.createElement("div", _extends({
1218
+ ref: node => {
1219
+ drawerRef.current = node;
1220
+ if (typeof ref === "function") ref(node);else if (ref) ref.current = node;
1221
+ },
1222
+ style: paperStyle
1223
+ }, props), children);
1224
+ } // Temporary drawer - with backdrop
1225
+
1226
+
1227
+ if (!isVisible && !open) return null; // SSR safety - don't render portal until mounted
1228
+
1229
+ if (!mounted || !canUseDOM()) return null;
1230
+
1231
+ const backdropStyle = _objectSpread({
1232
+ position: "fixed",
1233
+ inset: 0,
1234
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1235
+ zIndex: 1199,
1236
+ opacity: open ? 1 : 0,
1237
+ visibility: open ? "visible" : "hidden",
1238
+ transition: "opacity ".concat(transitionDuration, "ms")
1239
+ }, (_ModalProps$BackdropP = ModalProps.BackdropProps) === null || _ModalProps$BackdropP === void 0 ? void 0 : _ModalProps$BackdropP.style);
1240
+
1241
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({
1242
+ style: {
1243
+ position: "fixed",
1244
+ inset: 0,
1245
+ zIndex: 1200
1246
+ }
1247
+ }, props), !hideBackdrop && /*#__PURE__*/React.createElement("div", {
1248
+ style: backdropStyle,
1249
+ onClick: onClose,
1250
+ "aria-hidden": "true"
1251
+ }), /*#__PURE__*/React.createElement("div", {
1252
+ ref: node => {
1253
+ drawerRef.current = node;
1254
+ if (typeof ref === "function") ref(node);else if (ref) ref.current = node;
1255
+ },
1256
+ style: paperStyle
1257
+ }, children)), document.body);
1258
+ });
1259
+ BaseDrawer.displayName = "BaseDrawer";
1260
+ const Drawer = withSx(BaseDrawer);
1261
+ /**
1262
+ * Tooltip - Informative text on hover (replaces MUI Tooltip)
1263
+ */
1264
+
1265
+ const BaseTooltip = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
1266
+ let {
1267
+ children,
1268
+ title,
1269
+ placement = "bottom",
1270
+ arrow = false,
1271
+ enterDelay = 100,
1272
+ leaveDelay = 0,
1273
+ disableHoverListener = false,
1274
+ disableFocusListener = false,
1275
+ disableTouchListener = false,
1276
+ open: controlledOpen,
1277
+ onOpen,
1278
+ onClose,
1279
+ componentsProps = {},
1280
+ slotProps = {},
1281
+ PopperProps = {}
1282
+ } = _ref11;
1283
+ _objectWithoutProperties(_ref11, _excluded10);
1284
+
1285
+ const {
1286
+ colors
1287
+ } = useTheme();
1288
+ const [isOpen, setIsOpen] = useState(false);
1289
+ const [position, setPosition] = useState({
1290
+ top: 0,
1291
+ left: 0
1292
+ });
1293
+ const [mounted, setMounted] = useState(false);
1294
+ const anchorRef = useRef(null);
1295
+ const tooltipRef = useRef(null);
1296
+ const enterTimeoutRef = useRef(null);
1297
+ const leaveTimeoutRef = useRef(null);
1298
+ const open = controlledOpen !== undefined ? controlledOpen : isOpen; // SSR safety
1299
+
1300
+ useEffect(() => {
1301
+ setMounted(true);
1302
+ }, []); // Merge slotProps and componentsProps
1303
+
1304
+ const mergedSlotProps = _objectSpread(_objectSpread({}, componentsProps), slotProps); // Resolve tooltip styles
1305
+
1306
+
1307
+ const tooltipStyle = useMemo(() => {
1308
+ const baseStyle = {
1309
+ position: "fixed",
1310
+ zIndex: 1500,
1311
+ pointerEvents: "none",
1312
+ backgroundColor: "rgba(97, 97, 97, 0.92)",
1313
+ borderRadius: "4px",
1314
+ color: "#fff",
1315
+ fontFamily: "inherit",
1316
+ padding: "4px 8px",
1317
+ fontSize: "11px",
1318
+ maxWidth: "300px",
1319
+ wordWrap: "break-word",
1320
+ fontWeight: 500
1321
+ };
1322
+ const tooltipSlotProps = mergedSlotProps.tooltip || {};
1323
+ const resolvedSx = tooltipSlotProps.sx ? resolveStyleColors(tooltipSlotProps.sx, colors) : {};
1324
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, baseStyle), resolvedSx), tooltipSlotProps.style), {}, {
1325
+ top: position.top,
1326
+ left: position.left,
1327
+ backgroundColor: "rgba(97, 97, 97, 0.92)"
1328
+ });
1329
+ }, [position, mergedSlotProps, colors]); // Resolve popper styles
1330
+
1331
+ const popperStyle = useMemo(() => {
1332
+ const popperSlotProps = mergedSlotProps.popper || {};
1333
+ const resolvedSx = popperSlotProps.sx ? resolveStyleColors(popperSlotProps.sx, colors) : {};
1334
+ const popperPropsSx = PopperProps.sx ? resolveStyleColors(PopperProps.sx, colors) : {};
1335
+ return _objectSpread(_objectSpread(_objectSpread({}, resolvedSx), popperSlotProps.style), popperPropsSx);
1336
+ }, [mergedSlotProps, PopperProps, colors]);
1337
+ const updatePosition = useCallback(() => {
1338
+ if (!canUseDOM() || !anchorRef.current || !tooltipRef.current) return;
1339
+ const anchorRect = anchorRef.current.getBoundingClientRect();
1340
+ const tooltipRect = tooltipRef.current.getBoundingClientRect();
1341
+ const offset = 8;
1342
+ let top = 0;
1343
+ let left = 0;
1344
+
1345
+ switch (placement) {
1346
+ case "top":
1347
+ top = anchorRect.top - tooltipRect.height - offset;
1348
+ left = anchorRect.left + (anchorRect.width - tooltipRect.width) / 2;
1349
+ break;
1350
+
1351
+ case "top-start":
1352
+ top = anchorRect.top - tooltipRect.height - offset;
1353
+ left = anchorRect.left;
1354
+ break;
1355
+
1356
+ case "top-end":
1357
+ top = anchorRect.top - tooltipRect.height - offset;
1358
+ left = anchorRect.right - tooltipRect.width;
1359
+ break;
1360
+
1361
+ case "bottom":
1362
+ top = anchorRect.bottom + offset;
1363
+ left = anchorRect.left + (anchorRect.width - tooltipRect.width) / 2;
1364
+ break;
1365
+
1366
+ case "bottom-start":
1367
+ top = anchorRect.bottom + offset;
1368
+ left = anchorRect.left;
1369
+ break;
1370
+
1371
+ case "bottom-end":
1372
+ top = anchorRect.bottom + offset;
1373
+ left = anchorRect.right - tooltipRect.width;
1374
+ break;
1375
+
1376
+ case "left":
1377
+ top = anchorRect.top + (anchorRect.height - tooltipRect.height) / 2;
1378
+ left = anchorRect.left - tooltipRect.width - offset;
1379
+ break;
1380
+
1381
+ case "left-start":
1382
+ top = anchorRect.top;
1383
+ left = anchorRect.left - tooltipRect.width - offset;
1384
+ break;
1385
+
1386
+ case "left-end":
1387
+ top = anchorRect.bottom - tooltipRect.height;
1388
+ left = anchorRect.left - tooltipRect.width - offset;
1389
+ break;
1390
+
1391
+ case "right":
1392
+ top = anchorRect.top + (anchorRect.height - tooltipRect.height) / 2;
1393
+ left = anchorRect.right + offset;
1394
+ break;
1395
+
1396
+ case "right-start":
1397
+ top = anchorRect.top;
1398
+ left = anchorRect.right + offset;
1399
+ break;
1400
+
1401
+ case "right-end":
1402
+ top = anchorRect.bottom - tooltipRect.height;
1403
+ left = anchorRect.right + offset;
1404
+ break;
1405
+
1406
+ default:
1407
+ top = anchorRect.bottom + offset;
1408
+ left = anchorRect.left + (anchorRect.width - tooltipRect.width) / 2;
1409
+ }
1410
+
1411
+ setPosition({
1412
+ top,
1413
+ left
1414
+ });
1415
+ }, [placement]);
1416
+ useEffect(() => {
1417
+ if (open) {
1418
+ requestAnimationFrame(updatePosition);
1419
+ }
1420
+ }, [open, updatePosition]);
1421
+ const handleOpen = useCallback(event => {
1422
+ clearTimeout(leaveTimeoutRef.current);
1423
+ enterTimeoutRef.current = setTimeout(() => {
1424
+ setIsOpen(true);
1425
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen(event);
1426
+ }, enterDelay);
1427
+ }, [enterDelay, onOpen]);
1428
+ const handleClose = useCallback(event => {
1429
+ clearTimeout(enterTimeoutRef.current);
1430
+ leaveTimeoutRef.current = setTimeout(() => {
1431
+ setIsOpen(false);
1432
+ onClose === null || onClose === void 0 ? void 0 : onClose(event);
1433
+ }, leaveDelay);
1434
+ }, [leaveDelay, onClose]);
1435
+ useEffect(() => {
1436
+ return () => {
1437
+ clearTimeout(enterTimeoutRef.current);
1438
+ clearTimeout(leaveTimeoutRef.current);
1439
+ };
1440
+ }, []); // Clone child and attach event handlers
1441
+
1442
+ const childElement = React.Children.only(children);
1443
+ const childProps = {
1444
+ ref: node => {
1445
+ anchorRef.current = node;
1446
+ const childRef = childElement.ref;
1447
+ if (typeof childRef === "function") childRef(node);else if (childRef) childRef.current = node;
1448
+ }
1449
+ };
1450
+
1451
+ if (!disableHoverListener) {
1452
+ childProps.onMouseEnter = e => {
1453
+ var _childElement$props$o, _childElement$props;
1454
+
1455
+ handleOpen(e);
1456
+ (_childElement$props$o = (_childElement$props = childElement.props).onMouseEnter) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
1457
+ };
1458
+
1459
+ childProps.onMouseLeave = e => {
1460
+ var _childElement$props$o2, _childElement$props2;
1461
+
1462
+ handleClose(e);
1463
+ (_childElement$props$o2 = (_childElement$props2 = childElement.props).onMouseLeave) === null || _childElement$props$o2 === void 0 ? void 0 : _childElement$props$o2.call(_childElement$props2, e);
1464
+ };
1465
+ }
1466
+
1467
+ if (!disableFocusListener) {
1468
+ childProps.onFocus = e => {
1469
+ var _childElement$props$o3, _childElement$props3;
1470
+
1471
+ handleOpen(e);
1472
+ (_childElement$props$o3 = (_childElement$props3 = childElement.props).onFocus) === null || _childElement$props$o3 === void 0 ? void 0 : _childElement$props$o3.call(_childElement$props3, e);
1473
+ };
1474
+
1475
+ childProps.onBlur = e => {
1476
+ var _childElement$props$o4, _childElement$props4;
1477
+
1478
+ handleClose(e);
1479
+ (_childElement$props$o4 = (_childElement$props4 = childElement.props).onBlur) === null || _childElement$props$o4 === void 0 ? void 0 : _childElement$props$o4.call(_childElement$props4, e);
1480
+ };
1481
+ }
1482
+
1483
+ const clonedChild = /*#__PURE__*/React.cloneElement(childElement, childProps);
1484
+ if (!title) return clonedChild; // SSR safety - don't render portal until mounted
1485
+
1486
+ const tooltipContent = open && mounted && canUseDOM() ? /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
1487
+ ref: tooltipRef,
1488
+ role: "tooltip",
1489
+ style: _objectSpread(_objectSpread({}, tooltipStyle), popperStyle)
1490
+ }, title), document.body) : null;
1491
+ return /*#__PURE__*/React.createElement(React.Fragment, null, clonedChild, tooltipContent);
1492
+ });
1493
+ BaseTooltip.displayName = "BaseTooltip";
1494
+ withSx(BaseTooltip);
1495
+ /**
1496
+ * Divider - Visual separator (replaces MUI Divider)
1497
+ */
1498
+
1499
+ const BaseDivider = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
1500
+ let {
1501
+ orientation = "horizontal",
1502
+ variant = "fullWidth",
1503
+ flexItem = false,
1504
+ light = false,
1505
+ textAlign = "center",
1506
+ children,
1507
+ component,
1508
+ style
1509
+ } = _ref12,
1510
+ props = _objectWithoutProperties(_ref12, _excluded11);
1511
+
1512
+ const {
1513
+ colors
1514
+ } = useTheme();
1515
+ const hasChildren = !!children;
1516
+ const Component = component || (hasChildren ? "div" : "hr");
1517
+ const borderColor = light ? "rgba(0, 0, 0, 0.08)" : (colors === null || colors === void 0 ? void 0 : colors.borderColor) || "rgba(0, 0, 0, 0.12)";
1518
+ const dividerStyle = useMemo(() => {
1519
+ const isHorizontal = orientation === "horizontal";
1520
+ const baseStyle = {
1521
+ margin: 0,
1522
+ flexShrink: 0,
1523
+ borderWidth: 0,
1524
+ borderStyle: "solid",
1525
+ borderColor: borderColor
1526
+ };
1527
+
1528
+ if (isHorizontal) {
1529
+ baseStyle.borderBottomWidth = "thin";
1530
+ baseStyle.width = "100%";
1531
+
1532
+ if (variant === "inset") {
1533
+ baseStyle.marginLeft = "72px";
1534
+ } else if (variant === "middle") {
1535
+ baseStyle.marginLeft = "16px";
1536
+ baseStyle.marginRight = "16px";
1537
+ }
1538
+ } else {
1539
+ baseStyle.height = "100%";
1540
+ baseStyle.borderRightWidth = "thin";
1541
+
1542
+ if (variant === "middle") {
1543
+ baseStyle.marginTop = "8px";
1544
+ baseStyle.marginBottom = "8px";
1545
+ }
1546
+ }
1547
+
1548
+ if (flexItem) {
1549
+ baseStyle.alignSelf = "stretch";
1550
+ baseStyle.height = "auto";
1551
+ }
1552
+
1553
+ if (hasChildren) {
1554
+ baseStyle.display = "flex";
1555
+ baseStyle.alignItems = "center";
1556
+ baseStyle.textAlign = textAlign;
1557
+ baseStyle.borderWidth = 0;
1558
+ }
1559
+
1560
+ return _objectSpread(_objectSpread({}, baseStyle), style);
1561
+ }, [orientation, variant, flexItem, light, hasChildren, textAlign, style, borderColor]);
1562
+
1563
+ if (hasChildren) {
1564
+ const lineStyle = {
1565
+ flex: 1,
1566
+ borderTop: "thin solid ".concat(borderColor)
1567
+ };
1568
+ return /*#__PURE__*/React.createElement(Component, _extends({
1569
+ ref: ref,
1570
+ style: dividerStyle,
1571
+ role: "separator"
1572
+ }, props), textAlign !== "right" && /*#__PURE__*/React.createElement("span", {
1573
+ style: lineStyle
1574
+ }), /*#__PURE__*/React.createElement("span", {
1575
+ style: {
1576
+ padding: "0 8px",
1577
+ display: "inline-block"
1578
+ }
1579
+ }, children), textAlign !== "left" && /*#__PURE__*/React.createElement("span", {
1580
+ style: lineStyle
1581
+ }));
1582
+ }
1583
+
1584
+ return /*#__PURE__*/React.createElement(Component, _extends({
1585
+ ref: ref,
1586
+ style: dividerStyle,
1587
+ role: "separator",
1588
+ "aria-orientation": orientation
1589
+ }, props));
1590
+ });
1591
+ BaseDivider.displayName = "BaseDivider";
1592
+ withSx(BaseDivider); // Export the context for advanced use cases
1593
+
1594
+ export { Alert, AlertTitle, Drawer, Menu, MenuItem, OverlayStackContext, Popover, PopoverContext, Snackbar, Tab, Tabs, useOverlayStack };