@xylabs/sdk-react 2.9.23 → 2.9.27
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/cjs5/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/cjs5/components/MenuEx.d.ts +7 -0
- package/dist/cjs5/components/RedirectWithQuery.d.ts +1 -0
- package/dist/cjs5/components/SelectEx.d.ts +7 -0
- package/dist/cjs5/components/index.d.ts +2 -0
- package/dist/cjs5/index.js +35 -14
- package/dist/cjs5/index.js.map +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js +8 -10
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js.map +1 -1
- package/dist/components/MenuEx.d.ts +7 -0
- package/dist/components/MenuEx.js +11 -0
- package/dist/components/MenuEx.js.map +1 -0
- package/dist/components/RedirectWithQuery.d.ts +1 -0
- package/dist/components/RedirectWithQuery.js +8 -3
- package/dist/components/RedirectWithQuery.js.map +1 -1
- package/dist/components/SelectEx.d.ts +7 -0
- package/dist/components/SelectEx.js +13 -0
- package/dist/components/SelectEx.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm2015/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/esm2015/components/MenuEx.d.ts +7 -0
- package/dist/esm2015/components/RedirectWithQuery.d.ts +1 -0
- package/dist/esm2015/components/SelectEx.d.ts +7 -0
- package/dist/esm2015/components/index.d.ts +2 -0
- package/dist/esm2015/index.js +34 -15
- package/dist/esm2015/index.js.map +1 -1
- package/dist/esm2017/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/esm2017/components/MenuEx.d.ts +7 -0
- package/dist/esm2017/components/RedirectWithQuery.d.ts +1 -0
- package/dist/esm2017/components/SelectEx.d.ts +7 -0
- package/dist/esm2017/components/index.d.ts +2 -0
- package/dist/esm2017/index.js +34 -15
- package/dist/esm2017/index.js.map +1 -1
- package/dist/esm5/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/esm5/components/MenuEx.d.ts +7 -0
- package/dist/esm5/components/RedirectWithQuery.d.ts +1 -0
- package/dist/esm5/components/SelectEx.d.ts +7 -0
- package/dist/esm5/components/index.d.ts +2 -0
- package/dist/esm5/index.js +34 -15
- package/dist/esm5/index.js.map +1 -1
- package/dist/node/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/node/components/MenuEx.d.ts +7 -0
- package/dist/node/components/RedirectWithQuery.d.ts +1 -0
- package/dist/node/components/SelectEx.d.ts +7 -0
- package/dist/node/components/index.d.ts +2 -0
- package/dist/node/index.js +35 -14
- package/dist/node/index.js.map +1 -1
- package/dist/node-esm/components/InvertableThemeProvider/InvertableThemeProvider.d.ts +9 -2
- package/dist/node-esm/components/MenuEx.d.ts +7 -0
- package/dist/node-esm/components/RedirectWithQuery.d.ts +1 -0
- package/dist/node-esm/components/SelectEx.d.ts +7 -0
- package/dist/node-esm/components/index.d.ts +2 -0
- package/dist/node-esm/index.js +34 -15
- package/dist/node-esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/InvertableThemeProvider/InvertableThemeProvider.tsx +10 -12
- package/src/components/MenuEx.tsx +13 -0
- package/src/components/RedirectWithQuery.tsx +8 -3
- package/src/components/SelectEx.tsx +21 -0
- package/src/components/index.ts +2 -0
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeOptions } from '@mui/material/styles';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { InvertableThemeProviderProps } from './InvertableThemeProviderProps';
|
|
4
|
-
export declare const resolveThemeColors: (
|
|
4
|
+
export declare const resolveThemeColors: (options: ThemeOptions) => ThemeOptions & {
|
|
5
|
+
palette: {
|
|
6
|
+
text: {
|
|
7
|
+
primary: string;
|
|
8
|
+
secondary: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
5
12
|
export declare const InvertableThemeProvider: React.FC<InvertableThemeProviderProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaletteMode, SelectProps } from '@mui/material';
|
|
3
|
+
export interface SelectExProps<T> extends SelectProps<T> {
|
|
4
|
+
colorize?: 'primary' | 'secondary';
|
|
5
|
+
mode?: PaletteMode;
|
|
6
|
+
}
|
|
7
|
+
export declare const SelectEx: <T>(props: SelectExProps<T>) => JSX.Element;
|
|
@@ -15,11 +15,13 @@ export * from './Experiments';
|
|
|
15
15
|
export * from './FlexBox';
|
|
16
16
|
export * from './InvertableThemeProvider';
|
|
17
17
|
export * from './LinkEx';
|
|
18
|
+
export * from './MenuEx';
|
|
18
19
|
export * from './NumberStatus';
|
|
19
20
|
export * from './Pixel';
|
|
20
21
|
export * from './Portal';
|
|
21
22
|
export * from './QuickTipButton';
|
|
22
23
|
export * from './RichResult';
|
|
23
24
|
export * from './ScrollToTop';
|
|
25
|
+
export * from './SelectEx';
|
|
24
26
|
export * from './TokenAmount';
|
|
25
27
|
export { Background, CoverProgress, HoverScale, Identicon, RedirectWithQuery, ScrollToTopButton };
|
package/dist/esm5/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useTheme, Box, alpha, CircularProgress, LinearProgress, Paper, Typography, IconButton, useScrollTrigger, Zoom, AppBar, Container, Toolbar, Button, Link, responsiveFontSizes, ScopedCssBaseline, ThemeProvider, Fab, Breadcrumbs, Dialog, DialogTitle, DialogContent, DialogActions, useMediaQuery, Slider, Badge, Card, Divider, FormControl, FormLabel, Switch } from '@mui/material';
|
|
2
|
+
import { useTheme, Box, alpha, CircularProgress, LinearProgress, Paper, Typography, IconButton, useScrollTrigger, Zoom, AppBar, Container, Toolbar, Button, Link, responsiveFontSizes, ScopedCssBaseline, ThemeProvider, Fab, Breadcrumbs, Dialog, DialogTitle, DialogContent, DialogActions, useMediaQuery, Slider, Menu, Badge, Card, Divider, FormControl, FormLabel, Switch, Select } from '@mui/material';
|
|
3
3
|
export { useMediaQuery } from '@mui/material';
|
|
4
4
|
import { AiOutlineReload, AiOutlineQuestionCircle } from 'react-icons/ai';
|
|
5
5
|
import { makeStyles, createStyles } from '@mui/styles';
|
|
@@ -13,7 +13,7 @@ import { getApiStage as getApiStage$1, delay, assertEx, EthAddress, forget, BigN
|
|
|
13
13
|
import { UserEventHandler, XyPixel } from '@xylabs/pixel';
|
|
14
14
|
import { parse, stringify } from 'query-string';
|
|
15
15
|
import { createTheme } from '@mui/material/styles';
|
|
16
|
-
import
|
|
16
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
17
17
|
import merge from 'lodash/merge';
|
|
18
18
|
import numeral from 'numeral';
|
|
19
19
|
import { createPortal } from 'react-dom';
|
|
@@ -192,13 +192,18 @@ const Identicon = (_a) => {
|
|
|
192
192
|
return (jsx(FlexRow, Object.assign({}, props, { children: jsx("canvas", { className: className, ref: canvas, style: { height: size, width: size } }, void 0) }), void 0));
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
-
const RedirectWithQuery = ({ to, toOptions }) => {
|
|
195
|
+
const RedirectWithQuery = ({ href, to, toOptions }) => {
|
|
196
196
|
const newPath = `${to}${document.location.search}`;
|
|
197
197
|
const navigate = useNavigate();
|
|
198
198
|
const { pathname } = useLocation();
|
|
199
199
|
useEffect(() => {
|
|
200
|
-
if (
|
|
201
|
-
|
|
200
|
+
if (href) {
|
|
201
|
+
window.location.href = href;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
if (newPath !== pathname) {
|
|
205
|
+
navigate(newPath, Object.assign({ replace: true }, toOptions));
|
|
206
|
+
}
|
|
202
207
|
}
|
|
203
208
|
});
|
|
204
209
|
return jsx("div", {}, void 0);
|
|
@@ -1660,9 +1665,10 @@ const InvertableThemeContext = createContext({
|
|
|
1660
1665
|
options: {},
|
|
1661
1666
|
});
|
|
1662
1667
|
|
|
1663
|
-
const resolveThemeColors = (
|
|
1668
|
+
const resolveThemeColors = (options) => {
|
|
1664
1669
|
var _a, _b;
|
|
1665
|
-
const
|
|
1670
|
+
const theme = createTheme(options);
|
|
1671
|
+
return merge({}, options, {
|
|
1666
1672
|
palette: {
|
|
1667
1673
|
text: {
|
|
1668
1674
|
primary: (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.getContrastText(theme.palette.primary.main),
|
|
@@ -1670,13 +1676,12 @@ const resolveThemeColors = (theme, options) => {
|
|
|
1670
1676
|
},
|
|
1671
1677
|
},
|
|
1672
1678
|
});
|
|
1673
|
-
return newTheme;
|
|
1674
1679
|
};
|
|
1675
1680
|
const InvertableThemeProvider = ({ options, children, dark, resolve = false, scoped = false, invert = false, noResponsiveFonts, darkTheme, }) => {
|
|
1676
1681
|
var _a, _b;
|
|
1677
1682
|
let internalDarkTheme = {};
|
|
1678
1683
|
const contextInvertableTheme = useContext(InvertableThemeContext);
|
|
1679
|
-
const clonedOptions =
|
|
1684
|
+
const clonedOptions = cloneDeep((_a = options !== null && options !== void 0 ? options : contextInvertableTheme.options) !== null && _a !== void 0 ? _a : {});
|
|
1680
1685
|
clonedOptions.palette = (_b = clonedOptions.palette) !== null && _b !== void 0 ? _b : {};
|
|
1681
1686
|
if (invert) {
|
|
1682
1687
|
clonedOptions.palette.mode = clonedOptions.palette.mode === 'dark' ? 'light' : 'dark';
|
|
@@ -1687,13 +1692,11 @@ const InvertableThemeProvider = ({ options, children, dark, resolve = false, sco
|
|
|
1687
1692
|
if (clonedOptions.palette.mode === 'dark' && (darkTheme === null || darkTheme === void 0 ? void 0 : darkTheme.palette)) {
|
|
1688
1693
|
internalDarkTheme = darkTheme;
|
|
1689
1694
|
}
|
|
1690
|
-
let
|
|
1695
|
+
let themeOptions = merge(clonedOptions, internalDarkTheme);
|
|
1691
1696
|
if (resolve) {
|
|
1692
|
-
|
|
1693
|
-
}
|
|
1694
|
-
if (!noResponsiveFonts) {
|
|
1695
|
-
theme = responsiveFontSizes(theme);
|
|
1697
|
+
themeOptions = resolveThemeColors(themeOptions);
|
|
1696
1698
|
}
|
|
1699
|
+
const theme = noResponsiveFonts ? createTheme(themeOptions) : responsiveFontSizes(createTheme(themeOptions));
|
|
1697
1700
|
return scoped ? (jsx(ScopedCssBaseline, { children: jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0) }, void 0)) : (jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0));
|
|
1698
1701
|
};
|
|
1699
1702
|
|
|
@@ -2066,6 +2069,13 @@ const LinkToEx = (_a) => {
|
|
|
2066
2069
|
return jsx(Link, Object.assign({ component: Link$1, to: to }, props), void 0);
|
|
2067
2070
|
};
|
|
2068
2071
|
|
|
2072
|
+
const MenuEx = (_a) => {
|
|
2073
|
+
var { MenuListProps = {}, mode = 'light', colorize } = _a, props = __rest(_a, ["MenuListProps", "mode", "colorize"]);
|
|
2074
|
+
const theme = useTheme();
|
|
2075
|
+
const colorizeMenuListProps = colorize ? { sx: { backgroundColor: theme.palette[colorize][mode] } } : {};
|
|
2076
|
+
return jsx(Menu, Object.assign({ MenuListProps: merge(MenuListProps, colorizeMenuListProps) }, props), void 0);
|
|
2077
|
+
};
|
|
2078
|
+
|
|
2069
2079
|
const NumberStatus = (_a) => {
|
|
2070
2080
|
var _b, _c;
|
|
2071
2081
|
var { error, format = '0[.]0a', color = 'primary', title, value, size, fontSize, rounded = false, autoWidth = false, style } = _a, props = __rest(_a, ["error", "format", "color", "title", "value", "size", "fontSize", "rounded", "autoWidth", "style"]);
|
|
@@ -2210,6 +2220,15 @@ var MapCategoryType;
|
|
|
2210
2220
|
MapCategoryType["VenueMap"] = "VenueMap";
|
|
2211
2221
|
})(MapCategoryType || (MapCategoryType = {}));
|
|
2212
2222
|
|
|
2223
|
+
const SelectEx = (_a) => {
|
|
2224
|
+
var { MenuProps, mode = 'light', colorize } = _a, props = __rest(_a, ["MenuProps", "mode", "colorize"]);
|
|
2225
|
+
const theme = useTheme();
|
|
2226
|
+
const colorizeMenuProps = colorize
|
|
2227
|
+
? { MenuListProps: { sx: { backgroundColor: theme.palette[colorize][mode] } } }
|
|
2228
|
+
: {};
|
|
2229
|
+
return jsx(Select, Object.assign({ MenuProps: merge(MenuProps, colorizeMenuProps) }, props), void 0);
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2213
2232
|
var img = "data:image/svg+xml,%3csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 238'%3e%3cdefs%3e%3cstyle%3e.cls-1%7bfill:%23999%3b%7d%3c/style%3e%3c/defs%3e%3ctitle%3eicon_gray%3c/title%3e%3cpath class='cls-1' d='M74.5%2c28.33%2c21.29%2c120.5%2c74.5%2c212.67H180.94l1.76-3%2c51.46-89.13L180.94%2c28.33ZM84.65%2c40.54h78.83L111.65%2c56.93a15.85%2c15.85%2c0%2c0%2c1%2c2%2c5l59.66-18.81L185.22%2c101a20.12%2c20.12%2c0%2c0%2c1%2c5.36-.78l-10-47.91%2c37.87%2c65.53h-7.62a24.21%2c24.21%2c0%2c0%2c1%2c.15%2c2.68%2c23.29%2c23.29%2c0%2c0%2c1-.15%2c2.68h7.62l-39.1%2c67.75%2c10.92-50.13A20.57%2c20.57%2c0%2c0%2c1%2c185%2c140l-12.88%2c59-58.37-19.53a17.61%2c17.61%2c0%2c0%2c1-1.7%2c5l47.5%2c15.92H84.65l4-6.85A20.17%2c20.17%2c0%2c0%2c1%2c83.93%2c191L80%2c197.78%2c42.67%2c133.13l37%2c32.66a20.52%2c20.52%2c0%2c0%2c1%2c3.6-4L36.69%2c120.66%2c85%2c77.79a17.45%2c17.45%2c0%2c0%2c1-3.19-4.32l-39.46%2c35L80%2c43.22l5.56%2c9.69A17.51%2c17.51%2c0%2c0%2c1%2c90.12%2c50Zm28.24%2c31.17a16.15%2c16.15%2c0%2c0%2c1-2.68%2c4.64l62%2c35.81a19.74%2c19.74%2c0%2c0%2c1%2c2.83-4.54Zm-20%2c10.51v75.33a18%2c18%2c0%2c0%2c1%2c2.47-.16%2c17.18%2c17.18%2c0%2c0%2c1%2c2.89.21v-75a11.21%2c11.21%2c0%2c0%2c1-1.29%2c0%2c17.57%2c17.57%2c0%2c0%2c1-4.07-.47Zm79.34%2c46.63-62.08%2c35.81a18.45%2c18.45%2c0%2c0%2c1%2c2.68%2c4.68l62.23-36a19.68%2c19.68%2c0%2c0%2c1-2.83-4.53Z'/%3e%3cpath class='cls-1' d='M97%2c48.58a17.06%2c17.06%2c0%2c1%2c0%2c17%2c17%2c17.08%2c17.08%2c0%2c0%2c0-17-17Zm0%2c5.36a11.7%2c11.7%2c0%2c1%2c1-11.7%2c11.69A11.65%2c11.65%2c0%2c0%2c1%2c97%2c53.94Z'/%3e%3cpath class='cls-1' d='M95.37%2c157.39a18.73%2c18.73%2c0%2c1%2c0%2c18.7%2c18.7%2c18.74%2c18.74%2c0%2c0%2c0-18.7-18.7Zm0%2c5.31A13.4%2c13.4%2c0%2c1%2c1%2c82%2c176.09a13.37%2c13.37%2c0%2c0%2c1%2c13.4-13.39Z'/%3e%3cpath class='cls-1' d='M190.73%2c100.2A20.3%2c20.3%2c0%2c1%2c0%2c211%2c120.5a20.34%2c20.34%2c0%2c0%2c0-20.3-20.3Zm0%2c5.36a14.94%2c14.94%2c0%2c1%2c1-14.94%2c14.94%2c14.88%2c14.88%2c0%2c0%2c1%2c14.94-14.94Z'/%3e%3c/svg%3e";
|
|
2214
2233
|
|
|
2215
2234
|
const base10Shift = (bn, places) => {
|
|
@@ -2228,5 +2247,5 @@ const TokenAmount = (_a) => {
|
|
|
2228
2247
|
return (jsx(ButtonEx, Object.assign({ style: Object.assign({ backgroundColor: statusColor }, style), variant: "outlined", onClick: onButtonClick }, props, { children: jsxs(FlexRow, Object.assign({ justifyContent: "space-between", width: "100%", busy: amount === undefined, busySize: 16 }, { children: [jsxs(FlexRow, { children: [logo ? jsx("img", { src: img, height: 24 }, void 0) : null, label ? (jsx(Typography, Object.assign({ marginRight: 1, marginLeft: logo ? 1 : 0, noWrap: true, fontFamily: textFontFamily, variant: "caption" }, { children: label }), void 0)) : null] }, void 0), jsx(Typography, Object.assign({ color: textColor, noWrap: true, fontFamily: textFontFamily, variant: "body1", style: { textTransform: 'none' } }, { children: amountString }), void 0)] }), void 0) }), void 0));
|
|
2229
2248
|
};
|
|
2230
2249
|
|
|
2231
|
-
export { ActionStatusType, AppBarEx, Background, BasePage, BreadcrumbsEx, BusyBox, ButtonEx, ContactPointOption, CookieConsent, CookieConsentBody, CookieConsentContext, CookieConsentLoader, CoverProgress, DebugUserEventsContext, DripCustomEvent, DripStandardEvents, ErrorDialog, EthAccount, EthersContext, EthersLoader, Experiment, Experiments, ExperimentsDebugger, FacebookCustomEvent, FacebookStandardEvents, Fbq, FlexCol, FlexGrowCol, FlexGrowRow, FlexRow, GoogleBaseEvent, GoogleCustomEvent, GoogleStandardEvents, GoogleUserEventHandler, Gtag, Gtm, HoverScale, Identicon, InvertableThemeProvider, ItemAvailability, LinkToEx, MapCategoryType, MessageDialog, NetworkSettingsContext, NetworkSettingsLoader, NumberStatus, PixelDebugger, PixelDebuggerProvider, PixelDebuggerToggle, Portal, QuickTipButton, Rdt, RedditCustomEvent, RedditStandardEvents, RedirectWithQuery, Referrer, RichResult, ScrollToTop, ScrollToTopButton, SnapTr, SnapchatStandardEvents, TiktokCustomEvent, TiktokStandardEvents, TokenAmount, Ttq, UserEventsContext, UserEventsLoader, XyBaseEvent, XyCustomEvent, XyUserEventHandler, XyoUserEventHandler, enableProfileLogging, getApiStage, getLocalStorageObject, getSessionStorageObject, isLocalhost, profileBlock, profileResults, resolveThemeColors, setLocalStorageObject, setSessionStorageObject, useAsyncEffect, useBreakpoint, useCookieConsent, useLocalStorage, useMounted, useNavigateToEthAddress, useSpacing, useUserEvents, useWebP, useWindowSize };
|
|
2250
|
+
export { ActionStatusType, AppBarEx, Background, BasePage, BreadcrumbsEx, BusyBox, ButtonEx, ContactPointOption, CookieConsent, CookieConsentBody, CookieConsentContext, CookieConsentLoader, CoverProgress, DebugUserEventsContext, DripCustomEvent, DripStandardEvents, ErrorDialog, EthAccount, EthersContext, EthersLoader, Experiment, Experiments, ExperimentsDebugger, FacebookCustomEvent, FacebookStandardEvents, Fbq, FlexCol, FlexGrowCol, FlexGrowRow, FlexRow, GoogleBaseEvent, GoogleCustomEvent, GoogleStandardEvents, GoogleUserEventHandler, Gtag, Gtm, HoverScale, Identicon, InvertableThemeProvider, ItemAvailability, LinkToEx, MapCategoryType, MenuEx, MessageDialog, NetworkSettingsContext, NetworkSettingsLoader, NumberStatus, PixelDebugger, PixelDebuggerProvider, PixelDebuggerToggle, Portal, QuickTipButton, Rdt, RedditCustomEvent, RedditStandardEvents, RedirectWithQuery, Referrer, RichResult, ScrollToTop, ScrollToTopButton, SelectEx, SnapTr, SnapchatStandardEvents, TiktokCustomEvent, TiktokStandardEvents, TokenAmount, Ttq, UserEventsContext, UserEventsLoader, XyBaseEvent, XyCustomEvent, XyUserEventHandler, XyoUserEventHandler, enableProfileLogging, getApiStage, getLocalStorageObject, getSessionStorageObject, isLocalhost, profileBlock, profileResults, resolveThemeColors, setLocalStorageObject, setSessionStorageObject, useAsyncEffect, useBreakpoint, useCookieConsent, useLocalStorage, useMounted, useNavigateToEthAddress, useSpacing, useUserEvents, useWebP, useWindowSize };
|
|
2232
2251
|
//# sourceMappingURL=index.js.map
|