@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,244 @@
|
|
|
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, { useState, useEffect } from 'react';
|
|
5
|
+
import { withSx } from './withSx.js';
|
|
6
|
+
|
|
7
|
+
const _excluded = ["container", "item", "spacing", "columns", "xs", "sm", "md", "lg", "xl", "direction", "wrap", "alignItems", "justifyContent", "children", "component", "style"],
|
|
8
|
+
_excluded2 = ["container", "size", "offset", "spacing", "columns", "rowSpacing", "columnSpacing", "children", "component", "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
|
+
* Hook to get current breakpoint
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const useBreakpoint = () => {
|
|
18
|
+
const [breakpoint, setBreakpoint] = useState('xs');
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const getBreakpoint = () => {
|
|
21
|
+
const width = window.innerWidth;
|
|
22
|
+
if (width >= 1536) return 'xl';
|
|
23
|
+
if (width >= 1200) return 'lg';
|
|
24
|
+
if (width >= 900) return 'md';
|
|
25
|
+
if (width >= 600) return 'sm';
|
|
26
|
+
return 'xs';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
setBreakpoint(getBreakpoint());
|
|
30
|
+
|
|
31
|
+
const handleResize = () => {
|
|
32
|
+
setBreakpoint(getBreakpoint());
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
window.addEventListener('resize', handleResize);
|
|
36
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
37
|
+
}, []);
|
|
38
|
+
return breakpoint;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get the active column span based on current breakpoint
|
|
42
|
+
* Falls back to smaller breakpoints if larger ones aren't defined
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const getActiveColSpan = (breakpoint, _ref) => {
|
|
47
|
+
let {
|
|
48
|
+
xs,
|
|
49
|
+
sm,
|
|
50
|
+
md,
|
|
51
|
+
lg,
|
|
52
|
+
xl
|
|
53
|
+
} = _ref;
|
|
54
|
+
const breakpoints = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
55
|
+
const values = {
|
|
56
|
+
xs,
|
|
57
|
+
sm,
|
|
58
|
+
md,
|
|
59
|
+
lg,
|
|
60
|
+
xl
|
|
61
|
+
};
|
|
62
|
+
const currentIndex = breakpoints.indexOf(breakpoint); // Start from current breakpoint and work backwards to find a defined value
|
|
63
|
+
|
|
64
|
+
for (let i = currentIndex; i >= 0; i--) {
|
|
65
|
+
const bp = breakpoints[i];
|
|
66
|
+
|
|
67
|
+
if (values[bp] !== undefined) {
|
|
68
|
+
return values[bp];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return undefined;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Grid - Responsive grid layout (replaces MUI Grid)
|
|
76
|
+
* Uses Flexbox for layout with responsive breakpoints
|
|
77
|
+
*
|
|
78
|
+
* Props:
|
|
79
|
+
* - container: Makes this a grid container
|
|
80
|
+
* - item: Makes this a grid item
|
|
81
|
+
* - spacing: Gap between items (uses 8px unit)
|
|
82
|
+
* - xs, sm, md, lg, xl: Responsive column spans (1-12 or 'auto' or true)
|
|
83
|
+
* - columns: Total columns in the grid (default 12)
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
const BaseGrid = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
88
|
+
let {
|
|
89
|
+
container = false,
|
|
90
|
+
item = false,
|
|
91
|
+
spacing = 0,
|
|
92
|
+
columns = 12,
|
|
93
|
+
xs,
|
|
94
|
+
sm,
|
|
95
|
+
md,
|
|
96
|
+
lg,
|
|
97
|
+
xl,
|
|
98
|
+
direction = 'row',
|
|
99
|
+
wrap = 'wrap',
|
|
100
|
+
alignItems,
|
|
101
|
+
justifyContent,
|
|
102
|
+
children,
|
|
103
|
+
component: Component = 'div',
|
|
104
|
+
style
|
|
105
|
+
} = _ref2,
|
|
106
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
107
|
+
|
|
108
|
+
const breakpoint = useBreakpoint(); // Convert spacing to pixels
|
|
109
|
+
|
|
110
|
+
const gap = typeof spacing === 'number' ? spacing * 8 : parseInt(spacing) || 0; // Get the active column span for current breakpoint
|
|
111
|
+
|
|
112
|
+
const activeColSpan = getActiveColSpan(breakpoint, {
|
|
113
|
+
xs,
|
|
114
|
+
sm,
|
|
115
|
+
md,
|
|
116
|
+
lg,
|
|
117
|
+
xl
|
|
118
|
+
}); // Convert column span to width
|
|
119
|
+
|
|
120
|
+
const getColumnWidth = colSpan => {
|
|
121
|
+
if (colSpan === true || colSpan === 'auto') {
|
|
122
|
+
return 'auto';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (typeof colSpan === 'number') {
|
|
126
|
+
return "".concat(colSpan / columns * 100, "%");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return undefined;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let gridStyle = _objectSpread({}, style);
|
|
133
|
+
|
|
134
|
+
if (container) {
|
|
135
|
+
// Container styles - use flexbox for MUI compatibility
|
|
136
|
+
gridStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
137
|
+
display: 'flex',
|
|
138
|
+
flexWrap: wrap,
|
|
139
|
+
flexDirection: direction
|
|
140
|
+
}, alignItems && {
|
|
141
|
+
alignItems
|
|
142
|
+
}), justifyContent && {
|
|
143
|
+
justifyContent
|
|
144
|
+
}), gap > 0 && {
|
|
145
|
+
margin: "-".concat(gap / 2, "px"),
|
|
146
|
+
width: "calc(100% + ".concat(gap, "px)")
|
|
147
|
+
}), gridStyle);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (item) {
|
|
151
|
+
// Item styles
|
|
152
|
+
const columnWidth = getColumnWidth(activeColSpan);
|
|
153
|
+
gridStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
154
|
+
flexGrow: activeColSpan === true ? 1 : 0,
|
|
155
|
+
flexShrink: 0
|
|
156
|
+
}, columnWidth && columnWidth !== 'auto' && {
|
|
157
|
+
flexBasis: columnWidth,
|
|
158
|
+
maxWidth: columnWidth
|
|
159
|
+
}), activeColSpan === 'auto' && {
|
|
160
|
+
flexBasis: 'auto',
|
|
161
|
+
flexGrow: 0,
|
|
162
|
+
maxWidth: 'none'
|
|
163
|
+
}), activeColSpan === true && {
|
|
164
|
+
flexBasis: 0,
|
|
165
|
+
flexGrow: 1,
|
|
166
|
+
maxWidth: '100%'
|
|
167
|
+
}), gap > 0 && {
|
|
168
|
+
padding: "".concat(gap / 2, "px")
|
|
169
|
+
}), {}, {
|
|
170
|
+
boxSizing: 'border-box'
|
|
171
|
+
}, gridStyle);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
175
|
+
ref: ref,
|
|
176
|
+
style: gridStyle
|
|
177
|
+
}, props), children);
|
|
178
|
+
});
|
|
179
|
+
BaseGrid.displayName = 'BaseGrid';
|
|
180
|
+
const Grid = withSx(BaseGrid);
|
|
181
|
+
/**
|
|
182
|
+
* Grid2 alternative using CSS Grid
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
const BaseGrid2 = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
186
|
+
let {
|
|
187
|
+
container = false,
|
|
188
|
+
size,
|
|
189
|
+
offset,
|
|
190
|
+
spacing = 0,
|
|
191
|
+
columns = 12,
|
|
192
|
+
rowSpacing,
|
|
193
|
+
columnSpacing,
|
|
194
|
+
children,
|
|
195
|
+
component: Component = 'div',
|
|
196
|
+
style
|
|
197
|
+
} = _ref3,
|
|
198
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
199
|
+
|
|
200
|
+
const breakpoint = useBreakpoint();
|
|
201
|
+
const gap = typeof spacing === 'number' ? spacing * 8 : parseInt(spacing) || 0;
|
|
202
|
+
const rowGap = rowSpacing !== undefined ? typeof rowSpacing === 'number' ? rowSpacing * 8 : parseInt(rowSpacing) || 0 : gap;
|
|
203
|
+
const colGap = columnSpacing !== undefined ? typeof columnSpacing === 'number' ? columnSpacing * 8 : parseInt(columnSpacing) || 0 : gap;
|
|
204
|
+
|
|
205
|
+
let gridStyle = _objectSpread({}, style);
|
|
206
|
+
|
|
207
|
+
if (container) {
|
|
208
|
+
gridStyle = _objectSpread({
|
|
209
|
+
display: 'grid',
|
|
210
|
+
gridTemplateColumns: "repeat(".concat(columns, ", 1fr)"),
|
|
211
|
+
rowGap: "".concat(rowGap, "px"),
|
|
212
|
+
columnGap: "".concat(colGap, "px")
|
|
213
|
+
}, gridStyle);
|
|
214
|
+
} else if (size !== undefined) {
|
|
215
|
+
// Grid item with size prop
|
|
216
|
+
const activeSize = typeof size === 'object' ? getActiveColSpan(breakpoint, size) : size;
|
|
217
|
+
const activeOffset = typeof offset === 'object' ? getActiveColSpan(breakpoint, offset) : offset;
|
|
218
|
+
|
|
219
|
+
if (activeSize === 'grow') {
|
|
220
|
+
gridStyle = _objectSpread({
|
|
221
|
+
gridColumn: 'span 1 / -1'
|
|
222
|
+
}, gridStyle);
|
|
223
|
+
} else if (typeof activeSize === 'number') {
|
|
224
|
+
gridStyle = _objectSpread({
|
|
225
|
+
gridColumn: "span ".concat(activeSize)
|
|
226
|
+
}, gridStyle);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (typeof activeOffset === 'number') {
|
|
230
|
+
gridStyle = _objectSpread({
|
|
231
|
+
gridColumnStart: activeOffset + 1
|
|
232
|
+
}, gridStyle);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
237
|
+
ref: ref,
|
|
238
|
+
style: gridStyle
|
|
239
|
+
}, props), children);
|
|
240
|
+
});
|
|
241
|
+
BaseGrid2.displayName = 'BaseGrid2';
|
|
242
|
+
withSx(BaseGrid2);
|
|
243
|
+
|
|
244
|
+
export { Grid, Grid as default };
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
import { useTheme } from './ThemeProvider.js';
|
|
7
|
+
|
|
8
|
+
const _excluded = ["color", "size", "disabled", "edge", "children", "onClick", "component", "href", "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
|
+
* IconButton - Circular button for icons (replaces MUI IconButton)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const BaseIconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
18
|
+
let {
|
|
19
|
+
color = 'default',
|
|
20
|
+
size = 'medium',
|
|
21
|
+
disabled = false,
|
|
22
|
+
edge,
|
|
23
|
+
children,
|
|
24
|
+
onClick,
|
|
25
|
+
component,
|
|
26
|
+
href,
|
|
27
|
+
style
|
|
28
|
+
} = _ref,
|
|
29
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
colors
|
|
33
|
+
} = useTheme(); // Get color value
|
|
34
|
+
|
|
35
|
+
const getColor = () => {
|
|
36
|
+
if (color === 'default') return 'var(--icons-in-active, rgba(0, 0, 0, 0.54))';
|
|
37
|
+
if (color === 'inherit') return 'inherit';
|
|
38
|
+
const colorValue = colors[color];
|
|
39
|
+
return typeof colorValue === 'object' ? colorValue.main : colorValue || color;
|
|
40
|
+
}; // Size mappings
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const sizeStyles = {
|
|
44
|
+
small: {
|
|
45
|
+
padding: '5px',
|
|
46
|
+
fontSize: '1.125rem'
|
|
47
|
+
},
|
|
48
|
+
medium: {
|
|
49
|
+
padding: '8px',
|
|
50
|
+
fontSize: '1.5rem'
|
|
51
|
+
},
|
|
52
|
+
large: {
|
|
53
|
+
padding: '12px',
|
|
54
|
+
fontSize: '1.75rem'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const buttonStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
59
|
+
display: 'inline-flex',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
position: 'relative',
|
|
63
|
+
boxSizing: 'border-box',
|
|
64
|
+
backgroundColor: 'transparent',
|
|
65
|
+
outline: 0,
|
|
66
|
+
border: 0,
|
|
67
|
+
margin: 0,
|
|
68
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
69
|
+
userSelect: 'none',
|
|
70
|
+
verticalAlign: 'middle',
|
|
71
|
+
textDecoration: 'none',
|
|
72
|
+
color: getColor(),
|
|
73
|
+
borderRadius: '50%',
|
|
74
|
+
overflow: 'visible',
|
|
75
|
+
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
|
|
76
|
+
}, sizeStyles[size]), edge === 'start' && {
|
|
77
|
+
marginLeft: size === 'small' ? '-3px' : '-12px'
|
|
78
|
+
}), edge === 'end' && {
|
|
79
|
+
marginRight: size === 'small' ? '-3px' : '-12px'
|
|
80
|
+
}), disabled && {
|
|
81
|
+
opacity: 0.5,
|
|
82
|
+
pointerEvents: 'none'
|
|
83
|
+
}), style);
|
|
84
|
+
|
|
85
|
+
const Component = component || (href ? 'a' : 'button');
|
|
86
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
87
|
+
ref: ref,
|
|
88
|
+
style: buttonStyle,
|
|
89
|
+
disabled: Component === 'button' ? disabled : undefined,
|
|
90
|
+
"aria-disabled": disabled,
|
|
91
|
+
onClick: disabled ? undefined : onClick,
|
|
92
|
+
href: href,
|
|
93
|
+
type: Component === 'button' ? 'button' : undefined
|
|
94
|
+
}, props), children);
|
|
95
|
+
});
|
|
96
|
+
BaseIconButton.displayName = 'BaseIconButton';
|
|
97
|
+
const IconButton = withSx(BaseIconButton);
|
|
98
|
+
|
|
99
|
+
export { IconButton, IconButton as default };
|