@thenamespace/ens-components 0.38.0-alpha → 1.1.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/README.md +200 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +68 -62
- package/dist/index.js.map +1 -1
- package/dist/types/components/ens-name-registration/ENSNameRegistrationForm.d.ts +1 -0
- package/dist/types/components/ens-name-registration/RegistrationSummary.d.ts +1 -0
- package/dist/types/components/subname-mint-form/MintFormActions.d.ts +3 -1
- package/dist/types/components/subname-mint-form/SubnameMintForm.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ interface EnsNameRegistrationFormProps {
|
|
|
88
88
|
onRegistrationSuccess?: (result: RegistrationSuccessData) => void;
|
|
89
89
|
onClose?: (isSuccess: boolean) => void;
|
|
90
90
|
onRegistrationStart?: (name: string) => void;
|
|
91
|
+
onConnectWallet?: () => void;
|
|
91
92
|
}
|
|
92
93
|
interface RegistrationSuccessData {
|
|
93
94
|
expiryInYears: number;
|
|
@@ -193,8 +194,9 @@ interface SubnameMintFormProps {
|
|
|
193
194
|
onSuccess?: (data: MintSuccessData) => void;
|
|
194
195
|
onSubnameMinted?: (data: SubnameMintedData) => void;
|
|
195
196
|
txConfirmations?: number;
|
|
197
|
+
onConnectWallet?: () => void;
|
|
196
198
|
}
|
|
197
|
-
declare const SubnameMintForm: ({ parentName, label, isTestnet, onCancel, onSuccess, onSubnameMinted, txConfirmations }: SubnameMintFormProps) => react_jsx_runtime.JSX.Element;
|
|
199
|
+
declare const SubnameMintForm: ({ parentName, label, isTestnet, onCancel, onSuccess, onSubnameMinted, txConfirmations, onConnectWallet, }: SubnameMintFormProps) => react_jsx_runtime.JSX.Element;
|
|
198
200
|
|
|
199
201
|
interface OffchainSubnameCreatedData {
|
|
200
202
|
label: string;
|
package/dist/index.js
CHANGED
|
@@ -12304,9 +12304,6 @@ const commonBgStyles = {
|
|
|
12304
12304
|
backgroundRepeat: "no-repeat",
|
|
12305
12305
|
backgroundPosition: "center"
|
|
12306
12306
|
};
|
|
12307
|
-
const getManualActionLabel = (isSet) => {
|
|
12308
|
-
return isSet ? "Edit URL" : "Enter URL";
|
|
12309
|
-
};
|
|
12310
12307
|
const ImageRecords = ({
|
|
12311
12308
|
avatar,
|
|
12312
12309
|
header,
|
|
@@ -12317,14 +12314,8 @@ const ImageRecords = ({
|
|
|
12317
12314
|
onHeaderUploadRequested,
|
|
12318
12315
|
onHeaderManualUrlRequested
|
|
12319
12316
|
}) => {
|
|
12320
|
-
const avatarStyles = avatar ? {
|
|
12321
|
-
|
|
12322
|
-
...commonBgStyles
|
|
12323
|
-
} : {};
|
|
12324
|
-
const headerStyles = header ? {
|
|
12325
|
-
backgroundImage: `url(${header})`,
|
|
12326
|
-
...commonBgStyles
|
|
12327
|
-
} : {};
|
|
12317
|
+
const avatarStyles = avatar ? { backgroundImage: `url(${avatar})`, ...commonBgStyles } : {};
|
|
12318
|
+
const headerStyles = header ? { backgroundImage: `url(${header})`, ...commonBgStyles } : {};
|
|
12328
12319
|
const headerRecordSet = header !== void 0;
|
|
12329
12320
|
const avatarRecordSet = avatar !== void 0;
|
|
12330
12321
|
const requestAvatarManualUrl = () => {
|
|
@@ -12352,16 +12343,11 @@ const ImageRecords = ({
|
|
|
12352
12343
|
}
|
|
12353
12344
|
actions.push({
|
|
12354
12345
|
id: "manual-url",
|
|
12355
|
-
label:
|
|
12346
|
+
label: "Enter URL",
|
|
12356
12347
|
onSelect: requestAvatarManualUrl
|
|
12357
12348
|
});
|
|
12358
12349
|
return actions;
|
|
12359
|
-
}, [
|
|
12360
|
-
onAvatarUploadRequested,
|
|
12361
|
-
onAvatarManualUrlRequested,
|
|
12362
|
-
onAvatarAdded,
|
|
12363
|
-
avatarRecordSet
|
|
12364
|
-
]);
|
|
12350
|
+
}, [onAvatarUploadRequested, onAvatarManualUrlRequested, onAvatarAdded]);
|
|
12365
12351
|
const headerActions = useMemo(() => {
|
|
12366
12352
|
const actions = [];
|
|
12367
12353
|
if (onHeaderUploadRequested) {
|
|
@@ -12373,36 +12359,22 @@ const ImageRecords = ({
|
|
|
12373
12359
|
}
|
|
12374
12360
|
actions.push({
|
|
12375
12361
|
id: "manual-url",
|
|
12376
|
-
label:
|
|
12362
|
+
label: "Enter URL",
|
|
12377
12363
|
onSelect: requestHeaderManualUrl
|
|
12378
12364
|
});
|
|
12379
12365
|
return actions;
|
|
12380
|
-
}, [
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
headerRecordSet
|
|
12385
|
-
]);
|
|
12386
|
-
const renderActionTrigger = (record, recordSet, actions) => {
|
|
12387
|
-
const title = recordSet ? `Change ${record}` : `Add ${record}`;
|
|
12388
|
-
const hasActions = actions.length > 0;
|
|
12389
|
-
return /* @__PURE__ */ jsx(
|
|
12366
|
+
}, [onHeaderUploadRequested, onHeaderManualUrlRequested, onHeaderAdded]);
|
|
12367
|
+
return /* @__PURE__ */ jsx("div", { className: "ns-image-records", children: /* @__PURE__ */ jsxs("div", { style: headerStyles, className: "ns-cover-record-cont", children: [
|
|
12368
|
+
/* @__PURE__ */ jsx("div", { className: "ns-top-grad" }),
|
|
12369
|
+
/* @__PURE__ */ jsx("div", { className: "ns-bot-grad" }),
|
|
12370
|
+
!headerRecordSet && /* @__PURE__ */ jsx("div", { className: "ns-header-record-placeholder", children: /* @__PURE__ */ jsx(
|
|
12390
12371
|
Dropdown,
|
|
12391
12372
|
{
|
|
12392
12373
|
placement: "bottom",
|
|
12393
12374
|
align: "end",
|
|
12394
|
-
disabled:
|
|
12395
|
-
trigger: /* @__PURE__ */ jsx(
|
|
12396
|
-
|
|
12397
|
-
{
|
|
12398
|
-
className: `ns-image-action-plus ${recordSet ? "ns-image-action-plus--set" : ""} ${!hasActions ? "ns-image-action-plus--disabled" : ""}`,
|
|
12399
|
-
title,
|
|
12400
|
-
"aria-label": title,
|
|
12401
|
-
"aria-disabled": !hasActions,
|
|
12402
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "plus", size: 16 })
|
|
12403
|
-
}
|
|
12404
|
-
),
|
|
12405
|
-
children: /* @__PURE__ */ jsx("div", { className: "ns-image-actions-menu", children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
12375
|
+
disabled: headerActions.length === 0,
|
|
12376
|
+
trigger: /* @__PURE__ */ jsx("div", { title: "Add header", "aria-label": "Add header", children: /* @__PURE__ */ jsx(Icon, { color: "white", name: "plus", size: 22 }) }),
|
|
12377
|
+
children: /* @__PURE__ */ jsx("div", { className: "ns-image-actions-menu", children: headerActions.map((action) => /* @__PURE__ */ jsx(
|
|
12406
12378
|
"button",
|
|
12407
12379
|
{
|
|
12408
12380
|
type: "button",
|
|
@@ -12410,25 +12382,34 @@ const ImageRecords = ({
|
|
|
12410
12382
|
onClick: () => action.onSelect(),
|
|
12411
12383
|
children: action.label
|
|
12412
12384
|
},
|
|
12413
|
-
|
|
12385
|
+
`header-${action.id}`
|
|
12414
12386
|
)) })
|
|
12415
12387
|
}
|
|
12416
|
-
)
|
|
12417
|
-
|
|
12418
|
-
return /* @__PURE__ */ jsx("div", { className: "ns-image-records", children: /* @__PURE__ */ jsxs("div", { style: headerStyles, className: "ns-cover-record-cont", children: [
|
|
12419
|
-
/* @__PURE__ */ jsx("div", { className: "ns-top-grad" }),
|
|
12420
|
-
/* @__PURE__ */ jsx("div", { className: "ns-bot-grad" }),
|
|
12421
|
-
!headerRecordSet && /* @__PURE__ */ jsx("div", { className: "ns-header-record-placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Icon, { color: "white", name: "image", size: 22 }) }),
|
|
12422
|
-
/* @__PURE__ */ jsx("div", { className: "ns-header-action-anchor", children: renderActionTrigger("header", headerRecordSet, headerActions) }),
|
|
12423
|
-
/* @__PURE__ */ jsxs(
|
|
12388
|
+
) }),
|
|
12389
|
+
/* @__PURE__ */ jsx(
|
|
12424
12390
|
"div",
|
|
12425
12391
|
{
|
|
12426
12392
|
style: avatarStyles,
|
|
12427
12393
|
className: `ns-avatar-record-cont ${avatarRecordSet ? "ns-avatar-record-cont--set" : ""}`,
|
|
12428
|
-
children:
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12394
|
+
children: !avatarRecordSet && /* @__PURE__ */ jsx("div", { className: "ns-avatar-record-placeholder", children: /* @__PURE__ */ jsx(
|
|
12395
|
+
Dropdown,
|
|
12396
|
+
{
|
|
12397
|
+
placement: "bottom",
|
|
12398
|
+
align: "end",
|
|
12399
|
+
disabled: avatarActions.length === 0,
|
|
12400
|
+
trigger: /* @__PURE__ */ jsx("div", { title: "Add avatar", "aria-label": "Add avatar", children: /* @__PURE__ */ jsx(Icon, { color: "grey", name: "plus", size: 28 }) }),
|
|
12401
|
+
children: /* @__PURE__ */ jsx("div", { className: "ns-image-actions-menu", children: avatarActions.map((action) => /* @__PURE__ */ jsx(
|
|
12402
|
+
"button",
|
|
12403
|
+
{
|
|
12404
|
+
type: "button",
|
|
12405
|
+
className: "ns-image-actions-menu-item",
|
|
12406
|
+
onClick: () => action.onSelect(),
|
|
12407
|
+
children: action.label
|
|
12408
|
+
},
|
|
12409
|
+
`avatar-${action.id}`
|
|
12410
|
+
)) })
|
|
12411
|
+
}
|
|
12412
|
+
) })
|
|
12432
12413
|
}
|
|
12433
12414
|
)
|
|
12434
12415
|
] }) });
|
|
@@ -90359,8 +90340,10 @@ const RegistrationSummary = ({
|
|
|
90359
90340
|
onPriceChange,
|
|
90360
90341
|
onNameValidationChange,
|
|
90361
90342
|
onSetProfile,
|
|
90362
|
-
onStart
|
|
90343
|
+
onStart,
|
|
90344
|
+
onConnectWallet
|
|
90363
90345
|
}) => {
|
|
90346
|
+
const { isConnected } = useAccount();
|
|
90364
90347
|
const { isEnsAvailable, getRegistrationPrice } = useRegisterENS({
|
|
90365
90348
|
isTestnet
|
|
90366
90349
|
});
|
|
@@ -90547,7 +90530,16 @@ const RegistrationSummary = ({
|
|
|
90547
90530
|
}
|
|
90548
90531
|
)
|
|
90549
90532
|
] }),
|
|
90550
|
-
/* @__PURE__ */ jsx(
|
|
90533
|
+
!isConnected && onConnectWallet ? /* @__PURE__ */ jsx(
|
|
90534
|
+
Button,
|
|
90535
|
+
{
|
|
90536
|
+
style: { width: "100%" },
|
|
90537
|
+
size: "lg",
|
|
90538
|
+
className: "mt-2",
|
|
90539
|
+
onClick: onConnectWallet,
|
|
90540
|
+
children: "Connect Wallet"
|
|
90541
|
+
}
|
|
90542
|
+
) : /* @__PURE__ */ jsx(
|
|
90551
90543
|
Button,
|
|
90552
90544
|
{
|
|
90553
90545
|
style: { width: "100%" },
|
|
@@ -92099,7 +92091,8 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
92099
92091
|
onPriceChange: setPrice,
|
|
92100
92092
|
onNameValidationChange: setNameValidation,
|
|
92101
92093
|
onSetProfile: () => setShowProfile(true),
|
|
92102
|
-
onStart: () => setStep(1 /* Progress */)
|
|
92094
|
+
onStart: () => setStep(1 /* Progress */),
|
|
92095
|
+
onConnectWallet: props.onConnectWallet
|
|
92103
92096
|
}
|
|
92104
92097
|
)
|
|
92105
92098
|
] }),
|
|
@@ -93228,9 +93221,15 @@ const MintFormActions = ({
|
|
|
93228
93221
|
needsChainSwitch = false,
|
|
93229
93222
|
chainName = "",
|
|
93230
93223
|
onSwitchChain,
|
|
93231
|
-
isSwitchingChain = false
|
|
93224
|
+
isSwitchingChain = false,
|
|
93225
|
+
isConnected = true,
|
|
93226
|
+
onConnectWallet
|
|
93232
93227
|
}) => {
|
|
93233
93228
|
const handlePrimaryClick = () => {
|
|
93229
|
+
if (!isConnected) {
|
|
93230
|
+
onConnectWallet?.();
|
|
93231
|
+
return;
|
|
93232
|
+
}
|
|
93234
93233
|
if (needsChainSwitch && onSwitchChain) {
|
|
93235
93234
|
onSwitchChain();
|
|
93236
93235
|
} else {
|
|
@@ -93238,11 +93237,13 @@ const MintFormActions = ({
|
|
|
93238
93237
|
}
|
|
93239
93238
|
};
|
|
93240
93239
|
const getButtonLabel = () => {
|
|
93240
|
+
if (!isConnected) return "Connect Wallet";
|
|
93241
93241
|
if (isWaitingWallet) return "Waiting for wallet...";
|
|
93242
93242
|
if (needsChainSwitch) return `Switch to ${chainName}`;
|
|
93243
93243
|
return "Mint";
|
|
93244
93244
|
};
|
|
93245
93245
|
const isDisabled = () => {
|
|
93246
|
+
if (!isConnected) return false;
|
|
93246
93247
|
if (isWaitingWallet) return true;
|
|
93247
93248
|
if (needsChainSwitch) return isSwitchingChain;
|
|
93248
93249
|
return isMintDisabled;
|
|
@@ -93444,7 +93445,8 @@ const SubnameMintForm = ({
|
|
|
93444
93445
|
onCancel,
|
|
93445
93446
|
onSuccess,
|
|
93446
93447
|
onSubnameMinted,
|
|
93447
|
-
txConfirmations
|
|
93448
|
+
txConfirmations,
|
|
93449
|
+
onConnectWallet
|
|
93448
93450
|
}) => {
|
|
93449
93451
|
const { getListingDetails } = useMintManager({ isTestnet });
|
|
93450
93452
|
const [initState, setInitState] = useState({
|
|
@@ -93512,7 +93514,8 @@ const SubnameMintForm = ({
|
|
|
93512
93514
|
onCancel,
|
|
93513
93515
|
onSuccess,
|
|
93514
93516
|
onSubnameMinted,
|
|
93515
|
-
txConfirmations
|
|
93517
|
+
txConfirmations,
|
|
93518
|
+
onConnectWallet
|
|
93516
93519
|
}
|
|
93517
93520
|
) });
|
|
93518
93521
|
};
|
|
@@ -93533,7 +93536,8 @@ const SubnameMintFormContent = ({
|
|
|
93533
93536
|
onCancel,
|
|
93534
93537
|
onSuccess,
|
|
93535
93538
|
onSubnameMinted,
|
|
93536
|
-
txConfirmations
|
|
93539
|
+
txConfirmations,
|
|
93540
|
+
onConnectWallet
|
|
93537
93541
|
}) => {
|
|
93538
93542
|
const { address: connectedAddress, chain: currentChain } = useAccount();
|
|
93539
93543
|
const { switchChain, isPending: isSwitchingChain } = useSwitchChain();
|
|
@@ -94010,7 +94014,9 @@ const SubnameMintFormContent = ({
|
|
|
94010
94014
|
needsChainSwitch,
|
|
94011
94015
|
chainName: requiredChainName,
|
|
94012
94016
|
onSwitchChain: handleSwitchChain,
|
|
94013
|
-
isSwitchingChain
|
|
94017
|
+
isSwitchingChain,
|
|
94018
|
+
isConnected: !!connectedAddress,
|
|
94019
|
+
onConnectWallet
|
|
94014
94020
|
}
|
|
94015
94021
|
)
|
|
94016
94022
|
] });
|