@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,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.MultiSelect = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _Input = require("./Input.styles");
|
|
12
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
13
|
+
var _checkIcon = require("../../static/images/check-icon.svg");
|
|
14
|
+
var _Select = require("./Select.styles");
|
|
15
|
+
const _excluded = ["children", "selectProps"],
|
|
16
|
+
_excluded2 = ["id", "name", "label", "options", "search", "error", "touched", "value", "disabled", "menuHeight", "placeholder", "showCheckboxes", "showCountBadge", "closeMenuOnSelect", "hideSelectedOptions", "width", "minMenuWidth", "maxMenuWidth"];
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
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); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
26
|
+
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); }
|
|
27
|
+
const CountBadge = _styledComponents.default.span.withConfig({
|
|
28
|
+
displayName: "MultiSelect__CountBadge",
|
|
29
|
+
componentId: "sc-1udb3q8-0"
|
|
30
|
+
})(["display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 6px;background-color:", ";color:", ";border-radius:10px;font-size:12px;font-weight:600;margin-left:8px;"], _colors.default.black, _colors.default.white);
|
|
31
|
+
const CheckboxWrapper = _styledComponents.default.div.withConfig({
|
|
32
|
+
displayName: "MultiSelect__CheckboxWrapper",
|
|
33
|
+
componentId: "sc-1udb3q8-1"
|
|
34
|
+
})(["display:flex;align-items:center;padding:16px 12px;cursor:pointer;transition:background-color 0.15s ease;&:hover{background-color:", ";}"], _colors.default.grey);
|
|
35
|
+
const Checkbox = _styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "MultiSelect__Checkbox",
|
|
37
|
+
componentId: "sc-1udb3q8-2"
|
|
38
|
+
})(["width:14px;height:14px;border:1px solid ", ";border-radius:3px;margin-right:12px;display:flex;align-items:center;justify-content:center;background-color:", ";transition:all 0.15s ease;flex-shrink:0;svg{opacity:", ";transition:opacity 0.15s ease;width:8px;height:8px;}svg path{stroke:", ";}"], props => props.isSelected ? _colors.default.black : _colors.default.grey2, props => props.isSelected ? _colors.default.white : _colors.default.white, props => props.isSelected ? 1 : 0, _colors.default.blue);
|
|
39
|
+
const OptionLabel = _styledComponents.default.span.withConfig({
|
|
40
|
+
displayName: "MultiSelect__OptionLabel",
|
|
41
|
+
componentId: "sc-1udb3q8-3"
|
|
42
|
+
})(["font-size:14px;color:", ";font-weight:400;letter-spacing:0.6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0;"], _colors.default.black);
|
|
43
|
+
const PlaceholderText = _styledComponents.default.span.withConfig({
|
|
44
|
+
displayName: "MultiSelect__PlaceholderText",
|
|
45
|
+
componentId: "sc-1udb3q8-4"
|
|
46
|
+
})(["font-size:14px;color:", ";font-weight:400;"], _colors.default.black);
|
|
47
|
+
|
|
48
|
+
// Custom Option with Checkbox
|
|
49
|
+
const CheckboxOption = props => {
|
|
50
|
+
const {
|
|
51
|
+
isSelected,
|
|
52
|
+
label,
|
|
53
|
+
innerRef,
|
|
54
|
+
innerProps
|
|
55
|
+
} = props;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(CheckboxWrapper, _extends({
|
|
57
|
+
ref: innerRef
|
|
58
|
+
}, innerProps), /*#__PURE__*/_react.default.createElement(Checkbox, {
|
|
59
|
+
isSelected: isSelected
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_checkIcon.ReactComponent, null)), /*#__PURE__*/_react.default.createElement(OptionLabel, null, label));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Custom ValueContainer that shows count badge
|
|
64
|
+
const CountValueContainer = _ref => {
|
|
65
|
+
let {
|
|
66
|
+
children,
|
|
67
|
+
selectProps
|
|
68
|
+
} = _ref,
|
|
69
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
70
|
+
const {
|
|
71
|
+
value,
|
|
72
|
+
placeholder
|
|
73
|
+
} = selectProps;
|
|
74
|
+
const count = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.ValueContainer, _extends({}, props, {
|
|
76
|
+
selectProps: selectProps
|
|
77
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
style: {
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center'
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement(PlaceholderText, null, placeholder), count > 0 && /*#__PURE__*/_react.default.createElement(CountBadge, null, count)), children);
|
|
83
|
+
};
|
|
84
|
+
const DropdownIndicator = props => {
|
|
85
|
+
const {
|
|
86
|
+
selectProps
|
|
87
|
+
} = props;
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.DropdownIndicator, props, /*#__PURE__*/_react.default.createElement(_Select.SelectIcon, {
|
|
89
|
+
isMenuOpen: selectProps.menuIsOpen
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
DropdownIndicator.propTypes = {
|
|
93
|
+
selectProps: _propTypes.default.instanceOf(Object).isRequired
|
|
94
|
+
};
|
|
95
|
+
const SelectMenuListWithScroll = props => {
|
|
96
|
+
const {
|
|
97
|
+
children,
|
|
98
|
+
selectProps
|
|
99
|
+
} = props;
|
|
100
|
+
const {
|
|
101
|
+
maxMenuHeight = 300
|
|
102
|
+
} = selectProps;
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_Select.SelectMenuList, {
|
|
104
|
+
autoHeight: true,
|
|
105
|
+
autoHeightMax: maxMenuHeight,
|
|
106
|
+
fullHeight: true
|
|
107
|
+
}, children);
|
|
108
|
+
};
|
|
109
|
+
SelectMenuListWithScroll.propTypes = {
|
|
110
|
+
children: _propTypes.default.node.isRequired
|
|
111
|
+
};
|
|
112
|
+
const MultiSelect = props => {
|
|
113
|
+
const {
|
|
114
|
+
id,
|
|
115
|
+
name,
|
|
116
|
+
label,
|
|
117
|
+
options,
|
|
118
|
+
search,
|
|
119
|
+
error,
|
|
120
|
+
touched,
|
|
121
|
+
value,
|
|
122
|
+
disabled,
|
|
123
|
+
menuHeight,
|
|
124
|
+
placeholder,
|
|
125
|
+
showCheckboxes = true,
|
|
126
|
+
showCountBadge = true,
|
|
127
|
+
closeMenuOnSelect = false,
|
|
128
|
+
hideSelectedOptions = false,
|
|
129
|
+
width,
|
|
130
|
+
minMenuWidth = 150,
|
|
131
|
+
maxMenuWidth = 300
|
|
132
|
+
} = props,
|
|
133
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
|
134
|
+
const hasValue = (value === null || value === void 0 ? void 0 : value.length) > 0;
|
|
135
|
+
const [labelUp, setLabelUp] = (0, _react.useState)(hasValue);
|
|
136
|
+
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
137
|
+
(0, _react.useEffect)(() => {
|
|
138
|
+
const currentHasValue = (value === null || value === void 0 ? void 0 : value.length) > 0;
|
|
139
|
+
setLabelUp(hasFocus || currentHasValue);
|
|
140
|
+
}, [hasFocus, value]);
|
|
141
|
+
const onFocus = () => {
|
|
142
|
+
props.onFocus && props.onFocus({
|
|
143
|
+
name,
|
|
144
|
+
value
|
|
145
|
+
});
|
|
146
|
+
setHasFocus(true);
|
|
147
|
+
};
|
|
148
|
+
const onBlur = () => {
|
|
149
|
+
props.onBlur && props.onBlur({
|
|
150
|
+
name,
|
|
151
|
+
value
|
|
152
|
+
});
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
setHasFocus(false);
|
|
155
|
+
}, 1);
|
|
156
|
+
};
|
|
157
|
+
const onChange = selectedOptions => {
|
|
158
|
+
const newValue = selectedOptions ? selectedOptions.map(opt => opt.value) : [];
|
|
159
|
+
props.onChange && props.onChange({
|
|
160
|
+
name,
|
|
161
|
+
value: newValue
|
|
162
|
+
});
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
setHasFocus(true);
|
|
165
|
+
}, 1);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// Get selected options from value array
|
|
169
|
+
const selectedOptions = options === null || options === void 0 ? void 0 : options.filter(option => value === null || value === void 0 ? void 0 : value.includes(option.value));
|
|
170
|
+
return /*#__PURE__*/_react.default.createElement(_Input.Wrapper, {
|
|
171
|
+
style: {
|
|
172
|
+
width: width || 'auto'
|
|
173
|
+
}
|
|
174
|
+
}, label && /*#__PURE__*/_react.default.createElement(_Input.Label, {
|
|
175
|
+
isUp: labelUp,
|
|
176
|
+
active: hasFocus,
|
|
177
|
+
error: error && touched,
|
|
178
|
+
htmlFor: id
|
|
179
|
+
}, label), /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({}, otherProps, {
|
|
180
|
+
id: id,
|
|
181
|
+
name: name,
|
|
182
|
+
options: options,
|
|
183
|
+
isDisabled: disabled,
|
|
184
|
+
onChange: onChange,
|
|
185
|
+
onBlur: onBlur,
|
|
186
|
+
onFocus: onFocus,
|
|
187
|
+
value: selectedOptions,
|
|
188
|
+
placeholder: placeholder,
|
|
189
|
+
isSearchable: search,
|
|
190
|
+
isMulti: true,
|
|
191
|
+
openMenuOnFocus: true,
|
|
192
|
+
closeMenuOnSelect: closeMenuOnSelect,
|
|
193
|
+
hideSelectedOptions: hideSelectedOptions,
|
|
194
|
+
maxMenuHeight: menuHeight,
|
|
195
|
+
styles: {
|
|
196
|
+
control: (baseStyle, state) => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
197
|
+
display: 'flex',
|
|
198
|
+
alignItems: 'center',
|
|
199
|
+
// minHeight: '44px',
|
|
200
|
+
padding: '0 10px',
|
|
201
|
+
backgroundColor: _colors.default.white,
|
|
202
|
+
border: "1px solid ".concat(state.isFocused ? _colors.default.grey2 : _colors.default.lightGrey),
|
|
203
|
+
borderRadius: '10px',
|
|
204
|
+
boxShadow: 'none',
|
|
205
|
+
cursor: 'pointer',
|
|
206
|
+
'&:hover': {
|
|
207
|
+
borderColor: _colors.default.grey2
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
menu: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
211
|
+
marginTop: '4px',
|
|
212
|
+
zIndex: 1000,
|
|
213
|
+
borderRadius: '8px',
|
|
214
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
215
|
+
border: "1px solid ".concat(_colors.default.lightGrey),
|
|
216
|
+
overflow: 'hidden',
|
|
217
|
+
minWidth: minMenuWidth,
|
|
218
|
+
maxWidth: maxMenuWidth,
|
|
219
|
+
width: 'auto'
|
|
220
|
+
}),
|
|
221
|
+
menuList: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
222
|
+
padding: 0
|
|
223
|
+
}),
|
|
224
|
+
option: (baseStyle, state) => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
225
|
+
// When using checkboxes, padding is handled by CheckboxOption
|
|
226
|
+
// Otherwise, add padding for the default option
|
|
227
|
+
padding: showCheckboxes ? 0 : '12px 16px',
|
|
228
|
+
backgroundColor: state.isFocused ? _colors.default.grey : 'transparent',
|
|
229
|
+
color: _colors.default.black,
|
|
230
|
+
cursor: 'pointer',
|
|
231
|
+
fontWeight: state.isSelected ? 600 : 400,
|
|
232
|
+
whiteSpace: 'nowrap',
|
|
233
|
+
overflow: 'hidden',
|
|
234
|
+
textOverflow: 'ellipsis',
|
|
235
|
+
'&:active': {
|
|
236
|
+
backgroundColor: _colors.default.grey
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
valueContainer: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
240
|
+
padding: 0,
|
|
241
|
+
display: 'flex',
|
|
242
|
+
alignItems: 'center'
|
|
243
|
+
}),
|
|
244
|
+
placeholder: () => ({
|
|
245
|
+
display: 'none' // We handle placeholder in ValueContainer
|
|
246
|
+
}),
|
|
247
|
+
multiValue: () => ({
|
|
248
|
+
display: showCountBadge ? 'none' : 'flex' // Hide tags when showing count
|
|
249
|
+
}),
|
|
250
|
+
input: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
251
|
+
margin: 0,
|
|
252
|
+
padding: 0
|
|
253
|
+
}),
|
|
254
|
+
indicatorsContainer: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
255
|
+
padding: 0,
|
|
256
|
+
gap: '4px'
|
|
257
|
+
}),
|
|
258
|
+
dropdownIndicator: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
259
|
+
padding: '4px'
|
|
260
|
+
}),
|
|
261
|
+
clearIndicator: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
262
|
+
padding: '4px'
|
|
263
|
+
// display: 'none',
|
|
264
|
+
})
|
|
265
|
+
},
|
|
266
|
+
components: {
|
|
267
|
+
DropdownIndicator,
|
|
268
|
+
IndicatorSeparator: null,
|
|
269
|
+
MenuList: SelectMenuListWithScroll,
|
|
270
|
+
Option: showCheckboxes ? CheckboxOption : _reactSelect.components.Option,
|
|
271
|
+
ValueContainer: showCountBadge ? CountValueContainer : _reactSelect.components.ValueContainer
|
|
272
|
+
}
|
|
273
|
+
})));
|
|
274
|
+
};
|
|
275
|
+
exports.MultiSelect = MultiSelect;
|
|
276
|
+
MultiSelect.propTypes = {
|
|
277
|
+
id: _propTypes.default.string.isRequired,
|
|
278
|
+
name: _propTypes.default.string.isRequired,
|
|
279
|
+
label: _propTypes.default.string,
|
|
280
|
+
error: _propTypes.default.bool,
|
|
281
|
+
touched: _propTypes.default.bool,
|
|
282
|
+
value: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
283
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
284
|
+
key: _propTypes.default.string.isRequired,
|
|
285
|
+
value: _propTypes.default.string.isRequired,
|
|
286
|
+
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
|
|
287
|
+
})).isRequired,
|
|
288
|
+
search: _propTypes.default.bool,
|
|
289
|
+
placeholder: _propTypes.default.string,
|
|
290
|
+
onChange: _propTypes.default.func,
|
|
291
|
+
onBlur: _propTypes.default.func,
|
|
292
|
+
onFocus: _propTypes.default.func,
|
|
293
|
+
showCheckboxes: _propTypes.default.bool,
|
|
294
|
+
showCountBadge: _propTypes.default.bool,
|
|
295
|
+
closeMenuOnSelect: _propTypes.default.bool,
|
|
296
|
+
hideSelectedOptions: _propTypes.default.bool,
|
|
297
|
+
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
298
|
+
minMenuWidth: _propTypes.default.number,
|
|
299
|
+
maxMenuWidth: _propTypes.default.number
|
|
300
|
+
};
|
|
301
|
+
MultiSelect.defaultProps = {
|
|
302
|
+
label: '',
|
|
303
|
+
value: [],
|
|
304
|
+
search: false,
|
|
305
|
+
error: false,
|
|
306
|
+
touched: false,
|
|
307
|
+
placeholder: 'Select',
|
|
308
|
+
onChange: () => {},
|
|
309
|
+
onBlur: () => {},
|
|
310
|
+
onFocus: () => {},
|
|
311
|
+
showCheckboxes: true,
|
|
312
|
+
showCountBadge: true,
|
|
313
|
+
closeMenuOnSelect: false,
|
|
314
|
+
hideSelectedOptions: false,
|
|
315
|
+
width: undefined,
|
|
316
|
+
minMenuWidth: 150,
|
|
317
|
+
maxMenuWidth: 300
|
|
318
|
+
};
|
|
319
|
+
var _default = exports.default = MultiSelect;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SearchInput = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _SearchInput = require("./SearchInput.styles");
|
|
9
|
+
var _searchIcon = require("../../static/images/search-icon.svg");
|
|
10
|
+
const _excluded = ["value", "onChange", "placeholder", "icon", "showIcon", "disabled", "variant", "onFocus", "onBlur", "className", "containerStyle", "inputStyle", "iconStyle", "id", "name", "aria-label", "aria-describedby"];
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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); }
|
|
13
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
|
+
const SearchInput = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
value = '',
|
|
18
|
+
onChange,
|
|
19
|
+
placeholder = 'Search',
|
|
20
|
+
icon,
|
|
21
|
+
showIcon = true,
|
|
22
|
+
disabled = false,
|
|
23
|
+
variant = 'filled',
|
|
24
|
+
// 'filled' or 'outlined'
|
|
25
|
+
onFocus,
|
|
26
|
+
onBlur,
|
|
27
|
+
className,
|
|
28
|
+
containerStyle,
|
|
29
|
+
inputStyle,
|
|
30
|
+
iconStyle,
|
|
31
|
+
id,
|
|
32
|
+
name,
|
|
33
|
+
'aria-label': ariaLabel,
|
|
34
|
+
'aria-describedby': ariaDescribedBy
|
|
35
|
+
} = _ref,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
const handleChange = e => {
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onChange(e.target.value, e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const handleFocus = e => {
|
|
43
|
+
if (onFocus) {
|
|
44
|
+
onFocus(e);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const handleBlur = e => {
|
|
48
|
+
if (onBlur) {
|
|
49
|
+
onBlur(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const inputId = id || "search-input-".concat(Math.random().toString(36).substr(2, 9));
|
|
53
|
+
const inputName = name || inputId;
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_SearchInput.SearchInputContainer, {
|
|
55
|
+
className: className,
|
|
56
|
+
style: containerStyle
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_SearchInput.SearchInputWrapper, {
|
|
58
|
+
disabled: disabled,
|
|
59
|
+
variant: variant
|
|
60
|
+
}, showIcon && /*#__PURE__*/_react.default.createElement(_SearchInput.SearchIconWrapper, {
|
|
61
|
+
style: iconStyle
|
|
62
|
+
}, icon || /*#__PURE__*/_react.default.createElement(_searchIcon.ReactComponent, null)), /*#__PURE__*/_react.default.createElement(_SearchInput.SearchInputField, _extends({
|
|
63
|
+
id: inputId,
|
|
64
|
+
name: inputName,
|
|
65
|
+
type: "search",
|
|
66
|
+
value: value,
|
|
67
|
+
onChange: handleChange,
|
|
68
|
+
onFocus: handleFocus,
|
|
69
|
+
onBlur: handleBlur,
|
|
70
|
+
placeholder: placeholder,
|
|
71
|
+
disabled: disabled,
|
|
72
|
+
"aria-label": ariaLabel || placeholder,
|
|
73
|
+
"aria-describedby": ariaDescribedBy,
|
|
74
|
+
style: inputStyle
|
|
75
|
+
}, props))));
|
|
76
|
+
};
|
|
77
|
+
exports.SearchInput = SearchInput;
|
|
78
|
+
var _default = exports.default = SearchInput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SearchInputWrapper = exports.SearchInputField = exports.SearchInputContainer = exports.SearchIconWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const SearchInputContainer = exports.SearchInputContainer = _styledComponents.default.div.withConfig({
|
|
11
|
+
displayName: "SearchInputstyles__SearchInputContainer",
|
|
12
|
+
componentId: "sc-dcxztv-0"
|
|
13
|
+
})(["width:100%;display:flex;"]);
|
|
14
|
+
const SearchInputWrapper = exports.SearchInputWrapper = _styledComponents.default.div.withConfig({
|
|
15
|
+
displayName: "SearchInputstyles__SearchInputWrapper",
|
|
16
|
+
componentId: "sc-dcxztv-1"
|
|
17
|
+
})(["position:relative;display:flex;align-items:center;width:100%;border-radius:8px;padding:0 16px;min-height:40px;transition:all 0.2s ease;background-color:", ";border:", ";", " &:focus-within{background-color:", ";border-color:", ";box-shadow:", ";}&:hover{border-color:", ";}"], props => props.variant === 'outlined' ? 'transparent' : _colors.default.grey3, props => props.variant === 'outlined' ? "1px solid ".concat(_colors.default.lightGrey) : '1px solid transparent', props => props.disabled && "\n opacity: 0.6;\n cursor: not-allowed;\n ", props => props.variant === 'outlined' ? 'transparent' : _colors.default.white, props => props.variant === 'outlined' ? _colors.default.grey2 : 'transparent', props => props.variant === 'outlined' ? 'none' : "0 0 0 2px ".concat(_colors.default.lightGrey), props => props.variant === 'outlined' ? _colors.default.grey2 : 'transparent');
|
|
18
|
+
const SearchIconWrapper = exports.SearchIconWrapper = _styledComponents.default.div.withConfig({
|
|
19
|
+
displayName: "SearchInputstyles__SearchIconWrapper",
|
|
20
|
+
componentId: "sc-dcxztv-2"
|
|
21
|
+
})(["display:flex;align-items:center;justify-content:center;margin-right:12px;color:", ";flex-shrink:0;width:16px;height:16px;svg{width:100%;height:100%;}", ":focus-within &{color:", ";}"], _colors.default.grey2, SearchInputWrapper, _colors.default.black);
|
|
22
|
+
const SearchInputField = exports.SearchInputField = _styledComponents.default.input.withConfig({
|
|
23
|
+
displayName: "SearchInputstyles__SearchInputField",
|
|
24
|
+
componentId: "sc-dcxztv-3"
|
|
25
|
+
})(["flex:1;border:none;outline:none;background:transparent;font-size:14px;font-weight:400;line-height:18px;color:", ";width:100%;min-width:0;letter-spacing:0.6px;&::placeholder{color:", ";opacity:1;}&:disabled{cursor:not-allowed;opacity:0.6;}&::-webkit-search-decoration,&::-webkit-search-cancel-button,&::-webkit-search-results-button,&::-webkit-search-results-decoration{-webkit-appearance:none;}"], _colors.default.black, _colors.default.grey2);
|
|
@@ -7,9 +7,10 @@ exports.default = exports.Select = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
10
|
+
var _creatable = _interopRequireDefault(require("react-select/creatable"));
|
|
10
11
|
var _Input = require("./Input.styles");
|
|
11
12
|
var _Select = require("./Select.styles");
|
|
12
|
-
const _excluded = ["id", "name", "label", "options", "search", "error", "touched", "value", "disabled", "menuHeight"];
|
|
13
|
+
const _excluded = ["id", "name", "label", "options", "search", "error", "touched", "value", "disabled", "menuHeight", "creatable", "formatCreateLabel"];
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
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
16
|
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); }
|
|
@@ -59,7 +60,9 @@ const Select = props => {
|
|
|
59
60
|
touched,
|
|
60
61
|
value,
|
|
61
62
|
disabled,
|
|
62
|
-
menuHeight
|
|
63
|
+
menuHeight,
|
|
64
|
+
creatable,
|
|
65
|
+
formatCreateLabel
|
|
63
66
|
} = props,
|
|
64
67
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
65
68
|
const [labelUp, setLabelUp] = (0, _react.useState)(!!value);
|
|
@@ -72,7 +75,7 @@ const Select = props => {
|
|
|
72
75
|
name,
|
|
73
76
|
value
|
|
74
77
|
});
|
|
75
|
-
if (search) {
|
|
78
|
+
if (search || creatable) {
|
|
76
79
|
setHasFocus(true);
|
|
77
80
|
}
|
|
78
81
|
};
|
|
@@ -94,12 +97,46 @@ const Select = props => {
|
|
|
94
97
|
setHasFocus(true);
|
|
95
98
|
}, 1);
|
|
96
99
|
};
|
|
100
|
+
|
|
101
|
+
// Choose component based on creatable prop
|
|
102
|
+
const SelectComponent = creatable ? _creatable.default : _reactSelect.default;
|
|
103
|
+
|
|
104
|
+
// Common styles for both components
|
|
105
|
+
const selectStyles = {
|
|
106
|
+
control: () => _Select.SelectControl,
|
|
107
|
+
menu: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
108
|
+
marginTop: 0,
|
|
109
|
+
zIndex: 1000,
|
|
110
|
+
SelectMenu: _Select.SelectMenu
|
|
111
|
+
}),
|
|
112
|
+
option: (baseStyle, state) => _objectSpread({
|
|
113
|
+
fontWeight: state.isSelected || state.isFocused ? 'bold' : 'normal',
|
|
114
|
+
cursor: 'pointer'
|
|
115
|
+
}, _Select.SelectOption),
|
|
116
|
+
selectContainer: () => _Select.SelectContainer,
|
|
117
|
+
valueContainer: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
118
|
+
padding: 0
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Common components for both
|
|
123
|
+
const selectComponents = {
|
|
124
|
+
DropdownIndicator,
|
|
125
|
+
IndicatorSeparator: null,
|
|
126
|
+
MenuList: SelectMenuListWithScroll
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Get current value - for creatable, also check if value exists even if not in options
|
|
130
|
+
const currentValue = creatable ? (options === null || options === void 0 ? void 0 : options.find(option => option.value === value)) || (value ? {
|
|
131
|
+
value,
|
|
132
|
+
label: value
|
|
133
|
+
} : null) : options === null || options === void 0 ? void 0 : options.find(option => option.value === value);
|
|
97
134
|
return /*#__PURE__*/_react.default.createElement(_Input.Wrapper, null, label && /*#__PURE__*/_react.default.createElement(_Input.Label, {
|
|
98
135
|
isUp: labelUp,
|
|
99
136
|
active: hasFocus,
|
|
100
137
|
error: error && touched,
|
|
101
138
|
htmlFor: id
|
|
102
|
-
}, label), /*#__PURE__*/_react.default.createElement(
|
|
139
|
+
}, label), /*#__PURE__*/_react.default.createElement(SelectComponent, _extends({}, otherProps, {
|
|
103
140
|
id: id,
|
|
104
141
|
name: name,
|
|
105
142
|
options: options,
|
|
@@ -107,32 +144,14 @@ const Select = props => {
|
|
|
107
144
|
onChange: onChange,
|
|
108
145
|
onBlur: onBlur,
|
|
109
146
|
onFocus: onFocus,
|
|
110
|
-
value:
|
|
147
|
+
value: currentValue,
|
|
111
148
|
placeholder: "",
|
|
112
|
-
isSearchable: search,
|
|
149
|
+
isSearchable: creatable || search,
|
|
113
150
|
maxMenuHeight: menuHeight,
|
|
114
|
-
styles:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
zIndex: 1000,
|
|
119
|
-
SelectMenu: _Select.SelectMenu
|
|
120
|
-
}),
|
|
121
|
-
option: (baseStyle, state) => _objectSpread({
|
|
122
|
-
fontWeight: state.isSelected || state.isFocused ? 'bold' : 'normal',
|
|
123
|
-
cursor: 'pointer'
|
|
124
|
-
}, _Select.SelectOption),
|
|
125
|
-
selectContainer: () => _Select.SelectContainer,
|
|
126
|
-
valueContainer: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
127
|
-
padding: 0
|
|
128
|
-
//marginLeft: '-2px',
|
|
129
|
-
})
|
|
130
|
-
},
|
|
131
|
-
components: {
|
|
132
|
-
DropdownIndicator,
|
|
133
|
-
IndicatorSeparator: null,
|
|
134
|
-
MenuList: SelectMenuListWithScroll
|
|
135
|
-
}
|
|
151
|
+
styles: selectStyles,
|
|
152
|
+
components: selectComponents
|
|
153
|
+
}, creatable && {
|
|
154
|
+
formatCreateLabel: formatCreateLabel || (inputValue => "Create \"".concat(inputValue, "\""))
|
|
136
155
|
})));
|
|
137
156
|
};
|
|
138
157
|
exports.Select = Select;
|
|
@@ -149,6 +168,8 @@ Select.propTypes = {
|
|
|
149
168
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
|
|
150
169
|
})).isRequired,
|
|
151
170
|
search: _propTypes.default.bool,
|
|
171
|
+
creatable: _propTypes.default.bool,
|
|
172
|
+
formatCreateLabel: _propTypes.default.func,
|
|
152
173
|
onChange: _propTypes.default.func,
|
|
153
174
|
onBlur: _propTypes.default.func,
|
|
154
175
|
onFocus: _propTypes.default.func
|
|
@@ -157,6 +178,8 @@ Select.defaultProps = {
|
|
|
157
178
|
label: '',
|
|
158
179
|
value: '',
|
|
159
180
|
search: false,
|
|
181
|
+
creatable: false,
|
|
182
|
+
formatCreateLabel: null,
|
|
160
183
|
error: false,
|
|
161
184
|
touched: false,
|
|
162
185
|
onChange: () => {},
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SideModal = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactDom = require("react-dom");
|
|
9
|
+
var _SideModal = require("./SideModal.styles");
|
|
10
|
+
var _Modal = require("./Modal.styles");
|
|
11
|
+
const _excluded = ["children", "isOpen", "onClose", "width", "minWidth", "className", "containerStyle", "closeOnDimmerClick", "showCloseButton"];
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const SideModal = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
isOpen,
|
|
20
|
+
onClose,
|
|
21
|
+
width = 40,
|
|
22
|
+
minWidth = 400,
|
|
23
|
+
className,
|
|
24
|
+
containerStyle,
|
|
25
|
+
closeOnDimmerClick = true,
|
|
26
|
+
showCloseButton = true
|
|
27
|
+
} = _ref,
|
|
28
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
const [isVisible, setIsVisible] = (0, _react.useState)(false);
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
// Disable scroll on background when modal is open
|
|
32
|
+
if (isOpen) {
|
|
33
|
+
document.body.style.overflow = 'hidden';
|
|
34
|
+
// Small delay to trigger animation
|
|
35
|
+
setTimeout(() => setIsVisible(true), 10);
|
|
36
|
+
} else {
|
|
37
|
+
document.body.style.overflow = 'unset';
|
|
38
|
+
setIsVisible(false);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
document.body.style.overflow = 'unset';
|
|
42
|
+
};
|
|
43
|
+
}, [isOpen]);
|
|
44
|
+
|
|
45
|
+
// Handle escape key
|
|
46
|
+
(0, _react.useEffect)(() => {
|
|
47
|
+
const handleEscape = e => {
|
|
48
|
+
if (e.key === 'Escape' && isOpen) {
|
|
49
|
+
onClose();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (isOpen) {
|
|
53
|
+
document.addEventListener('keydown', handleEscape);
|
|
54
|
+
}
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener('keydown', handleEscape);
|
|
57
|
+
};
|
|
58
|
+
}, [isOpen, onClose]);
|
|
59
|
+
const handleDimmerClick = e => {
|
|
60
|
+
if (closeOnDimmerClick && e.target === e.currentTarget) {
|
|
61
|
+
onClose();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
if (!isOpen) return null;
|
|
65
|
+
const modalContent = /*#__PURE__*/_react.default.createElement(_SideModal.SideModalRoot, _extends({
|
|
66
|
+
className: className,
|
|
67
|
+
style: containerStyle
|
|
68
|
+
}, props), /*#__PURE__*/_react.default.createElement(_SideModal.Dimmer, {
|
|
69
|
+
onClick: handleDimmerClick,
|
|
70
|
+
isVisible: isVisible
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_SideModal.SideModalBox, {
|
|
72
|
+
width: width,
|
|
73
|
+
minWidth: minWidth,
|
|
74
|
+
isVisible: isVisible,
|
|
75
|
+
onClick: e => e.stopPropagation()
|
|
76
|
+
}, showCloseButton && /*#__PURE__*/_react.default.createElement(_Modal.ModalClose, {
|
|
77
|
+
onClick: onClose
|
|
78
|
+
}), children)));
|
|
79
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(modalContent, document.body);
|
|
80
|
+
};
|
|
81
|
+
exports.SideModal = SideModal;
|
|
82
|
+
var _default = exports.default = SideModal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SideModalRoot = exports.SideModalBox = exports.Dimmer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const SideModalRoot = exports.SideModalRoot = _styledComponents.default.div.withConfig({
|
|
11
|
+
displayName: "SideModalstyles__SideModalRoot",
|
|
12
|
+
componentId: "sc-f9ztpn-0"
|
|
13
|
+
})(["position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;"]);
|
|
14
|
+
const Dimmer = exports.Dimmer = _styledComponents.default.div.withConfig({
|
|
15
|
+
displayName: "SideModalstyles__Dimmer",
|
|
16
|
+
componentId: "sc-f9ztpn-1"
|
|
17
|
+
})(["position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);display:flex;justify-content:flex-end;align-items:stretch;opacity:", ";transition:opacity 0.3s ease-in-out;pointer-events:", ";"], props => props.isVisible ? 1 : 0, props => props.isVisible ? 'auto' : 'none');
|
|
18
|
+
const SideModalBox = exports.SideModalBox = _styledComponents.default.div.withConfig({
|
|
19
|
+
displayName: "SideModalstyles__SideModalBox",
|
|
20
|
+
componentId: "sc-f9ztpn-2"
|
|
21
|
+
})(["position:relative;width:", "%;min-width:", "px;max-width:90%;height:100%;background-color:", ";box-shadow:-2px 0 8px rgba(0,0,0,0.15);display:flex;flex-direction:column;overflow-y:auto;transform:translateX(", ");transition:transform 0.3s ease-in-out;z-index:1;pointer-events:auto;@media (max-width:768px){width:90%;min-width:90%;max-width:90%;}"], props => props.width, props => props.minWidth, _colors.default.white, props => props.isVisible ? '0' : '100%');
|