@ape.swap/bonds-sdk 1.0.167 → 1.0.168

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.
@@ -59,6 +59,7 @@ import Svg from '../uikit/Svg';
59
59
  import '../../scss/Bonds.scss';
60
60
  import { BigNumber } from 'bignumber.js';
61
61
  import { ChainId } from '../../config/chains';
62
+ import Tooltip from '../Tooltip';
62
63
  var Bonds = function (_a) {
63
64
  var connectionString = _a.connectionString;
64
65
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -161,7 +162,7 @@ var Bonds = function (_a) {
161
162
  var getDiscountColor = function (discount) {
162
163
  return discount < 0 ? 'discount-negative' : 'discount-positive';
163
164
  };
164
- return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: "Tokens" })), _jsx(Flex, __assign({ className: "column column-discount" }, { children: "Discount" })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "ARR" })), _jsx(Flex, __assign({ className: "column column-term" }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: "Tokens Remaining" })), _jsx(Flex, { className: "column column-hotbond" })] })), sortedBonds.map(function (bond) {
165
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: _jsx(Tooltip, __assign({ body: "test" }, { children: "Tokens" })) })), _jsx(Flex, __assign({ className: "column column-discount" }, { children: "Discount" })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "ARR" })), _jsx(Flex, __assign({ className: "column column-term" }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: "Tokens Remaining" })), _jsx(Flex, { className: "column column-hotbond" })] })), sortedBonds.map(function (bond) {
165
166
  var _a, _b, _c;
166
167
  return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: bond.showcaseTokenName })), _jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_a = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime(bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: bond.tokensRemaining.split('.')[0] })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_c = bond.discount) !== null && _c !== void 0 ? _c : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] }), bond.billAddress));
167
168
  })] }))] })));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from './types';
3
+ declare const TooltipBubble: React.FC<TooltipProps>;
4
+ export default TooltipBubble;
@@ -0,0 +1,66 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var _a;
24
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
25
+ import { Box } from 'theme-ui';
26
+ import { placements } from './types';
27
+ import style, { container } from './styles';
28
+ var placementStyles = (_a = {},
29
+ _a[placements.BOTTOMLEFT] = {
30
+ top: 'calc(100% + 15px)',
31
+ left: 0,
32
+ },
33
+ _a[placements.BOTTOMRIGHT] = {
34
+ top: 'calc(100% + 15px)',
35
+ right: 0,
36
+ },
37
+ _a[placements.TOPLEFT] = {
38
+ bottom: 'calc(100% + 15px)',
39
+ left: 0,
40
+ },
41
+ _a[placements.TOPRIGHT] = {
42
+ bottom: 'calc(100% + 15px)',
43
+ right: 0,
44
+ },
45
+ _a[placements.ONLYCONTAINERRIGHT] = {
46
+ top: 'calc(100% + 15px)',
47
+ right: 0,
48
+ },
49
+ _a);
50
+ var TooltipBubble = function (_a) {
51
+ var width = _a.width, _b = _a.placement, placement = _b === void 0 ? placements.BOTTOMRIGHT : _b, body = _a.body, backgroundColor = _a.backgroundColor, hideTooltip = _a.hideTooltip, children = _a.children, transformTip = _a.transformTip, props = __rest(_a, ["width", "placement", "body", "backgroundColor", "hideTooltip", "children", "transformTip"]);
52
+ var backgroundColorStyle = backgroundColor
53
+ ? {
54
+ backgroundColor: backgroundColor,
55
+ '&:before': {
56
+ borderBottomColor: placement === placements.BOTTOMLEFT || placement === placements.BOTTOMRIGHT ? backgroundColor : undefined,
57
+ borderTopColor: placement === placements.TOPLEFT || placement === placements.TOPRIGHT ? backgroundColor : undefined,
58
+ },
59
+ }
60
+ : {};
61
+ var handleClick = function (event) {
62
+ event.stopPropagation();
63
+ };
64
+ return (_jsxs(Box, __assign({ sx: container(hideTooltip), onClick: handleClick }, { children: [_jsx(Box, __assign({ sx: __assign({ position: 'absolute' }, (placementStyles[placement] || {})) }, { children: _jsx(Box, __assign({ sx: __assign(__assign(__assign(__assign({ position: 'relative' }, style.default), style[placement]), backgroundColorStyle), { width: width, transform: transformTip }) }, props, { children: body })) })), children] })));
65
+ };
66
+ export default TooltipBubble;
@@ -0,0 +1,4 @@
1
+ import { ThemeUIStyleObject } from 'theme-ui';
2
+ export declare const container: (hide?: boolean) => ThemeUIStyleObject;
3
+ declare const styles: Record<string, ThemeUIStyleObject>;
4
+ export default styles;
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var baseStyle = {
13
+ p: 9,
14
+ borderRadius: 'normal',
15
+ background: 'white2',
16
+ width: 'max-content',
17
+ zIndex: 'modal',
18
+ boxShadow: "0px 0px 30px rgb(200,200,200, .4)",
19
+ };
20
+ var baseDirectionArrow = {
21
+ content: '""',
22
+ display: 'block',
23
+ width: 0,
24
+ border: '12px solid transparent',
25
+ };
26
+ var topArrow = __assign(__assign({ bottom: 0 }, baseDirectionArrow), { borderBottom: 0, borderTopWidth: '15px', borderTopStyle: 'solid', transform: 'translate(-50%, calc(100%))' });
27
+ var bottomArrow = __assign(__assign({ top: 0 }, baseDirectionArrow), { borderTop: 0, borderBottomWidth: '15px', borderBottomStyle: 'solid', transform: 'translate(-50%, calc(-100%))' });
28
+ export var container = function (hide) { return ({
29
+ position: 'relative',
30
+ display: 'inline-block',
31
+ '& > div:first-of-type': {
32
+ display: 'none',
33
+ },
34
+ '&:hover > div:first-of-type': {
35
+ display: hide ? 'none' : 'block',
36
+ },
37
+ }); };
38
+ var styles = {
39
+ default: __assign({ color: 'text', fontSize: 0, lineHeight: '18px', fontWeight: 'normal' }, baseStyle),
40
+ bottomRight: {
41
+ '&::before': __assign(__assign({ position: 'absolute' }, bottomArrow), { right: '3%', borderBottomColor: 'white2' }),
42
+ },
43
+ bottomLeft: {
44
+ '&::before': __assign(__assign({ position: 'absolute' }, bottomArrow), { left: 'calc(3% + 15px)', borderBottomColor: 'white2' }),
45
+ },
46
+ topRight: {
47
+ '&::before': __assign(__assign({ position: 'absolute' }, topArrow), { right: '3%', borderTopColor: 'white2' }),
48
+ },
49
+ topLeft: {
50
+ '&::before': __assign(__assign({ position: 'absolute' }, topArrow), { left: 'calc(3% + 15px)', borderTopColor: 'white2' }),
51
+ },
52
+ onlyContainerRight: {
53
+ '&::before': {
54
+ position: 'absolute',
55
+ right: '3%',
56
+ borderBottomColor: 'white2',
57
+ },
58
+ },
59
+ };
60
+ export default styles;
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { BoxProps } from 'theme-ui';
3
+ export declare enum placements {
4
+ TOPRIGHT = "topRight",
5
+ TOPLEFT = "topLeft",
6
+ BOTTOMRIGHT = "bottomRight",
7
+ BOTTOMLEFT = "bottomLeft",
8
+ ONLYCONTAINERRIGHT = "onlyContainerRight"
9
+ }
10
+ export type placementProps = `${placements}`;
11
+ export interface TooltipProps extends BoxProps {
12
+ width?: string;
13
+ placement?: placementProps;
14
+ body: ReactNode;
15
+ hideTooltip?: boolean;
16
+ transformTip?: string;
17
+ }
@@ -0,0 +1,8 @@
1
+ export var placements;
2
+ (function (placements) {
3
+ placements["TOPRIGHT"] = "topRight";
4
+ placements["TOPLEFT"] = "topLeft";
5
+ placements["BOTTOMRIGHT"] = "bottomRight";
6
+ placements["BOTTOMLEFT"] = "bottomLeft";
7
+ placements["ONLYCONTAINERRIGHT"] = "onlyContainerRight";
8
+ })(placements || (placements = {}));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "1.0.167",
6
+ "version": "1.0.168",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",