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