@blerp/design 1.3.16 → 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 +98 -52
- 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 +39 -3
- 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,214 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { withSx } from './withSx.js';
|
|
6
|
+
|
|
7
|
+
const _excluded = ["children", "value", "selected", "disabled", "onChange", "onClick", "color", "size", "fullWidth", "className", "style"],
|
|
8
|
+
_excluded2 = ["children", "value", "onChange", "exclusive", "disabled", "color", "size", "orientation", "fullWidth", "className", "style"];
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
+
/**
|
|
14
|
+
* ToggleButton - button that can be toggled on/off
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const ToggleButtonBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
value,
|
|
21
|
+
selected = false,
|
|
22
|
+
disabled = false,
|
|
23
|
+
onChange,
|
|
24
|
+
onClick,
|
|
25
|
+
color = "standard",
|
|
26
|
+
size = "medium",
|
|
27
|
+
fullWidth = false,
|
|
28
|
+
className,
|
|
29
|
+
style
|
|
30
|
+
} = _ref,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
const sizeStyles = {
|
|
34
|
+
small: {
|
|
35
|
+
padding: "4px 8px",
|
|
36
|
+
fontSize: 13
|
|
37
|
+
},
|
|
38
|
+
medium: {
|
|
39
|
+
padding: "8px 12px",
|
|
40
|
+
fontSize: 14
|
|
41
|
+
},
|
|
42
|
+
large: {
|
|
43
|
+
padding: "12px 16px",
|
|
44
|
+
fontSize: 15
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const colorStyles = {
|
|
48
|
+
standard: {
|
|
49
|
+
default: {
|
|
50
|
+
backgroundColor: "transparent",
|
|
51
|
+
color: "#000000",
|
|
52
|
+
borderColor: "rgba(0, 0, 0, 0.12)"
|
|
53
|
+
},
|
|
54
|
+
selected: {
|
|
55
|
+
backgroundColor: "rgba(0, 0, 0, 0.08)",
|
|
56
|
+
color: "#000000",
|
|
57
|
+
borderColor: "rgba(0, 0, 0, 0.12)"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
primary: {
|
|
61
|
+
default: {
|
|
62
|
+
backgroundColor: "transparent",
|
|
63
|
+
color: "#000000",
|
|
64
|
+
borderColor: "rgba(0, 0, 0, 0.12)"
|
|
65
|
+
},
|
|
66
|
+
selected: {
|
|
67
|
+
backgroundColor: "rgba(124, 77, 255, 0.12)",
|
|
68
|
+
color: "#7C4DFF",
|
|
69
|
+
borderColor: "#7C4DFF"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
secondary: {
|
|
73
|
+
default: {
|
|
74
|
+
backgroundColor: "transparent",
|
|
75
|
+
color: "#000000",
|
|
76
|
+
borderColor: "rgba(0, 0, 0, 0.12)"
|
|
77
|
+
},
|
|
78
|
+
selected: {
|
|
79
|
+
backgroundColor: "rgba(255, 64, 129, 0.12)",
|
|
80
|
+
color: "#FF4081",
|
|
81
|
+
borderColor: "#FF4081"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const currentColorStyle = colorStyles[color] || colorStyles.standard; // Explicitly compute these based on selected boolean to force re-render
|
|
86
|
+
|
|
87
|
+
const backgroundColor = selected ? currentColorStyle.selected.backgroundColor : currentColorStyle.default.backgroundColor;
|
|
88
|
+
const textColor = selected ? currentColorStyle.selected.color : currentColorStyle.default.color;
|
|
89
|
+
const borderColorValue = selected ? currentColorStyle.selected.borderColor : currentColorStyle.default.borderColor;
|
|
90
|
+
|
|
91
|
+
const baseStyle = _objectSpread(_objectSpread(_objectSpread({
|
|
92
|
+
display: "inline-flex",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
justifyContent: "center",
|
|
95
|
+
border: "1px solid",
|
|
96
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
97
|
+
opacity: disabled ? 0.5 : 1,
|
|
98
|
+
transition: "background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out",
|
|
99
|
+
textTransform: "uppercase",
|
|
100
|
+
fontWeight: 500,
|
|
101
|
+
fontFamily: "inherit",
|
|
102
|
+
width: fullWidth ? "100%" : undefined,
|
|
103
|
+
outline: "none"
|
|
104
|
+
}, sizeStyles[size]), style), {}, {
|
|
105
|
+
// These MUST be last to override any style prop
|
|
106
|
+
backgroundColor,
|
|
107
|
+
color: textColor,
|
|
108
|
+
borderColor: borderColorValue
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const handleClick = event => {
|
|
112
|
+
if (disabled) return; // Blur to clear any focus state that might be holding onto styles
|
|
113
|
+
|
|
114
|
+
event.currentTarget.blur();
|
|
115
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event, value);
|
|
116
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
120
|
+
ref: ref,
|
|
121
|
+
className: className,
|
|
122
|
+
style: baseStyle,
|
|
123
|
+
disabled: disabled,
|
|
124
|
+
onClick: handleClick,
|
|
125
|
+
"aria-pressed": selected,
|
|
126
|
+
type: "button"
|
|
127
|
+
}, props), children);
|
|
128
|
+
});
|
|
129
|
+
ToggleButtonBase.displayName = "ToggleButton";
|
|
130
|
+
withSx(ToggleButtonBase);
|
|
131
|
+
/**
|
|
132
|
+
* ToggleButtonGroup - group of toggle buttons
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
const ToggleButtonGroupBase = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
136
|
+
let {
|
|
137
|
+
children,
|
|
138
|
+
value,
|
|
139
|
+
onChange,
|
|
140
|
+
exclusive = false,
|
|
141
|
+
disabled = false,
|
|
142
|
+
color = "standard",
|
|
143
|
+
size = "medium",
|
|
144
|
+
orientation = "horizontal",
|
|
145
|
+
fullWidth = false,
|
|
146
|
+
className,
|
|
147
|
+
style
|
|
148
|
+
} = _ref2,
|
|
149
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
150
|
+
|
|
151
|
+
const baseStyle = _objectSpread({
|
|
152
|
+
display: "inline-flex",
|
|
153
|
+
flexDirection: orientation === "vertical" ? "column" : "row",
|
|
154
|
+
borderRadius: 4
|
|
155
|
+
}, style);
|
|
156
|
+
|
|
157
|
+
const handleChange = (event, buttonValue) => {
|
|
158
|
+
if (exclusive) {
|
|
159
|
+
// Single selection - toggle off if same value clicked
|
|
160
|
+
const newValue = value === buttonValue ? null : buttonValue;
|
|
161
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, newValue);
|
|
162
|
+
} else {
|
|
163
|
+
// Multiple selection
|
|
164
|
+
const currentValue = Array.isArray(value) ? value : [];
|
|
165
|
+
const newValue = currentValue.includes(buttonValue) ? currentValue.filter(v => v !== buttonValue) : [...currentValue, buttonValue];
|
|
166
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, newValue);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const isSelected = buttonValue => {
|
|
171
|
+
if (exclusive) {
|
|
172
|
+
return value === buttonValue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return Array.isArray(value) && value.includes(buttonValue);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
179
|
+
ref: ref,
|
|
180
|
+
className: className,
|
|
181
|
+
style: baseStyle,
|
|
182
|
+
role: "group"
|
|
183
|
+
}, props), React.Children.map(children, (child, index) => {
|
|
184
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
185
|
+
const isFirst = index === 0;
|
|
186
|
+
const isLast = index === React.Children.count(children) - 1;
|
|
187
|
+
const borderRadiusStyle = orientation === "horizontal" ? {
|
|
188
|
+
borderRadius: 0,
|
|
189
|
+
borderTopLeftRadius: isFirst ? 4 : 0,
|
|
190
|
+
borderBottomLeftRadius: isFirst ? 4 : 0,
|
|
191
|
+
borderTopRightRadius: isLast ? 4 : 0,
|
|
192
|
+
borderBottomRightRadius: isLast ? 4 : 0,
|
|
193
|
+
marginLeft: isFirst ? 0 : -1
|
|
194
|
+
} : {
|
|
195
|
+
borderRadius: 0,
|
|
196
|
+
borderTopLeftRadius: isFirst ? 4 : 0,
|
|
197
|
+
borderTopRightRadius: isFirst ? 4 : 0,
|
|
198
|
+
borderBottomLeftRadius: isLast ? 4 : 0,
|
|
199
|
+
borderBottomRightRadius: isLast ? 4 : 0,
|
|
200
|
+
marginTop: isFirst ? 0 : -1
|
|
201
|
+
};
|
|
202
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
203
|
+
selected: isSelected(child.props.value),
|
|
204
|
+
onChange: handleChange,
|
|
205
|
+
disabled: disabled || child.props.disabled,
|
|
206
|
+
color: child.props.color || color,
|
|
207
|
+
size: child.props.size || size,
|
|
208
|
+
fullWidth,
|
|
209
|
+
style: _objectSpread(_objectSpread({}, borderRadiusStyle), child.props.style)
|
|
210
|
+
});
|
|
211
|
+
}));
|
|
212
|
+
});
|
|
213
|
+
ToggleButtonGroupBase.displayName = "ToggleButtonGroup";
|
|
214
|
+
withSx(ToggleButtonGroupBase);
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* createTheme - creates a theme object compatible with MUI's createTheme
|
|
9
|
+
* This is a simplified version that merges theme options
|
|
10
|
+
*/
|
|
11
|
+
const defaultTheme = {
|
|
12
|
+
palette: {
|
|
13
|
+
mode: "light",
|
|
14
|
+
primary: {
|
|
15
|
+
main: "#7C4DFF",
|
|
16
|
+
light: "#B47CFF",
|
|
17
|
+
dark: "#3F1DCB",
|
|
18
|
+
contrastText: "#FFFFFF"
|
|
19
|
+
},
|
|
20
|
+
secondary: {
|
|
21
|
+
main: "#FF4081",
|
|
22
|
+
light: "#FF79B0",
|
|
23
|
+
dark: "#C60055",
|
|
24
|
+
contrastText: "#FFFFFF"
|
|
25
|
+
},
|
|
26
|
+
error: {
|
|
27
|
+
main: "#F44336",
|
|
28
|
+
light: "#E57373",
|
|
29
|
+
dark: "#D32F2F",
|
|
30
|
+
contrastText: "#FFFFFF"
|
|
31
|
+
},
|
|
32
|
+
warning: {
|
|
33
|
+
main: "#FF9800",
|
|
34
|
+
light: "#FFB74D",
|
|
35
|
+
dark: "#F57C00",
|
|
36
|
+
contrastText: "rgba(0, 0, 0, 0.87)"
|
|
37
|
+
},
|
|
38
|
+
info: {
|
|
39
|
+
main: "#2196F3",
|
|
40
|
+
light: "#64B5F6",
|
|
41
|
+
dark: "#1976D2",
|
|
42
|
+
contrastText: "#FFFFFF"
|
|
43
|
+
},
|
|
44
|
+
success: {
|
|
45
|
+
main: "#4CAF50",
|
|
46
|
+
light: "#81C784",
|
|
47
|
+
dark: "#388E3C",
|
|
48
|
+
contrastText: "rgba(0, 0, 0, 0.87)"
|
|
49
|
+
},
|
|
50
|
+
grey: {
|
|
51
|
+
50: "#FAFAFA",
|
|
52
|
+
100: "#F5F5F5",
|
|
53
|
+
200: "#EEEEEE",
|
|
54
|
+
300: "#E0E0E0",
|
|
55
|
+
400: "#BDBDBD",
|
|
56
|
+
500: "#9E9E9E",
|
|
57
|
+
600: "#757575",
|
|
58
|
+
700: "#616161",
|
|
59
|
+
800: "#424242",
|
|
60
|
+
900: "#212121",
|
|
61
|
+
A100: "#D5D5D5",
|
|
62
|
+
A200: "#AAAAAA",
|
|
63
|
+
A400: "#616161",
|
|
64
|
+
A700: "#303030"
|
|
65
|
+
},
|
|
66
|
+
text: {
|
|
67
|
+
primary: "rgba(0, 0, 0, 0.87)",
|
|
68
|
+
secondary: "rgba(0, 0, 0, 0.6)",
|
|
69
|
+
disabled: "rgba(0, 0, 0, 0.38)"
|
|
70
|
+
},
|
|
71
|
+
background: {
|
|
72
|
+
paper: "#FFFFFF",
|
|
73
|
+
default: "#FAFAFA"
|
|
74
|
+
},
|
|
75
|
+
divider: "rgba(0, 0, 0, 0.12)",
|
|
76
|
+
action: {
|
|
77
|
+
active: "rgba(0, 0, 0, 0.54)",
|
|
78
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
|
79
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
|
80
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
|
81
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
typography: {
|
|
85
|
+
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
86
|
+
fontSize: 14,
|
|
87
|
+
fontWeightLight: 300,
|
|
88
|
+
fontWeightRegular: 400,
|
|
89
|
+
fontWeightMedium: 500,
|
|
90
|
+
fontWeightBold: 700,
|
|
91
|
+
h1: {
|
|
92
|
+
fontWeight: 300,
|
|
93
|
+
fontSize: "6rem",
|
|
94
|
+
lineHeight: 1.167,
|
|
95
|
+
letterSpacing: "-0.01562em"
|
|
96
|
+
},
|
|
97
|
+
h2: {
|
|
98
|
+
fontWeight: 300,
|
|
99
|
+
fontSize: "3.75rem",
|
|
100
|
+
lineHeight: 1.2,
|
|
101
|
+
letterSpacing: "-0.00833em"
|
|
102
|
+
},
|
|
103
|
+
h3: {
|
|
104
|
+
fontWeight: 400,
|
|
105
|
+
fontSize: "3rem",
|
|
106
|
+
lineHeight: 1.167,
|
|
107
|
+
letterSpacing: "0em"
|
|
108
|
+
},
|
|
109
|
+
h4: {
|
|
110
|
+
fontWeight: 400,
|
|
111
|
+
fontSize: "2.125rem",
|
|
112
|
+
lineHeight: 1.235,
|
|
113
|
+
letterSpacing: "0.00735em"
|
|
114
|
+
},
|
|
115
|
+
h5: {
|
|
116
|
+
fontWeight: 400,
|
|
117
|
+
fontSize: "1.5rem",
|
|
118
|
+
lineHeight: 1.334,
|
|
119
|
+
letterSpacing: "0em"
|
|
120
|
+
},
|
|
121
|
+
h6: {
|
|
122
|
+
fontWeight: 500,
|
|
123
|
+
fontSize: "1.25rem",
|
|
124
|
+
lineHeight: 1.6,
|
|
125
|
+
letterSpacing: "0.0075em"
|
|
126
|
+
},
|
|
127
|
+
subtitle1: {
|
|
128
|
+
fontWeight: 400,
|
|
129
|
+
fontSize: "1rem",
|
|
130
|
+
lineHeight: 1.75,
|
|
131
|
+
letterSpacing: "0.00938em"
|
|
132
|
+
},
|
|
133
|
+
subtitle2: {
|
|
134
|
+
fontWeight: 500,
|
|
135
|
+
fontSize: "0.875rem",
|
|
136
|
+
lineHeight: 1.57,
|
|
137
|
+
letterSpacing: "0.00714em"
|
|
138
|
+
},
|
|
139
|
+
body1: {
|
|
140
|
+
fontWeight: 400,
|
|
141
|
+
fontSize: "1rem",
|
|
142
|
+
lineHeight: 1.5,
|
|
143
|
+
letterSpacing: "0.00938em"
|
|
144
|
+
},
|
|
145
|
+
body2: {
|
|
146
|
+
fontWeight: 400,
|
|
147
|
+
fontSize: "0.875rem",
|
|
148
|
+
lineHeight: 1.43,
|
|
149
|
+
letterSpacing: "0.01071em"
|
|
150
|
+
},
|
|
151
|
+
button: {
|
|
152
|
+
fontWeight: 500,
|
|
153
|
+
fontSize: "0.875rem",
|
|
154
|
+
lineHeight: 1.75,
|
|
155
|
+
letterSpacing: "0.02857em",
|
|
156
|
+
textTransform: "uppercase"
|
|
157
|
+
},
|
|
158
|
+
caption: {
|
|
159
|
+
fontWeight: 400,
|
|
160
|
+
fontSize: "0.75rem",
|
|
161
|
+
lineHeight: 1.66,
|
|
162
|
+
letterSpacing: "0.03333em"
|
|
163
|
+
},
|
|
164
|
+
overline: {
|
|
165
|
+
fontWeight: 400,
|
|
166
|
+
fontSize: "0.75rem",
|
|
167
|
+
lineHeight: 2.66,
|
|
168
|
+
letterSpacing: "0.08333em",
|
|
169
|
+
textTransform: "uppercase"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
spacing: factor => "".concat(8 * factor, "px"),
|
|
173
|
+
shape: {
|
|
174
|
+
borderRadius: 4
|
|
175
|
+
},
|
|
176
|
+
shadows: ["none", "0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)", "0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)", "0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)", "0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)" // ... more shadow levels
|
|
177
|
+
],
|
|
178
|
+
transitions: {
|
|
179
|
+
easing: {
|
|
180
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
181
|
+
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
|
182
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
183
|
+
sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
|
|
184
|
+
},
|
|
185
|
+
duration: {
|
|
186
|
+
shortest: 150,
|
|
187
|
+
shorter: 200,
|
|
188
|
+
short: 250,
|
|
189
|
+
standard: 300,
|
|
190
|
+
complex: 375,
|
|
191
|
+
enteringScreen: 225,
|
|
192
|
+
leavingScreen: 195
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
zIndex: {
|
|
196
|
+
mobileStepper: 1000,
|
|
197
|
+
fab: 1050,
|
|
198
|
+
speedDial: 1050,
|
|
199
|
+
appBar: 1100,
|
|
200
|
+
drawer: 1200,
|
|
201
|
+
modal: 1300,
|
|
202
|
+
snackbar: 1400,
|
|
203
|
+
tooltip: 1500
|
|
204
|
+
},
|
|
205
|
+
breakpoints: {
|
|
206
|
+
keys: ["xs", "sm", "md", "lg", "xl"],
|
|
207
|
+
values: {
|
|
208
|
+
xs: 0,
|
|
209
|
+
sm: 600,
|
|
210
|
+
md: 900,
|
|
211
|
+
lg: 1200,
|
|
212
|
+
xl: 1536
|
|
213
|
+
},
|
|
214
|
+
up: key => "@media (min-width:".concat(defaultTheme.breakpoints.values[key], "px)"),
|
|
215
|
+
down: key => "@media (max-width:".concat(defaultTheme.breakpoints.values[key] - 0.05, "px)"),
|
|
216
|
+
between: (start, end) => "@media (min-width:".concat(defaultTheme.breakpoints.values[start], "px) and (max-width:").concat(defaultTheme.breakpoints.values[end] - 0.05, "px)"),
|
|
217
|
+
only: key => {
|
|
218
|
+
const keys = defaultTheme.breakpoints.keys;
|
|
219
|
+
const idx = keys.indexOf(key);
|
|
220
|
+
|
|
221
|
+
if (idx === keys.length - 1) {
|
|
222
|
+
return defaultTheme.breakpoints.up(key);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return defaultTheme.breakpoints.between(key, keys[idx + 1]);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
components: {}
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Deep merge utility
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
function deepMerge(target, source) {
|
|
235
|
+
const output = _objectSpread({}, target);
|
|
236
|
+
|
|
237
|
+
if (isObject(target) && isObject(source)) {
|
|
238
|
+
Object.keys(source).forEach(key => {
|
|
239
|
+
if (isObject(source[key])) {
|
|
240
|
+
if (!(key in target)) {
|
|
241
|
+
output[key] = source[key];
|
|
242
|
+
} else {
|
|
243
|
+
output[key] = deepMerge(target[key], source[key]);
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
output[key] = source[key];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return output;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function isObject(item) {
|
|
255
|
+
return item && typeof item === "object" && !Array.isArray(item);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* createTheme - creates a custom theme by merging with defaults
|
|
259
|
+
* @param {Object} options - Theme options to merge with defaults
|
|
260
|
+
* @returns {Object} Complete theme object
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
function createTheme() {
|
|
265
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
266
|
+
const theme = deepMerge(defaultTheme, options); // Rebuild breakpoint functions with merged values
|
|
267
|
+
|
|
268
|
+
theme.breakpoints.up = key => "@media (min-width:".concat(theme.breakpoints.values[key], "px)");
|
|
269
|
+
|
|
270
|
+
theme.breakpoints.down = key => "@media (max-width:".concat(theme.breakpoints.values[key] - 0.05, "px)");
|
|
271
|
+
|
|
272
|
+
theme.breakpoints.between = (start, end) => "@media (min-width:".concat(theme.breakpoints.values[start], "px) and (max-width:").concat(theme.breakpoints.values[end] - 0.05, "px)");
|
|
273
|
+
|
|
274
|
+
theme.breakpoints.only = key => {
|
|
275
|
+
const keys = theme.breakpoints.keys;
|
|
276
|
+
const idx = keys.indexOf(key);
|
|
277
|
+
|
|
278
|
+
if (idx === keys.length - 1) {
|
|
279
|
+
return theme.breakpoints.up(key);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return theme.breakpoints.between(key, keys[idx + 1]);
|
|
283
|
+
}; // Ensure spacing function uses merged value
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
const spacingInput = options.spacing;
|
|
287
|
+
|
|
288
|
+
if (typeof spacingInput === "number") {
|
|
289
|
+
theme.spacing = factor => "".concat(spacingInput * factor, "px");
|
|
290
|
+
} else if (typeof spacingInput === "function") {
|
|
291
|
+
theme.spacing = spacingInput;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return theme;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export { createTheme, createTheme as default };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import '@babel/runtime/helpers/extends';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import React, { useId, useMemo, useEffect } from 'react';
|
|
5
|
+
import { sxToStyle, generatePseudoCSS } from '../neo-utils/sxToStyle.js';
|
|
6
|
+
import { useTheme } from './ThemeProvider.js';
|
|
7
|
+
|
|
8
|
+
const _excluded = ["sx", "style", "className"];
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
+
|
|
14
|
+
const styleCache = new Map();
|
|
15
|
+
let styleSheet = null;
|
|
16
|
+
|
|
17
|
+
function getStyleSheet() {
|
|
18
|
+
if (styleSheet) return styleSheet; // Check for existing stylesheet
|
|
19
|
+
|
|
20
|
+
const existing = document.querySelector("style[data-blerp-sx]");
|
|
21
|
+
|
|
22
|
+
if (existing) {
|
|
23
|
+
styleSheet = existing.sheet;
|
|
24
|
+
return styleSheet;
|
|
25
|
+
} // Create new stylesheet
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const style = document.createElement("style");
|
|
29
|
+
style.setAttribute("data-blerp-sx", "true");
|
|
30
|
+
document.head.appendChild(style);
|
|
31
|
+
styleSheet = style.sheet;
|
|
32
|
+
return styleSheet;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function injectStyles(className, pseudoStyles, nestedStyles, mediaQueries, themeColors) {
|
|
36
|
+
if (!className) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const hasStyles = pseudoStyles && Object.keys(pseudoStyles).length > 0 || nestedStyles && Object.keys(nestedStyles).length > 0 || mediaQueries && Object.keys(mediaQueries).length > 0;
|
|
41
|
+
|
|
42
|
+
if (!hasStyles) {
|
|
43
|
+
return;
|
|
44
|
+
} // Check cache
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const cacheKey = className;
|
|
48
|
+
|
|
49
|
+
if (styleCache.has(cacheKey)) {
|
|
50
|
+
return;
|
|
51
|
+
} // Generate CSS
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const css = generatePseudoCSS(className, pseudoStyles, themeColors, nestedStyles, mediaQueries);
|
|
55
|
+
|
|
56
|
+
if (css) {
|
|
57
|
+
try {
|
|
58
|
+
const sheet = getStyleSheet(); // Split by newlines and insert each rule
|
|
59
|
+
|
|
60
|
+
css.split("\n").filter(Boolean).forEach(rule => {
|
|
61
|
+
try {
|
|
62
|
+
sheet.insertRule(rule.trim(), sheet.cssRules.length);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// Rule might be invalid, log for debugging but don't crash
|
|
65
|
+
if (process.env.NODE_ENV === "development") {
|
|
66
|
+
console.warn("Failed to insert CSS rule:", rule, e.message);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
styleCache.set(cacheKey, true);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.warn("Failed to inject styles:", e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Higher-Order Component that adds MUI-compatible `sx` prop support
|
|
78
|
+
*
|
|
79
|
+
* Supports:
|
|
80
|
+
* - Regular style properties (margin, padding, color, etc.)
|
|
81
|
+
* - MUI shorthand props (m, p, mt, px, etc.)
|
|
82
|
+
* - Theme color references (color: "primary.main")
|
|
83
|
+
* - Pseudo-selectors (&:hover, &:disabled, etc.)
|
|
84
|
+
* - Nested selectors (.className, & > div, etc.)
|
|
85
|
+
* - Media queries (@media (max-width: 600px))
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
function withSx(Component) {
|
|
89
|
+
const WrappedComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
90
|
+
let {
|
|
91
|
+
sx,
|
|
92
|
+
style,
|
|
93
|
+
className
|
|
94
|
+
} = _ref,
|
|
95
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
96
|
+
|
|
97
|
+
const {
|
|
98
|
+
colors
|
|
99
|
+
} = useTheme();
|
|
100
|
+
useId().replace(/:/g, ""); // Memoize the style conversion
|
|
101
|
+
|
|
102
|
+
const {
|
|
103
|
+
computedStyle,
|
|
104
|
+
pseudoClassName,
|
|
105
|
+
pseudoStyles,
|
|
106
|
+
nestedStyles,
|
|
107
|
+
mediaQueries
|
|
108
|
+
} = useMemo(() => {
|
|
109
|
+
if (!sx) {
|
|
110
|
+
return {
|
|
111
|
+
computedStyle: style || {},
|
|
112
|
+
pseudoClassName: "",
|
|
113
|
+
pseudoStyles: {},
|
|
114
|
+
nestedStyles: {},
|
|
115
|
+
mediaQueries: {}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const result = sxToStyle(sx, colors);
|
|
120
|
+
return {
|
|
121
|
+
computedStyle: _objectSpread(_objectSpread({}, result.style), style),
|
|
122
|
+
pseudoClassName: result.pseudoClassName,
|
|
123
|
+
pseudoStyles: result.pseudoStyles,
|
|
124
|
+
nestedStyles: result.nestedStyles,
|
|
125
|
+
mediaQueries: result.mediaQueries
|
|
126
|
+
};
|
|
127
|
+
}, [sx, style, colors]); // Inject special styles (pseudo, nested, media queries)
|
|
128
|
+
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (typeof window !== "undefined" && pseudoClassName) {
|
|
131
|
+
injectStyles(pseudoClassName, pseudoStyles, nestedStyles, mediaQueries, colors);
|
|
132
|
+
}
|
|
133
|
+
}, [pseudoClassName, pseudoStyles, nestedStyles, mediaQueries, colors]); // Also inject synchronously for SSR/initial render
|
|
134
|
+
|
|
135
|
+
if (typeof window !== "undefined" && pseudoClassName) {
|
|
136
|
+
injectStyles(pseudoClassName, pseudoStyles, nestedStyles, mediaQueries, colors);
|
|
137
|
+
} // Combine classNames
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const combinedClassName = [className, pseudoClassName].filter(Boolean).join(" ") || undefined;
|
|
141
|
+
return /*#__PURE__*/React.createElement(Component, _objectSpread({
|
|
142
|
+
ref,
|
|
143
|
+
style: computedStyle,
|
|
144
|
+
className: combinedClassName,
|
|
145
|
+
sx
|
|
146
|
+
}, props));
|
|
147
|
+
});
|
|
148
|
+
const componentName = typeof Component === "string" ? Component : Component.displayName || Component.name || "Component";
|
|
149
|
+
WrappedComponent.displayName = "withSx(".concat(componentName, ")");
|
|
150
|
+
return WrappedComponent;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { withSx as default, withSx };
|