@thenamespace/ens-components 0.2.0 → 0.4.0
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/index.css +121 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +49 -35
- package/dist/index.js +250 -119
- package/dist/index.js.map +1 -1
- package/dist/types/components/atoms/icon/Icon.d.ts +1 -1
- package/dist/types/components/atoms/index.d.ts +1 -0
- package/dist/types/components/atoms/textarea/Textarea.d.ts +13 -0
- package/dist/types/constants/records/contenthashConstants.d.ts +1 -0
- package/dist/types/hooks/useWeb3Clients.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -88,6 +88,48 @@ const Input = forwardRef(
|
|
|
88
88
|
);
|
|
89
89
|
Input.displayName = "Input";
|
|
90
90
|
|
|
91
|
+
const Textarea = forwardRef(
|
|
92
|
+
({
|
|
93
|
+
size = "md",
|
|
94
|
+
prefix,
|
|
95
|
+
suffix,
|
|
96
|
+
disabled = false,
|
|
97
|
+
error = false,
|
|
98
|
+
className = "",
|
|
99
|
+
dataTestId,
|
|
100
|
+
rows = 4,
|
|
101
|
+
...rest
|
|
102
|
+
}, ref) => {
|
|
103
|
+
const sizeClass = `ns-textarea--${size}`;
|
|
104
|
+
const errorClass = error ? "ns-textarea--error" : "";
|
|
105
|
+
const disabledClass = disabled ? "ns-textarea--disabled" : "";
|
|
106
|
+
const classes = [
|
|
107
|
+
"ns-textarea",
|
|
108
|
+
sizeClass,
|
|
109
|
+
errorClass,
|
|
110
|
+
disabledClass,
|
|
111
|
+
className
|
|
112
|
+
].filter(Boolean).join(" ");
|
|
113
|
+
return /* @__PURE__ */ jsxs("div", { className: `ns-textarea__wrapper ${sizeClass}`, children: [
|
|
114
|
+
prefix && /* @__PURE__ */ jsx("div", { className: "ns-textarea__prefix", children: prefix }),
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"textarea",
|
|
117
|
+
{
|
|
118
|
+
ref,
|
|
119
|
+
className: classes,
|
|
120
|
+
disabled,
|
|
121
|
+
"aria-invalid": error || void 0,
|
|
122
|
+
"data-test-id": dataTestId,
|
|
123
|
+
rows,
|
|
124
|
+
...rest
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
suffix && /* @__PURE__ */ jsx("div", { className: "ns-textarea__suffix", children: suffix })
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
Textarea.displayName = "Textarea";
|
|
132
|
+
|
|
91
133
|
const Text = ({
|
|
92
134
|
children,
|
|
93
135
|
size = "md",
|
|
@@ -713,7 +755,8 @@ const icons$1 = {
|
|
|
713
755
|
logout: LogOut,
|
|
714
756
|
edit: SquarePen,
|
|
715
757
|
copy: Copy,
|
|
716
|
-
clock: Clock
|
|
758
|
+
clock: Clock,
|
|
759
|
+
xSocial: XIcon
|
|
717
760
|
};
|
|
718
761
|
const Icon = ({
|
|
719
762
|
name,
|
|
@@ -11275,23 +11318,28 @@ const encode = (name, value) => {
|
|
|
11275
11318
|
const supportedContenthashRecords = [
|
|
11276
11319
|
{
|
|
11277
11320
|
protocol: ContenthashProtocol.Ipfs,
|
|
11278
|
-
label: "
|
|
11321
|
+
label: "IPFS",
|
|
11322
|
+
protocolPrefix: "ipfs://"
|
|
11279
11323
|
},
|
|
11280
11324
|
{
|
|
11281
11325
|
protocol: ContenthashProtocol.Onion,
|
|
11282
|
-
label: "
|
|
11326
|
+
label: "ONION",
|
|
11327
|
+
protocolPrefix: "onion3://"
|
|
11283
11328
|
},
|
|
11284
11329
|
{
|
|
11285
11330
|
protocol: ContenthashProtocol.Arweave,
|
|
11286
|
-
label: "
|
|
11331
|
+
label: "ARWEAVE",
|
|
11332
|
+
protocolPrefix: "ar://"
|
|
11287
11333
|
},
|
|
11288
11334
|
{
|
|
11289
11335
|
protocol: ContenthashProtocol.Skynet,
|
|
11290
|
-
label: "
|
|
11336
|
+
label: "SKYNET",
|
|
11337
|
+
protocolPrefix: "sia://"
|
|
11291
11338
|
},
|
|
11292
11339
|
{
|
|
11293
11340
|
protocol: ContenthashProtocol.Swarm,
|
|
11294
|
-
label: "
|
|
11341
|
+
label: "SWARM",
|
|
11342
|
+
protocolPrefix: "bzz://"
|
|
11295
11343
|
}
|
|
11296
11344
|
];
|
|
11297
11345
|
const getSupportedChashByProtocol = (protocol) => {
|
|
@@ -11302,6 +11350,7 @@ const isContenthashValid = (protocol, value) => {
|
|
|
11302
11350
|
encode(protocol, value);
|
|
11303
11351
|
return true;
|
|
11304
11352
|
} catch (err) {
|
|
11353
|
+
console.log(err, "ERR HERE");
|
|
11305
11354
|
return false;
|
|
11306
11355
|
}
|
|
11307
11356
|
};
|
|
@@ -11314,76 +11363,88 @@ var TextRecordCategory = /* @__PURE__ */ ((TextRecordCategory2) => {
|
|
|
11314
11363
|
})(TextRecordCategory || {});
|
|
11315
11364
|
const supportedTexts = [
|
|
11316
11365
|
{
|
|
11317
|
-
icon: "
|
|
11366
|
+
icon: "image",
|
|
11318
11367
|
key: "avatar",
|
|
11319
11368
|
category: "image" /* Image */,
|
|
11320
|
-
label: "Avatar"
|
|
11369
|
+
label: "Avatar",
|
|
11370
|
+
placeholder: "Your avatar image url..."
|
|
11321
11371
|
},
|
|
11322
11372
|
{
|
|
11323
|
-
icon: "
|
|
11373
|
+
icon: "image",
|
|
11324
11374
|
key: "header",
|
|
11325
11375
|
category: "image" /* Image */,
|
|
11326
|
-
label: "Header"
|
|
11376
|
+
label: "Header",
|
|
11377
|
+
placeholder: "Your header image url..."
|
|
11327
11378
|
},
|
|
11328
11379
|
{
|
|
11329
11380
|
icon: "person",
|
|
11330
11381
|
key: "name",
|
|
11331
11382
|
category: "general" /* General */,
|
|
11332
|
-
label: "Nickname"
|
|
11383
|
+
label: "Nickname",
|
|
11384
|
+
placeholder: "e.g. John"
|
|
11333
11385
|
},
|
|
11334
11386
|
{
|
|
11335
11387
|
icon: "book",
|
|
11336
11388
|
key: "description",
|
|
11337
11389
|
category: "general" /* General */,
|
|
11338
|
-
label: "Short bio"
|
|
11390
|
+
label: "Short bio",
|
|
11391
|
+
placeholder: "I am an alien from outer space"
|
|
11339
11392
|
},
|
|
11340
11393
|
{
|
|
11341
11394
|
icon: "globe",
|
|
11342
11395
|
key: "url",
|
|
11343
11396
|
category: "general" /* General */,
|
|
11344
|
-
label: "Website"
|
|
11397
|
+
label: "Website",
|
|
11398
|
+
placeholder: "e.g. https://celo.org"
|
|
11345
11399
|
},
|
|
11346
11400
|
{
|
|
11347
11401
|
icon: "map-pin",
|
|
11348
11402
|
key: "location",
|
|
11349
11403
|
category: "general" /* General */,
|
|
11350
|
-
label: "Location"
|
|
11404
|
+
label: "Location",
|
|
11405
|
+
placeholder: "e.g. Jupiter"
|
|
11351
11406
|
},
|
|
11352
11407
|
{
|
|
11353
11408
|
icon: "mail",
|
|
11354
11409
|
key: "mail",
|
|
11355
11410
|
category: "general" /* General */,
|
|
11356
|
-
label: "E-Mail"
|
|
11411
|
+
label: "E-Mail",
|
|
11412
|
+
placeholder: "e.g. example@email.com"
|
|
11357
11413
|
},
|
|
11358
11414
|
{
|
|
11359
|
-
icon: "
|
|
11415
|
+
icon: "xSocial",
|
|
11360
11416
|
key: "com.twitter",
|
|
11361
11417
|
category: "social" /* Social */,
|
|
11362
|
-
label: "Twitter"
|
|
11418
|
+
label: "Twitter",
|
|
11419
|
+
placeholder: "e.g. celonames"
|
|
11363
11420
|
},
|
|
11364
11421
|
{
|
|
11365
11422
|
icon: "discord",
|
|
11366
11423
|
key: "com.discord",
|
|
11367
11424
|
category: "social" /* Social */,
|
|
11368
|
-
label: "Discord"
|
|
11425
|
+
label: "Discord",
|
|
11426
|
+
placeholder: "e.g. celonames"
|
|
11369
11427
|
},
|
|
11370
11428
|
{
|
|
11371
11429
|
icon: "github",
|
|
11372
11430
|
key: "com.github",
|
|
11373
11431
|
category: "social" /* Social */,
|
|
11374
|
-
label: "Github"
|
|
11432
|
+
label: "Github",
|
|
11433
|
+
placeholder: "e.g. celonames"
|
|
11375
11434
|
},
|
|
11376
11435
|
{
|
|
11377
11436
|
icon: "telegram",
|
|
11378
11437
|
key: "org.telegram",
|
|
11379
11438
|
category: "social" /* Social */,
|
|
11380
|
-
label: "Telegram"
|
|
11439
|
+
label: "Telegram",
|
|
11440
|
+
placeholder: "e.g. celonames"
|
|
11381
11441
|
},
|
|
11382
11442
|
{
|
|
11383
11443
|
icon: "youtube",
|
|
11384
11444
|
key: "com.youtube",
|
|
11385
11445
|
category: "social" /* Social */,
|
|
11386
|
-
label: "Youtube"
|
|
11446
|
+
label: "Youtube",
|
|
11447
|
+
placeholder: "e.g. celonames"
|
|
11387
11448
|
}
|
|
11388
11449
|
];
|
|
11389
11450
|
const getSupportedText = (key) => {
|
|
@@ -11457,6 +11518,7 @@ const TextRecords = ({
|
|
|
11457
11518
|
/* @__PURE__ */ jsx(Text, { className: "ns-mb-2", weight: "bold", children: capitalize(category) }),
|
|
11458
11519
|
filteredItems.filter((record) => existingTextsMap[record.key] !== void 0).map((record) => {
|
|
11459
11520
|
const current = existingTextsMap[record.key];
|
|
11521
|
+
const isDescription = record.key === "description";
|
|
11460
11522
|
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: 10 }, children: [
|
|
11461
11523
|
/* @__PURE__ */ jsx(
|
|
11462
11524
|
Text,
|
|
@@ -11474,7 +11536,21 @@ const TextRecords = ({
|
|
|
11474
11536
|
style: { width: "100%" },
|
|
11475
11537
|
className: "d-flex align-items-center",
|
|
11476
11538
|
children: [
|
|
11477
|
-
/* @__PURE__ */ jsx(
|
|
11539
|
+
isDescription ? /* @__PURE__ */ jsx(
|
|
11540
|
+
Textarea,
|
|
11541
|
+
{
|
|
11542
|
+
size: "sm",
|
|
11543
|
+
ref: (el) => {
|
|
11544
|
+
inputRefs.current[record.key] = el;
|
|
11545
|
+
},
|
|
11546
|
+
style: { width: "100%", flex: 1, height: 70 },
|
|
11547
|
+
onChange: (e) => handleTextChanged(record.key, e.target.value),
|
|
11548
|
+
prefix: /* @__PURE__ */ jsx(Icon, { name: record.icon, size: 18, color: "grey" }),
|
|
11549
|
+
value: current.value,
|
|
11550
|
+
placeholder: record.placeholder,
|
|
11551
|
+
rows: 4
|
|
11552
|
+
}
|
|
11553
|
+
) : /* @__PURE__ */ jsx(
|
|
11478
11554
|
Input,
|
|
11479
11555
|
{
|
|
11480
11556
|
ref: (el) => {
|
|
@@ -11492,6 +11568,7 @@ const TextRecords = ({
|
|
|
11492
11568
|
{
|
|
11493
11569
|
onClick: () => handleRemoveText(record.key),
|
|
11494
11570
|
className: "ns-close-icon ns-ms-1",
|
|
11571
|
+
style: { marginTop: isDescription ? "8px" : "0" },
|
|
11495
11572
|
children: /* @__PURE__ */ jsx(Icon, { name: "x", size: 18 })
|
|
11496
11573
|
}
|
|
11497
11574
|
)
|
|
@@ -11502,7 +11579,7 @@ const TextRecords = ({
|
|
|
11502
11579
|
}),
|
|
11503
11580
|
/* @__PURE__ */ jsx("div", { className: "row g-2", children: filteredItems.filter(
|
|
11504
11581
|
(record) => existingTextsMap[record.key] === void 0 && record.category !== TextRecordCategory.Image && filterSuggestions(record)
|
|
11505
|
-
).map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6", children: /* @__PURE__ */ jsxs(
|
|
11582
|
+
).map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6 col-6", children: /* @__PURE__ */ jsxs(
|
|
11506
11583
|
"div",
|
|
11507
11584
|
{
|
|
11508
11585
|
className: "ns-text-suggestion",
|
|
@@ -11632,7 +11709,7 @@ const AddressRecords = ({
|
|
|
11632
11709
|
)
|
|
11633
11710
|
] }, record.chainName);
|
|
11634
11711
|
}),
|
|
11635
|
-
/* @__PURE__ */ jsx("div", { className: "row g-2", children: filteredAddresses.filter((record) => existingAddressMap[record.coinType] === void 0).map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6", children: /* @__PURE__ */ jsxs(
|
|
11712
|
+
/* @__PURE__ */ jsx("div", { className: "row g-2", children: filteredAddresses.filter((record) => existingAddressMap[record.coinType] === void 0).map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6 col-6", children: /* @__PURE__ */ jsxs(
|
|
11636
11713
|
"div",
|
|
11637
11714
|
{
|
|
11638
11715
|
className: "ns-text-suggestion",
|
|
@@ -11856,8 +11933,10 @@ const SwarmIcon = ({ size = 20 }) => {
|
|
|
11856
11933
|
{
|
|
11857
11934
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11858
11935
|
width: size,
|
|
11859
|
-
height: size
|
|
11936
|
+
height: size,
|
|
11937
|
+
viewBox: "0 0 34.4 35",
|
|
11860
11938
|
fill: "none",
|
|
11939
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
11861
11940
|
children: /* @__PURE__ */ jsxs("g", { fill: "#FF8A00", children: [
|
|
11862
11941
|
/* @__PURE__ */ jsx("path", { d: "m0 30.47 8.02 4.502 8.022-4.502v-8.986L8.02 16.977 0 21.484zM26.516.03l-4.24 2.381-.006.036v4.758l4.246 2.382.036.017 4.24-2.376V2.43zM34.4 21.484l-8.02-4.507-8.022 4.507v8.986l8.021 4.502L34.4 30.47z" }),
|
|
11863
11942
|
/* @__PURE__ */ jsx("path", { d: "m17.137 1.285-8.01 4.502v8.986l8.022 4.501 8.02-4.501v-3.58l-3.905-2.19-1.054-.59V3.119z" })
|
|
@@ -12032,13 +12111,26 @@ const ContenthashRecord = ({
|
|
|
12032
12111
|
onContenthashAdded,
|
|
12033
12112
|
searchFilter
|
|
12034
12113
|
}) => {
|
|
12114
|
+
const inputRef = useRef(null);
|
|
12035
12115
|
const metadata = useMemo(() => {
|
|
12036
12116
|
if (contenthash?.protocol) {
|
|
12037
12117
|
return getSupportedChashByProtocol(contenthash?.protocol);
|
|
12038
12118
|
}
|
|
12039
12119
|
}, [contenthash]);
|
|
12040
|
-
const handleContenthashChanged = (protocol,
|
|
12041
|
-
|
|
12120
|
+
const handleContenthashChanged = (protocol, inputValue) => {
|
|
12121
|
+
const protocolPrefix = metadata.protocolPrefix;
|
|
12122
|
+
if (inputValue.length <= protocolPrefix.length) {
|
|
12123
|
+
onContenthashChanged({ protocol, value: "" });
|
|
12124
|
+
return;
|
|
12125
|
+
}
|
|
12126
|
+
let cleanValue = inputValue;
|
|
12127
|
+
if (cleanValue.startsWith(protocolPrefix)) {
|
|
12128
|
+
cleanValue = cleanValue.substring(protocolPrefix.length);
|
|
12129
|
+
} else {
|
|
12130
|
+
onContenthashChanged({ protocol, value: "" });
|
|
12131
|
+
return;
|
|
12132
|
+
}
|
|
12133
|
+
onContenthashChanged({ protocol, value: cleanValue });
|
|
12042
12134
|
};
|
|
12043
12135
|
const filterChash = (record) => {
|
|
12044
12136
|
if (searchFilter && searchFilter.length > 0) {
|
|
@@ -12047,6 +12139,16 @@ const ContenthashRecord = ({
|
|
|
12047
12139
|
}
|
|
12048
12140
|
return true;
|
|
12049
12141
|
};
|
|
12142
|
+
const prefixWithProtocol = (value, protocol) => {
|
|
12143
|
+
const protocolPrefix = metadata.protocolPrefix;
|
|
12144
|
+
if (value.length === 0) {
|
|
12145
|
+
return protocolPrefix;
|
|
12146
|
+
}
|
|
12147
|
+
if (value.startsWith(protocolPrefix)) {
|
|
12148
|
+
return value;
|
|
12149
|
+
}
|
|
12150
|
+
return `${protocolPrefix}${value}`;
|
|
12151
|
+
};
|
|
12050
12152
|
const filteredSuggestions = useMemo(() => {
|
|
12051
12153
|
return supportedContenthashRecords.filter((record) => filterChash(record));
|
|
12052
12154
|
}, [searchFilter]);
|
|
@@ -12055,7 +12157,7 @@ const ContenthashRecord = ({
|
|
|
12055
12157
|
}
|
|
12056
12158
|
return /* @__PURE__ */ jsxs("div", { className: "ns-text-records", children: [
|
|
12057
12159
|
/* @__PURE__ */ jsx(Text, { className: "ns-mb-2", weight: "bold", children: "Website" }),
|
|
12058
|
-
!contenthash && /* @__PURE__ */ jsx("div", { className: "row g-2", children: filteredSuggestions.map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6", children: /* @__PURE__ */ jsxs(
|
|
12160
|
+
!contenthash && /* @__PURE__ */ jsx("div", { className: "row g-2", children: filteredSuggestions.map((record) => /* @__PURE__ */ jsx("div", { className: "col col-lg-3 col-sm-6 col-6", children: /* @__PURE__ */ jsxs(
|
|
12059
12161
|
"div",
|
|
12060
12162
|
{
|
|
12061
12163
|
className: "ns-text-suggestion",
|
|
@@ -12081,11 +12183,27 @@ const ContenthashRecord = ({
|
|
|
12081
12183
|
/* @__PURE__ */ jsx(
|
|
12082
12184
|
Input,
|
|
12083
12185
|
{
|
|
12186
|
+
ref: inputRef,
|
|
12084
12187
|
style: { width: "100%" },
|
|
12085
12188
|
onChange: (e) => handleContenthashChanged(contenthash.protocol, e.target.value),
|
|
12189
|
+
onKeyDown: (e) => {
|
|
12190
|
+
const protocolPrefix = `${contenthash.protocol}://`;
|
|
12191
|
+
const input = e.currentTarget;
|
|
12192
|
+
const cursorPosition = input.selectionStart || 0;
|
|
12193
|
+
if (cursorPosition <= protocolPrefix.length) {
|
|
12194
|
+
if (e.key === "Backspace" && cursorPosition > 0) {
|
|
12195
|
+
e.preventDefault();
|
|
12196
|
+
setTimeout(() => {
|
|
12197
|
+
input.setSelectionRange(protocolPrefix.length, protocolPrefix.length);
|
|
12198
|
+
}, 0);
|
|
12199
|
+
} else if (e.key === "Delete" && cursorPosition < protocolPrefix.length) {
|
|
12200
|
+
e.preventDefault();
|
|
12201
|
+
}
|
|
12202
|
+
}
|
|
12203
|
+
},
|
|
12086
12204
|
error: contenthash.value.length > 0 && !isContenthashValid(contenthash.protocol, contenthash.value),
|
|
12087
12205
|
prefix: /* @__PURE__ */ jsx(ContenthashIcon, { protocol: contenthash.protocol, size: 18 }),
|
|
12088
|
-
value: contenthash.value,
|
|
12206
|
+
value: prefixWithProtocol(contenthash.value, contenthash.protocol),
|
|
12089
12207
|
placeholder: `${contenthash.protocol}://`
|
|
12090
12208
|
}
|
|
12091
12209
|
),
|
|
@@ -12133,56 +12251,18 @@ const ImageRecords = ({
|
|
|
12133
12251
|
return /* @__PURE__ */ jsx("div", { className: "ns-image-records", children: /* @__PURE__ */ jsxs("div", { style: headerStyles, className: "ns-cover-record-cont", children: [
|
|
12134
12252
|
/* @__PURE__ */ jsx("div", { className: "ns-top-grad" }),
|
|
12135
12253
|
/* @__PURE__ */ jsx("div", { className: "ns-bot-grad" }),
|
|
12136
|
-
!headerRecordSet && /* @__PURE__ */ jsx(
|
|
12137
|
-
|
|
12138
|
-
{
|
|
12139
|
-
|
|
12140
|
-
children: /* @__PURE__ */ jsxs("div", { className: "ns-upload-options", children: [
|
|
12141
|
-
/* @__PURE__ */ jsx(
|
|
12142
|
-
Text,
|
|
12143
|
-
{
|
|
12144
|
-
onClick: (e) => {
|
|
12145
|
-
e.stopPropagation();
|
|
12146
|
-
if (!headerRecordSet) {
|
|
12147
|
-
onHeaderAdded("");
|
|
12148
|
-
}
|
|
12149
|
-
},
|
|
12150
|
-
weight: "medium",
|
|
12151
|
-
className: "option",
|
|
12152
|
-
size: "sm",
|
|
12153
|
-
children: "Add Header Record"
|
|
12154
|
-
}
|
|
12155
|
-
),
|
|
12156
|
-
/* @__PURE__ */ jsx(Text, { weight: "medium", className: "option disabled", size: "sm", children: "Upload image" }),
|
|
12157
|
-
/* @__PURE__ */ jsx(Text, { weight: "medium", className: "option disabled", size: "sm", children: "Select NFT" })
|
|
12158
|
-
] })
|
|
12254
|
+
!headerRecordSet && /* @__PURE__ */ jsx("div", { style: { zIndex: 10 }, onClick: (e) => {
|
|
12255
|
+
e.stopPropagation();
|
|
12256
|
+
if (!headerRecordSet) {
|
|
12257
|
+
onHeaderAdded("");
|
|
12159
12258
|
}
|
|
12160
|
-
),
|
|
12161
|
-
/* @__PURE__ */ jsx("div", { style: avatarStyles, className: "ns-avatar-record-cont", children: !avatarRecordSet && /* @__PURE__ */ jsx(
|
|
12162
|
-
|
|
12163
|
-
{
|
|
12164
|
-
|
|
12165
|
-
children: /* @__PURE__ */ jsxs("div", { className: "ns-upload-options", children: [
|
|
12166
|
-
/* @__PURE__ */ jsx(
|
|
12167
|
-
Text,
|
|
12168
|
-
{
|
|
12169
|
-
onClick: (e) => {
|
|
12170
|
-
e.stopPropagation();
|
|
12171
|
-
if (!avatarRecordSet) {
|
|
12172
|
-
onAvatarAdded("");
|
|
12173
|
-
}
|
|
12174
|
-
},
|
|
12175
|
-
weight: "medium",
|
|
12176
|
-
className: "option",
|
|
12177
|
-
size: "sm",
|
|
12178
|
-
children: "Add Avatar Record"
|
|
12179
|
-
}
|
|
12180
|
-
),
|
|
12181
|
-
/* @__PURE__ */ jsx(Text, { weight: "medium", className: "option disabled", size: "sm", children: "Upload image" }),
|
|
12182
|
-
/* @__PURE__ */ jsx(Text, { weight: "medium", className: "option disabled", size: "sm", children: "Select NFT" })
|
|
12183
|
-
] })
|
|
12259
|
+
}, className: "ns-header-handle", children: /* @__PURE__ */ jsx(Icon, { color: "white", name: "rotate-circle" }) }),
|
|
12260
|
+
/* @__PURE__ */ jsx("div", { style: avatarStyles, className: "ns-avatar-record-cont", children: !avatarRecordSet && /* @__PURE__ */ jsx("div", { style: { zIndex: 10 }, onClick: (e) => {
|
|
12261
|
+
e.stopPropagation();
|
|
12262
|
+
if (!headerRecordSet) {
|
|
12263
|
+
onAvatarAdded("");
|
|
12184
12264
|
}
|
|
12185
|
-
) })
|
|
12265
|
+
}, className: "ns-image-handle", children: /* @__PURE__ */ jsx(Icon, { color: "grey", name: "rotate-circle" }) }) })
|
|
12186
12266
|
] }) });
|
|
12187
12267
|
};
|
|
12188
12268
|
|
|
@@ -12206,6 +12286,46 @@ const SelectRecordsForm = ({
|
|
|
12206
12286
|
const [currentNav, setCurrentNav] = useState(
|
|
12207
12287
|
"General" /* General */
|
|
12208
12288
|
);
|
|
12289
|
+
const recordsInnerRef = useRef(null);
|
|
12290
|
+
const isScrollingProgrammatically = useRef(false);
|
|
12291
|
+
useEffect(() => {
|
|
12292
|
+
const scrollContainer = recordsInnerRef.current;
|
|
12293
|
+
if (!scrollContainer) return;
|
|
12294
|
+
const refs = [
|
|
12295
|
+
{ ref: generalCategoryRef, nav: "General" /* General */ },
|
|
12296
|
+
{ ref: socialCategoryRef, nav: "Social" /* Social */ },
|
|
12297
|
+
{ ref: addressesCategoryRef, nav: "Addresses" /* Addresses */ },
|
|
12298
|
+
{ ref: websiteCategoryRef, nav: "Website" /* Website */ }
|
|
12299
|
+
];
|
|
12300
|
+
const updateActiveNav = () => {
|
|
12301
|
+
if (isScrollingProgrammatically.current) return;
|
|
12302
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
12303
|
+
const containerTop = containerRect.top;
|
|
12304
|
+
let closestSection = null;
|
|
12305
|
+
let closestDistance = Infinity;
|
|
12306
|
+
refs.forEach(({ ref, nav }) => {
|
|
12307
|
+
if (ref.current) {
|
|
12308
|
+
const sectionRect = ref.current.getBoundingClientRect();
|
|
12309
|
+
const sectionTop = sectionRect.top - containerTop;
|
|
12310
|
+
if (sectionTop <= 100 && sectionTop > -100) {
|
|
12311
|
+
const distance = Math.abs(sectionTop);
|
|
12312
|
+
if (distance < closestDistance) {
|
|
12313
|
+
closestDistance = distance;
|
|
12314
|
+
closestSection = nav;
|
|
12315
|
+
}
|
|
12316
|
+
}
|
|
12317
|
+
}
|
|
12318
|
+
});
|
|
12319
|
+
if (closestSection) {
|
|
12320
|
+
setCurrentNav(closestSection);
|
|
12321
|
+
}
|
|
12322
|
+
};
|
|
12323
|
+
updateActiveNav();
|
|
12324
|
+
scrollContainer.addEventListener("scroll", updateActiveNav);
|
|
12325
|
+
return () => {
|
|
12326
|
+
scrollContainer.removeEventListener("scroll", updateActiveNav);
|
|
12327
|
+
};
|
|
12328
|
+
}, []);
|
|
12209
12329
|
const handleTextsUpdated = (texts) => {
|
|
12210
12330
|
onRecordsUpdated({ ...records, texts });
|
|
12211
12331
|
};
|
|
@@ -12221,10 +12341,14 @@ const SelectRecordsForm = ({
|
|
|
12221
12341
|
};
|
|
12222
12342
|
const currentRef = references[category];
|
|
12223
12343
|
if (currentRef && currentRef.current) {
|
|
12344
|
+
isScrollingProgrammatically.current = true;
|
|
12224
12345
|
currentRef.current.scrollIntoView({
|
|
12225
12346
|
behavior: "smooth",
|
|
12226
12347
|
block: "start"
|
|
12227
12348
|
});
|
|
12349
|
+
setTimeout(() => {
|
|
12350
|
+
isScrollingProgrammatically.current = false;
|
|
12351
|
+
}, 1e3);
|
|
12228
12352
|
}
|
|
12229
12353
|
};
|
|
12230
12354
|
const handleSidebarChange = (nav, scroll = true) => {
|
|
@@ -12299,47 +12423,54 @@ const SelectRecordsForm = ({
|
|
|
12299
12423
|
item
|
|
12300
12424
|
);
|
|
12301
12425
|
}) }),
|
|
12302
|
-
/* @__PURE__ */ jsxs(
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12426
|
+
/* @__PURE__ */ jsxs(
|
|
12427
|
+
"div",
|
|
12428
|
+
{
|
|
12429
|
+
ref: recordsInnerRef,
|
|
12430
|
+
className: "col col-sm-9 col-12 ns-records-inner ns-styled-scrollbar",
|
|
12431
|
+
children: [
|
|
12432
|
+
/* @__PURE__ */ jsx("div", { ref: generalCategoryRef, className: "ns-mb-2", children: /* @__PURE__ */ jsx(
|
|
12433
|
+
TextRecords,
|
|
12434
|
+
{
|
|
12435
|
+
initialTexts: initialRecords.texts,
|
|
12436
|
+
texts: records.texts,
|
|
12437
|
+
onTextsChanged: handleTextsUpdated,
|
|
12438
|
+
category: TextRecordCategory.General,
|
|
12439
|
+
searchFilter
|
|
12440
|
+
}
|
|
12441
|
+
) }),
|
|
12442
|
+
/* @__PURE__ */ jsx("div", { ref: socialCategoryRef, className: "ns-mb-2", children: /* @__PURE__ */ jsx(
|
|
12443
|
+
TextRecords,
|
|
12444
|
+
{
|
|
12445
|
+
initialTexts: initialRecords.texts,
|
|
12446
|
+
texts: records.texts,
|
|
12447
|
+
onTextsChanged: handleTextsUpdated,
|
|
12448
|
+
category: TextRecordCategory.Social,
|
|
12449
|
+
searchFilter
|
|
12450
|
+
}
|
|
12451
|
+
) }),
|
|
12452
|
+
/* @__PURE__ */ jsx("div", { ref: addressesCategoryRef, className: "ns-mb-2", children: /* @__PURE__ */ jsx(
|
|
12453
|
+
AddressRecords,
|
|
12454
|
+
{
|
|
12455
|
+
initialAddresses: initialRecords.addresses,
|
|
12456
|
+
addresses: records.addresses,
|
|
12457
|
+
onAddressesChanged: (e) => handleAddressesUpdated(e),
|
|
12458
|
+
searchFilter
|
|
12459
|
+
}
|
|
12460
|
+
) }),
|
|
12461
|
+
/* @__PURE__ */ jsx("div", { ref: websiteCategoryRef, className: "ns-mb-2", children: /* @__PURE__ */ jsx(
|
|
12462
|
+
ContenthashRecord,
|
|
12463
|
+
{
|
|
12464
|
+
contenthash: records.contenthash,
|
|
12465
|
+
onContenthashChanged: (e) => handleContenthashUpdated(e),
|
|
12466
|
+
onContenthashRemoved: () => handleContenthashRemoved(),
|
|
12467
|
+
onContenthashAdded: (e) => handleContenthashAdded(e),
|
|
12468
|
+
searchFilter
|
|
12469
|
+
}
|
|
12470
|
+
) })
|
|
12471
|
+
]
|
|
12472
|
+
}
|
|
12473
|
+
)
|
|
12343
12474
|
] }) })
|
|
12344
12475
|
] });
|
|
12345
12476
|
};
|
|
@@ -12652,5 +12783,5 @@ const useTheme = () => {
|
|
|
12652
12783
|
return ctx;
|
|
12653
12784
|
};
|
|
12654
12785
|
|
|
12655
|
-
export { Alert, Button, Card, ChainIcon, ContenthashIcon, ContenthashProtocol, Dropdown, ENSNameCard, ENS_RESOLVER_ABI, Icon, Input, MULTICALL, Modal, NavbarProfileCard, PendingTransaction, ProfileCard, ProfileHeader, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, Text, TextRecordCategory, ThemeProvider, Tooltip, TransactionState, capitalize, convertEVMChainIdToCoinType, deepCopy, equalsIgnoreCase, getEnsRecordsDiff, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isContenthashValid, supportedAddresses, supportedContenthashRecords, supportedTexts, useTheme, useWaitForTransaction, useWeb3Client };
|
|
12786
|
+
export { Alert, Button, Card, ChainIcon, ContenthashIcon, ContenthashProtocol, Dropdown, ENSNameCard, ENS_RESOLVER_ABI, Icon, Input, MULTICALL, Modal, NavbarProfileCard, PendingTransaction, ProfileCard, ProfileHeader, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TransactionState, capitalize, convertEVMChainIdToCoinType, deepCopy, equalsIgnoreCase, getEnsRecordsDiff, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isContenthashValid, supportedAddresses, supportedContenthashRecords, supportedTexts, useTheme, useWaitForTransaction, useWeb3Client };
|
|
12656
12787
|
//# sourceMappingURL=index.js.map
|