@xylabs/sdk-react 2.9.32 → 2.9.35
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/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/cjs5/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/cjs5/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/cjs5/components/LinkEx/index.d.ts +1 -2
- package/dist/cjs5/hooks/index.d.ts +2 -0
- package/dist/cjs5/hooks/useInterval.d.ts +2 -0
- package/dist/cjs5/hooks/useTimeout.d.ts +2 -0
- package/dist/cjs5/index.js +42 -4
- package/dist/cjs5/index.js.map +1 -1
- package/dist/components/BasePage/BasePage.stories.js +2 -1
- package/dist/components/BasePage/BasePage.stories.js.map +1 -1
- package/dist/components/EthAccount/EthAccount.js +2 -2
- package/dist/components/EthAccount/EthAccount.js.map +1 -1
- package/dist/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/components/EthAccount/EthAccount.stories.js +18 -1
- package/dist/components/EthAccount/EthAccount.stories.js.map +1 -1
- package/dist/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/components/LinkEx/LinkToEx.js +10 -3
- package/dist/components/LinkEx/LinkToEx.js.map +1 -1
- package/dist/components/LinkEx/index.d.ts +1 -2
- package/dist/components/LinkEx/index.js +1 -2
- package/dist/components/LinkEx/index.js.map +1 -1
- package/dist/esm2015/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm2015/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm2015/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/esm2015/components/LinkEx/index.d.ts +1 -2
- package/dist/esm2015/hooks/index.d.ts +2 -0
- package/dist/esm2015/hooks/useInterval.d.ts +2 -0
- package/dist/esm2015/hooks/useTimeout.d.ts +2 -0
- package/dist/esm2015/index.js +40 -5
- package/dist/esm2015/index.js.map +1 -1
- package/dist/esm2017/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm2017/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm2017/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/esm2017/components/LinkEx/index.d.ts +1 -2
- package/dist/esm2017/hooks/index.d.ts +2 -0
- package/dist/esm2017/hooks/useInterval.d.ts +2 -0
- package/dist/esm2017/hooks/useTimeout.d.ts +2 -0
- package/dist/esm2017/index.js +40 -5
- package/dist/esm2017/index.js.map +1 -1
- package/dist/esm5/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm5/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm5/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/esm5/components/LinkEx/index.d.ts +1 -2
- package/dist/esm5/hooks/index.d.ts +2 -0
- package/dist/esm5/hooks/useInterval.d.ts +2 -0
- package/dist/esm5/hooks/useTimeout.d.ts +2 -0
- package/dist/esm5/index.js +40 -5
- package/dist/esm5/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useInterval.d.ts +2 -0
- package/dist/hooks/useInterval.js +15 -0
- package/dist/hooks/useInterval.js.map +1 -0
- package/dist/hooks/useTimeout.d.ts +2 -0
- package/dist/hooks/useTimeout.js +15 -0
- package/dist/hooks/useTimeout.js.map +1 -0
- package/dist/node/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/node/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/node/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/node/components/LinkEx/index.d.ts +1 -2
- package/dist/node/hooks/index.d.ts +2 -0
- package/dist/node/hooks/useInterval.d.ts +2 -0
- package/dist/node/hooks/useTimeout.d.ts +2 -0
- package/dist/node/index.js +42 -4
- package/dist/node/index.js.map +1 -1
- package/dist/node-esm/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/node-esm/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/node-esm/components/LinkEx/LinkToEx.d.ts +4 -2
- package/dist/node-esm/components/LinkEx/index.d.ts +1 -2
- package/dist/node-esm/hooks/index.d.ts +2 -0
- package/dist/node-esm/hooks/useInterval.d.ts +2 -0
- package/dist/node-esm/hooks/useTimeout.d.ts +2 -0
- package/dist/node-esm/index.js +40 -5
- package/dist/node-esm/index.js.map +1 -1
- package/package.json +11 -11
- package/src/components/BasePage/BasePage.stories.tsx +6 -1
- package/src/components/EthAccount/EthAccount.stories.tsx +20 -1
- package/src/components/EthAccount/EthAccount.tsx +2 -1
- package/src/components/EthAccount/EthAccountProps.tsx +1 -0
- package/src/components/LinkEx/LinkToEx.tsx +11 -4
- package/src/components/LinkEx/index.ts +1 -3
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useInterval.ts +19 -0
- package/src/hooks/useTimeout.ts +19 -0
|
@@ -3,9 +3,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
|
3
3
|
declare const StorybookEntry: ComponentMeta<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
4
4
|
declare const Long: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
5
5
|
declare const LongEmpty: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
6
|
+
declare const Medium: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
7
|
+
declare const MediumEmpty: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
6
8
|
declare const Short: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
7
9
|
declare const ShortEmpty: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
8
10
|
declare const Auto: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
9
11
|
declare const AutoEmpty: ComponentStory<import("react").FC<import("./EthAccountProps").EthAccountProps>>;
|
|
10
|
-
export { Auto, AutoEmpty, Long, LongEmpty, Short, ShortEmpty };
|
|
12
|
+
export { Auto, AutoEmpty, Long, LongEmpty, Medium, MediumEmpty, Short, ShortEmpty };
|
|
11
13
|
export default StorybookEntry;
|
|
@@ -2,7 +2,9 @@ import { LinkProps } from '@mui/material';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { To } from 'react-router-dom';
|
|
4
4
|
interface Props extends LinkProps {
|
|
5
|
-
to
|
|
5
|
+
to?: To;
|
|
6
6
|
}
|
|
7
|
+
declare const LinkEx: React.FC<Props>;
|
|
8
|
+
/** @deprecated use LinkEx instead */
|
|
7
9
|
declare const LinkToEx: React.FC<Props>;
|
|
8
|
-
export { LinkToEx };
|
|
10
|
+
export { LinkEx, LinkToEx };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { LinkToEx };
|
|
1
|
+
export * from './LinkToEx';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './useBreakpoint';
|
|
2
|
+
export * from './useInterval';
|
|
2
3
|
export * from './useLocalStorage';
|
|
3
4
|
export * from './useMediaQuery';
|
|
4
5
|
export * from './useMounted';
|
|
5
6
|
export * from './useNavigateToEthAddress';
|
|
6
7
|
export * from './useSpacing';
|
|
8
|
+
export * from './useTimeout';
|
|
7
9
|
export * from './useUserEvents';
|
|
8
10
|
export * from './useWebP';
|
|
9
11
|
export * from './useWindowSize';
|
package/dist/cjs5/index.js
CHANGED
|
@@ -1805,6 +1805,20 @@ const useBreakpoint = () => {
|
|
|
1805
1805
|
}
|
|
1806
1806
|
};
|
|
1807
1807
|
|
|
1808
|
+
const useInterval = (callback, delay) => {
|
|
1809
|
+
const intervalRef = react.useRef(-1);
|
|
1810
|
+
const savedCallback = react.useRef(callback);
|
|
1811
|
+
react.useEffect(() => {
|
|
1812
|
+
savedCallback.current = callback;
|
|
1813
|
+
}, [callback]);
|
|
1814
|
+
react.useEffect(() => {
|
|
1815
|
+
const tick = () => savedCallback.current();
|
|
1816
|
+
intervalRef.current = window.setInterval(tick, delay);
|
|
1817
|
+
return () => window.clearInterval(intervalRef.current);
|
|
1818
|
+
}, [delay]);
|
|
1819
|
+
return intervalRef;
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1808
1822
|
const useLocalStorage = (key, defaultValue) => {
|
|
1809
1823
|
const [storedValue, setStoredValue] = react.useState(() => {
|
|
1810
1824
|
try {
|
|
@@ -1879,6 +1893,20 @@ const useSpacing = (value) => {
|
|
|
1879
1893
|
return theme.spacing(typeof value === 'string' ? parseInt(value) : value);
|
|
1880
1894
|
};
|
|
1881
1895
|
|
|
1896
|
+
const useTimeout = (callback, delay) => {
|
|
1897
|
+
const timeoutRef = react.useRef(-1);
|
|
1898
|
+
const savedCallback = react.useRef(callback);
|
|
1899
|
+
react.useEffect(() => {
|
|
1900
|
+
savedCallback.current = callback;
|
|
1901
|
+
}, [callback]);
|
|
1902
|
+
react.useEffect(() => {
|
|
1903
|
+
const tick = () => savedCallback.current();
|
|
1904
|
+
timeoutRef.current = window.setTimeout(tick, delay);
|
|
1905
|
+
return () => window.clearTimeout(timeoutRef.current);
|
|
1906
|
+
}, [delay]);
|
|
1907
|
+
return timeoutRef;
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1882
1910
|
const useUserEvents = () => {
|
|
1883
1911
|
const { userEvents } = react.useContext(UserEventsContext);
|
|
1884
1912
|
if (!userEvents) {
|
|
@@ -1929,7 +1957,7 @@ function useWindowSize() {
|
|
|
1929
1957
|
}
|
|
1930
1958
|
|
|
1931
1959
|
const EthAccount = (_a) => {
|
|
1932
|
-
var { address, icon = false, iconSize = 16, iconOnly = false, addressLength = 'auto', fontFamily = '"Source Code Pro",monospace', toEtherScan, onButtonClick } = _a, props = __rest(_a, ["address", "icon", "iconSize", "iconOnly", "addressLength", "fontFamily", "toEtherScan", "onButtonClick"]);
|
|
1960
|
+
var { address, icon = false, iconSize = 16, iconOnly = false, shortenedLength, addressLength = 'auto', fontFamily = '"Source Code Pro",monospace', toEtherScan, onButtonClick } = _a, props = __rest(_a, ["address", "icon", "iconSize", "iconOnly", "shortenedLength", "addressLength", "fontFamily", "toEtherScan", "onButtonClick"]);
|
|
1933
1961
|
const { localAddress } = react.useContext(EthersContext);
|
|
1934
1962
|
const theme = material.useTheme();
|
|
1935
1963
|
const large = material.useMediaQuery(theme.breakpoints.up('md'));
|
|
@@ -1944,7 +1972,7 @@ const EthAccount = (_a) => {
|
|
|
1944
1972
|
const testToDisplay = addressLength === 'long'
|
|
1945
1973
|
? addressToDisplay.toString()
|
|
1946
1974
|
: addressLength === 'short'
|
|
1947
|
-
? addressToDisplay.toShortString()
|
|
1975
|
+
? addressToDisplay.toShortString(shortenedLength)
|
|
1948
1976
|
: large
|
|
1949
1977
|
? addressToDisplay.toString()
|
|
1950
1978
|
: addressToDisplay.toShortString();
|
|
@@ -2076,10 +2104,17 @@ const ExperimentsDebugger = (_a) => {
|
|
|
2076
2104
|
}) }), void 0));
|
|
2077
2105
|
};
|
|
2078
2106
|
|
|
2079
|
-
const
|
|
2107
|
+
const LinkEx = (_a) => {
|
|
2080
2108
|
var { to } = _a, props = __rest(_a, ["to"]);
|
|
2081
|
-
|
|
2109
|
+
if (to) {
|
|
2110
|
+
return jsxRuntime.jsx(material.Link, Object.assign({ component: reactRouterDom.Link, to: to }, props), void 0);
|
|
2111
|
+
}
|
|
2112
|
+
else {
|
|
2113
|
+
return jsxRuntime.jsx(material.Link, Object.assign({}, props), void 0);
|
|
2114
|
+
}
|
|
2082
2115
|
};
|
|
2116
|
+
/** @deprecated use LinkEx instead */
|
|
2117
|
+
const LinkToEx = LinkEx;
|
|
2083
2118
|
|
|
2084
2119
|
const MenuEx = (_a) => {
|
|
2085
2120
|
var { MenuListProps = {}, mode = 'light', colorize } = _a, props = __rest(_a, ["MenuListProps", "mode", "colorize"]);
|
|
@@ -2300,6 +2335,7 @@ exports.Gtm = Gtm;
|
|
|
2300
2335
|
exports.HoverScale = HoverScale;
|
|
2301
2336
|
exports.Identicon = Identicon;
|
|
2302
2337
|
exports.InvertableThemeProvider = InvertableThemeProvider;
|
|
2338
|
+
exports.LinkEx = LinkEx;
|
|
2303
2339
|
exports.LinkToEx = LinkToEx;
|
|
2304
2340
|
exports.MenuEx = MenuEx;
|
|
2305
2341
|
exports.MessageDialog = MessageDialog;
|
|
@@ -2345,10 +2381,12 @@ exports.setSessionStorageObject = setSessionStorageObject;
|
|
|
2345
2381
|
exports.useAsyncEffect = useAsyncEffect;
|
|
2346
2382
|
exports.useBreakpoint = useBreakpoint;
|
|
2347
2383
|
exports.useCookieConsent = useCookieConsent;
|
|
2384
|
+
exports.useInterval = useInterval;
|
|
2348
2385
|
exports.useLocalStorage = useLocalStorage;
|
|
2349
2386
|
exports.useMounted = useMounted;
|
|
2350
2387
|
exports.useNavigateToEthAddress = useNavigateToEthAddress;
|
|
2351
2388
|
exports.useSpacing = useSpacing;
|
|
2389
|
+
exports.useTimeout = useTimeout;
|
|
2352
2390
|
exports.useUserEvents = useUserEvents;
|
|
2353
2391
|
exports.useWebP = useWebP;
|
|
2354
2392
|
exports.useWindowSize = useWindowSize;
|