@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/cjs5/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var sdkJs = require('@xylabs/sdk-js');
|
|
|
16
16
|
var pixel = require('@xylabs/pixel');
|
|
17
17
|
var queryString = require('query-string');
|
|
18
18
|
var styles$1 = require('@mui/material/styles');
|
|
19
|
-
var
|
|
19
|
+
var cloneDeep = require('lodash/cloneDeep');
|
|
20
20
|
var merge = require('lodash/merge');
|
|
21
21
|
var numeral = require('numeral');
|
|
22
22
|
var reactDom = require('react-dom');
|
|
@@ -24,7 +24,7 @@ var reactDom = require('react-dom');
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
25
|
|
|
26
26
|
var md5__default = /*#__PURE__*/_interopDefaultLegacy(md5);
|
|
27
|
-
var
|
|
27
|
+
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
28
28
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
29
29
|
var numeral__default = /*#__PURE__*/_interopDefaultLegacy(numeral);
|
|
30
30
|
|
|
@@ -202,13 +202,18 @@ const Identicon = (_a) => {
|
|
|
202
202
|
return (jsxRuntime.jsx(FlexRow, Object.assign({}, props, { children: jsxRuntime.jsx("canvas", { className: className, ref: canvas, style: { height: size, width: size } }, void 0) }), void 0));
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
const RedirectWithQuery = ({ to, toOptions }) => {
|
|
205
|
+
const RedirectWithQuery = ({ href, to, toOptions }) => {
|
|
206
206
|
const newPath = `${to}${document.location.search}`;
|
|
207
207
|
const navigate = reactRouterDom.useNavigate();
|
|
208
208
|
const { pathname } = reactRouterDom.useLocation();
|
|
209
209
|
react.useEffect(() => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
210
|
+
if (href) {
|
|
211
|
+
window.location.href = href;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
if (newPath !== pathname) {
|
|
215
|
+
navigate(newPath, Object.assign({ replace: true }, toOptions));
|
|
216
|
+
}
|
|
212
217
|
}
|
|
213
218
|
});
|
|
214
219
|
return jsxRuntime.jsx("div", {}, void 0);
|
|
@@ -1670,9 +1675,10 @@ const InvertableThemeContext = react.createContext({
|
|
|
1670
1675
|
options: {},
|
|
1671
1676
|
});
|
|
1672
1677
|
|
|
1673
|
-
const resolveThemeColors = (
|
|
1678
|
+
const resolveThemeColors = (options) => {
|
|
1674
1679
|
var _a, _b;
|
|
1675
|
-
const
|
|
1680
|
+
const theme = styles$1.createTheme(options);
|
|
1681
|
+
return merge__default["default"]({}, options, {
|
|
1676
1682
|
palette: {
|
|
1677
1683
|
text: {
|
|
1678
1684
|
primary: (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.getContrastText(theme.palette.primary.main),
|
|
@@ -1680,13 +1686,12 @@ const resolveThemeColors = (theme, options) => {
|
|
|
1680
1686
|
},
|
|
1681
1687
|
},
|
|
1682
1688
|
});
|
|
1683
|
-
return newTheme;
|
|
1684
1689
|
};
|
|
1685
1690
|
const InvertableThemeProvider = ({ options, children, dark, resolve = false, scoped = false, invert = false, noResponsiveFonts, darkTheme, }) => {
|
|
1686
1691
|
var _a, _b;
|
|
1687
1692
|
let internalDarkTheme = {};
|
|
1688
1693
|
const contextInvertableTheme = react.useContext(InvertableThemeContext);
|
|
1689
|
-
const clonedOptions =
|
|
1694
|
+
const clonedOptions = cloneDeep__default["default"]((_a = options !== null && options !== void 0 ? options : contextInvertableTheme.options) !== null && _a !== void 0 ? _a : {});
|
|
1690
1695
|
clonedOptions.palette = (_b = clonedOptions.palette) !== null && _b !== void 0 ? _b : {};
|
|
1691
1696
|
if (invert) {
|
|
1692
1697
|
clonedOptions.palette.mode = clonedOptions.palette.mode === 'dark' ? 'light' : 'dark';
|
|
@@ -1697,13 +1702,11 @@ const InvertableThemeProvider = ({ options, children, dark, resolve = false, sco
|
|
|
1697
1702
|
if (clonedOptions.palette.mode === 'dark' && (darkTheme === null || darkTheme === void 0 ? void 0 : darkTheme.palette)) {
|
|
1698
1703
|
internalDarkTheme = darkTheme;
|
|
1699
1704
|
}
|
|
1700
|
-
let
|
|
1705
|
+
let themeOptions = merge__default["default"](clonedOptions, internalDarkTheme);
|
|
1701
1706
|
if (resolve) {
|
|
1702
|
-
|
|
1703
|
-
}
|
|
1704
|
-
if (!noResponsiveFonts) {
|
|
1705
|
-
theme = material.responsiveFontSizes(theme);
|
|
1707
|
+
themeOptions = resolveThemeColors(themeOptions);
|
|
1706
1708
|
}
|
|
1709
|
+
const theme = noResponsiveFonts ? styles$1.createTheme(themeOptions) : material.responsiveFontSizes(styles$1.createTheme(themeOptions));
|
|
1707
1710
|
return scoped ? (jsxRuntime.jsx(material.ScopedCssBaseline, { children: jsxRuntime.jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsxRuntime.jsx(material.ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0) }, void 0)) : (jsxRuntime.jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsxRuntime.jsx(material.ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0));
|
|
1708
1711
|
};
|
|
1709
1712
|
|
|
@@ -2076,6 +2079,13 @@ const LinkToEx = (_a) => {
|
|
|
2076
2079
|
return jsxRuntime.jsx(material.Link, Object.assign({ component: reactRouterDom.Link, to: to }, props), void 0);
|
|
2077
2080
|
};
|
|
2078
2081
|
|
|
2082
|
+
const MenuEx = (_a) => {
|
|
2083
|
+
var { MenuListProps = {}, mode = 'light', colorize } = _a, props = __rest(_a, ["MenuListProps", "mode", "colorize"]);
|
|
2084
|
+
const theme = material.useTheme();
|
|
2085
|
+
const colorizeMenuListProps = colorize ? { sx: { backgroundColor: theme.palette[colorize][mode] } } : {};
|
|
2086
|
+
return jsxRuntime.jsx(material.Menu, Object.assign({ MenuListProps: merge__default["default"](MenuListProps, colorizeMenuListProps) }, props), void 0);
|
|
2087
|
+
};
|
|
2088
|
+
|
|
2079
2089
|
const NumberStatus = (_a) => {
|
|
2080
2090
|
var _b, _c;
|
|
2081
2091
|
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"]);
|
|
@@ -2220,6 +2230,15 @@ exports.MapCategoryType = void 0;
|
|
|
2220
2230
|
MapCategoryType["VenueMap"] = "VenueMap";
|
|
2221
2231
|
})(exports.MapCategoryType || (exports.MapCategoryType = {}));
|
|
2222
2232
|
|
|
2233
|
+
const SelectEx = (_a) => {
|
|
2234
|
+
var { MenuProps, mode = 'light', colorize } = _a, props = __rest(_a, ["MenuProps", "mode", "colorize"]);
|
|
2235
|
+
const theme = material.useTheme();
|
|
2236
|
+
const colorizeMenuProps = colorize
|
|
2237
|
+
? { MenuListProps: { sx: { backgroundColor: theme.palette[colorize][mode] } } }
|
|
2238
|
+
: {};
|
|
2239
|
+
return jsxRuntime.jsx(material.Select, Object.assign({ MenuProps: merge__default["default"](MenuProps, colorizeMenuProps) }, props), void 0);
|
|
2240
|
+
};
|
|
2241
|
+
|
|
2223
2242
|
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";
|
|
2224
2243
|
|
|
2225
2244
|
const base10Shift = (bn, places) => {
|
|
@@ -2280,6 +2299,7 @@ exports.HoverScale = HoverScale;
|
|
|
2280
2299
|
exports.Identicon = Identicon;
|
|
2281
2300
|
exports.InvertableThemeProvider = InvertableThemeProvider;
|
|
2282
2301
|
exports.LinkToEx = LinkToEx;
|
|
2302
|
+
exports.MenuEx = MenuEx;
|
|
2283
2303
|
exports.MessageDialog = MessageDialog;
|
|
2284
2304
|
exports.NetworkSettingsContext = NetworkSettingsContext;
|
|
2285
2305
|
exports.NetworkSettingsLoader = NetworkSettingsLoader;
|
|
@@ -2297,6 +2317,7 @@ exports.Referrer = Referrer;
|
|
|
2297
2317
|
exports.RichResult = RichResult;
|
|
2298
2318
|
exports.ScrollToTop = ScrollToTop;
|
|
2299
2319
|
exports.ScrollToTopButton = ScrollToTopButton;
|
|
2320
|
+
exports.SelectEx = SelectEx;
|
|
2300
2321
|
exports.SnapTr = SnapTr;
|
|
2301
2322
|
exports.SnapchatStandardEvents = SnapchatStandardEvents;
|
|
2302
2323
|
exports.TiktokCustomEvent = TiktokCustomEvent;
|