@stokr/components-library 2.3.65-beta.1 → 2.3.65-beta.11
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/2FA/main-flow.js +28 -7
- package/dist/components/AdminDashboard/Table/ReactTable.js +123 -7
- package/dist/components/Chips/Chip.js +1 -2
- package/dist/components/Chips/Chip.styles.js +3 -2
- package/dist/components/Input/Input.js +33 -33
- package/dist/components/Input/MultiSelect.js +319 -0
- package/dist/components/Input/SearchInput.js +78 -0
- package/dist/components/Input/SearchInput.styles.js +25 -0
- package/dist/components/Input/Select.js +51 -28
- package/dist/components/Modal/SideModal.js +82 -0
- package/dist/components/Modal/SideModal.styles.js +21 -0
- package/dist/components/Payment/PaymentDetailsCard.js +189 -0
- package/dist/components/Payment/PaymentDisplay.js +2 -12
- package/dist/components/ProfileBox/ProfileBox.js +2 -1
- package/dist/components/Snackbar/Snackbar.js +193 -0
- package/dist/components/Snackbar/Snackbar.styles.js +97 -0
- package/dist/components/Snackbar/SnackbarProvider.js +81 -0
- package/dist/components/Snackbar/index.js +32 -0
- package/dist/components/Snackbar/useSnackbar.js +43 -0
- package/dist/components/StatusTag/StatusTag.js +175 -0
- package/dist/components/StatusTag/StatusTag.styles.js +37 -0
- package/dist/components/StepsProgress/StepIndicator.js +59 -0
- package/dist/components/StepsProgress/StepIndicator.styles.js +30 -0
- package/dist/components/TextLink/TextLink.styles.js +1 -1
- package/dist/components/Timeline/TimelineStep.js +2 -2
- package/dist/constants/globalVariables.js +41 -2
- package/dist/context/Checkbox/CheckboxContext.js +0 -1
- package/dist/index.js +66 -0
- package/dist/static/images/bmn2-logo.svg +9 -0
- package/dist/static/images/document-icon.svg +3 -0
- package/dist/static/images/plus-icon.svg +4 -0
- package/dist/static/images/search-icon.svg +3 -0
- package/dist/static/images/sent-icon.svg +10 -0
- package/dist/static/images/transfer-icon.svg +10 -0
- package/dist/utils/formatCurrencyValue.js +43 -3
- package/package.json +3 -2
- package/dist/components/2FA/EnterCode.stories.js +0 -35
- package/dist/components/2FA/disable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/enable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/login-with-otp-flow.stories.js +0 -31
- package/dist/components/2FA/main-flow.stories.js +0 -33
- package/dist/components/AccountBalance/AccountBalance.stories.js +0 -83
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +0 -406
- package/dist/components/AgreementItem/AgreementItem.stories.js +0 -105
- package/dist/components/AnalyticGraphs/Analytic.js +0 -541
- package/dist/components/AnalyticGraphs/Analytic.styles.js +0 -25
- package/dist/components/BackButton/BackButton.stories.js +0 -32
- package/dist/components/Background/Background.stories.js +0 -75
- package/dist/components/BarChart/BarChart.js +0 -263
- package/dist/components/BarChart/BarChart.stories.js +0 -66
- package/dist/components/BarChart/BarChart.styles.js +0 -26
- package/dist/components/BarChartLegend/BarChartLegend.js +0 -79
- package/dist/components/BarChartLegend/BarChartLegend.styles.js +0 -21
- package/dist/components/BasicTable/BasicTable.stories.js +0 -59
- package/dist/components/BlogPost/BlogPost.stories.js +0 -160
- package/dist/components/Button/Button.stories.js +0 -146
- package/dist/components/Button/GlareButton.stories.js +0 -132
- package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +0 -42
- package/dist/components/ChartBox/ChartBox.js +0 -41
- package/dist/components/ChartBox/ChartBox.stories.js +0 -17
- package/dist/components/ChartBox/ChartBox.styles.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.stories.js +0 -18
- package/dist/components/ChartLegend/ChartLegend.stories.js +0 -90
- package/dist/components/Checkbox/Checkbox.stories.js +0 -88
- package/dist/components/Checklist/ChecklistCard.stories.js +0 -102
- package/dist/components/Checklist/UserChecklist.js +0 -184
- package/dist/components/Checklist/UserChecklist.stories.js +0 -317
- package/dist/components/Chips/Chip.stories.js +0 -36
- package/dist/components/Chips/ChipsWrapper.stories.js +0 -47
- package/dist/components/ComponentScroll/ComponentScroll.stories.js +0 -111
- package/dist/components/CryptoAddress/CryptoAddress.stories.js +0 -205
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +0 -70
- package/dist/components/DonutChart/DonutChart.stories.js +0 -54
- package/dist/components/FAQ/FAQ.stories.js +0 -76
- package/dist/components/Footer/Footer.stories.js +0 -49
- package/dist/components/Footer/FooterLayout.stories.js +0 -26
- package/dist/components/Footer/FooterMenu.stories.js +0 -113
- package/dist/components/Footer/mangopay.png +0 -0
- package/dist/components/Footer/mangopay.svg +0 -20
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +0 -69
- package/dist/components/Form/Form.stories.js +0 -32
- package/dist/components/FullscreenCard/FullscreenCard.styles.js +0 -27
- package/dist/components/Header/Header.stories.js +0 -192
- package/dist/components/InfoIcon/InfoIcon.stories.js +0 -299
- package/dist/components/InfoPanel/InfoPanel.js +0 -124
- package/dist/components/Input/DatePickerInput.stories.js +0 -87
- package/dist/components/Input/Input.stories.js +0 -142
- package/dist/components/Input/InputPassword.stories.js +0 -80
- package/dist/components/Input/InputWithButton.stories.js +0 -75
- package/dist/components/Input/OtpInput.stories.js +0 -57
- package/dist/components/Input/RangeInput.stories.js +0 -58
- package/dist/components/Input/Select.stories.js +0 -139
- package/dist/components/InvestCalculator/InvestCalculator.stories.js +0 -135
- package/dist/components/InvestmentStat/InvestmentStat.stories.js +0 -52
- package/dist/components/KYCFlow/BasicInfo.js +0 -448
- package/dist/components/KYCFlow/Confirmation.js +0 -46
- package/dist/components/KYCFlow/DocumentFileUpload.js +0 -263
- package/dist/components/KYCFlow/DocumentScan.js +0 -75
- package/dist/components/KYCFlow/DocumentScanUpload.js +0 -251
- package/dist/components/KYCFlow/DocumentSelect.js +0 -118
- package/dist/components/KYCFlow/DocumentSuccess.js +0 -63
- package/dist/components/KYCFlow/DocumentUpload.js +0 -53
- package/dist/components/KYCFlow/DocumentVerificationType.js +0 -131
- package/dist/components/KYCFlow/FaceScan.js +0 -54
- package/dist/components/KYCFlow/FaceScanRecognition.js +0 -61
- package/dist/components/KYCFlow/FaceScanSuccess.js +0 -56
- package/dist/components/KYCFlow/Terms.js +0 -119
- package/dist/components/KYCFlow/_styles.js +0 -111
- package/dist/components/KYCFlow/index.js +0 -97
- package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +0 -29
- package/dist/components/LatestUpdate/LatestUpdate.stories.js +0 -58
- package/dist/components/Layout/Layout.stories.js +0 -60
- package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +0 -66
- package/dist/components/LearnMorePage/LearnMore.stories.js +0 -48
- package/dist/components/LearnMorePage/LearnMoreItem.stories.js +0 -62
- package/dist/components/LearnMoreSection/LearnMore.stories.js +0 -30
- package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +0 -59
- package/dist/components/LoginModal/LoginModal.stories.js +0 -74
- package/dist/components/MatomoConnect/Matomo.js +0 -228
- package/dist/components/MatomoConnect/Matomo_fuckup.js +0 -387
- package/dist/components/Modal/Modal.stories.js +0 -75
- package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +0 -150
- package/dist/components/Modal/PaymentModal.stories.js +0 -57
- package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +0 -67
- package/dist/components/Newsletter/Newsletter.stories.js +0 -16
- package/dist/components/NotificationContext/NotificationContext.js +0 -141
- package/dist/components/Number/Number.stories.js +0 -92
- package/dist/components/Pagination/Pagination.stories.js +0 -83
- package/dist/components/Pagination/PaginationControls.stories.js +0 -112
- package/dist/components/Payment/PaymentDisplay.stories.js +0 -302
- package/dist/components/Payment/TimerComponent.stories.js +0 -236
- package/dist/components/Process/Process.stories.js +0 -42
- package/dist/components/ProfileBadge/ProfileBadge.stories.js +0 -45
- package/dist/components/ProfileBox/ProfileBox.stories.js +0 -35
- package/dist/components/ProfileHeader/ProfileHeader.js +0 -252
- package/dist/components/ProfileHeader/ProfileHeader.styles.js +0 -65
- package/dist/components/ProfileStat/ProfileStat.stories.js +0 -66
- package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +0 -53
- package/dist/components/QRCode/QRCode.stories.js +0 -104
- package/dist/components/Radio/Radio.stories.js +0 -73
- package/dist/components/RefreshButton/RefreshButton.stories.js +0 -38
- package/dist/components/RegisterAlgorand/AlgoAddressName.js +0 -138
- package/dist/components/RegisterAlgorand/AlgoAdressSelect.js +0 -443
- package/dist/components/RegisterAlgorand/AlgoConnectWallet.js +0 -47
- package/dist/components/RegisterAlgorand/AlgoSuccess.js +0 -38
- package/dist/components/RegisterAlgorand/Algorand.stories.js +0 -80
- package/dist/components/RegisterAlgorand/ChooseWallet.js +0 -97
- package/dist/components/RegisterAlgorand/SelectProject.js +0 -89
- package/dist/components/RegisterAlgorand/_styles.js +0 -28
- package/dist/components/RegisterAlgorand/flow.js +0 -409
- package/dist/components/RegisterAlgorand/flowWithMemo.js +0 -410
- package/dist/components/RegisterAlgorand/index.js +0 -48
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +0 -41
- package/dist/components/RegisterEthereum/EthAddressLedger.js +0 -226
- package/dist/components/RegisterEthereum/EthAddressMetamask.js +0 -204
- package/dist/components/RegisterEthereum/EthAddressName.js +0 -135
- package/dist/components/RegisterEthereum/EthConnectLedger.js +0 -194
- package/dist/components/RegisterEthereum/EthConnectMetamask.js +0 -35
- package/dist/components/RegisterEthereum/EthFinish.js +0 -41
- package/dist/components/RegisterEthereum/EthIntro.js +0 -95
- package/dist/components/RegisterEthereum/_styles.js +0 -28
- package/dist/components/RegisterEthereum/index.js +0 -68
- package/dist/components/RegisterModal/RegisterModal.stories.js +0 -49
- package/dist/components/RequestDataBox/RequestDataBox.stories.js +0 -37
- package/dist/components/RiskQuestionnaire/RiskQuestionnaireContext.js +0 -185
- package/dist/components/RiskQuestionnaire/_styles.js +0 -15
- package/dist/components/SEO/SEO.stories.js +0 -60
- package/dist/components/SideLine/SideLine.stories.js +0 -28
- package/dist/components/SigningSubflow/SignSubAddressMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubConnectLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubConnectMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubIntro.js +0 -55
- package/dist/components/SigningSubflow/SignSubSendLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubSendMetamask.js +0 -62
- package/dist/components/SigningSubflow/SignSubTransactionLedger.js +0 -161
- package/dist/components/SigningSubflow/SignSubTransactionMetamask.js +0 -166
- package/dist/components/SigningSubflow/_styles.js +0 -34
- package/dist/components/SigningSubflow/index.js +0 -32
- package/dist/components/Slider/Slider.stories.js +0 -68
- package/dist/components/StepController/StepController.stories.js +0 -60
- package/dist/components/StepController/StepControllerProgress.stories.js +0 -49
- package/dist/components/StepsProgress/StepsProgress.stories.js +0 -49
- package/dist/components/Switch/Switch.stories.js +0 -81
- package/dist/components/Tabs/Tabs.stories.js +0 -36
- package/dist/components/TabsNav/TabNav.stories.js +0 -40
- package/dist/components/TabsNav/TabsNav.stories.js +0 -37
- package/dist/components/TeamOverview/TeamOverview.stories.js +0 -76
- package/dist/components/TermsModal/TermsModal.stories.js +0 -31
- package/dist/components/Text/Headline.stories.js +0 -48
- package/dist/components/Text/Text.stories.js +0 -70
- package/dist/components/Timeline/Timeline.stories.js +0 -393
- package/dist/components/ToDoList/ToDoList.stories.js +0 -133
- package/dist/components/ToDoList/ToDoListTask.stories.js +0 -70
- package/dist/components/TransactionDetails/TransactionDetails.stories.js +0 -55
- package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +0 -305
- package/dist/components/TransactionInfo/TransactionInfo.stories.js +0 -61
- package/dist/components/TwoFactorModal/TwoFactorModal.js +0 -100
- package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +0 -59
- package/dist/components/headerHo/HeaderHo.stories.js +0 -35
- package/dist/components/icons/Arrow.stories.js +0 -42
- package/dist/components/icons/ArrowSimple.stories.js +0 -48
- package/dist/components/icons/Check.stories.js +0 -22
- package/dist/components/icons/Facebook.stories.js +0 -21
- package/dist/components/icons/Facebook_Logo.png +0 -0
- package/dist/components/icons/Info.stories.js +0 -16
- package/dist/components/icons/Instagram.stories.js +0 -21
- package/dist/components/icons/LI-In-Bug.png +0 -0
- package/dist/components/icons/LinkIcon.stories.js +0 -21
- package/dist/components/icons/LinkedIn.stories.js +0 -16
- package/dist/components/icons/Medium.stories.js +0 -16
- package/dist/components/icons/Reddit.stories.js +0 -21
- package/dist/components/icons/Share.stories.js +0 -16
- package/dist/components/icons/Telegram-Logo.png +0 -0
- package/dist/components/icons/Telegram.stories.js +0 -16
- package/dist/components/icons/Twitter.stories.js +0 -21
- package/dist/components/icons/X-logo-black.png +0 -0
- package/dist/components/icons/X.stories.js +0 -16
- package/dist/components/icons/Youtube.stories.js +0 -21
- package/dist/components/icons/youtube_social_circle_red.png +0 -0
- package/dist/components/taxId/TaxId.stories.js +0 -50
- package/dist/components/video/Video.stories.js +0 -52
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.PaymentDetailsCard = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
10
|
+
var _InfoIcon = require("../InfoIcon/InfoIcon");
|
|
11
|
+
var _formatCurrencyValue = require("../../utils/formatCurrencyValue");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const CardContainer = _styledComponents.default.div.withConfig({
|
|
14
|
+
displayName: "PaymentDetailsCard__CardContainer",
|
|
15
|
+
componentId: "sc-e830fo-0"
|
|
16
|
+
})(["background:", ";border-radius:15px;border:1px solid ", ";padding:20px 32px;"], _colors.default.white, _colors.default.lightGrey);
|
|
17
|
+
const CardTitle = _styledComponents.default.div.withConfig({
|
|
18
|
+
displayName: "PaymentDetailsCard__CardTitle",
|
|
19
|
+
componentId: "sc-e830fo-1"
|
|
20
|
+
})(["font-size:16px;font-weight:600;margin-bottom:20px;color:", ";"], _colors.default.black);
|
|
21
|
+
const AmountSection = _styledComponents.default.div.withConfig({
|
|
22
|
+
displayName: "PaymentDetailsCard__AmountSection",
|
|
23
|
+
componentId: "sc-e830fo-2"
|
|
24
|
+
})([""]);
|
|
25
|
+
const AmountLabel = _styledComponents.default.div.withConfig({
|
|
26
|
+
displayName: "PaymentDetailsCard__AmountLabel",
|
|
27
|
+
componentId: "sc-e830fo-3"
|
|
28
|
+
})(["font-size:14px;font-weight:300;line-height:20px;letter-spacing:0.08px;margin-bottom:12px;color:", ";"], _colors.default.grey2);
|
|
29
|
+
const AmountDisplay = _styledComponents.default.div.withConfig({
|
|
30
|
+
displayName: "PaymentDetailsCard__AmountDisplay",
|
|
31
|
+
componentId: "sc-e830fo-4"
|
|
32
|
+
})(["display:flex;align-items:center;gap:16px;"]);
|
|
33
|
+
const CurrencyLogo = _styledComponents.default.div.withConfig({
|
|
34
|
+
displayName: "PaymentDetailsCard__CurrencyLogo",
|
|
35
|
+
componentId: "sc-e830fo-5"
|
|
36
|
+
})(["width:32px;height:32px;border-radius:50%;background-color:", ";display:flex;align-items:center;justify-content:center;flex-shrink:0;color:", ";font-size:14px;font-weight:600;overflow:hidden;"], props => props.color || _colors.default.black, _colors.default.white);
|
|
37
|
+
const CurrencyIcon = _styledComponents.default.img.withConfig({
|
|
38
|
+
displayName: "PaymentDetailsCard__CurrencyIcon",
|
|
39
|
+
componentId: "sc-e830fo-6"
|
|
40
|
+
})(["width:100%;height:100%;object-fit:contain;"]);
|
|
41
|
+
const AmountValue = _styledComponents.default.div.withConfig({
|
|
42
|
+
displayName: "PaymentDetailsCard__AmountValue",
|
|
43
|
+
componentId: "sc-e830fo-7"
|
|
44
|
+
})(["font-size:34px;font-weight:800;text-transform:uppercase;line-height:40px;letter-spacing:1.5px;word-wrap:break-word;"]);
|
|
45
|
+
const Separator = _styledComponents.default.hr.withConfig({
|
|
46
|
+
displayName: "PaymentDetailsCard__Separator",
|
|
47
|
+
componentId: "sc-e830fo-8"
|
|
48
|
+
})(["border:none;border-top:1px solid ", ";margin:20px -32px;"], _colors.default.lightGrey);
|
|
49
|
+
const DetailsSection = _styledComponents.default.div.withConfig({
|
|
50
|
+
displayName: "PaymentDetailsCard__DetailsSection",
|
|
51
|
+
componentId: "sc-e830fo-9"
|
|
52
|
+
})(["margin-bottom:", ";"], props => props.noMargin ? '0' : '24px');
|
|
53
|
+
const DetailRow = _styledComponents.default.div.withConfig({
|
|
54
|
+
displayName: "PaymentDetailsCard__DetailRow",
|
|
55
|
+
componentId: "sc-e830fo-10"
|
|
56
|
+
})(["display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px;&:last-child{margin-bottom:0;}"]);
|
|
57
|
+
const DetailLabel = _styledComponents.default.div.withConfig({
|
|
58
|
+
displayName: "PaymentDetailsCard__DetailLabel",
|
|
59
|
+
componentId: "sc-e830fo-11"
|
|
60
|
+
})(["display:flex;align-items:center;gap:10px;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0.1px;"]);
|
|
61
|
+
const DetailValue = _styledComponents.default.div.withConfig({
|
|
62
|
+
displayName: "PaymentDetailsCard__DetailValue",
|
|
63
|
+
componentId: "sc-e830fo-12"
|
|
64
|
+
})(["font-size:16px;font-weight:700;line-height:24px;letter-spacing:0.1px;word-wrap:break-word;text-align:right;max-width:60%;color:", ";"], _colors.default.black);
|
|
65
|
+
const PlaceholderValue = _styledComponents.default.span.withConfig({
|
|
66
|
+
displayName: "PaymentDetailsCard__PlaceholderValue",
|
|
67
|
+
componentId: "sc-e830fo-13"
|
|
68
|
+
})(["color:", ";font-weight:400;"], _colors.default.grey2);
|
|
69
|
+
const InfoSectionContainer = _styledComponents.default.div.withConfig({
|
|
70
|
+
displayName: "PaymentDetailsCard__InfoSectionContainer",
|
|
71
|
+
componentId: "sc-e830fo-14"
|
|
72
|
+
})(["margin-top:24px;"]);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Renders a single detail row
|
|
76
|
+
*/
|
|
77
|
+
const DetailItem = _ref => {
|
|
78
|
+
let {
|
|
79
|
+
label,
|
|
80
|
+
value,
|
|
81
|
+
tooltip,
|
|
82
|
+
placeholder,
|
|
83
|
+
isCustom
|
|
84
|
+
} = _ref;
|
|
85
|
+
// If value is a custom component (React element), render it directly
|
|
86
|
+
const renderValue = () => {
|
|
87
|
+
if (isCustom && value) {
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
if (placeholder) {
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(PlaceholderValue, null, placeholder);
|
|
95
|
+
}
|
|
96
|
+
return /*#__PURE__*/_react.default.createElement(PlaceholderValue, null, "-");
|
|
97
|
+
};
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(DetailRow, null, /*#__PURE__*/_react.default.createElement(DetailLabel, null, label, tooltip && /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
|
|
99
|
+
containerStyle: {
|
|
100
|
+
width: 14,
|
|
101
|
+
height: 14
|
|
102
|
+
},
|
|
103
|
+
title: tooltip,
|
|
104
|
+
noMargin: true
|
|
105
|
+
})), /*#__PURE__*/_react.default.createElement(DetailValue, null, renderValue()));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* PaymentDetailsCard - Fully customizable details card
|
|
110
|
+
*
|
|
111
|
+
* @param {string} title - Optional card title
|
|
112
|
+
* @param {object|node} amountSection - Amount section config or custom node
|
|
113
|
+
* - If object: { label, amount, currency, currencyColor, icon }
|
|
114
|
+
* - If node: renders custom component
|
|
115
|
+
* @param {array} details - Array of detail items
|
|
116
|
+
* - { label, value (string|node), tooltip, placeholder, isCustom }
|
|
117
|
+
* @param {node} infoSection - Optional custom node for bottom info section
|
|
118
|
+
* @param {boolean} showSeparators - Whether to show separators between sections
|
|
119
|
+
*/
|
|
120
|
+
const PaymentDetailsCard = _ref2 => {
|
|
121
|
+
let {
|
|
122
|
+
title,
|
|
123
|
+
amountSection,
|
|
124
|
+
details,
|
|
125
|
+
infoSection,
|
|
126
|
+
showSeparators = true
|
|
127
|
+
} = _ref2;
|
|
128
|
+
// Render amount section
|
|
129
|
+
const renderAmountSection = () => {
|
|
130
|
+
if (!amountSection) return null;
|
|
131
|
+
|
|
132
|
+
// If it's a React element, render it directly
|
|
133
|
+
if (/*#__PURE__*/_react.default.isValidElement(amountSection)) {
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, amountSection, showSeparators && /*#__PURE__*/_react.default.createElement(Separator, null));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Otherwise, render the default amount layout
|
|
138
|
+
const {
|
|
139
|
+
label = 'Amount',
|
|
140
|
+
amount,
|
|
141
|
+
currency,
|
|
142
|
+
currencyColor,
|
|
143
|
+
icon
|
|
144
|
+
} = amountSection;
|
|
145
|
+
const displayAmount = (0, _formatCurrencyValue.formatCurrencyValue)(currency, amount, 2, {
|
|
146
|
+
valueFirst: true
|
|
147
|
+
});
|
|
148
|
+
const currencyIcon = (0, _formatCurrencyValue.getCurrencyIcon)(currency, icon);
|
|
149
|
+
const logoColor = currencyColor || _colors.default.black;
|
|
150
|
+
const renderCurrencyLogo = () => {
|
|
151
|
+
if (currencyIcon) {
|
|
152
|
+
return /*#__PURE__*/_react.default.createElement(CurrencyLogo, {
|
|
153
|
+
color: 'transparent'
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(CurrencyIcon, {
|
|
155
|
+
src: currencyIcon,
|
|
156
|
+
alt: currency || 'currency'
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement(CurrencyLogo, {
|
|
160
|
+
color: logoColor
|
|
161
|
+
}, currency ? currency.charAt(0).toUpperCase() : '?');
|
|
162
|
+
};
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(AmountSection, null, /*#__PURE__*/_react.default.createElement(AmountLabel, null, label), /*#__PURE__*/_react.default.createElement(AmountDisplay, null, renderCurrencyLogo(), /*#__PURE__*/_react.default.createElement(AmountValue, null, displayAmount))), showSeparators && /*#__PURE__*/_react.default.createElement(Separator, null));
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// Render details section
|
|
167
|
+
const renderDetailsSection = () => {
|
|
168
|
+
if (!details || details.length === 0) return null;
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement(DetailsSection, {
|
|
170
|
+
noMargin: !infoSection
|
|
171
|
+
}, details.map((detail, index) => /*#__PURE__*/_react.default.createElement(DetailItem, {
|
|
172
|
+
key: detail.key || index,
|
|
173
|
+
label: detail.label,
|
|
174
|
+
value: detail.value,
|
|
175
|
+
tooltip: detail.tooltip,
|
|
176
|
+
placeholder: detail.placeholder,
|
|
177
|
+
isCustom: detail.isCustom
|
|
178
|
+
})));
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Render info section
|
|
182
|
+
const renderInfoSection = () => {
|
|
183
|
+
if (!infoSection) return null;
|
|
184
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showSeparators && /*#__PURE__*/_react.default.createElement(Separator, null), /*#__PURE__*/_react.default.createElement(InfoSectionContainer, null, infoSection));
|
|
185
|
+
};
|
|
186
|
+
return /*#__PURE__*/_react.default.createElement(CardContainer, null, title && /*#__PURE__*/_react.default.createElement(CardTitle, null, title), renderAmountSection(), renderDetailsSection(), renderInfoSection());
|
|
187
|
+
};
|
|
188
|
+
exports.PaymentDetailsCard = PaymentDetailsCard;
|
|
189
|
+
var _default = exports.default = PaymentDetailsCard;
|
|
@@ -16,9 +16,7 @@ var _SectionTitle = require("../SectionTitle/SectionTitle.styles");
|
|
|
16
16
|
var _reactTippy = require("react-tippy");
|
|
17
17
|
var _Grid = require("../Grid/Grid.styles");
|
|
18
18
|
var _rwd = _interopRequireDefault(require("../../styles/rwd"));
|
|
19
|
-
var
|
|
20
|
-
var _usdqLogo = _interopRequireDefault(require("../../static/images/usdq-logo.png"));
|
|
21
|
-
var _bitcoinLogo = _interopRequireDefault(require("../../static/images/bitcoin-logo.svg"));
|
|
19
|
+
var _formatCurrencyValue = require("../../utils/formatCurrencyValue");
|
|
22
20
|
var _templateObject, _templateObject2, _templateObject3;
|
|
23
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
@@ -105,14 +103,6 @@ const PaymentDisplay = _ref2 => {
|
|
|
105
103
|
onAddressCopy,
|
|
106
104
|
copyButtonStyle
|
|
107
105
|
} = _ref2;
|
|
108
|
-
const getCurrencyIcon = currency => {
|
|
109
|
-
if (customCurrencyIcon) return customCurrencyIcon;
|
|
110
|
-
if (!currency) return null;
|
|
111
|
-
if (currency.toLowerCase().includes('btc')) return _bitcoinLogo.default;
|
|
112
|
-
if (currency.toLowerCase().includes('usdc')) return _usdcLogo.default;
|
|
113
|
-
if (currency.toLowerCase().includes('usdq')) return _usdqLogo.default;
|
|
114
|
-
return null;
|
|
115
|
-
};
|
|
116
106
|
const defaultQRCodeStyle = {
|
|
117
107
|
backgroundColor: '#000000',
|
|
118
108
|
padding: 18,
|
|
@@ -131,7 +121,7 @@ const PaymentDisplay = _ref2 => {
|
|
|
131
121
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_SectionTitle.SectionTitle, null, amountTitle), /*#__PURE__*/_react.default.createElement(AmountSection, {
|
|
132
122
|
style: amountSectionStyle
|
|
133
123
|
}, /*#__PURE__*/_react.default.createElement(AmountIcon, {
|
|
134
|
-
src: getCurrencyIcon(currency),
|
|
124
|
+
src: (0, _formatCurrencyValue.getCurrencyIcon)(currency, customCurrencyIcon),
|
|
135
125
|
style: amountIconStyle,
|
|
136
126
|
alt: currency
|
|
137
127
|
}), /*#__PURE__*/_react.default.createElement(AmountText, {
|
|
@@ -29,7 +29,8 @@ const ProfileBox = _ref => {
|
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_ProfileBox.Container, null, /*#__PURE__*/_react.default.createElement(_ProfileBox.ImageWrapper, null, /*#__PURE__*/_react.default.createElement(_Background.default, {
|
|
30
30
|
src: pictureSrc
|
|
31
31
|
})), /*#__PURE__*/_react.default.createElement(_ProfileBox.EditButton, {
|
|
32
|
-
onClick: handleEdit
|
|
32
|
+
onClick: handleEdit,
|
|
33
|
+
"data-cy": "edit-button-profile-box"
|
|
33
34
|
}, /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, null, /*#__PURE__*/_react.default.createElement(_ProfileBox.Name, {
|
|
34
35
|
style: _objectSpread(_objectSpread({}, lineBreaker), nameStyle)
|
|
35
36
|
}, name, withEditButton && /*#__PURE__*/_react.default.createElement(_ProfileBox.EditIcon, null)))));
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Snackbar = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactDom = require("react-dom");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _Snackbar = require("./Snackbar.styles");
|
|
11
|
+
var _crossIcon = require("../../static/images/cross-icon.svg");
|
|
12
|
+
var _warningFilled = require("../../static/images/warning-filled.svg");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } // Import existing SVG icons
|
|
16
|
+
// Info icon - circled "i" (not available in library, matching design)
|
|
17
|
+
const InfoIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
fill: "none",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
22
|
+
cx: "12",
|
|
23
|
+
cy: "12",
|
|
24
|
+
r: "10",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: "2"
|
|
27
|
+
}), /*#__PURE__*/_react.default.createElement("line", {
|
|
28
|
+
x1: "12",
|
|
29
|
+
y1: "16",
|
|
30
|
+
x2: "12",
|
|
31
|
+
y2: "12",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
strokeWidth: "2",
|
|
34
|
+
strokeLinecap: "round"
|
|
35
|
+
}), /*#__PURE__*/_react.default.createElement("circle", {
|
|
36
|
+
cx: "12",
|
|
37
|
+
cy: "8",
|
|
38
|
+
r: "1",
|
|
39
|
+
fill: "currentColor"
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
// Error icon - circled "!" (not available in library, matching design)
|
|
43
|
+
const ErrorIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
fill: "none",
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
48
|
+
cx: "12",
|
|
49
|
+
cy: "12",
|
|
50
|
+
r: "10",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "2"
|
|
53
|
+
}), /*#__PURE__*/_react.default.createElement("line", {
|
|
54
|
+
x1: "12",
|
|
55
|
+
y1: "8",
|
|
56
|
+
x2: "12",
|
|
57
|
+
y2: "12",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "2",
|
|
60
|
+
strokeLinecap: "round"
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement("circle", {
|
|
62
|
+
cx: "12",
|
|
63
|
+
cy: "16",
|
|
64
|
+
r: "1",
|
|
65
|
+
fill: "currentColor"
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
// Success icon wrapper - adds circle around check icon
|
|
69
|
+
const SuccessIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
70
|
+
viewBox: "0 0 24 24",
|
|
71
|
+
fill: "none",
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
74
|
+
cx: "12",
|
|
75
|
+
cy: "12",
|
|
76
|
+
r: "10",
|
|
77
|
+
stroke: "currentColor",
|
|
78
|
+
strokeWidth: "2"
|
|
79
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
80
|
+
d: "M8 12L10.5 14.5L16 9",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeWidth: "2",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round"
|
|
85
|
+
}));
|
|
86
|
+
const defaultIcons = {
|
|
87
|
+
info: /*#__PURE__*/_react.default.createElement(InfoIcon, null),
|
|
88
|
+
error: /*#__PURE__*/_react.default.createElement(ErrorIcon, null),
|
|
89
|
+
success: /*#__PURE__*/_react.default.createElement(SuccessIcon, null),
|
|
90
|
+
warning: /*#__PURE__*/_react.default.createElement(_warningFilled.ReactComponent, null)
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Individual Snackbar item component
|
|
95
|
+
*/
|
|
96
|
+
const SnackbarItem = _ref => {
|
|
97
|
+
let {
|
|
98
|
+
id,
|
|
99
|
+
message,
|
|
100
|
+
variant = 'info',
|
|
101
|
+
icon,
|
|
102
|
+
onClick,
|
|
103
|
+
onClose,
|
|
104
|
+
duration = 5000
|
|
105
|
+
} = _ref;
|
|
106
|
+
const [isExiting, setIsExiting] = (0, _react.useState)(false);
|
|
107
|
+
const handleClose = (0, _react.useCallback)(() => {
|
|
108
|
+
setIsExiting(true);
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
onClose(id);
|
|
111
|
+
}, 300); // Match animation duration
|
|
112
|
+
}, [id, onClose]);
|
|
113
|
+
(0, _react.useEffect)(() => {
|
|
114
|
+
if (duration === 'permanent' || duration === 0) return;
|
|
115
|
+
const timer = setTimeout(() => {
|
|
116
|
+
handleClose();
|
|
117
|
+
}, duration);
|
|
118
|
+
return () => clearTimeout(timer);
|
|
119
|
+
}, [duration, handleClose]);
|
|
120
|
+
const handleClick = () => {
|
|
121
|
+
if (onClick) {
|
|
122
|
+
onClick();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const displayIcon = icon !== undefined ? icon : defaultIcons[variant];
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(_Snackbar.SnackbarWrapper, {
|
|
127
|
+
$variant: variant,
|
|
128
|
+
$isExiting: isExiting,
|
|
129
|
+
$hasClick: !!onClick,
|
|
130
|
+
onClick: onClick ? handleClick : undefined
|
|
131
|
+
}, displayIcon && /*#__PURE__*/_react.default.createElement(_Snackbar.IconWrapper, {
|
|
132
|
+
$variant: variant
|
|
133
|
+
}, displayIcon), /*#__PURE__*/_react.default.createElement(_Snackbar.Message, null, message), /*#__PURE__*/_react.default.createElement(_Snackbar.CloseButton, {
|
|
134
|
+
onClick: e => {
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
handleClose();
|
|
137
|
+
},
|
|
138
|
+
"aria-label": "Close"
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_crossIcon.ReactComponent, null)));
|
|
140
|
+
};
|
|
141
|
+
SnackbarItem.propTypes = {
|
|
142
|
+
id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
143
|
+
message: _propTypes.default.node.isRequired,
|
|
144
|
+
variant: _propTypes.default.oneOf(['info', 'error', 'success', 'warning']),
|
|
145
|
+
icon: _propTypes.default.node,
|
|
146
|
+
onClick: _propTypes.default.func,
|
|
147
|
+
onClose: _propTypes.default.func.isRequired,
|
|
148
|
+
duration: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['permanent'])])
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Snackbar container component
|
|
153
|
+
* Can render to a specific container or to document.body
|
|
154
|
+
*/
|
|
155
|
+
const Snackbar = _ref2 => {
|
|
156
|
+
let {
|
|
157
|
+
snackbars = [],
|
|
158
|
+
onClose,
|
|
159
|
+
position = 'top-right',
|
|
160
|
+
container = null
|
|
161
|
+
} = _ref2;
|
|
162
|
+
if (snackbars.length === 0) return null;
|
|
163
|
+
const content = /*#__PURE__*/_react.default.createElement(_Snackbar.SnackbarContainer, {
|
|
164
|
+
$position: position,
|
|
165
|
+
$isContained: !!container
|
|
166
|
+
}, snackbars.map(snackbar => /*#__PURE__*/_react.default.createElement(SnackbarItem, _extends({
|
|
167
|
+
key: snackbar.id
|
|
168
|
+
}, snackbar, {
|
|
169
|
+
onClose: onClose
|
|
170
|
+
}))));
|
|
171
|
+
|
|
172
|
+
// If container is provided, render inside it (for contained snackbars)
|
|
173
|
+
// Otherwise, render to document.body via portal
|
|
174
|
+
if (container) {
|
|
175
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(content, container);
|
|
176
|
+
}
|
|
177
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(content, document.body);
|
|
178
|
+
};
|
|
179
|
+
exports.Snackbar = Snackbar;
|
|
180
|
+
Snackbar.propTypes = {
|
|
181
|
+
snackbars: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
182
|
+
id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
183
|
+
message: _propTypes.default.node.isRequired,
|
|
184
|
+
variant: _propTypes.default.oneOf(['info', 'error', 'success', 'warning']),
|
|
185
|
+
icon: _propTypes.default.node,
|
|
186
|
+
onClick: _propTypes.default.func,
|
|
187
|
+
duration: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['permanent'])])
|
|
188
|
+
})),
|
|
189
|
+
onClose: _propTypes.default.func.isRequired,
|
|
190
|
+
position: _propTypes.default.oneOf(['top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center']),
|
|
191
|
+
container: _propTypes.default.instanceOf(Element)
|
|
192
|
+
};
|
|
193
|
+
var _default = exports.default = Snackbar;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.variantStyles = exports.SnackbarWrapper = exports.SnackbarContainer = exports.Message = exports.IconWrapper = exports.CloseButton = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
const slideIn = (0, _styledComponents.keyframes)(["from{opacity:0;transform:translateX(100%);}to{opacity:1;transform:translateX(0);}"]);
|
|
12
|
+
const slideOut = (0, _styledComponents.keyframes)(["from{opacity:1;transform:translateX(0);}to{opacity:0;transform:translateX(100%);}"]);
|
|
13
|
+
const slideInLeft = (0, _styledComponents.keyframes)(["from{opacity:0;transform:translateX(-100%);}to{opacity:1;transform:translateX(0);}"]);
|
|
14
|
+
const slideInUp = (0, _styledComponents.keyframes)(["from{opacity:0;transform:translateY(100%);}to{opacity:1;transform:translateY(0);}"]);
|
|
15
|
+
const slideInDown = (0, _styledComponents.keyframes)(["from{opacity:0;transform:translateY(-100%);}to{opacity:1;transform:translateY(0);}"]);
|
|
16
|
+
|
|
17
|
+
// Variant configurations
|
|
18
|
+
const variantStyles = exports.variantStyles = {
|
|
19
|
+
info: {
|
|
20
|
+
borderColor: _colors.default.blue,
|
|
21
|
+
iconColor: _colors.default.blue
|
|
22
|
+
},
|
|
23
|
+
error: {
|
|
24
|
+
borderColor: _colors.default.orangishRed,
|
|
25
|
+
iconColor: _colors.default.orangishRed
|
|
26
|
+
},
|
|
27
|
+
success: {
|
|
28
|
+
borderColor: _colors.default.progressAccentStart,
|
|
29
|
+
iconColor: _colors.default.progressAccentStart
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
borderColor: _colors.default.warningOrange,
|
|
33
|
+
iconColor: _colors.default.warningOrange
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Position configurations
|
|
38
|
+
const positionStyles = {
|
|
39
|
+
'top-right': (0, _styledComponents.css)(["top:20px;right:20px;animation:", " 0.3s ease-out forwards;"], slideIn),
|
|
40
|
+
'top-left': (0, _styledComponents.css)(["top:20px;left:20px;animation:", " 0.3s ease-out forwards;"], slideInLeft),
|
|
41
|
+
'top-center': (0, _styledComponents.css)(["top:20px;left:50%;transform:translateX(-50%);animation:", " 0.3s ease-out forwards;"], slideInDown),
|
|
42
|
+
'bottom-right': (0, _styledComponents.css)(["bottom:20px;right:20px;animation:", " 0.3s ease-out forwards;"], slideIn),
|
|
43
|
+
'bottom-left': (0, _styledComponents.css)(["bottom:20px;left:20px;animation:", " 0.3s ease-out forwards;"], slideInLeft),
|
|
44
|
+
'bottom-center': (0, _styledComponents.css)(["bottom:20px;left:50%;transform:translateX(-50%);animation:", " 0.3s ease-out forwards;"], slideInUp)
|
|
45
|
+
};
|
|
46
|
+
const SnackbarContainer = exports.SnackbarContainer = _styledComponents.default.div.withConfig({
|
|
47
|
+
displayName: "Snackbarstyles__SnackbarContainer",
|
|
48
|
+
componentId: "sc-xf2wxi-0"
|
|
49
|
+
})(["position:", ";z-index:1100;display:flex;flex-direction:column;gap:10px;pointer-events:none;", ""], _ref => {
|
|
50
|
+
let {
|
|
51
|
+
$isContained
|
|
52
|
+
} = _ref;
|
|
53
|
+
return $isContained ? 'absolute' : 'fixed';
|
|
54
|
+
}, _ref2 => {
|
|
55
|
+
let {
|
|
56
|
+
$position
|
|
57
|
+
} = _ref2;
|
|
58
|
+
return positionStyles[$position] || positionStyles['top-right'];
|
|
59
|
+
});
|
|
60
|
+
const SnackbarWrapper = exports.SnackbarWrapper = _styledComponents.default.div.withConfig({
|
|
61
|
+
displayName: "Snackbarstyles__SnackbarWrapper",
|
|
62
|
+
componentId: "sc-xf2wxi-1"
|
|
63
|
+
})(["display:flex;align-items:center;gap:12px;min-width:320px;max-width:480px;padding:12px 16px;background-color:", ";box-shadow:0 1px 2px -1px rgba(0,0,0,0.12);border-radius:6px;border:1px solid ", ";border-bottom:3px solid ", ";pointer-events:auto;animation:", " 0.3s ease-out forwards;", ""], _colors.default.white, _colors.default.grey, _ref3 => {
|
|
64
|
+
var _variantStyles$$varia;
|
|
65
|
+
let {
|
|
66
|
+
$variant
|
|
67
|
+
} = _ref3;
|
|
68
|
+
return ((_variantStyles$$varia = variantStyles[$variant]) === null || _variantStyles$$varia === void 0 ? void 0 : _variantStyles$$varia.borderColor) || _colors.default.blue;
|
|
69
|
+
}, _ref4 => {
|
|
70
|
+
let {
|
|
71
|
+
$isExiting
|
|
72
|
+
} = _ref4;
|
|
73
|
+
return $isExiting ? slideOut : 'none';
|
|
74
|
+
}, _ref5 => {
|
|
75
|
+
let {
|
|
76
|
+
$hasClick
|
|
77
|
+
} = _ref5;
|
|
78
|
+
return $hasClick && (0, _styledComponents.css)(["cursor:pointer;&:hover{box-shadow:0 4px 24px rgba(0,0,0,0.16);}"]);
|
|
79
|
+
});
|
|
80
|
+
const IconWrapper = exports.IconWrapper = _styledComponents.default.div.withConfig({
|
|
81
|
+
displayName: "Snackbarstyles__IconWrapper",
|
|
82
|
+
componentId: "sc-xf2wxi-2"
|
|
83
|
+
})(["flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;color:", ";svg{width:100%;height:100%;}"], _ref6 => {
|
|
84
|
+
var _variantStyles$$varia2;
|
|
85
|
+
let {
|
|
86
|
+
$variant
|
|
87
|
+
} = _ref6;
|
|
88
|
+
return ((_variantStyles$$varia2 = variantStyles[$variant]) === null || _variantStyles$$varia2 === void 0 ? void 0 : _variantStyles$$varia2.iconColor) || _colors.default.blue;
|
|
89
|
+
});
|
|
90
|
+
const Message = exports.Message = _styledComponents.default.div.withConfig({
|
|
91
|
+
displayName: "Snackbarstyles__Message",
|
|
92
|
+
componentId: "sc-xf2wxi-3"
|
|
93
|
+
})(["flex:1;font-size:16px;font-weight:600;line-height:24px;letter-spacing:0.6px;color:", ";"], _colors.default.black);
|
|
94
|
+
const CloseButton = exports.CloseButton = _styledComponents.default.button.withConfig({
|
|
95
|
+
displayName: "Snackbarstyles__CloseButton",
|
|
96
|
+
componentId: "sc-xf2wxi-4"
|
|
97
|
+
})(["flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;cursor:pointer;transition:opacity 0.2s ease;&:hover{opacity:0.7;}svg{width:12px;height:12px;path{stroke:", ";stroke-width:2;}}&:hover svg path{stroke:", ";}"], _colors.default.grey2, _colors.default.black);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SnackbarProvider = exports.SnackbarContext = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Snackbar = require("./Snackbar");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
const SnackbarContext = exports.SnackbarContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
13
|
+
let snackbarId = 0;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* SnackbarProvider - Wrap your app with this to enable global snackbar functionality
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <SnackbarProvider position="top-right" maxSnacks={5}>
|
|
20
|
+
* <App />
|
|
21
|
+
* </SnackbarProvider>
|
|
22
|
+
*/
|
|
23
|
+
const SnackbarProvider = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
children,
|
|
26
|
+
position = 'top-right',
|
|
27
|
+
maxSnacks = 5,
|
|
28
|
+
defaultDuration = 5000,
|
|
29
|
+
container = null
|
|
30
|
+
} = _ref;
|
|
31
|
+
const [snackbars, setSnackbars] = (0, _react.useState)([]);
|
|
32
|
+
const closeSnackbar = (0, _react.useCallback)(id => {
|
|
33
|
+
setSnackbars(prev => prev.filter(s => s.id !== id));
|
|
34
|
+
}, []);
|
|
35
|
+
const showSnackbar = (0, _react.useCallback)(options => {
|
|
36
|
+
var _options$id, _options$duration;
|
|
37
|
+
const id = (_options$id = options.id) !== null && _options$id !== void 0 ? _options$id : ++snackbarId;
|
|
38
|
+
const newSnackbar = {
|
|
39
|
+
id,
|
|
40
|
+
message: options.message,
|
|
41
|
+
variant: options.variant || 'info',
|
|
42
|
+
icon: options.icon,
|
|
43
|
+
onClick: options.onClick,
|
|
44
|
+
duration: (_options$duration = options.duration) !== null && _options$duration !== void 0 ? _options$duration : defaultDuration
|
|
45
|
+
};
|
|
46
|
+
setSnackbars(prev => {
|
|
47
|
+
// Remove oldest if we exceed maxSnacks
|
|
48
|
+
const updated = [...prev, newSnackbar];
|
|
49
|
+
if (updated.length > maxSnacks) {
|
|
50
|
+
return updated.slice(-maxSnacks);
|
|
51
|
+
}
|
|
52
|
+
return updated;
|
|
53
|
+
});
|
|
54
|
+
return id;
|
|
55
|
+
}, [maxSnacks, defaultDuration]);
|
|
56
|
+
const clearAll = (0, _react.useCallback)(() => {
|
|
57
|
+
setSnackbars([]);
|
|
58
|
+
}, []);
|
|
59
|
+
const contextValue = (0, _react.useMemo)(() => ({
|
|
60
|
+
showSnackbar,
|
|
61
|
+
closeSnackbar,
|
|
62
|
+
clearAll
|
|
63
|
+
}), [showSnackbar, closeSnackbar, clearAll]);
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(SnackbarContext.Provider, {
|
|
65
|
+
value: contextValue
|
|
66
|
+
}, children, /*#__PURE__*/_react.default.createElement(_Snackbar.Snackbar, {
|
|
67
|
+
snackbars: snackbars,
|
|
68
|
+
onClose: closeSnackbar,
|
|
69
|
+
position: position,
|
|
70
|
+
container: container
|
|
71
|
+
}));
|
|
72
|
+
};
|
|
73
|
+
exports.SnackbarProvider = SnackbarProvider;
|
|
74
|
+
SnackbarProvider.propTypes = {
|
|
75
|
+
children: _propTypes.default.node.isRequired,
|
|
76
|
+
position: _propTypes.default.oneOf(['top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center']),
|
|
77
|
+
maxSnacks: _propTypes.default.number,
|
|
78
|
+
defaultDuration: _propTypes.default.number,
|
|
79
|
+
container: _propTypes.default.instanceOf(Element)
|
|
80
|
+
};
|
|
81
|
+
var _default = exports.default = SnackbarProvider;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Snackbar", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Snackbar.Snackbar;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SnackbarContext", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _SnackbarProvider.SnackbarContext;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SnackbarProvider", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _SnackbarProvider.SnackbarProvider;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "useSnackbar", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _useSnackbar.useSnackbar;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _Snackbar = require("./Snackbar");
|
|
31
|
+
var _SnackbarProvider = require("./SnackbarProvider");
|
|
32
|
+
var _useSnackbar = require("./useSnackbar");
|