@openzeppelin/ui-components 3.6.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 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.6.0";
41
+ const VERSION = "3.7.0";
42
42
 
43
43
  //#endregion
44
44
  //#region src/components/ui/accordion.tsx
@@ -3739,6 +3739,61 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
3739
3739
  }
3740
3740
  AddressField.displayName = "AddressField";
3741
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
+
3742
3797
  //#endregion
3743
3798
  //#region src/components/fields/TextAreaField.tsx
3744
3799
  /**
@@ -7661,6 +7716,7 @@ exports.AccordionItem = AccordionItem;
7661
7716
  exports.AccordionTrigger = AccordionTrigger;
7662
7717
  exports.AddressDisplay = AddressDisplay;
7663
7718
  exports.AddressField = AddressField;
7719
+ exports.AddressFieldWithResolvedPreview = AddressFieldWithResolvedPreview;
7664
7720
  exports.AddressLabelProvider = AddressLabelProvider;
7665
7721
  exports.AddressListField = AddressListField;
7666
7722
  exports.AddressNameProvider = AddressNameProvider;
@@ -7761,6 +7817,7 @@ exports.RadioField = RadioField;
7761
7817
  exports.RadioGroup = RadioGroup;
7762
7818
  exports.RadioGroupItem = RadioGroupItem;
7763
7819
  exports.RelayerDetailsCard = RelayerDetailsCard;
7820
+ exports.ResolvedAddressFieldPreview = ResolvedAddressFieldPreview;
7764
7821
  exports.Select = Select;
7765
7822
  exports.SelectContent = SelectContent;
7766
7823
  exports.SelectField = SelectField;