@ludo.ninja/components 2.3.54 → 2.3.55

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.
@@ -0,0 +1,11 @@
1
+ import { ICollectionFilterInput, ICreationFilterInput } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
2
+ import React from "react";
3
+ interface Props {
4
+ defaultOptionValue?: string;
5
+ isLoading?: boolean;
6
+ onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
7
+ name: string;
8
+ isError: boolean;
9
+ }
10
+ declare const BlockChainSelect: React.FC<Props>;
11
+ export default BlockChainSelect;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const env_1 = require("../../../store/env");
8
+ const ScreenWidth_1 = require("../../../styles/ScreenWidth");
9
+ const DesktopSelect_1 = __importDefault(require("../../../system/Forms/Selects/DesktopSelect"));
10
+ const core_1 = require("@ludo.ninja/core");
11
+ const data_1 = require("@ludo.ninja/core/build/blockchains/data");
12
+ const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
13
+ const typography_1 = require("@ludo.ninja/ui/build/styles/typography");
14
+ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
15
+ const react_select_1 = require("react-select");
16
+ const styled_components_1 = __importDefault(require("styled-components"));
17
+ const StyledSelect = (0, styled_components_1.default)(DesktopSelect_1.default) `
18
+ border-radius: 6px;
19
+ border: 1px solid ${(props) => (props.isError ? colors_1.ErrorColor : colors_1.BorderColorLight)};
20
+
21
+ .react-select__value-container {
22
+ padding-left: 8px;
23
+ }
24
+
25
+ .react-select__menu-list {
26
+ padding: 8px;
27
+
28
+ .react-select__option {
29
+ padding: 0;
30
+ font-weight: 400;
31
+ &.react-select__option--is-focused{
32
+ background: ${colors_1.BackgroundColorLight};
33
+ }
34
+ }
35
+ }
36
+
37
+ .react-select__menu {
38
+ box-shadow: 0 8px 16px 0 rgba(33, 21, 95, 0.1);
39
+ }
40
+
41
+ .react-select__placeholder {
42
+ ${typography_1.MainText};
43
+ }
44
+
45
+ .react-select__input-container {
46
+ ${typography_1.MainText};
47
+ }
48
+
49
+ .react-select__single-value {
50
+ padding-left: 2px;
51
+ }
52
+
53
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
54
+ border-radius: ${(0, _4k_1.adaptiveValueCalc)(6)};
55
+
56
+ .react-select__value-container {
57
+ padding-left: ${(0, _4k_1.adaptiveValueCalc)(8)};
58
+ }
59
+
60
+ .react-select__menu-list {
61
+ padding: ${(0, _4k_1.adaptiveValueCalc)(8)};
62
+ }
63
+
64
+ .react-select__single-value {
65
+ padding-left: ${(0, _4k_1.adaptiveValueCalc)(2)};
66
+ }
67
+ }
68
+ `;
69
+ const getBlockchainOptions = (domain) => {
70
+ const data = [];
71
+ for (const buildBlockchainsDatum in data_1.blockChainData) {
72
+ const key = buildBlockchainsDatum;
73
+ const test = new core_1.BlockChainEntity(key);
74
+ if (key !== core_1.BlockChainKeys.no_blockchain) {
75
+ data.push({
76
+ id: data_1.blockChainData[key].blockchainPrivateLabel,
77
+ label: data_1.blockChainData[key].blockchainPublicLabel,
78
+ icon: test.getBlockChainIconRegular({ domain }),
79
+ });
80
+ }
81
+ }
82
+ return data.sort((a, b) => a.label.localeCompare(b.label));
83
+ };
84
+ const StyledImg = styled_components_1.default.img `
85
+ border-radius: 50%;
86
+
87
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
88
+ width: ${(0, _4k_1.adaptiveValueCalc)(20)};
89
+ height: ${(0, _4k_1.adaptiveValueCalc)(20)};
90
+ margin-right: ${(0, _4k_1.adaptiveValueCalc)(6)};
91
+ }
92
+ `;
93
+ const OptionWrapper = styled_components_1.default.div `
94
+ display: flex;
95
+ padding: 6px 8px;
96
+ align-items: center;
97
+ gap: 10px;
98
+ border-radius: 4px;
99
+
100
+ &:hover {
101
+ background: ${colors_1.BackgroundColorLight};
102
+ }
103
+
104
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
105
+ padding: ${(0, _4k_1.adaptiveValueCalc)(6)} ${(0, _4k_1.adaptiveValueCalc)(8)};
106
+ gap: ${(0, _4k_1.adaptiveValueCalc)(10)};
107
+ border-radius: ${(0, _4k_1.adaptiveValueCalc)(4)};
108
+ }
109
+ `;
110
+ const SingleValueWrapper = styled_components_1.default.div `
111
+ display: flex;
112
+ padding: 6px 0;
113
+ align-items: center;
114
+ gap: 10px;
115
+
116
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
117
+ padding: ${(0, _4k_1.adaptiveValueCalc)(6)} 0;
118
+ gap: ${(0, _4k_1.adaptiveValueCalc)(10)};
119
+ }
120
+ `;
121
+ const Option = (props) => {
122
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_select_1.components.Option, { ...props, children: (0, jsx_runtime_1.jsxs)(OptionWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.label }), props.label] }) }) }));
123
+ };
124
+ const SingleValue = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)(react_select_1.components.SingleValue, { ...props, children: (0, jsx_runtime_1.jsxs)(SingleValueWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.data.label }), children] }) }));
125
+ const BlockChainSelect = ({ isLoading, isError, onChangeHandler, defaultOptionValue, name }) => {
126
+ const getStaticENVDomain = (0, env_1.useEnvStore)((state) => state.getStaticDomain);
127
+ return ((0, jsx_runtime_1.jsx)(StyledSelect, { isError: isError, options: getBlockchainOptions(getStaticENVDomain()), isLoading: isLoading, isSearchable: true, onChangeHandler: onChangeHandler, name: name, customComponents: { Option, SingleValue }, defaultOptionValue: defaultOptionValue, placeholder: "Blockchain" }));
128
+ };
129
+ exports.default = BlockChainSelect;
@@ -7,11 +7,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const resultSubmitNewProjectModal_1 = __importDefault(require("./resultSubmitNewProjectModal"));
8
8
  const ui_1 = require("../../store/ui");
9
9
  const Forms_1 = require("../../system/Forms");
10
- const DesktopSelect_1 = __importDefault(require("../../system/Forms/Selects/DesktopSelect"));
11
10
  const api_1 = require("@ludo.ninja/api");
12
11
  const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema");
13
- const blockchains_1 = require("@ludo.ninja/core/build/blockchains");
14
- const data_1 = require("@ludo.ninja/core/build/blockchains/data");
15
12
  const ScreenWidth_1 = require("@ludo.ninja/ui/build/styles/ScreenWidth");
16
13
  const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
17
14
  const typography_1 = require("@ludo.ninja/ui/build/styles/typography");
@@ -19,21 +16,11 @@ const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
19
16
  const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Buttons/MainButton"));
20
17
  const Text_1 = require("@ludo.ninja/ui/build/system/Text");
21
18
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
19
+ const react_1 = require("react");
22
20
  const react_hook_form_1 = require("react-hook-form");
23
21
  const styled_components_1 = __importDefault(require("styled-components"));
24
- const getBlockchainOptions = () => {
25
- const data = [];
26
- for (const buildBlockchainsDatum in data_1.blockChainData) {
27
- const key = buildBlockchainsDatum;
28
- if (key !== blockchains_1.BlockChainKeys.no_blockchain) {
29
- data.push({
30
- id: data_1.blockChainData[key].blockchainPrivateLabel,
31
- label: data_1.blockChainData[key].blockchainPublicLabel,
32
- });
33
- }
34
- }
35
- return data;
36
- };
22
+ const validateTokenAddress_1 = require("../../utils/validateTokenAddress");
23
+ const blockchainSelect_1 = __importDefault(require("./blockchainSelect"));
37
24
  const StyledCreateForm = styled_components_1.default.div `
38
25
  min-width: 392px;
39
26
  margin-top: -18px;
@@ -118,33 +105,15 @@ const StyledCreateForm = styled_components_1.default.div `
118
105
  }
119
106
  }
120
107
  `;
121
- const StyledSelect = (0, styled_components_1.default)(DesktopSelect_1.default) `
122
- border-radius: 6px;
123
- border: 1px solid ${(props) => (props.isError ? colors_1.ErrorColor : colors_1.BorderColorLight)};
124
- height: 46px;
125
-
126
- .react-select__menu {
127
- box-shadow: 0 8px 16px 0 rgba(33, 21, 95, 0.1);
128
- }
129
-
130
- .react-select__placeholder {
131
- ${typography_1.MainText};
132
- }
133
-
134
- ${ScreenWidth_1.mediaQuery.minWidthFourK} {
135
- height: ${(0, _4k_1.adaptiveValueCalc)(46)};
136
- border-radius: ${(0, _4k_1.adaptiveValueCalc)(6)};
137
- border: ${(0, _4k_1.adaptiveValueCalc)(1)} solid #cfd5ea;
138
-
139
- .react-select__menu {
140
- box-shadow: 0 ${(0, _4k_1.adaptiveValueCalc)(8)} ${(0, _4k_1.adaptiveValueCalc)(16)} 0 rgba(33, 21, 95, 0.1);
141
- }
142
- }
143
- `;
144
108
  const SubmitNewProjectForm = () => {
145
- const { control, register, handleSubmit, formState: { errors }, setError, } = (0, react_hook_form_1.useForm)({
146
- mode: "all",
109
+ const { control, register, handleSubmit, formState: { errors }, setError, setFocus, watch, } = (0, react_hook_form_1.useForm)({
110
+ mode: 'all',
147
111
  });
112
+ (0, react_1.useEffect)(() => {
113
+ setTimeout(() => {
114
+ setFocus('contract');
115
+ }, 1);
116
+ }, [setFocus]);
148
117
  const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
149
118
  const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
150
119
  const openModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.openModalSidebarPortal);
@@ -154,12 +123,15 @@ const SubmitNewProjectForm = () => {
154
123
  },
155
124
  });
156
125
  const dataForContract = {
157
- labelText: "Project contract ID",
158
- name: "contract",
159
- placeHolder: "Project contract ID",
126
+ labelText: 'Project contract ID',
127
+ name: 'contract',
128
+ placeHolder: 'Project contract ID',
160
129
  };
161
- const registerContract = register("contract", {
162
- required: { message: "Project contract ID is required", value: true },
130
+ const blockchain = watch('blockchain');
131
+ const registerContract = register('contract', {
132
+ required: { message: 'Project contract ID is required', value: true },
133
+ validate: (value) => (0, validateTokenAddress_1.validateTokenAddress)(value, blockchain),
134
+ setValueAs: (value) => value.trim(),
163
135
  });
164
136
  const errorContract = {
165
137
  isNeedShowError: Boolean(errors?.contract),
@@ -182,20 +154,20 @@ const SubmitNewProjectForm = () => {
182
154
  openModalSidebarPortal((0, jsx_runtime_1.jsx)(resultSubmitNewProjectModal_1.default, { status: registerNewProject.status, projectInfo: registerNewProject.project }));
183
155
  },
184
156
  onError: () => {
185
- setError("contract", {
186
- type: "custom",
187
- message: "Provided address is not matching the token address",
157
+ setError('contract', {
158
+ type: 'custom',
159
+ message: 'Provided address is not matching the token address',
188
160
  });
189
161
  openAlert({
190
162
  type: type_1.alertVariants.error,
191
- caption: "Project can not be registered",
163
+ caption: 'Project can not be registered',
192
164
  });
193
165
  },
194
166
  });
195
167
  };
196
- return ((0, jsx_runtime_1.jsxs)(StyledCreateForm, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "head", children: [(0, jsx_runtime_1.jsx)("h3", { className: "tittle", children: "Submit New Project" }), (0, jsx_runtime_1.jsx)(Text_1.MainText, { color: colors_1.TextGrayColor, children: "Add your favorite project to follow up it on Ludo" })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsxs)("div", { className: "content", children: [(0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(Forms_1.Input, { register: registerContract, error: errorContract, data: dataForContract }) }), (0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: "blockchain", control: control, rules: {
197
- required: { message: "Blockchain is required", value: true },
198
- }, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(StyledSelect, { isError: Boolean(errors.blockchain), options: getBlockchainOptions(), isLoading: false, onChangeHandler: async (fieldName, fieldValue) => field.onChange(fieldValue), name: field.name, placeholder: "Blockchain" }), errors.blockchain && (0, jsx_runtime_1.jsx)(Forms_1.BasicErrorLabel, { children: errors.blockchain.message })] })) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: "Add", type: "submit", variant: "primaryM", disabled: loading, onClick: () => null }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: "Cancel", variant: "outline", onClick: () => {
168
+ return ((0, jsx_runtime_1.jsxs)(StyledCreateForm, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'head', children: [(0, jsx_runtime_1.jsx)("h3", { className: 'tittle', children: 'Submit New Project' }), (0, jsx_runtime_1.jsx)(Text_1.MainText, { color: colors_1.TextGrayColor, children: "Add your favorite project to follow up it on Ludo" })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsxs)("div", { className: 'content', children: [(0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(Forms_1.Input, { register: registerContract, error: errorContract, data: dataForContract }) }), (0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: "blockchain", control: control, rules: {
169
+ required: { message: 'Blockchain is required', value: true },
170
+ }, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(blockchainSelect_1.default, { isError: Boolean(errors.blockchain), isLoading: false, onChangeHandler: async (fieldName, fieldValue) => field.onChange(fieldValue), name: field.name }), errors.blockchain && ((0, jsx_runtime_1.jsx)(Forms_1.BasicErrorLabel, { children: errors.blockchain.message }))] })) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add', type: 'submit', variant: "primaryM", disabled: loading, onClick: () => null }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Cancel', variant: "outline", onClick: () => {
199
171
  closeModalSidebarPortal();
200
172
  } })] })] })] }));
201
173
  };
@@ -15,6 +15,8 @@ const ScreenWidth_1 = require("@ludo.ninja/ui/build/styles/ScreenWidth");
15
15
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
16
16
  const utils_1 = require("@ludo.ninja/utils");
17
17
  const styled_components_1 = __importDefault(require("styled-components"));
18
+ const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Buttons/MainButton"));
19
+ const submitNewProjectForm_1 = __importDefault(require(".."));
18
20
  const Wrapper = styled_components_1.default.div `
19
21
  width: 290px;
20
22
  display: flex;
@@ -79,17 +81,23 @@ const ProjectTitleWrapper = styled_components_1.default.div `
79
81
  const ResultSubmitNewProjectModal = ({ status, projectInfo, }) => {
80
82
  const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
81
83
  const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
84
+ const openModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.openModalSidebarPortal);
82
85
  const handleProjectClick = () => {
83
86
  if (projectInfo?.slug) {
84
- window.open(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]}/x/${projectInfo.slug}`, "_blank");
87
+ window.open(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]['welcome']}/x/${projectInfo.slug}`, '_blank');
85
88
  closeModalSidebarPortal();
86
89
  }
87
90
  };
91
+ const handleAddNewProjectClick = () => {
92
+ closeModalSidebarPortal();
93
+ openModalSidebarPortal((0, jsx_runtime_1.jsx)(submitNewProjectForm_1.default, {}));
94
+ };
88
95
  switch (status) {
89
96
  case schema_1.IProjectRegistrationStatus.Submitted:
90
- return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(success_svg_1.default, {}), (0, jsx_runtime_1.jsx)(ui_2.H3, { children: "Project submitted successfully and added to the review queue" })] }));
97
+ return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(success_svg_1.default, {}), (0, jsx_runtime_1.jsx)(ui_2.H3, { children: "Project submitted successfully and added to the review queue" }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add new Project', type: 'submit', variant: "primaryM", onClick: handleAddNewProjectClick })] }));
91
98
  case schema_1.IProjectRegistrationStatus.Exists:
92
- return ((0, jsx_runtime_1.jsxs)(ProjectExist, { children: [(0, jsx_runtime_1.jsx)(ui_2.H3, { children: "This project already exists in our system" }), Boolean(projectInfo) && ((0, jsx_runtime_1.jsxs)(ProjectTitleWrapper, { onClick: handleProjectClick, children: [(0, jsx_runtime_1.jsxs)("div", { className: "name", children: [(0, jsx_runtime_1.jsx)(ui_2.H1, { color: "#6048FF", children: projectInfo?.name || (0, utils_1.shortenedText)(projectInfo?.contract) }), projectInfo?.verified && (0, jsx_runtime_1.jsx)(badge_svg_1.default, { style: { color: "#43A5FF" } })] }), (0, jsx_runtime_1.jsx)(ui_2.H2, { color: "#696F90", children: projectInfo?.symbol })] }))] }));
99
+ return ((0, jsx_runtime_1.jsxs)(ProjectExist, { children: [(0, jsx_runtime_1.jsx)(ui_2.H3, { children: "This project already exists in our system" }), Boolean(projectInfo) && ((0, jsx_runtime_1.jsxs)(ProjectTitleWrapper, { onClick: handleProjectClick, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'name', children: [(0, jsx_runtime_1.jsx)(ui_2.H1, { color: '#6048FF', children: projectInfo?.name ||
100
+ (0, utils_1.shortenedText)(projectInfo?.contract) }), projectInfo?.verified && ((0, jsx_runtime_1.jsx)(badge_svg_1.default, { style: { color: '#43A5FF' } }))] }), (0, jsx_runtime_1.jsx)(ui_2.H2, { color: '#696F90', children: projectInfo?.symbol })] }))] }));
93
101
  }
94
102
  };
95
103
  exports.default = ResultSubmitNewProjectModal;
@@ -1,12 +1,16 @@
1
1
  import { ISelectInput } from '../MobileSelect';
2
2
  import { ICollectionFilterInput, ICreationFilterInput } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
3
3
  import React from "react";
4
+ import { GroupBase } from "react-select";
5
+ import { SelectComponents } from "react-select/dist/declarations/src/components";
4
6
  interface Props {
5
7
  options: ISelectInput[];
6
8
  defaultOptionValue?: string;
7
9
  isLoading?: boolean;
10
+ isSearchable?: boolean;
8
11
  onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
9
12
  name: string;
13
+ customComponents?: Partial<SelectComponents<unknown, boolean, GroupBase<unknown>>>;
10
14
  }
11
15
  declare const DesktopSelect: React.FC<Props>;
12
16
  export default DesktopSelect;
@@ -149,7 +149,7 @@ const DropdownIndicator = (props) => {
149
149
  transform: props.selectProps.menuIsOpen ? "rotate(180deg)" : "rotate(0)",
150
150
  }, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M16 11L12 15L8 11", stroke: "#696F91", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
151
151
  };
152
- const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, ...props }) => {
152
+ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, customComponents, isSearchable, ...props }) => {
153
153
  const [selectedOption, setSelectedOption] = (0, react_1.useState)(options.find((option) => {
154
154
  return defaultOptionValue === option.id;
155
155
  }) || null);
@@ -172,9 +172,10 @@ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue
172
172
  const { windowDimensions } = (0, screen_1.useWindowDimensionsWithServerInitial)();
173
173
  if (isLoading)
174
174
  return (0, jsx_runtime_1.jsx)(react_loading_skeleton_1.default, { height: `${minHeight}px`, width: "154px" });
175
- return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable: false, components: {
175
+ return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable: isSearchable, components: {
176
176
  DropdownIndicator,
177
177
  IndicatorSeparator: () => null,
178
+ ...customComponents
178
179
  }, ...props }));
179
180
  };
180
181
  exports.default = DesktopSelect;
@@ -3,6 +3,7 @@ import { ICollectionFilterInput, ICreationFilterInput } from '@ludo.ninja/api/bu
3
3
  export interface ISelectInput {
4
4
  id: string;
5
5
  label: string;
6
+ icon?: string;
6
7
  }
7
8
  interface Props {
8
9
  options: ISelectInput[];
@@ -0,0 +1,2 @@
1
+ import { BlockChainKeys } from '@ludo.ninja/core/src/blockchains/type';
2
+ export declare const validateTokenAddress: (address: string, blockchain: BlockChainKeys) => true | string;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateTokenAddress = void 0;
4
+ const validateTokenAddress = (address, blockchain) => {
5
+ const ethLikeRegex = /^0x[a-fA-F0-9]{40}$/;
6
+ const base58Regex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
7
+ const nearRegex = /^[.a-z0-9_-]+\.near$/;
8
+ const tezosRegex = /^(tz1|tz2|tz3|KT1)[1-9A-HJ-NP-Za-km-z]{33}$/;
9
+ const flowRegex = /^0x[a-fA-F0-9]{16}$/;
10
+ const tonRegex = /^[a-fA-F0-9]{64}$/;
11
+ const waxRegex = /^[a-z1-5.]{12}$/;
12
+ switch (blockchain) {
13
+ case 'ethereum':
14
+ case 'arbitrum':
15
+ case 'arbitrum-nova':
16
+ case 'avalanche':
17
+ case 'base':
18
+ case 'binance':
19
+ case 'cronos':
20
+ case 'immutablex':
21
+ case 'klaytn':
22
+ case 'moonbeam':
23
+ case 'optimism':
24
+ case 'polygon':
25
+ case 'polygonzkevm':
26
+ case 'skale':
27
+ return ethLikeRegex.test(address) || 'Invalid EVM address';
28
+ case 'solana':
29
+ return base58Regex.test(address) || 'Invalid Solana address';
30
+ case 'elrond':
31
+ return base58Regex.test(address) || 'Invalid MultiversX address';
32
+ case 'near':
33
+ return nearRegex.test(address) || 'Invalid Near address';
34
+ case 'tezos':
35
+ return tezosRegex.test(address) || 'Invalid Tezos address';
36
+ case 'flow':
37
+ return flowRegex.test(address) || 'Invalid Flow address';
38
+ case 'ton':
39
+ return tonRegex.test(address) || 'Invalid TON address';
40
+ case 'wax':
41
+ return waxRegex.test(address) || 'Invalid Wax address';
42
+ default:
43
+ return true;
44
+ }
45
+ };
46
+ exports.validateTokenAddress = validateTokenAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.3.54",
3
+ "version": "2.3.55",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",