@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.
- 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 +280 -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 +493 -0
- package/dist/cjs/neo-components/Layout.js +1213 -0
- package/dist/cjs/neo-components/Misc.js +858 -0
- package/dist/cjs/neo-components/Navigation.js +1578 -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 +164 -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 +269 -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 +478 -0
- package/dist/esm/neo-components/Layout.js +1179 -0
- package/dist/esm/neo-components/Misc.js +840 -0
- package/dist/esm/neo-components/Navigation.js +1556 -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 +153 -0
- package/dist/esm/neo-utils/sxToStyle.js +502 -0
- package/package.json +19 -15
|
@@ -0,0 +1,441 @@
|
|
|
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
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
15
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
17
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
|
|
19
|
+
const _excluded = ["open", "invisible", "children", "onClick", "style"],
|
|
20
|
+
_excluded2 = ["open", "onClose", "children", "disableEscapeKeyDown", "disableBackdropClick", "disableEnforceFocus", "disableAutoFocus", "disableRestoreFocus", "disablePortal", "hideBackdrop", "keepMounted", "BackdropProps", "container", "style"],
|
|
21
|
+
_excluded3 = ["open", "onClose", "maxWidth", "fullWidth", "fullScreen", "scroll", "children", "PaperProps", "TransitionProps", "disablePortal", "style"],
|
|
22
|
+
_excluded4 = ["children", "component", "style"],
|
|
23
|
+
_excluded5 = ["dividers", "children", "style"],
|
|
24
|
+
_excluded6 = ["children", "style"],
|
|
25
|
+
_excluded7 = ["disableSpacing", "children", "style"];
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
/**
|
|
31
|
+
* Backdrop - Overlay behind modals (replaces MUI Backdrop)
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const BaseBackdrop = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
35
|
+
let {
|
|
36
|
+
open,
|
|
37
|
+
invisible = false,
|
|
38
|
+
children,
|
|
39
|
+
onClick,
|
|
40
|
+
style
|
|
41
|
+
} = _ref,
|
|
42
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
43
|
+
|
|
44
|
+
if (!open) return null;
|
|
45
|
+
|
|
46
|
+
const backdropStyle = _objectSpread({
|
|
47
|
+
position: "fixed",
|
|
48
|
+
display: "flex",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
inset: 0,
|
|
52
|
+
backgroundColor: invisible ? "transparent" : "rgba(0, 0, 0, 0.5)",
|
|
53
|
+
zIndex: -1,
|
|
54
|
+
WebkitTapHighlightColor: "transparent"
|
|
55
|
+
}, style);
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
58
|
+
ref: ref,
|
|
59
|
+
style: backdropStyle,
|
|
60
|
+
onClick: onClick
|
|
61
|
+
}, props), children);
|
|
62
|
+
});
|
|
63
|
+
BaseBackdrop.displayName = "BaseBackdrop";
|
|
64
|
+
const Backdrop = withSx.withSx(BaseBackdrop);
|
|
65
|
+
/**
|
|
66
|
+
* Get all focusable elements within a container
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
const getFocusableElements = container => {
|
|
70
|
+
const focusableSelectors = ['a[href]', 'button:not([disabled])', 'textarea:not([disabled])', 'input:not([disabled])', 'select:not([disabled])', '[tabindex]:not([tabindex="-1"])'].join(', ');
|
|
71
|
+
return Array.from(container.querySelectorAll(focusableSelectors)).filter(el => el.offsetParent !== null);
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Modal - Base modal component (replaces MUI Modal)
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
const BaseModal = /*#__PURE__*/React__default["default"].forwardRef((_ref2, ref) => {
|
|
79
|
+
let {
|
|
80
|
+
open,
|
|
81
|
+
onClose,
|
|
82
|
+
children,
|
|
83
|
+
disableEscapeKeyDown = false,
|
|
84
|
+
disableBackdropClick = false,
|
|
85
|
+
disableEnforceFocus = false,
|
|
86
|
+
disableAutoFocus = false,
|
|
87
|
+
disableRestoreFocus = false,
|
|
88
|
+
disablePortal = false,
|
|
89
|
+
hideBackdrop = false,
|
|
90
|
+
keepMounted = false,
|
|
91
|
+
BackdropProps = {},
|
|
92
|
+
container,
|
|
93
|
+
style
|
|
94
|
+
} = _ref2,
|
|
95
|
+
props = _objectWithoutProperties__default["default"](_ref2, _excluded2);
|
|
96
|
+
|
|
97
|
+
const modalRef = React.useRef(null);
|
|
98
|
+
const previousActiveElement = React.useRef(null);
|
|
99
|
+
const handleRef = React.useCallback(node => {
|
|
100
|
+
modalRef.current = node;
|
|
101
|
+
|
|
102
|
+
if (typeof ref === 'function') {
|
|
103
|
+
ref(node);
|
|
104
|
+
} else if (ref) {
|
|
105
|
+
ref.current = node;
|
|
106
|
+
}
|
|
107
|
+
}, [ref]);
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
if (open && !disableAutoFocus) {
|
|
110
|
+
previousActiveElement.current = document.activeElement;
|
|
111
|
+
requestAnimationFrame(() => {
|
|
112
|
+
if (modalRef.current) {
|
|
113
|
+
const focusable = getFocusableElements(modalRef.current);
|
|
114
|
+
|
|
115
|
+
if (focusable.length > 0) {
|
|
116
|
+
focusable[0].focus();
|
|
117
|
+
} else {
|
|
118
|
+
modalRef.current.focus();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return () => {
|
|
125
|
+
if (open && !disableRestoreFocus && previousActiveElement.current) {
|
|
126
|
+
var _previousActiveElemen, _previousActiveElemen2;
|
|
127
|
+
|
|
128
|
+
(_previousActiveElemen = (_previousActiveElemen2 = previousActiveElement.current).focus) === null || _previousActiveElemen === void 0 ? void 0 : _previousActiveElemen.call(_previousActiveElemen2);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}, [open, disableAutoFocus, disableRestoreFocus]);
|
|
132
|
+
React.useEffect(() => {
|
|
133
|
+
if (!open || disableEscapeKeyDown) return;
|
|
134
|
+
|
|
135
|
+
const handleKeyDown = event => {
|
|
136
|
+
if (event.key === "Escape") {
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(event, "escapeKeyDown");
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
143
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
144
|
+
}, [open, disableEscapeKeyDown, onClose]);
|
|
145
|
+
React.useEffect(() => {
|
|
146
|
+
if (!open || disableEnforceFocus) return;
|
|
147
|
+
|
|
148
|
+
const handleFocusTrap = event => {
|
|
149
|
+
if (!modalRef.current) return;
|
|
150
|
+
|
|
151
|
+
if (!modalRef.current.contains(event.target)) {
|
|
152
|
+
event.stopPropagation();
|
|
153
|
+
const focusable = getFocusableElements(modalRef.current);
|
|
154
|
+
|
|
155
|
+
if (focusable.length > 0) {
|
|
156
|
+
focusable[0].focus();
|
|
157
|
+
} else {
|
|
158
|
+
modalRef.current.focus();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleKeyDown = event => {
|
|
164
|
+
if (event.key !== 'Tab' || !modalRef.current) return;
|
|
165
|
+
const focusable = getFocusableElements(modalRef.current);
|
|
166
|
+
if (focusable.length === 0) return;
|
|
167
|
+
const firstElement = focusable[0];
|
|
168
|
+
const lastElement = focusable[focusable.length - 1];
|
|
169
|
+
|
|
170
|
+
if (event.shiftKey && document.activeElement === firstElement) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
lastElement.focus();
|
|
173
|
+
} else if (!event.shiftKey && document.activeElement === lastElement) {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
firstElement.focus();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
document.addEventListener("focus", handleFocusTrap, true);
|
|
180
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
181
|
+
return () => {
|
|
182
|
+
document.removeEventListener("focus", handleFocusTrap, true);
|
|
183
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
184
|
+
};
|
|
185
|
+
}, [open, disableEnforceFocus]);
|
|
186
|
+
React.useEffect(() => {
|
|
187
|
+
if (open) {
|
|
188
|
+
const originalOverflow = document.body.style.overflow;
|
|
189
|
+
document.body.style.overflow = "hidden";
|
|
190
|
+
return () => {
|
|
191
|
+
document.body.style.overflow = originalOverflow;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}, [open]); // Handle backdrop click - properly stop propagation for modal content clicks
|
|
195
|
+
|
|
196
|
+
const handleModalClick = React.useCallback(event => {
|
|
197
|
+
// Stop propagation so document-level handlers don't close parent menus
|
|
198
|
+
event.stopPropagation();
|
|
199
|
+
}, []);
|
|
200
|
+
const handleBackdropClick = React.useCallback(event => {
|
|
201
|
+
// Only trigger close if clicking directly on the backdrop, not its children
|
|
202
|
+
if (event.target === event.currentTarget && !disableBackdropClick) {
|
|
203
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(event, "backdropClick");
|
|
204
|
+
}
|
|
205
|
+
}, [disableBackdropClick, onClose]);
|
|
206
|
+
if (!open && !keepMounted) return null;
|
|
207
|
+
|
|
208
|
+
const modalStyle = _objectSpread({
|
|
209
|
+
position: "fixed",
|
|
210
|
+
zIndex: 1300,
|
|
211
|
+
top: 0,
|
|
212
|
+
left: 0,
|
|
213
|
+
right: 0,
|
|
214
|
+
bottom: 0,
|
|
215
|
+
display: open ? "flex" : "none",
|
|
216
|
+
alignItems: "center",
|
|
217
|
+
justifyContent: "center"
|
|
218
|
+
}, style);
|
|
219
|
+
|
|
220
|
+
const backdropStyle = _objectSpread({
|
|
221
|
+
position: "fixed",
|
|
222
|
+
top: 0,
|
|
223
|
+
left: 0,
|
|
224
|
+
right: 0,
|
|
225
|
+
bottom: 0,
|
|
226
|
+
backgroundColor: hideBackdrop ? "transparent" : "rgba(0, 0, 0, 0.5)",
|
|
227
|
+
zIndex: -1
|
|
228
|
+
}, BackdropProps.style);
|
|
229
|
+
|
|
230
|
+
const modalContent = /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
231
|
+
ref: handleRef,
|
|
232
|
+
role: "presentation",
|
|
233
|
+
tabIndex: -1,
|
|
234
|
+
style: modalStyle,
|
|
235
|
+
"data-modal-root": "true",
|
|
236
|
+
"data-modal-disable-portal": disablePortal ? "true" : undefined,
|
|
237
|
+
onClick: handleModalClick,
|
|
238
|
+
onMouseDown: handleModalClick
|
|
239
|
+
}, props), /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
240
|
+
style: backdropStyle,
|
|
241
|
+
"aria-hidden": "true",
|
|
242
|
+
onClick: handleBackdropClick
|
|
243
|
+
}, BackdropProps)), children);
|
|
244
|
+
|
|
245
|
+
if (disablePortal) {
|
|
246
|
+
return modalContent;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return /*#__PURE__*/ReactDOM.createPortal(modalContent, container || document.body);
|
|
250
|
+
});
|
|
251
|
+
BaseModal.displayName = "BaseModal";
|
|
252
|
+
const Modal = withSx.withSx(BaseModal);
|
|
253
|
+
/**
|
|
254
|
+
* Dialog - Modal dialog component (replaces MUI Dialog)
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
const BaseDialog = /*#__PURE__*/React__default["default"].forwardRef((_ref3, ref) => {
|
|
258
|
+
let {
|
|
259
|
+
open,
|
|
260
|
+
onClose,
|
|
261
|
+
maxWidth = "sm",
|
|
262
|
+
fullWidth = false,
|
|
263
|
+
fullScreen = false,
|
|
264
|
+
scroll = "paper",
|
|
265
|
+
children,
|
|
266
|
+
PaperProps = {},
|
|
267
|
+
TransitionProps = {},
|
|
268
|
+
disablePortal = false,
|
|
269
|
+
style
|
|
270
|
+
} = _ref3,
|
|
271
|
+
props = _objectWithoutProperties__default["default"](_ref3, _excluded3);
|
|
272
|
+
|
|
273
|
+
const maxWidthValues = {
|
|
274
|
+
xs: "444px",
|
|
275
|
+
sm: "600px",
|
|
276
|
+
md: "900px",
|
|
277
|
+
lg: "1200px",
|
|
278
|
+
xl: "1536px",
|
|
279
|
+
false: "none"
|
|
280
|
+
};
|
|
281
|
+
const handlePaperClick = React.useCallback(event => {
|
|
282
|
+
// Prevent clicks inside the dialog from closing it
|
|
283
|
+
event.stopPropagation();
|
|
284
|
+
}, []);
|
|
285
|
+
|
|
286
|
+
const dialogPaperStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
287
|
+
position: "relative",
|
|
288
|
+
display: "flex",
|
|
289
|
+
flexDirection: "column",
|
|
290
|
+
maxHeight: fullScreen ? "100%" : "calc(100% - 64px)",
|
|
291
|
+
overflowY: scroll === "paper" ? "auto" : "visible",
|
|
292
|
+
backgroundColor: "var(--flyout-background, #fff)",
|
|
293
|
+
color: "var(--body-text, rgba(0, 0, 0, 0.87))",
|
|
294
|
+
borderRadius: fullScreen ? 0 : "8px",
|
|
295
|
+
boxShadow: "0px 11px 15px -7px rgba(0,0,0,0.2), 0px 24px 38px 3px rgba(0,0,0,0.14), 0px 9px 46px 8px rgba(0,0,0,0.12)",
|
|
296
|
+
boxSizing: "border-box",
|
|
297
|
+
isolation: "isolate"
|
|
298
|
+
}, fullScreen && {
|
|
299
|
+
width: "100%",
|
|
300
|
+
height: "100%",
|
|
301
|
+
maxWidth: "none",
|
|
302
|
+
maxHeight: "none"
|
|
303
|
+
}), !fullScreen && fullWidth && {
|
|
304
|
+
width: "calc(100% - 64px)",
|
|
305
|
+
maxWidth: maxWidthValues[maxWidth] || maxWidth
|
|
306
|
+
}), !fullScreen && !fullWidth && {
|
|
307
|
+
width: "fit-content",
|
|
308
|
+
minWidth: "280px",
|
|
309
|
+
maxWidth: maxWidthValues[maxWidth] || maxWidth
|
|
310
|
+
}), PaperProps.style);
|
|
311
|
+
|
|
312
|
+
return /*#__PURE__*/React__default["default"].createElement(Modal, _extends__default["default"]({
|
|
313
|
+
ref: ref,
|
|
314
|
+
open: open,
|
|
315
|
+
onClose: onClose,
|
|
316
|
+
disablePortal: disablePortal,
|
|
317
|
+
style: style
|
|
318
|
+
}, props), /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
319
|
+
role: "dialog",
|
|
320
|
+
"aria-modal": "true",
|
|
321
|
+
style: dialogPaperStyle,
|
|
322
|
+
onClick: handlePaperClick,
|
|
323
|
+
onMouseDown: handlePaperClick
|
|
324
|
+
}, PaperProps), children));
|
|
325
|
+
});
|
|
326
|
+
BaseDialog.displayName = "BaseDialog";
|
|
327
|
+
const Dialog = withSx.withSx(BaseDialog);
|
|
328
|
+
/**
|
|
329
|
+
* DialogTitle - Title for dialogs
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
const DialogTitle = /*#__PURE__*/React__default["default"].forwardRef((_ref4, ref) => {
|
|
333
|
+
let {
|
|
334
|
+
children,
|
|
335
|
+
component: Component = "h2",
|
|
336
|
+
style
|
|
337
|
+
} = _ref4,
|
|
338
|
+
props = _objectWithoutProperties__default["default"](_ref4, _excluded4);
|
|
339
|
+
|
|
340
|
+
const titleStyle = _objectSpread({
|
|
341
|
+
margin: 0,
|
|
342
|
+
padding: "16px 24px",
|
|
343
|
+
fontSize: "1.25rem",
|
|
344
|
+
fontWeight: 500,
|
|
345
|
+
lineHeight: 1.6
|
|
346
|
+
}, style);
|
|
347
|
+
|
|
348
|
+
return /*#__PURE__*/React__default["default"].createElement(Component, _extends__default["default"]({
|
|
349
|
+
ref: ref,
|
|
350
|
+
style: titleStyle
|
|
351
|
+
}, props), children);
|
|
352
|
+
});
|
|
353
|
+
DialogTitle.displayName = "DialogTitle";
|
|
354
|
+
/**
|
|
355
|
+
* DialogContent - Content area for dialogs
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
const DialogContent = /*#__PURE__*/React__default["default"].forwardRef((_ref5, ref) => {
|
|
359
|
+
let {
|
|
360
|
+
dividers = false,
|
|
361
|
+
children,
|
|
362
|
+
style
|
|
363
|
+
} = _ref5,
|
|
364
|
+
props = _objectWithoutProperties__default["default"](_ref5, _excluded5);
|
|
365
|
+
|
|
366
|
+
const contentStyle = _objectSpread(_objectSpread({
|
|
367
|
+
flex: "1 1 auto",
|
|
368
|
+
overflowY: "auto",
|
|
369
|
+
padding: "20px 24px"
|
|
370
|
+
}, dividers && {
|
|
371
|
+
borderTop: "1px solid var(--border-color, rgba(0, 0, 0, 0.12))",
|
|
372
|
+
borderBottom: "1px solid var(--border-color, rgba(0, 0, 0, 0.12))",
|
|
373
|
+
padding: "16px 24px"
|
|
374
|
+
}), style);
|
|
375
|
+
|
|
376
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
377
|
+
ref: ref,
|
|
378
|
+
style: contentStyle
|
|
379
|
+
}, props), children);
|
|
380
|
+
});
|
|
381
|
+
DialogContent.displayName = "DialogContent";
|
|
382
|
+
/**
|
|
383
|
+
* DialogContentText - Text inside dialog content
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
const DialogContentText = /*#__PURE__*/React__default["default"].forwardRef((_ref6, ref) => {
|
|
387
|
+
let {
|
|
388
|
+
children,
|
|
389
|
+
style
|
|
390
|
+
} = _ref6,
|
|
391
|
+
props = _objectWithoutProperties__default["default"](_ref6, _excluded6);
|
|
392
|
+
|
|
393
|
+
const textStyle = _objectSpread({
|
|
394
|
+
margin: 0,
|
|
395
|
+
color: "var(--secondary-text, rgba(0, 0, 0, 0.6))",
|
|
396
|
+
fontSize: "1rem",
|
|
397
|
+
lineHeight: 1.5
|
|
398
|
+
}, style);
|
|
399
|
+
|
|
400
|
+
return /*#__PURE__*/React__default["default"].createElement("p", _extends__default["default"]({
|
|
401
|
+
ref: ref,
|
|
402
|
+
style: textStyle
|
|
403
|
+
}, props), children);
|
|
404
|
+
});
|
|
405
|
+
DialogContentText.displayName = "DialogContentText";
|
|
406
|
+
/**
|
|
407
|
+
* DialogActions - Action buttons for dialogs
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
const DialogActions = /*#__PURE__*/React__default["default"].forwardRef((_ref7, ref) => {
|
|
411
|
+
let {
|
|
412
|
+
disableSpacing = false,
|
|
413
|
+
children,
|
|
414
|
+
style
|
|
415
|
+
} = _ref7,
|
|
416
|
+
props = _objectWithoutProperties__default["default"](_ref7, _excluded7);
|
|
417
|
+
|
|
418
|
+
const actionsStyle = _objectSpread(_objectSpread({
|
|
419
|
+
display: "flex",
|
|
420
|
+
alignItems: "center",
|
|
421
|
+
justifyContent: "flex-end",
|
|
422
|
+
padding: "8px"
|
|
423
|
+
}, !disableSpacing && {
|
|
424
|
+
gap: "8px"
|
|
425
|
+
}), style);
|
|
426
|
+
|
|
427
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
428
|
+
ref: ref,
|
|
429
|
+
style: actionsStyle
|
|
430
|
+
}, props), children);
|
|
431
|
+
});
|
|
432
|
+
DialogActions.displayName = "DialogActions";
|
|
433
|
+
|
|
434
|
+
exports.Backdrop = Backdrop;
|
|
435
|
+
exports.Dialog = Dialog;
|
|
436
|
+
exports.DialogActions = DialogActions;
|
|
437
|
+
exports.DialogContent = DialogContent;
|
|
438
|
+
exports.DialogContentText = DialogContentText;
|
|
439
|
+
exports.DialogTitle = DialogTitle;
|
|
440
|
+
exports.Modal = Modal;
|
|
441
|
+
exports["default"] = Dialog;
|
|
@@ -0,0 +1,237 @@
|
|
|
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 withSx = require('./withSx.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
+
|
|
18
|
+
const _excluded = ["children", "color", "size", "variant", "disabled", "href", "onClick", "className", "style"],
|
|
19
|
+
_excluded2 = ["ariaLabel", "children", "direction", "hidden", "icon", "onClose", "onOpen", "open", "FabProps", "className", "style"],
|
|
20
|
+
_excluded3 = ["icon", "tooltipTitle", "tooltipOpen", "tooltipPlacement", "onClick", "FabProps", "className", "style"];
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
/**
|
|
26
|
+
* Floating Action Button (FAB)
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const FabBase = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
30
|
+
let {
|
|
31
|
+
children,
|
|
32
|
+
color = "primary",
|
|
33
|
+
size = "large",
|
|
34
|
+
variant = "circular",
|
|
35
|
+
disabled = false,
|
|
36
|
+
href,
|
|
37
|
+
onClick,
|
|
38
|
+
className,
|
|
39
|
+
style
|
|
40
|
+
} = _ref,
|
|
41
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
42
|
+
|
|
43
|
+
const sizeStyles = {
|
|
44
|
+
small: {
|
|
45
|
+
width: 40,
|
|
46
|
+
height: 40,
|
|
47
|
+
fontSize: 18
|
|
48
|
+
},
|
|
49
|
+
medium: {
|
|
50
|
+
width: 48,
|
|
51
|
+
height: 48,
|
|
52
|
+
fontSize: 20
|
|
53
|
+
},
|
|
54
|
+
large: {
|
|
55
|
+
width: 56,
|
|
56
|
+
height: 56,
|
|
57
|
+
fontSize: 24
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const colorStyles = {
|
|
61
|
+
primary: {
|
|
62
|
+
backgroundColor: "#7C4DFF",
|
|
63
|
+
color: "#FFFFFF"
|
|
64
|
+
},
|
|
65
|
+
secondary: {
|
|
66
|
+
backgroundColor: "#FF4081",
|
|
67
|
+
color: "#FFFFFF"
|
|
68
|
+
},
|
|
69
|
+
default: {
|
|
70
|
+
backgroundColor: "#E0E0E0",
|
|
71
|
+
color: "#000000"
|
|
72
|
+
},
|
|
73
|
+
inherit: {
|
|
74
|
+
backgroundColor: "inherit",
|
|
75
|
+
color: "inherit"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const baseStyle = _objectSpread(_objectSpread(_objectSpread({
|
|
80
|
+
display: "inline-flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
justifyContent: "center",
|
|
83
|
+
border: "none",
|
|
84
|
+
borderRadius: variant === "extended" ? 24 : "50%",
|
|
85
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
86
|
+
opacity: disabled ? 0.5 : 1,
|
|
87
|
+
boxShadow: "0 3px 5px -1px rgba(0,0,0,0.2), 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12)",
|
|
88
|
+
transition: "background-color 0.2s, box-shadow 0.2s",
|
|
89
|
+
textDecoration: "none",
|
|
90
|
+
padding: variant === "extended" ? "0 16px" : 0,
|
|
91
|
+
minWidth: variant === "extended" ? 48 : undefined
|
|
92
|
+
}, sizeStyles[size]), colorStyles[color]), style);
|
|
93
|
+
|
|
94
|
+
const Component = href ? "a" : "button";
|
|
95
|
+
return /*#__PURE__*/React__default["default"].createElement(Component, _extends__default["default"]({
|
|
96
|
+
ref: ref,
|
|
97
|
+
className: className,
|
|
98
|
+
style: baseStyle,
|
|
99
|
+
disabled: disabled,
|
|
100
|
+
href: href,
|
|
101
|
+
onClick: onClick
|
|
102
|
+
}, props), children);
|
|
103
|
+
});
|
|
104
|
+
FabBase.displayName = "Fab";
|
|
105
|
+
const Fab = withSx.withSx(FabBase);
|
|
106
|
+
/**
|
|
107
|
+
* SpeedDial - FAB that reveals related actions
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
const SpeedDialBase = /*#__PURE__*/React__default["default"].forwardRef((_ref2, ref) => {
|
|
111
|
+
let {
|
|
112
|
+
ariaLabel,
|
|
113
|
+
children,
|
|
114
|
+
direction = "up",
|
|
115
|
+
hidden = false,
|
|
116
|
+
icon,
|
|
117
|
+
onClose,
|
|
118
|
+
onOpen,
|
|
119
|
+
open: controlledOpen,
|
|
120
|
+
FabProps = {},
|
|
121
|
+
className,
|
|
122
|
+
style
|
|
123
|
+
} = _ref2,
|
|
124
|
+
props = _objectWithoutProperties__default["default"](_ref2, _excluded2);
|
|
125
|
+
|
|
126
|
+
const [internalOpen, setInternalOpen] = React__default["default"].useState(false);
|
|
127
|
+
const open = controlledOpen !== undefined ? controlledOpen : internalOpen;
|
|
128
|
+
|
|
129
|
+
const handleToggle = () => {
|
|
130
|
+
if (controlledOpen === undefined) {
|
|
131
|
+
setInternalOpen(!internalOpen);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (open) {
|
|
135
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
136
|
+
} else {
|
|
137
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const directionStyles = {
|
|
142
|
+
up: {
|
|
143
|
+
flexDirection: "column-reverse",
|
|
144
|
+
bottom: 16,
|
|
145
|
+
right: 16
|
|
146
|
+
},
|
|
147
|
+
down: {
|
|
148
|
+
flexDirection: "column",
|
|
149
|
+
top: 16,
|
|
150
|
+
right: 16
|
|
151
|
+
},
|
|
152
|
+
left: {
|
|
153
|
+
flexDirection: "row-reverse",
|
|
154
|
+
bottom: 16,
|
|
155
|
+
right: 16
|
|
156
|
+
},
|
|
157
|
+
right: {
|
|
158
|
+
flexDirection: "row",
|
|
159
|
+
bottom: 16,
|
|
160
|
+
left: 16
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const baseStyle = _objectSpread(_objectSpread({
|
|
165
|
+
position: "fixed",
|
|
166
|
+
display: "flex",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
gap: 8,
|
|
169
|
+
zIndex: 1050,
|
|
170
|
+
visibility: hidden ? "hidden" : "visible"
|
|
171
|
+
}, directionStyles[direction]), style);
|
|
172
|
+
|
|
173
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
174
|
+
ref: ref,
|
|
175
|
+
className: className,
|
|
176
|
+
style: baseStyle
|
|
177
|
+
}, props), /*#__PURE__*/React__default["default"].createElement(Fab, _extends__default["default"]({
|
|
178
|
+
"aria-label": ariaLabel,
|
|
179
|
+
onClick: handleToggle
|
|
180
|
+
}, FabProps), icon), open && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
181
|
+
style: {
|
|
182
|
+
display: "flex",
|
|
183
|
+
flexDirection: directionStyles[direction].flexDirection,
|
|
184
|
+
gap: 8
|
|
185
|
+
}
|
|
186
|
+
}, children));
|
|
187
|
+
});
|
|
188
|
+
SpeedDialBase.displayName = "SpeedDial";
|
|
189
|
+
const SpeedDial = withSx.withSx(SpeedDialBase);
|
|
190
|
+
/**
|
|
191
|
+
* SpeedDialAction - Individual action in SpeedDial
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
const SpeedDialActionBase = /*#__PURE__*/React__default["default"].forwardRef((_ref3, ref) => {
|
|
195
|
+
let {
|
|
196
|
+
icon,
|
|
197
|
+
tooltipTitle,
|
|
198
|
+
tooltipOpen = false,
|
|
199
|
+
tooltipPlacement = "left",
|
|
200
|
+
onClick,
|
|
201
|
+
FabProps = {},
|
|
202
|
+
className,
|
|
203
|
+
style
|
|
204
|
+
} = _ref3,
|
|
205
|
+
props = _objectWithoutProperties__default["default"](_ref3, _excluded3);
|
|
206
|
+
|
|
207
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
|
|
208
|
+
ref: ref,
|
|
209
|
+
className: className,
|
|
210
|
+
style: _objectSpread({
|
|
211
|
+
position: "relative",
|
|
212
|
+
display: "inline-flex",
|
|
213
|
+
alignItems: "center"
|
|
214
|
+
}, style)
|
|
215
|
+
}, props), tooltipOpen && tooltipTitle && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
216
|
+
style: {
|
|
217
|
+
position: "absolute",
|
|
218
|
+
[tooltipPlacement]: "100%",
|
|
219
|
+
marginLeft: tooltipPlacement === "left" ? -8 : 8,
|
|
220
|
+
marginRight: tooltipPlacement === "right" ? -8 : 8,
|
|
221
|
+
backgroundColor: "#616161",
|
|
222
|
+
color: "#fff",
|
|
223
|
+
padding: "4px 8px",
|
|
224
|
+
borderRadius: 4,
|
|
225
|
+
fontSize: 12,
|
|
226
|
+
whiteSpace: "nowrap"
|
|
227
|
+
}
|
|
228
|
+
}, tooltipTitle), /*#__PURE__*/React__default["default"].createElement(Fab, _extends__default["default"]({
|
|
229
|
+
size: "small",
|
|
230
|
+
onClick: onClick
|
|
231
|
+
}, FabProps), icon));
|
|
232
|
+
});
|
|
233
|
+
SpeedDialActionBase.displayName = "SpeedDialAction";
|
|
234
|
+
withSx.withSx(SpeedDialActionBase);
|
|
235
|
+
|
|
236
|
+
exports.Fab = Fab;
|
|
237
|
+
exports.SpeedDial = SpeedDial;
|