@rabbitio/ui-kit 1.0.0-beta.48 → 1.0.0-beta.49
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/.husky/commit-msg +14 -1
- package/coverage/clover.xml +5950 -1573
- package/coverage/coverage-final.json +127 -66
- package/coverage/index.html +395 -65
- package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/index.html +27 -12
- package/coverage/ui-kit/src/common/adapters/qrUtils.js.html +139 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/amountUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/errorUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/ipAddressProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/fiatCurrenciesService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/blockchain.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/coin.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/protocol.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/cache.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/emailAPI.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logger.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logsStorage.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/safeStringify.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/LoadingDots/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/index.html +3 -3
- package/coverage/ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
- package/coverage/ui-kit/src/components/atoms/QrCode/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/index.html +3 -3
- package/coverage/ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +559 -0
- package/coverage/ui-kit/src/components/atoms/Textarea/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/index.html +3 -3
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +325 -0
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/Validation.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useReferredState.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/index.html +3 -3
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +205 -0
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/inputValueProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/uiUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/urlQueryUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +9 -6
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +4 -4
- package/coverage/ui-kit/stories/atoms/LinesOfText.stories.jsx.html +265 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +37 -7
- package/coverage/ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/ui-kit/stories/molecules/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
- package/dist/index.cjs +234 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2887 -26
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +217 -106
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +234 -105
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +237 -107
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -1
- package/src/common/adapters/qrUtils.js +18 -0
- package/src/components/atoms/BackgroundTitle/background-title.module.scss +1 -1
- package/src/components/atoms/QrCode/QrCode.jsx +34 -0
- package/src/components/atoms/QrCode/qr-code.module.scss +9 -0
- package/src/components/atoms/Textarea/Textarea.jsx +158 -0
- package/src/components/atoms/Textarea/textarea.module.scss +63 -0
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +80 -0
- package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +62 -0
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +40 -0
- package/src/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +1 -1
- package/src/index.js +1 -0
- package/styles/_placeholder.scss +1 -1
- package/styles/global-styles-index.scss +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabbitio/ui-kit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.49",
|
|
4
4
|
"description": "Rabbit.io react.js components kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,9 +48,11 @@
|
|
|
48
48
|
"clipboard-copy": "4.0.1",
|
|
49
49
|
"eventbusjs": "0.2.0",
|
|
50
50
|
"jshashes": "1.0.8",
|
|
51
|
+
"qrcode": "1.4.4",
|
|
51
52
|
"react": ">=18.2.0",
|
|
52
53
|
"react-animate-height": "3.2.3",
|
|
53
54
|
"react-dom": ">=18.2.0",
|
|
55
|
+
"react-textarea-autosize": "^8.5.3",
|
|
54
56
|
"react-transition-group": "4.4.5",
|
|
55
57
|
"resize-observer-polyfill": "1.5.1",
|
|
56
58
|
"uuid": "9.0.0"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import QRCode from "qrcode";
|
|
2
|
+
|
|
3
|
+
import { improveAndRethrow } from "../errorUtils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates QR as svg xml string.
|
|
7
|
+
* Note that you should care about the element size by your self - the generated QR will just fill all available space
|
|
8
|
+
*
|
|
9
|
+
* @param encodingString {string} to be encoded as QR-code image
|
|
10
|
+
* @return {Promise<string>} xml string of generated svg image
|
|
11
|
+
*/
|
|
12
|
+
export async function generateQrAndShowInCanvas(encodingString) {
|
|
13
|
+
try {
|
|
14
|
+
return await QRCode.toString(encodingString, { type: "svg" });
|
|
15
|
+
} catch (e) {
|
|
16
|
+
improveAndRethrow(e, "generateQrAndShowInCanvas");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import { logErrorOrOutputToConsole } from "../../../common/errorUtils";
|
|
5
|
+
import { generateQrAndShowInCanvas } from "../../../common/adapters/qrUtils";
|
|
6
|
+
|
|
7
|
+
import s from "./qr-code.module.scss";
|
|
8
|
+
|
|
9
|
+
export const QrCode = ({ address }) => {
|
|
10
|
+
const canvasRef = useRef();
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
(async () => {
|
|
14
|
+
try {
|
|
15
|
+
if (address) {
|
|
16
|
+
canvasRef.current.innerHTML =
|
|
17
|
+
await generateQrAndShowInCanvas(address);
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {
|
|
20
|
+
logErrorOrOutputToConsole(e);
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
}, [address]);
|
|
24
|
+
|
|
25
|
+
return <div className={s["qr-code"]} ref={canvasRef} />;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
QrCode.propTypes = {
|
|
29
|
+
address: PropTypes.string.isRequired,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
QrCode.defaultProps = {
|
|
33
|
+
address: "",
|
|
34
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import TextareaAutosize from "react-textarea-autosize";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
import s from "./textarea.module.scss";
|
|
6
|
+
|
|
7
|
+
import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors";
|
|
8
|
+
import { Validation } from "../Validation/Validation";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A textarea component with optional adaptive height and validation messaging.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} name - The name of the textarea.
|
|
14
|
+
* @param {function} onChange - Handler for change events.
|
|
15
|
+
* @param {string} placeholder - Placeholder text for the textarea.
|
|
16
|
+
* @param {string} alertText - Text for the alert message.
|
|
17
|
+
* @param {string} successAlertText - Text for the success alert message.
|
|
18
|
+
* @param {string} value - Value of the textarea.
|
|
19
|
+
* @param {string} label - Label text for the textarea.
|
|
20
|
+
* @param {string|null} id - ID for the textarea element.
|
|
21
|
+
* @param {boolean} autoFocus - If the textarea should be auto-focused.
|
|
22
|
+
* @param {boolean} fullHeight - If the textarea should be full height.
|
|
23
|
+
* @param {boolean} smallText - If the textarea should use small text styling.
|
|
24
|
+
* @param {boolean} adaptiveHeight - If the textarea should adjust its height based on content.
|
|
25
|
+
* @param {boolean} disabled - If the textarea is disabled.
|
|
26
|
+
* @param {boolean} errorEncountered - If there is an error related to the textarea.
|
|
27
|
+
* @param {boolean} ignoreEnter - If Enter key presses should be ignored.
|
|
28
|
+
*/
|
|
29
|
+
export const Textarea = forwardRef(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
name = "",
|
|
33
|
+
onChange = () => {},
|
|
34
|
+
placeholder = "",
|
|
35
|
+
alertText = "",
|
|
36
|
+
successAlertText = "",
|
|
37
|
+
value = "",
|
|
38
|
+
label = "",
|
|
39
|
+
id = null,
|
|
40
|
+
autoFocus = false,
|
|
41
|
+
fullHeight = false,
|
|
42
|
+
smallText = false,
|
|
43
|
+
adaptiveHeight = false,
|
|
44
|
+
disabled = false,
|
|
45
|
+
errorEncountered = false,
|
|
46
|
+
ignoreEnter = false,
|
|
47
|
+
},
|
|
48
|
+
ref
|
|
49
|
+
) => {
|
|
50
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
51
|
+
|
|
52
|
+
const onChangeProxy = (e) => {
|
|
53
|
+
if (ignoreEnter)
|
|
54
|
+
e.target.value = e.target.value.replace(/(\r\n|\n|\r)/gm, "");
|
|
55
|
+
|
|
56
|
+
if (e.target?.value.indexOf("\n") === -1 || !ignoreEnter)
|
|
57
|
+
onChange(e);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={
|
|
63
|
+
s["textarea"] +
|
|
64
|
+
` ${fullHeight ? " " + s["full-height"] : ""}`
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
{label ? (
|
|
68
|
+
<label htmlFor={id} className={s["input-label"]}>
|
|
69
|
+
{label}
|
|
70
|
+
</label>
|
|
71
|
+
) : null}
|
|
72
|
+
|
|
73
|
+
{adaptiveHeight ? (
|
|
74
|
+
<TextareaAutosize
|
|
75
|
+
className={
|
|
76
|
+
s["textarea-input"] +
|
|
77
|
+
" " +
|
|
78
|
+
s["adaptive-height"] +
|
|
79
|
+
(disabled ? " " + s["disabled"] : "") +
|
|
80
|
+
(errorEncountered
|
|
81
|
+
? " " + s["error-encountered"]
|
|
82
|
+
: "")
|
|
83
|
+
}
|
|
84
|
+
minRows={1}
|
|
85
|
+
maxRows={3}
|
|
86
|
+
onChange={(e) => callHandlingErrors(onChangeProxy, e)}
|
|
87
|
+
placeholder={placeholder}
|
|
88
|
+
value={value}
|
|
89
|
+
id={id}
|
|
90
|
+
autoFocus={autoFocus}
|
|
91
|
+
ref={ref}
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
/>
|
|
94
|
+
) : (
|
|
95
|
+
<textarea
|
|
96
|
+
name={name}
|
|
97
|
+
className={
|
|
98
|
+
s["textarea-input"] +
|
|
99
|
+
` ${fullHeight ? s["full-height"] : ""} ${
|
|
100
|
+
smallText ? s["small-text"] : ""
|
|
101
|
+
} ${disabled ? s["disabled"] : ""}`
|
|
102
|
+
}
|
|
103
|
+
onChange={(e) => callHandlingErrors(onChange, e)}
|
|
104
|
+
placeholder={placeholder}
|
|
105
|
+
value={value}
|
|
106
|
+
id={id}
|
|
107
|
+
autoFocus={autoFocus}
|
|
108
|
+
ref={ref}
|
|
109
|
+
disabled={disabled}
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{alertText || successAlertText ? (
|
|
114
|
+
<Validation
|
|
115
|
+
text={alertText || successAlertText}
|
|
116
|
+
isSuccessAlert={!alertText}
|
|
117
|
+
/>
|
|
118
|
+
) : null}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
Textarea.propTypes = {
|
|
125
|
+
name: PropTypes.string,
|
|
126
|
+
onChange: PropTypes.func,
|
|
127
|
+
placeholder: PropTypes.string,
|
|
128
|
+
alertText: PropTypes.string,
|
|
129
|
+
successAlertText: PropTypes.string,
|
|
130
|
+
value: PropTypes.string,
|
|
131
|
+
label: PropTypes.string,
|
|
132
|
+
id: PropTypes.string,
|
|
133
|
+
autoFocus: PropTypes.bool,
|
|
134
|
+
fullHeight: PropTypes.bool,
|
|
135
|
+
smallText: PropTypes.bool,
|
|
136
|
+
adaptiveHeight: PropTypes.bool,
|
|
137
|
+
disabled: PropTypes.bool,
|
|
138
|
+
errorEncountered: PropTypes.bool,
|
|
139
|
+
ignoreEnter: PropTypes.bool,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
Textarea.defaultProps = {
|
|
143
|
+
name: "",
|
|
144
|
+
onChange: () => {},
|
|
145
|
+
placeholder: "",
|
|
146
|
+
alertText: "",
|
|
147
|
+
successAlertText: "",
|
|
148
|
+
value: "",
|
|
149
|
+
label: "",
|
|
150
|
+
id: null,
|
|
151
|
+
autoFocus: false,
|
|
152
|
+
fullHeight: false,
|
|
153
|
+
smallText: false,
|
|
154
|
+
adaptiveHeight: false,
|
|
155
|
+
disabled: false,
|
|
156
|
+
errorEncountered: false,
|
|
157
|
+
ignoreEnter: false,
|
|
158
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.textarea {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
&.full-height {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-input {
|
|
12
|
+
@extend %text-medium;
|
|
13
|
+
padding: Padding("5");
|
|
14
|
+
border-radius: 7px;
|
|
15
|
+
background: SolidColor("lightsmoke");
|
|
16
|
+
border: none;
|
|
17
|
+
width: 100%;
|
|
18
|
+
resize: none;
|
|
19
|
+
min-height: 117px;
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
color: SolidColor("grey");
|
|
22
|
+
appearance: none;
|
|
23
|
+
transition: 0.2s box-shadow $transitionEaseOut;
|
|
24
|
+
box-shadow: $shadowOutlineStatic;
|
|
25
|
+
|
|
26
|
+
@media (hover: hover) {
|
|
27
|
+
&:hover:not(:focus) {
|
|
28
|
+
box-shadow: $shadowOutlineHover;
|
|
29
|
+
transition: 0.02s box-shadow $transitionEaseOut;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
box-shadow: $shadowOutlineActive;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::placeholder {
|
|
38
|
+
@extend %text-medium;
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
color: SolidColor("grey");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.full-height {
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.adaptive-height {
|
|
48
|
+
min-height: auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.small-text {
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.disabled {
|
|
56
|
+
opacity: 0.5;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.error-encountered {
|
|
60
|
+
box-shadow: $shadowOutlineError !important;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./lines-of-text.module.scss";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders up to three lines of text with configurable options for horizontal layout, text wrapping, and breaking.
|
|
8
|
+
* Optionally, displays a default text content centered vertically if provided.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} firstLineText - Text for the first line.
|
|
11
|
+
* @param {string} secondLineText - Text for the second line.
|
|
12
|
+
* @param {string} thirdLineText - Text for the third line.
|
|
13
|
+
* @param {boolean} isHorizontal - If true, displays the text horizontally.
|
|
14
|
+
* @param {string} defaultTextContent - Default text content to display, centered vertically.
|
|
15
|
+
* @param {boolean} isFirstLineTextReducible - If true, the first line text can be reduced.
|
|
16
|
+
* @param {string} firstLineNotReducibleSuffix - Suffix to append to the first line text if not reducible.
|
|
17
|
+
* @param {boolean} wrapFirstLine - If true, allows the first line text to wrap.
|
|
18
|
+
* @param {boolean} breakFirstLine - If true, allows the first line text to break onto the next line.
|
|
19
|
+
*/
|
|
20
|
+
export const LinesOfText = ({
|
|
21
|
+
firstLineText = "",
|
|
22
|
+
secondLineText = "",
|
|
23
|
+
thirdLineText = "",
|
|
24
|
+
isHorizontal = false,
|
|
25
|
+
defaultTextContent = "",
|
|
26
|
+
isFirstLineTextReducible = false,
|
|
27
|
+
firstLineNotReducibleSuffix = "",
|
|
28
|
+
wrapFirstLine = false,
|
|
29
|
+
breakFirstLine = false,
|
|
30
|
+
}) => {
|
|
31
|
+
return defaultTextContent ? (
|
|
32
|
+
<div className={s["centered-vertically"]}>{defaultTextContent}</div>
|
|
33
|
+
) : (
|
|
34
|
+
<div className={isHorizontal ? s["horizontal"] : ""}>
|
|
35
|
+
<h5 className={s["first-line-text"]}>
|
|
36
|
+
<span
|
|
37
|
+
className={`${
|
|
38
|
+
isFirstLineTextReducible ? s["shorted"] : s["full-text"]
|
|
39
|
+
} ${wrapFirstLine ? " " + s["wrap"] : ""} ${
|
|
40
|
+
breakFirstLine ? " " + s["break"] : ""
|
|
41
|
+
}`}
|
|
42
|
+
>
|
|
43
|
+
{firstLineText}
|
|
44
|
+
</span>
|
|
45
|
+
{`\u00A0${firstLineNotReducibleSuffix}`}
|
|
46
|
+
</h5>
|
|
47
|
+
{isHorizontal ? <div className={s["line"]} /> : null}
|
|
48
|
+
{secondLineText ? (
|
|
49
|
+
<p className={s["second-line-text"]}>{secondLineText}</p>
|
|
50
|
+
) : null}
|
|
51
|
+
{thirdLineText ? (
|
|
52
|
+
<p className={s["second-line-text"]}>{thirdLineText}</p>
|
|
53
|
+
) : null}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
LinesOfText.propTypes = {
|
|
59
|
+
firstLineText: PropTypes.string,
|
|
60
|
+
secondLineText: PropTypes.string,
|
|
61
|
+
thirdLineText: PropTypes.string,
|
|
62
|
+
isHorizontal: PropTypes.bool,
|
|
63
|
+
defaultTextContent: PropTypes.string,
|
|
64
|
+
isFirstLineTextReducible: PropTypes.bool,
|
|
65
|
+
firstLineNotReducibleSuffix: PropTypes.string,
|
|
66
|
+
wrapFirstLine: PropTypes.bool,
|
|
67
|
+
breakFirstLine: PropTypes.bool,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
LinesOfText.defaultProps = {
|
|
71
|
+
firstLineText: "",
|
|
72
|
+
secondLineText: "",
|
|
73
|
+
thirdLineText: "",
|
|
74
|
+
isHorizontal: false,
|
|
75
|
+
defaultTextContent: "",
|
|
76
|
+
isFirstLineTextReducible: false,
|
|
77
|
+
firstLineNotReducibleSuffix: "",
|
|
78
|
+
wrapFirstLine: false,
|
|
79
|
+
breakFirstLine: false,
|
|
80
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.first-line-text {
|
|
4
|
+
display: flex;
|
|
5
|
+
font-weight: $bold;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
// font-family: NunitoSans;
|
|
8
|
+
|
|
9
|
+
.wrap {
|
|
10
|
+
white-space: normal;
|
|
11
|
+
word-wrap: break-word;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.break {
|
|
15
|
+
word-break: break-all;
|
|
16
|
+
white-space: break-spaces;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.full-text {
|
|
20
|
+
width: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: Margin("2");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.shorted {
|
|
27
|
+
word-wrap: unset;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
|
|
32
|
+
@media (max-width: $tablet-width) {
|
|
33
|
+
width: auto;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.horizontal {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
@media (max-width: $phone-width) {
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.line {
|
|
48
|
+
width: 20px;
|
|
49
|
+
margin: 0 Margin("3");
|
|
50
|
+
// font-family: NunitoSans;
|
|
51
|
+
|
|
52
|
+
@media (max-width: $phone-width) {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.second-line-text {
|
|
59
|
+
color: SolidColor("grey");
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
// font-family: NunitoSans;
|
|
62
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./line-with-icon-link.module.scss";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a line with text and an accompanying icon that serves as a link.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} props - Component props.
|
|
10
|
+
* @param {string} props.text - Text to be displayed.
|
|
11
|
+
* @param {string} props.icon - URL of the icon image.
|
|
12
|
+
* @param {string} props.url - Target URL that the icon link points to.
|
|
13
|
+
*/
|
|
14
|
+
export const LineWithIconLink = ({ text, icon, url }) => {
|
|
15
|
+
return (
|
|
16
|
+
<div className={s["line-with-icon-link"]}>
|
|
17
|
+
<h5 className={s["line-with-icon-link-text"]}>{text}</h5>
|
|
18
|
+
<a
|
|
19
|
+
href={url}
|
|
20
|
+
target="_blank"
|
|
21
|
+
rel="noopener noreferrer"
|
|
22
|
+
className={"line-with-icon-link-icon"}
|
|
23
|
+
>
|
|
24
|
+
<img src={icon} alt="Link Icon" />
|
|
25
|
+
</a>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
LineWithIconLink.propTypes = {
|
|
31
|
+
text: PropTypes.string.isRequired,
|
|
32
|
+
icon: PropTypes.string.isRequired,
|
|
33
|
+
url: PropTypes.string.isRequired,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
LineWithIconLink.defaultProps = {
|
|
37
|
+
text: "",
|
|
38
|
+
icon: "",
|
|
39
|
+
url: "",
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.line-with-icon-link {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
// font-family: NunitoSans;
|
|
7
|
+
|
|
8
|
+
&-text {
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
font-weight: $bold;
|
|
13
|
+
margin-right: Margin("4");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-icon {
|
|
17
|
+
@extend %hover-state;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
|
|
21
|
+
img {
|
|
22
|
+
width: 24px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { NoticeIcon } from "./components/atoms/NoticeIcon/NoticeIcon.jsx";
|
|
|
22
22
|
export { TitleBox } from "./components/atoms/TitleBox/TitleBox.jsx";
|
|
23
23
|
export { AmountInput } from "./components/molecules/AmountInput/AmountInput.jsx";
|
|
24
24
|
export { SwapForm } from "./components/organisms/SwapForm/SwapForm.jsx";
|
|
25
|
+
export { Textarea } from "./components/atoms/Textarea/Textarea.jsx";
|
|
25
26
|
|
|
26
27
|
export { useCallHandlingErrors } from "./components/hooks/useCallHandlingErrors.js";
|
|
27
28
|
export { useReferredState } from "./components/hooks/useReferredState.js";
|
package/styles/_placeholder.scss
CHANGED