@stokr/components-library 2.3.48 → 2.3.50
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/components/InfoIcon/InfoIcon.js +4 -2
- package/dist/components/Input/Select.js +2 -2
- package/dist/components/Input/Select.stories.js +1 -0
- package/dist/utils/copyToClipboard.js +34 -3
- package/dist/utils/formatCurrencyValue.js +8 -2
- package/dist/utils/scrollUtils.js +17 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _reactTippy = require("react-tippy");
|
|
10
10
|
var _InfoIcon = require("./InfoIcon.styles");
|
|
11
|
-
var _excluded = ["title", "html", "position", "noMargin", "noMarginLeft", "noMarginRight", "noIcon", "disabled", "fullWidth"];
|
|
11
|
+
var _excluded = ["title", "html", "position", "noMargin", "noMarginLeft", "noMarginRight", "noIcon", "disabled", "fullWidth", "containerStyle"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -22,12 +22,14 @@ var InfoIcon = function InfoIcon(_ref) {
|
|
|
22
22
|
noIcon = _ref.noIcon,
|
|
23
23
|
disabled = _ref.disabled,
|
|
24
24
|
fullWidth = _ref.fullWidth,
|
|
25
|
+
containerStyle = _ref.containerStyle,
|
|
25
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
27
|
return /*#__PURE__*/_react.default.createElement(_InfoIcon.Container, {
|
|
27
28
|
noMargin: noMargin,
|
|
28
29
|
noMarginLeft: noMarginLeft,
|
|
29
30
|
noMarginRight: noMarginRight,
|
|
30
|
-
fullWidth: fullWidth
|
|
31
|
+
fullWidth: fullWidth,
|
|
32
|
+
style: containerStyle
|
|
31
33
|
}, /*#__PURE__*/_react.default.createElement(_reactTippy.Tooltip, {
|
|
32
34
|
position: position,
|
|
33
35
|
title: title,
|
|
@@ -106,7 +106,7 @@ var Select = function Select(props) {
|
|
|
106
106
|
active: hasFocus,
|
|
107
107
|
error: error && touched,
|
|
108
108
|
htmlFor: id
|
|
109
|
-
}, label), /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
109
|
+
}, label), /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({}, otherProps, {
|
|
110
110
|
id: id,
|
|
111
111
|
name: name,
|
|
112
112
|
options: options,
|
|
@@ -153,7 +153,7 @@ var Select = function Select(props) {
|
|
|
153
153
|
IndicatorSeparator: null,
|
|
154
154
|
MenuList: SelectMenuListWithScroll
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
})));
|
|
157
157
|
};
|
|
158
158
|
exports.Select = Select;
|
|
159
159
|
Select.propTypes = {
|
|
@@ -4,6 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.CopyToClipBoardTooltip = void 0;
|
|
7
8
|
Object.defineProperty(exports, "CopyToClipboard", {
|
|
8
9
|
enumerable: true,
|
|
9
10
|
get: function get() {
|
|
@@ -11,9 +12,12 @@ Object.defineProperty(exports, "CopyToClipboard", {
|
|
|
11
12
|
}
|
|
12
13
|
});
|
|
13
14
|
exports.withCopyToClipboard = exports.useCopyToClipboard = exports.copyTextToClipboard = void 0;
|
|
14
|
-
var _react =
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _reactCopyToClipboard = require("react-copy-to-clipboard");
|
|
16
|
-
|
|
17
|
+
var _reactTippy = require("react-tippy");
|
|
18
|
+
var _CryptoAddress = require("../components/CryptoAddress/CryptoAddress.styles");
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
22
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -168,6 +172,33 @@ var useCopyToClipboard = function useCopyToClipboard(text) {
|
|
|
168
172
|
copied: copied
|
|
169
173
|
};
|
|
170
174
|
};
|
|
175
|
+
exports.useCopyToClipboard = useCopyToClipboard;
|
|
176
|
+
var CopyToClipBoardTooltip = function CopyToClipBoardTooltip(_ref3) {
|
|
177
|
+
var value = _ref3.value,
|
|
178
|
+
buttonStyle = _ref3.buttonStyle;
|
|
179
|
+
var _useState = (0, _react.useState)(false),
|
|
180
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
181
|
+
copied = _useState2[0],
|
|
182
|
+
setCopied = _useState2[1];
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement(_reactTippy.Tooltip, {
|
|
184
|
+
position: "top",
|
|
185
|
+
title: copied ? 'Copied to clipboard!' : 'Click to copy to clipboard',
|
|
186
|
+
theme: "light",
|
|
187
|
+
arrow: true,
|
|
188
|
+
hideOnClick: false,
|
|
189
|
+
onHidden: function onHidden() {
|
|
190
|
+
return setCopied(false);
|
|
191
|
+
},
|
|
192
|
+
duration: 200
|
|
193
|
+
}, /*#__PURE__*/_react.default.createElement(_reactCopyToClipboard.CopyToClipboard, {
|
|
194
|
+
text: value,
|
|
195
|
+
onCopy: function onCopy() {
|
|
196
|
+
return setCopied(true);
|
|
197
|
+
}
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(_CryptoAddress.CopyToClipboardButton, {
|
|
199
|
+
style: buttonStyle
|
|
200
|
+
})));
|
|
201
|
+
};
|
|
171
202
|
|
|
172
203
|
// Export the original CopyToClipboard component for direct use if needed
|
|
173
|
-
exports.
|
|
204
|
+
exports.CopyToClipBoardTooltip = CopyToClipBoardTooltip;
|
|
@@ -28,7 +28,10 @@ var formatCurrencyValue = function formatCurrencyValue(currency, value) {
|
|
|
28
28
|
lusdt: ['USDT', 2],
|
|
29
29
|
'bitcoin-private': ['EUR', 2],
|
|
30
30
|
'lbtc-private': ['BTC', 8],
|
|
31
|
-
bmn1: ['BMN1', 2]
|
|
31
|
+
bmn1: ['BMN1', 2],
|
|
32
|
+
'btc-fb': ['BTC', 8],
|
|
33
|
+
'usdc-fb': ['USDC', 2],
|
|
34
|
+
'usdq-fb': ['USDQ', 2]
|
|
32
35
|
}[currency] || [currency, tokenDecimals],
|
|
33
36
|
_ref2 = _slicedToArray(_ref, 2),
|
|
34
37
|
symbol = _ref2[0],
|
|
@@ -49,7 +52,10 @@ var getCurrencySymbol = function getCurrencySymbol(currencySelected) {
|
|
|
49
52
|
'lusdt-bfx': 'USDT',
|
|
50
53
|
'lbtc-bfx': 'LBTC',
|
|
51
54
|
'btc-bfx': 'BTC',
|
|
52
|
-
bmn1: 'BMN1'
|
|
55
|
+
bmn1: 'BMN1',
|
|
56
|
+
'btc-fb': 'BTC',
|
|
57
|
+
'usdc-fb': 'USDC',
|
|
58
|
+
'usdq-fb': 'USDQ'
|
|
53
59
|
}[currencySelected] || currencySelected;
|
|
54
60
|
};
|
|
55
61
|
exports.getCurrencySymbol = getCurrencySymbol;
|
|
@@ -4,8 +4,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.scrollToElement = exports.default = void 0;
|
|
7
|
+
exports.useScrollActions = exports.scrollToElement = exports.default = exports.ScrollToTop = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
12
|
/**
|
|
@@ -121,5 +122,20 @@ var useScrollActions = function useScrollActions() {
|
|
|
121
122
|
scrollToElementWithOffset: scrollToElementWithOffset
|
|
122
123
|
};
|
|
123
124
|
};
|
|
125
|
+
exports.useScrollActions = useScrollActions;
|
|
126
|
+
var ScrollToTop = function ScrollToTop() {
|
|
127
|
+
var _useLocation = (0, _reactRouterDom.useLocation)(),
|
|
128
|
+
pathname = _useLocation.pathname;
|
|
129
|
+
(0, _react.useEffect)(function () {
|
|
130
|
+
// Reset scroll position on route change
|
|
131
|
+
window.scrollTo({
|
|
132
|
+
top: 0,
|
|
133
|
+
left: 0,
|
|
134
|
+
behavior: 'smooth'
|
|
135
|
+
});
|
|
136
|
+
}, [pathname]);
|
|
137
|
+
return null;
|
|
138
|
+
};
|
|
139
|
+
exports.ScrollToTop = ScrollToTop;
|
|
124
140
|
var _default = useScrollActions;
|
|
125
141
|
exports.default = _default;
|