@openzeppelin/ui-components 3.5.0 → 3.7.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.cjs +60 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +73 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +59 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ let sonner = require("sonner");
|
|
|
38
38
|
let next_themes = require("next-themes");
|
|
39
39
|
|
|
40
40
|
//#region src/version.ts
|
|
41
|
-
const VERSION = "3.
|
|
41
|
+
const VERSION = "3.7.0";
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/ui/accordion.tsx
|
|
@@ -3439,7 +3439,7 @@ function normalizeResolvedName(value) {
|
|
|
3439
3439
|
* The component stays capability-free: it never reads a runtime or wallet
|
|
3440
3440
|
* state; everything arrives through the injected context (INV-118).
|
|
3441
3441
|
*/
|
|
3442
|
-
function AddressField({ id, label, placeholder, helperText, control, name, width = "full", validation, addressing, readOnly, suggestions: suggestionsProp, onSuggestionSelect, onResolvedNameChange, showCrossNetworkFallbackDisclaimer = true }) {
|
|
3442
|
+
function AddressField({ id, label, placeholder, helperText, control, name, width = "full", validation, addressing, readOnly, suggestions: suggestionsProp, onSuggestionSelect, onResolvedNameChange, showCrossNetworkFallbackDisclaimer = true, showForwardResolutionSuccessAnnouncer = true }) {
|
|
3443
3443
|
const isRequired = !!validation?.required;
|
|
3444
3444
|
const errorId = `${id}-error`;
|
|
3445
3445
|
const descriptionId = `${id}-description`;
|
|
@@ -3642,6 +3642,7 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
|
|
|
3642
3642
|
});
|
|
3643
3643
|
const fallbackNetworks = showCrossNetworkFallbackDisclaimer && (0, _openzeppelin_ui_utils.isCrossNetworkFallback)(resolution.data.provenance) ? (0, _openzeppelin_ui_utils.getFallbackNetworks)(resolution.data.provenance) : void 0;
|
|
3644
3644
|
const fallbackMessage = fallbackNetworks && (0, _openzeppelin_ui_utils.nameResolutionCrossNetworkFallbackMessage)(fallbackNetworks, (0, _openzeppelin_ui_utils.crossNetworkFallbackMessageNames)(fallbackNetworks, resolveNetworkLabel));
|
|
3645
|
+
if (!showForwardResolutionSuccessAnnouncer) return null;
|
|
3645
3646
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3646
3647
|
className: "text-sm",
|
|
3647
3648
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["Resolved to ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
@@ -3738,6 +3739,61 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
|
|
|
3738
3739
|
}
|
|
3739
3740
|
AddressField.displayName = "AddressField";
|
|
3740
3741
|
|
|
3742
|
+
//#endregion
|
|
3743
|
+
//#region src/components/fields/ResolvedAddressFieldPreview.tsx
|
|
3744
|
+
/**
|
|
3745
|
+
* Rich ENS preview shown below an `AddressField` once the value is a valid address.
|
|
3746
|
+
* Complements the field's mechanism-neutral "Resolved to 0x…" announcer with
|
|
3747
|
+
* reverse-resolved name + avatar via `AddressDisplay`.
|
|
3748
|
+
*
|
|
3749
|
+
* For async reverse resolution, wrap in `AddressNameProvider` (or
|
|
3750
|
+
* `AddressNameResolutionProvider` from `@openzeppelin/ui-renderer`) and omit
|
|
3751
|
+
* `resolvedName`. For sync / app-owned resolution, pass `resolvedName` directly.
|
|
3752
|
+
*/
|
|
3753
|
+
function ResolvedAddressFieldPreview({ address, networkId, addressing, resolvedName, label = "Resolved account", displayProps }) {
|
|
3754
|
+
const trimmed = address?.trim() ?? "";
|
|
3755
|
+
if (!(trimmed !== "" && addressing?.isValidAddress(trimmed) === true)) return null;
|
|
3756
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3757
|
+
className: "rounded-md border border-border/60 bg-muted/30 px-3 py-2",
|
|
3758
|
+
"aria-label": "Resolved address preview",
|
|
3759
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3760
|
+
className: "mb-1 text-xs text-muted-foreground",
|
|
3761
|
+
children: label
|
|
3762
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddressDisplay, {
|
|
3763
|
+
address: trimmed,
|
|
3764
|
+
networkId,
|
|
3765
|
+
variant: "chip",
|
|
3766
|
+
showCopyButton: true,
|
|
3767
|
+
resolvedName,
|
|
3768
|
+
...displayProps
|
|
3769
|
+
})]
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
//#endregion
|
|
3774
|
+
//#region src/components/fields/AddressFieldWithResolvedPreview.tsx
|
|
3775
|
+
/**
|
|
3776
|
+
* `AddressField` plus a rich ENS preview card. Suppresses the redundant forward
|
|
3777
|
+
* "Resolved to 0x…" announcer — the preview card below replaces it.
|
|
3778
|
+
*
|
|
3779
|
+
* Parent must `watch` the field and pass the value as `previewAddress`.
|
|
3780
|
+
*/
|
|
3781
|
+
function AddressFieldWithResolvedPreview({ previewAddress, previewNetworkId, addressing, className, preview, showCrossNetworkFallbackDisclaimer, showForwardResolutionSuccessAnnouncer, ...addressFieldProps }) {
|
|
3782
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3783
|
+
className: (0, _openzeppelin_ui_utils.cn)("space-y-1", "[&_[id$=\"-resolution\"]:empty]:min-h-0", className),
|
|
3784
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddressField, {
|
|
3785
|
+
...addressFieldProps,
|
|
3786
|
+
addressing,
|
|
3787
|
+
showCrossNetworkFallbackDisclaimer: showCrossNetworkFallbackDisclaimer ?? false,
|
|
3788
|
+
showForwardResolutionSuccessAnnouncer: showForwardResolutionSuccessAnnouncer ?? false
|
|
3789
|
+
}), preview ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedAddressFieldPreview, {
|
|
3790
|
+
address: previewAddress,
|
|
3791
|
+
networkId: previewNetworkId,
|
|
3792
|
+
addressing
|
|
3793
|
+
})]
|
|
3794
|
+
});
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3741
3797
|
//#endregion
|
|
3742
3798
|
//#region src/components/fields/TextAreaField.tsx
|
|
3743
3799
|
/**
|
|
@@ -7660,6 +7716,7 @@ exports.AccordionItem = AccordionItem;
|
|
|
7660
7716
|
exports.AccordionTrigger = AccordionTrigger;
|
|
7661
7717
|
exports.AddressDisplay = AddressDisplay;
|
|
7662
7718
|
exports.AddressField = AddressField;
|
|
7719
|
+
exports.AddressFieldWithResolvedPreview = AddressFieldWithResolvedPreview;
|
|
7663
7720
|
exports.AddressLabelProvider = AddressLabelProvider;
|
|
7664
7721
|
exports.AddressListField = AddressListField;
|
|
7665
7722
|
exports.AddressNameProvider = AddressNameProvider;
|
|
@@ -7760,6 +7817,7 @@ exports.RadioField = RadioField;
|
|
|
7760
7817
|
exports.RadioGroup = RadioGroup;
|
|
7761
7818
|
exports.RadioGroupItem = RadioGroupItem;
|
|
7762
7819
|
exports.RelayerDetailsCard = RelayerDetailsCard;
|
|
7820
|
+
exports.ResolvedAddressFieldPreview = ResolvedAddressFieldPreview;
|
|
7763
7821
|
exports.Select = Select;
|
|
7764
7822
|
exports.SelectContent = SelectContent;
|
|
7765
7823
|
exports.SelectField = SelectField;
|