@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.mjs CHANGED
@@ -26,7 +26,7 @@ import { Toaster as Toaster$1, toast } from "sonner";
26
26
  import { useTheme } from "next-themes";
27
27
 
28
28
  //#region src/version.ts
29
- const VERSION = "3.5.0";
29
+ const VERSION = "3.7.0";
30
30
 
31
31
  //#endregion
32
32
  //#region src/components/ui/accordion.tsx
@@ -3415,7 +3415,7 @@ function normalizeResolvedName(value) {
3415
3415
  * The component stays capability-free: it never reads a runtime or wallet
3416
3416
  * state; everything arrives through the injected context (INV-118).
3417
3417
  */
3418
- function AddressField({ id, label, placeholder, helperText, control, name, width = "full", validation, addressing, readOnly, suggestions: suggestionsProp, onSuggestionSelect, onResolvedNameChange, showCrossNetworkFallbackDisclaimer = true }) {
3418
+ function AddressField({ id, label, placeholder, helperText, control, name, width = "full", validation, addressing, readOnly, suggestions: suggestionsProp, onSuggestionSelect, onResolvedNameChange, showCrossNetworkFallbackDisclaimer = true, showForwardResolutionSuccessAnnouncer = true }) {
3419
3419
  const isRequired = !!validation?.required;
3420
3420
  const errorId = `${id}-error`;
3421
3421
  const descriptionId = `${id}-description`;
@@ -3618,6 +3618,7 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
3618
3618
  });
3619
3619
  const fallbackNetworks = showCrossNetworkFallbackDisclaimer && isCrossNetworkFallback(resolution.data.provenance) ? getFallbackNetworks(resolution.data.provenance) : void 0;
3620
3620
  const fallbackMessage = fallbackNetworks && nameResolutionCrossNetworkFallbackMessage(fallbackNetworks, crossNetworkFallbackMessageNames(fallbackNetworks, resolveNetworkLabel));
3621
+ if (!showForwardResolutionSuccessAnnouncer) return null;
3621
3622
  return /* @__PURE__ */ jsxs("span", {
3622
3623
  className: "text-sm",
3623
3624
  children: [/* @__PURE__ */ jsxs("span", { children: ["Resolved to ", /* @__PURE__ */ jsx("code", {
@@ -3714,6 +3715,61 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
3714
3715
  }
3715
3716
  AddressField.displayName = "AddressField";
3716
3717
 
3718
+ //#endregion
3719
+ //#region src/components/fields/ResolvedAddressFieldPreview.tsx
3720
+ /**
3721
+ * Rich ENS preview shown below an `AddressField` once the value is a valid address.
3722
+ * Complements the field's mechanism-neutral "Resolved to 0x…" announcer with
3723
+ * reverse-resolved name + avatar via `AddressDisplay`.
3724
+ *
3725
+ * For async reverse resolution, wrap in `AddressNameProvider` (or
3726
+ * `AddressNameResolutionProvider` from `@openzeppelin/ui-renderer`) and omit
3727
+ * `resolvedName`. For sync / app-owned resolution, pass `resolvedName` directly.
3728
+ */
3729
+ function ResolvedAddressFieldPreview({ address, networkId, addressing, resolvedName, label = "Resolved account", displayProps }) {
3730
+ const trimmed = address?.trim() ?? "";
3731
+ if (!(trimmed !== "" && addressing?.isValidAddress(trimmed) === true)) return null;
3732
+ return /* @__PURE__ */ jsxs("div", {
3733
+ className: "rounded-md border border-border/60 bg-muted/30 px-3 py-2",
3734
+ "aria-label": "Resolved address preview",
3735
+ children: [/* @__PURE__ */ jsx("p", {
3736
+ className: "mb-1 text-xs text-muted-foreground",
3737
+ children: label
3738
+ }), /* @__PURE__ */ jsx(AddressDisplay, {
3739
+ address: trimmed,
3740
+ networkId,
3741
+ variant: "chip",
3742
+ showCopyButton: true,
3743
+ resolvedName,
3744
+ ...displayProps
3745
+ })]
3746
+ });
3747
+ }
3748
+
3749
+ //#endregion
3750
+ //#region src/components/fields/AddressFieldWithResolvedPreview.tsx
3751
+ /**
3752
+ * `AddressField` plus a rich ENS preview card. Suppresses the redundant forward
3753
+ * "Resolved to 0x…" announcer — the preview card below replaces it.
3754
+ *
3755
+ * Parent must `watch` the field and pass the value as `previewAddress`.
3756
+ */
3757
+ function AddressFieldWithResolvedPreview({ previewAddress, previewNetworkId, addressing, className, preview, showCrossNetworkFallbackDisclaimer, showForwardResolutionSuccessAnnouncer, ...addressFieldProps }) {
3758
+ return /* @__PURE__ */ jsxs("div", {
3759
+ className: cn("space-y-1", "[&_[id$=\"-resolution\"]:empty]:min-h-0", className),
3760
+ children: [/* @__PURE__ */ jsx(AddressField, {
3761
+ ...addressFieldProps,
3762
+ addressing,
3763
+ showCrossNetworkFallbackDisclaimer: showCrossNetworkFallbackDisclaimer ?? false,
3764
+ showForwardResolutionSuccessAnnouncer: showForwardResolutionSuccessAnnouncer ?? false
3765
+ }), preview ?? /* @__PURE__ */ jsx(ResolvedAddressFieldPreview, {
3766
+ address: previewAddress,
3767
+ networkId: previewNetworkId,
3768
+ addressing
3769
+ })]
3770
+ });
3771
+ }
3772
+
3717
3773
  //#endregion
3718
3774
  //#region src/components/fields/TextAreaField.tsx
3719
3775
  /**
@@ -7630,5 +7686,5 @@ const Toaster = ({ ...props }) => {
7630
7686
  };
7631
7687
 
7632
7688
  //#endregion
7633
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddressDisplay, AddressField, AddressLabelProvider, AddressListField, AddressNameProvider, AddressSuggestionList, AddressSuggestionProvider, Alert, AlertDescription, AlertTitle, AmountField, ArrayField, ArrayObjectField, Banner, BaseField, BigIntField, BooleanField, Button, BytesField, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_ADDRESS_LIST_FIELD_LABELS, DateRangePicker, DateTimeField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EcosystemDropdown, EcosystemIcon, EmptyState, EnumField, ErrorMessage, ExternalLink, FileUploadField, Footer, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Header, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, Input, Label, LoadingButton, MapEntryRow, MapField, MidnightIcon, NAME_RESOLUTION_DEBOUNCE_MS, NameResolverContext, NameResolverProvider, NetworkAvailabilityNotice, NetworkErrorNotificationProvider, NetworkIcon, NetworkSelector, NetworkServiceErrorBanner, NetworkStatusBadge, NumberField, ObjectField, OverflowMenu, PasswordField, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioGroup, RadioGroupItem, RelayerDetailsCard, Select, SelectContent, SelectField, SelectGroup, SelectGroupedField, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, SidebarGroup, SidebarLayout, SidebarSection, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextField, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, VERSION, ViewContractStateButton, WizardLayout, WizardNavigation, WizardStepper, buildAddressListPreviewSummary, buttonVariants, computeChildTouched, createFocusManager, createValidationResult, formatAddressBulkSummary, formatValidationError, getAccessibilityProps, getDescribedById, getErrorMessage, getValidationStateClasses, getWidthClasses, handleEscapeKey, handleKeyboardEvent, handleNumericKeys, handleToggleKeys, handleValidationError, hasFieldError, isDuplicateMapKey, resolveAddressListFieldLabels, useAddressLabel, useAddressName, useAddressSuggestionField, useAddressSuggestions, useDuplicateKeyIndexes, useInjectedNameResolution, useMapFieldSync, useNameResolver, useNetworkErrorAwareAdapter, useNetworkErrorReporter, useNetworkErrors, validateField, validateMapEntries, validateMapStructure };
7689
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddressDisplay, AddressField, AddressFieldWithResolvedPreview, AddressLabelProvider, AddressListField, AddressNameProvider, AddressSuggestionList, AddressSuggestionProvider, Alert, AlertDescription, AlertTitle, AmountField, ArrayField, ArrayObjectField, Banner, BaseField, BigIntField, BooleanField, Button, BytesField, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_ADDRESS_LIST_FIELD_LABELS, DateRangePicker, DateTimeField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EcosystemDropdown, EcosystemIcon, EmptyState, EnumField, ErrorMessage, ExternalLink, FileUploadField, Footer, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Header, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, Input, Label, LoadingButton, MapEntryRow, MapField, MidnightIcon, NAME_RESOLUTION_DEBOUNCE_MS, NameResolverContext, NameResolverProvider, NetworkAvailabilityNotice, NetworkErrorNotificationProvider, NetworkIcon, NetworkSelector, NetworkServiceErrorBanner, NetworkStatusBadge, NumberField, ObjectField, OverflowMenu, PasswordField, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioGroup, RadioGroupItem, RelayerDetailsCard, ResolvedAddressFieldPreview, Select, SelectContent, SelectField, SelectGroup, SelectGroupedField, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, SidebarGroup, SidebarLayout, SidebarSection, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextField, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, VERSION, ViewContractStateButton, WizardLayout, WizardNavigation, WizardStepper, buildAddressListPreviewSummary, buttonVariants, computeChildTouched, createFocusManager, createValidationResult, formatAddressBulkSummary, formatValidationError, getAccessibilityProps, getDescribedById, getErrorMessage, getValidationStateClasses, getWidthClasses, handleEscapeKey, handleKeyboardEvent, handleNumericKeys, handleToggleKeys, handleValidationError, hasFieldError, isDuplicateMapKey, resolveAddressListFieldLabels, useAddressLabel, useAddressName, useAddressSuggestionField, useAddressSuggestions, useDuplicateKeyIndexes, useInjectedNameResolution, useMapFieldSync, useNameResolver, useNetworkErrorAwareAdapter, useNetworkErrorReporter, useNetworkErrors, validateField, validateMapEntries, validateMapStructure };
7634
7690
  //# sourceMappingURL=index.mjs.map