@blerp/design 1.3.17 → 1.4.1

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