@openzeppelin/ui-components 3.3.0 → 3.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/README.md +4 -0
- package/dist/index.cjs +1006 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +417 -15
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +423 -21
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +988 -194
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React$2 from "react";
|
|
2
|
-
import React$1, { ForwardedRef, JSX, ReactElement, ReactNode } from "react";
|
|
2
|
+
import React$1, { Context, ForwardedRef, JSX, ReactElement, ReactNode } from "react";
|
|
3
3
|
import { Control, FieldError, FieldPath, FieldValues, FormProvider, UseFormReturn } from "react-hook-form";
|
|
4
4
|
import * as class_variance_authority_types1 from "class-variance-authority/types";
|
|
5
5
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
6
6
|
import { VariantProps } from "class-variance-authority";
|
|
7
|
-
import { AddressLabelResolver, AddressSuggestion, AddressSuggestionResolver, AddressingCapability, ContractSchema, Ecosystem, EcosystemMetadata, EnumValue, FieldValidation, FormFieldType, FunctionParameter, MapEntry, NetworkConfig, NetworkType, RelayerDetails, RelayerDetailsRich, RuntimeCapability, TypeMappingCapability } from "@openzeppelin/ui-types";
|
|
7
|
+
import { AddressLabelResolver, AddressNameResolver, AddressSuggestion, AddressSuggestionResolver, AddressingCapability, ContractSchema, Ecosystem, EcosystemMetadata, EnumValue, FieldValidation, FormFieldType, FunctionParameter, MapEntry, NameResolutionError, NameResolver, NetworkConfig, NetworkType, RelayerDetails, RelayerDetailsRich, ResolutionResult, ResolvedAddress, ResolvedName, RuntimeCapability, TypeMappingCapability } from "@openzeppelin/ui-types";
|
|
8
8
|
import { DateRange, DayPicker } from "react-day-picker";
|
|
9
9
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
10
10
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
@@ -45,6 +45,18 @@ declare const AccordionTrigger: React$2.ForwardRefExoticComponent<AccordionTrigg
|
|
|
45
45
|
interface AccordionContentProps extends React$2.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>, VariantProps<typeof accordionContentVariants> {}
|
|
46
46
|
declare const AccordionContent: React$2.ForwardRefExoticComponent<AccordionContentProps & React$2.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
//#endregion
|
|
48
|
+
//#region src/components/ui/address-display/address-avatar.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* Visual treatment for {@link AddressAvatar}.
|
|
51
|
+
*
|
|
52
|
+
* - `'fill'` – a square avatar that stretches to the parent slot's full
|
|
53
|
+
* height and sits flush against its edges (default). Intended for a chip
|
|
54
|
+
* whose container clips it with `overflow-hidden` + a border radius.
|
|
55
|
+
* - `'circle'` – small round avatar sitting inline with the text (the
|
|
56
|
+
* original look, kept as an opt-in).
|
|
57
|
+
*/
|
|
58
|
+
type AddressAvatarVariant = 'circle' | 'fill';
|
|
59
|
+
//#endregion
|
|
48
60
|
//#region src/components/ui/address-display/address-display.d.ts
|
|
49
61
|
/**
|
|
50
62
|
* Visual style for the component container.
|
|
@@ -123,9 +135,12 @@ interface AddressDisplayProps extends React$2.HTMLAttributes<HTMLDivElement> {
|
|
|
123
135
|
*/
|
|
124
136
|
networkId?: string;
|
|
125
137
|
/**
|
|
126
|
-
* When `true`, skip label resolution from
|
|
127
|
-
*
|
|
128
|
-
*
|
|
138
|
+
* When `true`, render the instance fully raw: skip label resolution from
|
|
139
|
+
* `AddressLabelContext` AND suppress any injected resolved name
|
|
140
|
+
* (`resolvedName` prop / `AddressNameContext`). Useful for rendering an
|
|
141
|
+
* address without any decoration (e.g. in a contract selector where the
|
|
142
|
+
* contract name is already shown) — existing `disableLabel` call-sites
|
|
143
|
+
* must not sprout a name once a resolver is wired app-wide.
|
|
129
144
|
* @default false
|
|
130
145
|
*/
|
|
131
146
|
disableLabel?: boolean;
|
|
@@ -142,6 +157,38 @@ interface AddressDisplayProps extends React$2.HTMLAttributes<HTMLDivElement> {
|
|
|
142
157
|
* @default "chip"
|
|
143
158
|
*/
|
|
144
159
|
variant?: AddressDisplayVariant;
|
|
160
|
+
/**
|
|
161
|
+
* Optional presentational leading element (e.g. an avatar or icon), rendered
|
|
162
|
+
* before the label/address block and vertically centered against it. Purely
|
|
163
|
+
* visual — a `React.ReactNode`, not a capability, so this component stays
|
|
164
|
+
* chain-agnostic. When omitted (the default at every existing call-site), the
|
|
165
|
+
* rendered DOM and layout are byte-for-byte identical to the pre-avatar
|
|
166
|
+
* component: no wrapper element, no reserved slot, in both render branches.
|
|
167
|
+
*/
|
|
168
|
+
avatar?: React$2.ReactNode;
|
|
169
|
+
/**
|
|
170
|
+
* Visual treatment for the leading avatar (both the record-constructed ENS
|
|
171
|
+
* avatar and an explicit `avatar` node):
|
|
172
|
+
*
|
|
173
|
+
* - `'fill'` – a square avatar that stretches to the chip's full height and
|
|
174
|
+
* sits flush against its top, bottom, and left edges (default; the chip
|
|
175
|
+
* clips its outer corners). No effect when no avatar is shown.
|
|
176
|
+
* - `'circle'` – small round avatar sitting inline with the text (the
|
|
177
|
+
* original look, kept as an opt-in).
|
|
178
|
+
*
|
|
179
|
+
* @default "fill"
|
|
180
|
+
*/
|
|
181
|
+
avatarVariant?: AddressAvatarVariant;
|
|
182
|
+
/**
|
|
183
|
+
* An already-resolved reverse name record for this address (value type).
|
|
184
|
+
* Highest precedence for the name channel — shadows the
|
|
185
|
+
* `AddressNameContext` resolver, exactly as `label` shadows
|
|
186
|
+
* `AddressLabelContext` (INV-120). The record's name renders only when
|
|
187
|
+
* `forwardVerified === true` (INV-52, LOCKED): a mismatched record is
|
|
188
|
+
* suppressed to hex — never name-alone, never name+warning. `undefined`
|
|
189
|
+
* falls back to the context (if any), then to hex.
|
|
190
|
+
*/
|
|
191
|
+
resolvedName?: ResolvedName;
|
|
145
192
|
/**
|
|
146
193
|
* Additional CSS classes
|
|
147
194
|
*/
|
|
@@ -149,15 +196,27 @@ interface AddressDisplayProps extends React$2.HTMLAttributes<HTMLDivElement> {
|
|
|
149
196
|
}
|
|
150
197
|
/**
|
|
151
198
|
* Displays a blockchain address with optional truncation, copy button,
|
|
152
|
-
* explorer link, tooltip,
|
|
199
|
+
* explorer link, tooltip, human-readable label, and (when an already-resolved
|
|
200
|
+
* record is injected) a forward-verified name + avatar.
|
|
153
201
|
*
|
|
154
|
-
* Labels are resolved in priority order:
|
|
202
|
+
* Labels are resolved in priority order (INV-56):
|
|
155
203
|
* 1. Explicit `label` prop
|
|
156
204
|
* 2. `AddressLabelContext` resolver (via `AddressLabelProvider`)
|
|
157
|
-
* 3.
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
205
|
+
* 3. Forward-verified resolved name (`resolvedName` prop, else
|
|
206
|
+
* `AddressNameContext` via `AddressNameProvider`) — a record with
|
|
207
|
+
* `forwardVerified: false` is suppressed to hex (INV-52, LOCKED)
|
|
208
|
+
* 4. No label (renders address only, identical to previous behavior)
|
|
209
|
+
*
|
|
210
|
+
* The component is synchronous and capability-free (INV-121): it never
|
|
211
|
+
* resolves anything itself — it reads injected values. Hex renders on first
|
|
212
|
+
* commit; the name+avatar swap in when the react layer feeds an updated
|
|
213
|
+
* record (progressive enhancement, INV-61). With no `resolvedName` and no
|
|
214
|
+
* `AddressNameProvider`, output is byte-identical to the pre-enhancement
|
|
215
|
+
* component (INV-54, LOCKED).
|
|
216
|
+
*
|
|
217
|
+
* Pass `disableLabel` to render fully raw — it suppresses both the context
|
|
218
|
+
* alias and any injected resolved name (e.g. when the surrounding UI already
|
|
219
|
+
* shows a name, such as a contract selector).
|
|
161
220
|
*
|
|
162
221
|
* @example
|
|
163
222
|
* ```tsx
|
|
@@ -184,6 +243,14 @@ interface AddressDisplayProps extends React$2.HTMLAttributes<HTMLDivElement> {
|
|
|
184
243
|
* // Inline variant (no chip background) — useful inside wallet bars
|
|
185
244
|
* <AddressDisplay address="0x742d35Cc..." variant="inline" showTooltip showCopyButton />
|
|
186
245
|
*
|
|
246
|
+
* // Reverse-resolved name + avatar via an injected value (react layer owns the async)
|
|
247
|
+
* <AddressDisplay address="0x742d35Cc..." resolvedName={record} showCopyButton />
|
|
248
|
+
*
|
|
249
|
+
* // Or subtree-wide via context (rows stay plain <AddressDisplay/>)
|
|
250
|
+
* <AddressNameProvider resolveAddressName={readFromResolutionCache}>
|
|
251
|
+
* <AddressDisplay address="0x742d35Cc..." />
|
|
252
|
+
* </AddressNameProvider>
|
|
253
|
+
*
|
|
187
254
|
* // Truncate only when an alias/label is present (full address when unlabeled)
|
|
188
255
|
* <AddressDisplay address="G..." truncateWhenLabeled />
|
|
189
256
|
* ```
|
|
@@ -204,6 +271,9 @@ declare function AddressDisplay({
|
|
|
204
271
|
disableLabel,
|
|
205
272
|
showTooltip,
|
|
206
273
|
variant,
|
|
274
|
+
avatar,
|
|
275
|
+
avatarVariant,
|
|
276
|
+
resolvedName,
|
|
207
277
|
className,
|
|
208
278
|
onPointerEnter,
|
|
209
279
|
onPointerLeave,
|
|
@@ -275,6 +345,58 @@ interface UseAddressLabelResult {
|
|
|
275
345
|
*/
|
|
276
346
|
declare function useAddressLabel(address: string, networkId?: string): UseAddressLabelResult;
|
|
277
347
|
//#endregion
|
|
348
|
+
//#region src/components/ui/address-display/address-name-context.d.ts
|
|
349
|
+
/**
|
|
350
|
+
* Props for `AddressNameProvider`.
|
|
351
|
+
*
|
|
352
|
+
* Accepts the same shape as `AddressNameResolver` so the provider can be
|
|
353
|
+
* spread directly from a resolver source: `<AddressNameProvider {...resolver}>`.
|
|
354
|
+
*/
|
|
355
|
+
interface AddressNameProviderProps extends AddressNameResolver {
|
|
356
|
+
children: React$2.ReactNode;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Provides reverse-name resolution to all `AddressDisplay` instances in the
|
|
360
|
+
* subtree. `resolveAddressName` MUST be synchronous — it is called during
|
|
361
|
+
* render (INV-122). A resolver that returns `undefined` for an address is
|
|
362
|
+
* behaviorally identical to mounting no provider (INV-54).
|
|
363
|
+
*
|
|
364
|
+
* @param props - Resolver function and children
|
|
365
|
+
*/
|
|
366
|
+
declare function AddressNameProvider({
|
|
367
|
+
children,
|
|
368
|
+
resolveAddressName
|
|
369
|
+
}: AddressNameProviderProps): React$2.ReactElement;
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/components/ui/address-display/use-address-name.d.ts
|
|
372
|
+
/**
|
|
373
|
+
* Return type for the `useAddressName` convenience hook.
|
|
374
|
+
*/
|
|
375
|
+
interface UseAddressNameResult {
|
|
376
|
+
/** Resolved record, or `undefined` if no provider/record exists */
|
|
377
|
+
record: ResolvedName | undefined;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Reads the `AddressNameContext` for one address, synchronously (INV-122).
|
|
381
|
+
* Returns `{ record: undefined }` when no provider is mounted — never throws,
|
|
382
|
+
* never suspends. Note the record is returned verbatim: callers rendering a
|
|
383
|
+
* name from it must apply the same `forwardVerified === true` gate that
|
|
384
|
+
* `AddressDisplay` applies (INV-52).
|
|
385
|
+
*
|
|
386
|
+
* @param address - The blockchain address to reverse-resolve
|
|
387
|
+
* @param networkId - Optional network identifier scoping the lookup
|
|
388
|
+
* @returns The current best-known record for the address
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```tsx
|
|
392
|
+
* function EnsBadge({ address }: { address: string }) {
|
|
393
|
+
* const { record } = useAddressName(address);
|
|
394
|
+
* return record?.forwardVerified ? <Badge>{record.name}</Badge> : null;
|
|
395
|
+
* }
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
declare function useAddressName(address: string, networkId?: string): UseAddressNameResult;
|
|
399
|
+
//#endregion
|
|
278
400
|
//#region src/components/ui/alert.d.ts
|
|
279
401
|
declare const Alert: React$2.ForwardRefExoticComponent<React$2.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
280
402
|
variant?: "default" | "destructive" | "success" | null | undefined;
|
|
@@ -1330,6 +1452,18 @@ interface AddressFieldProps<TFieldValues extends FieldValues = FieldValues> exte
|
|
|
1330
1452
|
* so callers can perform additional side-effects beyond filling the field value.
|
|
1331
1453
|
*/
|
|
1332
1454
|
onSuggestionSelect?: (suggestion: AddressSuggestion) => void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Fired when the resolved-and-name-matched name changes. Emits the resolved
|
|
1457
|
+
* NAME (not the hex) on `resolved` + name-match, and `undefined` in every
|
|
1458
|
+
* other state (idle / debouncing / loading / error / hex / cleared).
|
|
1459
|
+
*
|
|
1460
|
+
* Pure notification for consumers that want the human-readable name (e.g.
|
|
1461
|
+
* the address book's alias suggestion, SF-5 INV-109..111). It reads existing
|
|
1462
|
+
* resolution state and does NOT participate in the resolved-hex write path
|
|
1463
|
+
* (INV-75/79/80/81/85 unaffected). With no injected resolver it only ever
|
|
1464
|
+
* emits `undefined`, so the field stays behavior-identical (INV-82).
|
|
1465
|
+
*/
|
|
1466
|
+
onResolvedNameChange?: (name: string | undefined) => void;
|
|
1333
1467
|
}
|
|
1334
1468
|
/**
|
|
1335
1469
|
* Address input field component specifically designed for blockchain addresses via React Hook Form integration.
|
|
@@ -1358,7 +1492,22 @@ interface AddressFieldProps<TFieldValues extends FieldValues = FieldValues> exte
|
|
|
1358
1492
|
* Pass `suggestions={false}` to opt out when a provider is mounted.
|
|
1359
1493
|
*
|
|
1360
1494
|
* The suggestion dropdown includes built-in debouncing, keyboard navigation (Arrow keys,
|
|
1361
|
-
* Enter, Escape), click-outside dismissal, and ARIA listbox semantics
|
|
1495
|
+
* Enter, Escape), click-outside dismissal, and ARIA listbox semantics — all provided by
|
|
1496
|
+
* the shared headless `useAddressSuggestionField` hook + `AddressSuggestionList`.
|
|
1497
|
+
*
|
|
1498
|
+
* **Inline name resolution (SF-3, opt-in via context).** When a
|
|
1499
|
+
* `NameResolverProvider` is mounted, the field also accepts a name (e.g.
|
|
1500
|
+
* `alice.eth`): the name is resolved inline through the injected `resolveName`
|
|
1501
|
+
* and the RHF form value becomes the resolved hex — never the name, never a
|
|
1502
|
+
* silently-coerced value. The correctness spine is a shadow-state model:
|
|
1503
|
+
* the `<input>` always shows the typed string (`inputValue`, INV-69); the RHF
|
|
1504
|
+
* value is `''` for every unresolved name state so submit stays gated with no
|
|
1505
|
+
* async validator (INV-75); the single name→hex write fires only on
|
|
1506
|
+
* `resolved` + normalized name-match (INV-79/80). With **no** provider mounted
|
|
1507
|
+
* every resolution branch below is dead code and the field is byte-identical
|
|
1508
|
+
* to its pre-ENS behavior (INV-82 — the LOCKED backward-compat guarantee).
|
|
1509
|
+
* The component stays capability-free: it never reads a runtime or wallet
|
|
1510
|
+
* state; everything arrives through the injected context (INV-118).
|
|
1362
1511
|
*/
|
|
1363
1512
|
declare function AddressField<TFieldValues extends FieldValues = FieldValues>({
|
|
1364
1513
|
id,
|
|
@@ -1372,7 +1521,8 @@ declare function AddressField<TFieldValues extends FieldValues = FieldValues>({
|
|
|
1372
1521
|
addressing,
|
|
1373
1522
|
readOnly,
|
|
1374
1523
|
suggestions: suggestionsProp,
|
|
1375
|
-
onSuggestionSelect
|
|
1524
|
+
onSuggestionSelect,
|
|
1525
|
+
onResolvedNameChange
|
|
1376
1526
|
}: AddressFieldProps<TFieldValues>): React$1.ReactElement;
|
|
1377
1527
|
declare namespace AddressField {
|
|
1378
1528
|
var displayName: string;
|
|
@@ -1524,6 +1674,248 @@ interface UseAddressSuggestionsResult {
|
|
|
1524
1674
|
/** Resolves address suggestions from the nearest `AddressSuggestionProvider`. */
|
|
1525
1675
|
declare function useAddressSuggestions(query: string, networkId?: string): UseAddressSuggestionsResult;
|
|
1526
1676
|
//#endregion
|
|
1677
|
+
//#region src/components/fields/address-suggestion/useAddressSuggestionField.d.ts
|
|
1678
|
+
/** Arguments for {@link useAddressSuggestionField}. */
|
|
1679
|
+
interface UseAddressSuggestionFieldArgs {
|
|
1680
|
+
/** The current input text — drives the debounce and dropdown visibility. */
|
|
1681
|
+
readonly inputValue: string;
|
|
1682
|
+
/**
|
|
1683
|
+
* Explicit suggestion list. When an array, it overrides context resolution and
|
|
1684
|
+
* is rendered as-is (no cap). `false` disables suggestions entirely (even with
|
|
1685
|
+
* a provider mounted). `undefined` falls back to context resolution.
|
|
1686
|
+
*/
|
|
1687
|
+
readonly suggestions?: AddressSuggestion[] | false;
|
|
1688
|
+
/** Optional network id forwarded to the context resolver for scoping. */
|
|
1689
|
+
readonly networkId?: string;
|
|
1690
|
+
}
|
|
1691
|
+
/** State and handlers returned by {@link useAddressSuggestionField}. */
|
|
1692
|
+
interface UseAddressSuggestionFieldResult {
|
|
1693
|
+
/** Ref for the field container — used for click-outside detection. */
|
|
1694
|
+
readonly containerRef: React.RefObject<HTMLDivElement | null>;
|
|
1695
|
+
/** The suggestions to render (context-resolved + capped, or the explicit array). */
|
|
1696
|
+
readonly resolvedSuggestions: AddressSuggestion[];
|
|
1697
|
+
/** `true` when the dropdown is open AND there is at least one suggestion. */
|
|
1698
|
+
readonly hasSuggestions: boolean;
|
|
1699
|
+
/** Index of the keyboard-highlighted option, or `-1` when none. */
|
|
1700
|
+
readonly highlightedIndex: number;
|
|
1701
|
+
/** `true` when suggestions are explicitly disabled (`suggestions === false`). */
|
|
1702
|
+
readonly suggestionsDisabled: boolean;
|
|
1703
|
+
/** Set the highlighted option index (e.g. on hover). */
|
|
1704
|
+
readonly setHighlightedIndex: (index: number) => void;
|
|
1705
|
+
/** Close the dropdown and clear the highlight. */
|
|
1706
|
+
readonly closeSuggestions: () => void;
|
|
1707
|
+
/** Notify the hook of an input change — opens/closes the dropdown and resets highlight. */
|
|
1708
|
+
readonly onInputChange: (value: string) => void;
|
|
1709
|
+
/** Container-level keydown handler: wrapping ArrowUp / ArrowDown navigation. */
|
|
1710
|
+
readonly onContainerKeyDown: (e: React.KeyboardEvent) => void;
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Headless address-suggestion dropdown behavior. See the module docstring for
|
|
1714
|
+
* the full behavior contract.
|
|
1715
|
+
*
|
|
1716
|
+
* @param args - {@link UseAddressSuggestionFieldArgs}.
|
|
1717
|
+
* @returns {@link UseAddressSuggestionFieldResult}.
|
|
1718
|
+
*/
|
|
1719
|
+
declare function useAddressSuggestionField({
|
|
1720
|
+
inputValue,
|
|
1721
|
+
suggestions: suggestionsProp,
|
|
1722
|
+
networkId
|
|
1723
|
+
}: UseAddressSuggestionFieldArgs): UseAddressSuggestionFieldResult;
|
|
1724
|
+
//#endregion
|
|
1725
|
+
//#region src/components/fields/address-suggestion/AddressSuggestionList.d.ts
|
|
1726
|
+
/** Props for {@link AddressSuggestionList}. */
|
|
1727
|
+
interface AddressSuggestionListProps {
|
|
1728
|
+
/** Field id — anchors the listbox id (`${id}-suggestions`) and option ids. */
|
|
1729
|
+
readonly id: string;
|
|
1730
|
+
/** The suggestions to render. */
|
|
1731
|
+
readonly suggestions: AddressSuggestion[];
|
|
1732
|
+
/** Index of the currently highlighted option, or `-1`. */
|
|
1733
|
+
readonly highlightedIndex: number;
|
|
1734
|
+
/** Called when an option is selected (click / mouse-down). */
|
|
1735
|
+
readonly onSelect: (suggestion: AddressSuggestion) => void;
|
|
1736
|
+
/** Called when an option is hovered, to sync the highlight. */
|
|
1737
|
+
readonly onHighlight: (index: number) => void;
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Render the suggestion dropdown. Returns `null` when there are no suggestions
|
|
1741
|
+
* (the consuming field also gates on `hasSuggestions`, so this is a safety net).
|
|
1742
|
+
*
|
|
1743
|
+
* @param props - {@link AddressSuggestionListProps}.
|
|
1744
|
+
*/
|
|
1745
|
+
declare function AddressSuggestionList({
|
|
1746
|
+
id,
|
|
1747
|
+
suggestions,
|
|
1748
|
+
highlightedIndex,
|
|
1749
|
+
onSelect,
|
|
1750
|
+
onHighlight
|
|
1751
|
+
}: AddressSuggestionListProps): React$2.ReactElement | null;
|
|
1752
|
+
declare namespace AddressSuggestionList {
|
|
1753
|
+
var displayName: string;
|
|
1754
|
+
}
|
|
1755
|
+
//#endregion
|
|
1756
|
+
//#region src/components/fields/name-resolution/context.d.ts
|
|
1757
|
+
/**
|
|
1758
|
+
* Value held by NameResolverContext. Extends the SF-3 injection seam with
|
|
1759
|
+
* optional network context for SF-6 chain-scope gating only.
|
|
1760
|
+
*/
|
|
1761
|
+
interface NameResolverContextValue extends NameResolver {
|
|
1762
|
+
/**
|
|
1763
|
+
* Active network id for chain-scope submit gating (opaque string).
|
|
1764
|
+
* When absent, `isChainScopeMismatch` is never true and coinType wrong-chain
|
|
1765
|
+
* protection is the integrator's responsibility.
|
|
1766
|
+
*/
|
|
1767
|
+
readonly activeNetworkId?: string | null;
|
|
1768
|
+
/**
|
|
1769
|
+
* Optional human-readable active network name — interpolated into the
|
|
1770
|
+
* chain-scope mismatch message only (same seam as INV-78 networkName).
|
|
1771
|
+
*/
|
|
1772
|
+
readonly activeNetworkName?: string;
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* @internal Shared context instance consumed by both AddressField and
|
|
1776
|
+
* NameResolverProvider (INV-118). Kept in its own file so component files
|
|
1777
|
+
* export only components (required by React Fast Refresh).
|
|
1778
|
+
*
|
|
1779
|
+
* `null` means no provider is mounted — every ENS branch in `AddressField` is
|
|
1780
|
+
* then dead code and the field is byte-identical to its pre-ENS behavior
|
|
1781
|
+
* (INV-82).
|
|
1782
|
+
*/
|
|
1783
|
+
declare const NameResolverContext: Context<NameResolverContextValue | null>;
|
|
1784
|
+
//#endregion
|
|
1785
|
+
//#region src/components/fields/name-resolution/name-resolver-context.d.ts
|
|
1786
|
+
/**
|
|
1787
|
+
* Props for `NameResolverProvider`.
|
|
1788
|
+
*
|
|
1789
|
+
* Accepts the same shape as `NameResolver` so the provider can be spread
|
|
1790
|
+
* directly from a resolver hook: `<NameResolverProvider {...resolver}>` —
|
|
1791
|
+
* the same idiom as `AddressSuggestionProvider` / `AddressLabelProvider`.
|
|
1792
|
+
*/
|
|
1793
|
+
interface NameResolverProviderProps extends NameResolverContextValue {
|
|
1794
|
+
children: React$2.ReactNode;
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Provides forward name resolution to all `AddressField` instances in the
|
|
1798
|
+
* subtree (zero call-site wiring, SC-001). Both functions are optional: an
|
|
1799
|
+
* absent `resolveName` means forward resolution is unsupported and a typed
|
|
1800
|
+
* name surfaces `UNSUPPORTED_NETWORK` (INV-119 / SC-006).
|
|
1801
|
+
*
|
|
1802
|
+
* ## Stable resolver identity (integrator contract)
|
|
1803
|
+
*
|
|
1804
|
+
* The injected resolver **must be referentially stable across renders** —
|
|
1805
|
+
* memoize it (e.g. `useMemo`) or use `useRuntimeNameResolver` from
|
|
1806
|
+
* `@openzeppelin/ui-react`, which is stable by construction. A resolver whose
|
|
1807
|
+
* function identity changes on every render (e.g. a fresh inline function) is a
|
|
1808
|
+
* misconfiguration: the field keys inline resolution on that identity, so a
|
|
1809
|
+
* churning identity would otherwise re-dispatch on every render — an unbounded
|
|
1810
|
+
* RPC loop on a funds path.
|
|
1811
|
+
*
|
|
1812
|
+
* The base component **detects and withstands** this (it is not merely a caveat):
|
|
1813
|
+
* dispatch is bounded per resolution intent so a churning resolver can never drive
|
|
1814
|
+
* an unbounded loop (INV-123), a one-shot development-only warning names the
|
|
1815
|
+
* misconfiguration (INV-124), and the field degrades to a **safe gated state**
|
|
1816
|
+
* (empty value, submit blocked — never a wrong address, never a throw; INV-125)
|
|
1817
|
+
* until the resolver is memoized. A **genuine** resolver/network swap — a single
|
|
1818
|
+
* identity change for a given input — is still honored and re-resolves within
|
|
1819
|
+
* budget (INV-119). The bound is a backstop; the contract is a stable identity.
|
|
1820
|
+
*
|
|
1821
|
+
* @param props - Injected resolver functions and children
|
|
1822
|
+
*/
|
|
1823
|
+
declare function NameResolverProvider({
|
|
1824
|
+
children,
|
|
1825
|
+
isValidName,
|
|
1826
|
+
resolveName,
|
|
1827
|
+
activeNetworkId,
|
|
1828
|
+
activeNetworkName
|
|
1829
|
+
}: NameResolverProviderProps): React$2.ReactElement;
|
|
1830
|
+
//#endregion
|
|
1831
|
+
//#region src/components/fields/name-resolution/useNameResolver.d.ts
|
|
1832
|
+
/**
|
|
1833
|
+
* Read the injected resolver context. Returns `null` when no
|
|
1834
|
+
* `NameResolverProvider` is mounted — the consuming field must then treat
|
|
1835
|
+
* every ENS branch as dead code (INV-82).
|
|
1836
|
+
*
|
|
1837
|
+
* @returns The extended context value, or `null` when no provider is mounted.
|
|
1838
|
+
*/
|
|
1839
|
+
declare function useNameResolver(): NameResolverContextValue | null;
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region src/components/fields/name-resolution/useInjectedNameResolution.d.ts
|
|
1842
|
+
/**
|
|
1843
|
+
* Default debounce window (ms) for typed names — mirrors SF-2's
|
|
1844
|
+
* `forwardDebounceMs` default so the field and the bare hook feel identical.
|
|
1845
|
+
*/
|
|
1846
|
+
declare const NAME_RESOLUTION_DEBOUNCE_MS = 300;
|
|
1847
|
+
/** Forward resolver function injected through `NameResolverContext`. */
|
|
1848
|
+
type InjectedResolveName = (name: string) => Promise<ResolutionResult<ResolvedAddress>>;
|
|
1849
|
+
/**
|
|
1850
|
+
* Machine result — a discriminated union keyed on `status`, shaped like SF-2's
|
|
1851
|
+
* `UseResolveNameResult` so downstream rendering logic carries over verbatim.
|
|
1852
|
+
* `name` is always the normalized (trim + lowercase) input the arm refers to.
|
|
1853
|
+
*/
|
|
1854
|
+
type InjectedNameResolutionResult = {
|
|
1855
|
+
readonly status: 'idle';
|
|
1856
|
+
} | {
|
|
1857
|
+
readonly status: 'debouncing';
|
|
1858
|
+
readonly name: string;
|
|
1859
|
+
} | {
|
|
1860
|
+
readonly status: 'loading';
|
|
1861
|
+
readonly name: string;
|
|
1862
|
+
} | {
|
|
1863
|
+
readonly status: 'resolved';
|
|
1864
|
+
readonly name: string;
|
|
1865
|
+
readonly data: ResolvedAddress;
|
|
1866
|
+
} | {
|
|
1867
|
+
readonly status: 'error';
|
|
1868
|
+
readonly name: string;
|
|
1869
|
+
readonly error: NameResolutionError;
|
|
1870
|
+
readonly retry: () => void;
|
|
1871
|
+
};
|
|
1872
|
+
/** Parameters for {@link useInjectedNameResolution}. */
|
|
1873
|
+
interface UseInjectedNameResolutionParams {
|
|
1874
|
+
/** The raw typed input (the field's display string). Normalized internally. */
|
|
1875
|
+
readonly input: string;
|
|
1876
|
+
/**
|
|
1877
|
+
* INV-83: `true` only when `classification === 'name-candidate'` AND an
|
|
1878
|
+
* injected `resolveName` exists. `false` forces `idle` with zero calls.
|
|
1879
|
+
*/
|
|
1880
|
+
readonly enabled: boolean;
|
|
1881
|
+
/** The injected forward resolver. Absent → the machine stays `idle`. */
|
|
1882
|
+
readonly resolveName?: InjectedResolveName;
|
|
1883
|
+
/** Debounce override (ms); `<= 0` disables debouncing. */
|
|
1884
|
+
readonly debounceMs?: number;
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Debounce + dispatch + status derivation over an injected `resolveName`.
|
|
1888
|
+
*
|
|
1889
|
+
* Guarantees:
|
|
1890
|
+
* - INV-83: no call unless `enabled` (name-candidate + injected method), and
|
|
1891
|
+
* never for a debounced copy that lags the current normalized input.
|
|
1892
|
+
* - INV-117: a settled result whose requested name ≠ the current debounced
|
|
1893
|
+
* input is discarded (last-write-wins at the component boundary).
|
|
1894
|
+
* - INV-87: a rejecting resolver (contract violation) is mapped to a typed
|
|
1895
|
+
* `ADAPTER_ERROR` — nothing throws into the render tree.
|
|
1896
|
+
* - INV-123: resolver dispatches are bounded per resolution intent (normalized
|
|
1897
|
+
* debounced input × retry attempt) at {@link MAX_DISPATCHES_PER_INTENT},
|
|
1898
|
+
* regardless of render count or resolver-identity oscillation; the budget
|
|
1899
|
+
* resets on intent change or when leaving the name-resolution path — never on
|
|
1900
|
+
* `settled.source` mismatch; `retry()` never consumes an existing budget.
|
|
1901
|
+
* - INV-124: an identity-churning resolver that exhausts the budget triggers a
|
|
1902
|
+
* one-shot, development-only `logger.warn` (silent in production).
|
|
1903
|
+
* - INV-125: under sustained churn the field stays in the safe gated state — the
|
|
1904
|
+
* perpetually-changing identity keeps failing the `settled.source` check, so
|
|
1905
|
+
* the machine derives `loading`, never `resolved`; combined with INV-87 it
|
|
1906
|
+
* never throws and never writes a hex.
|
|
1907
|
+
* - No `setState` after unmount: every dispatch is cancelled on cleanup.
|
|
1908
|
+
*
|
|
1909
|
+
* @param params - {@link UseInjectedNameResolutionParams}
|
|
1910
|
+
* @returns The current {@link InjectedNameResolutionResult}.
|
|
1911
|
+
*/
|
|
1912
|
+
declare function useInjectedNameResolution({
|
|
1913
|
+
input,
|
|
1914
|
+
enabled,
|
|
1915
|
+
resolveName,
|
|
1916
|
+
debounceMs
|
|
1917
|
+
}: UseInjectedNameResolutionParams): InjectedNameResolutionResult;
|
|
1918
|
+
//#endregion
|
|
1527
1919
|
//#region src/components/fields/AmountField.d.ts
|
|
1528
1920
|
/**
|
|
1529
1921
|
* AmountField component properties
|
|
@@ -2665,6 +3057,15 @@ interface TextFieldProps<TFieldValues extends FieldValues = FieldValues> extends
|
|
|
2665
3057
|
* Placeholder text displayed when the field is empty
|
|
2666
3058
|
*/
|
|
2667
3059
|
placeholder?: string;
|
|
3060
|
+
/**
|
|
3061
|
+
* Fired with the new value on USER-originated edits only — keystrokes and the
|
|
3062
|
+
* Escape-clear — never on programmatic writes (`setValue`/`reset`). This is
|
|
3063
|
+
* the discriminator consumers need to tell "the user claimed this field" from
|
|
3064
|
+
* "code seeded this field" (e.g. the address book's ENS alias suggestion,
|
|
3065
|
+
* SF-5 INV-103/INV-105); RHF's `dirtyFields` cannot express it because any
|
|
3066
|
+
* form-wide dirty recompute retroactively marks a seeded value dirty.
|
|
3067
|
+
*/
|
|
3068
|
+
onUserEdit?: (value: string) => void;
|
|
2668
3069
|
}
|
|
2669
3070
|
/**
|
|
2670
3071
|
* Text input field component specifically designed for React Hook Form integration.
|
|
@@ -2693,7 +3094,8 @@ declare function TextField<TFieldValues extends FieldValues = FieldValues>({
|
|
|
2693
3094
|
name,
|
|
2694
3095
|
width,
|
|
2695
3096
|
validation,
|
|
2696
|
-
readOnly
|
|
3097
|
+
readOnly,
|
|
3098
|
+
onUserEdit
|
|
2697
3099
|
}: TextFieldProps<TFieldValues>): React$1.ReactElement;
|
|
2698
3100
|
declare namespace TextField {
|
|
2699
3101
|
var displayName: string;
|
|
@@ -3093,5 +3495,5 @@ declare const Toaster: ({
|
|
|
3093
3495
|
...props
|
|
3094
3496
|
}: ToasterProps) => JSX.Element;
|
|
3095
3497
|
//#endregion
|
|
3096
|
-
export { AccessibilityProps, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, AddressDisplay, type AddressDisplayVariant, AddressField, AddressLabelProvider, type AddressLabelProviderProps, AddressListEntryMode, AddressListField, AddressListFieldLabels, AddressListFieldProps, AddressSuggestionProvider, type AddressSuggestionProviderProps, Alert, AlertDescription, AlertTitle, AmountField, AmountFieldProps, ArrayField, ArrayFieldProps, ArrayObjectField, ArrayObjectFieldProps, Banner, BannerProps, BannerSize, BannerVariant, BaseField, BaseFieldProps, BigIntField, BigIntFieldProps, BooleanField, BooleanFieldProps, Button, ButtonProps, BytesField, BytesFieldProps, Calendar, CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_ADDRESS_LIST_FIELD_LABELS, type DateRange, DateRangePicker, DateRangePickerProps, DateTimeField, DateTimeFieldProps, 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, EcosystemDropdownOption, EcosystemDropdownProps, EcosystemIcon, EcosystemIconProps, EmptyState, EmptyStateProps, EnumField, EnumFieldProps, EnumFieldValue, EnumMetadata, EnumVariant, ErrorMessage, ExternalLink, FileUploadField, FileUploadFieldProps, Footer, FooterProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GroupedSelectOption, Header, HeaderProps, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, Input, InputProps, Label, LoadingButton, LoadingButtonProps, MapEntryRow, MapField, MapFieldProps, MidnightIcon, NetworkAvailabilityNotice, type NetworkAvailabilityNoticeProps, NetworkError, NetworkErrorNotificationProvider, NetworkErrorType, NetworkIcon, NetworkIconProps, NetworkSelector, NetworkSelectorProps, NetworkServiceErrorBanner, NetworkServiceErrorBannerProps, NetworkStatusBadge, NumberField, NumberFieldProps, ObjectField, ObjectFieldProps, OptionGroup, OverflowMenu, OverflowMenuItem, OverflowMenuProps, PasswordField, PasswordFieldProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioFieldProps, RadioGroup, RadioGroupItem, RadioOption, RelayerDetailsCard, type RelayerDetailsCardProps, Select, SelectContent, SelectField, SelectFieldProps, SelectGroup, SelectGroupedField, SelectGroupedFieldProps, SelectItem, SelectLabel, SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, type SidebarButtonProps, SidebarGroup, type SidebarGroupProps, SidebarLayout, type SidebarLayoutProps, SidebarSection, type SidebarSectionProps, type StepStatus, type StepVisualState, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextAreaFieldProps, TextField, TextFieldProps, Textarea, TextareaProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, type UseAddressLabelResult, type UseAddressSuggestionsResult, VERSION, ViewContractStateButton, WizardLayout, type WizardLayoutProps, WizardNavigation, type WizardNavigationProps, type WizardStepConfig, type WizardStepDef, WizardStepper, type WizardStepperProps, buildAddressListPreviewSummary, buttonVariants, computeChildTouched, createFocusManager, createValidationResult, formatAddressBulkSummary, formatValidationError, getAccessibilityProps, getDescribedById, getErrorMessage, getValidationStateClasses, getWidthClasses, handleEscapeKey, handleKeyboardEvent, handleNumericKeys, handleToggleKeys, handleValidationError, hasFieldError, isDuplicateMapKey, resolveAddressListFieldLabels, useAddressLabel, useAddressSuggestions, useDuplicateKeyIndexes, useMapFieldSync, useNetworkErrorAwareAdapter, useNetworkErrorReporter, useNetworkErrors, validateField, validateMapEntries, validateMapStructure };
|
|
3498
|
+
export { AccessibilityProps, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, type AddressAvatarVariant, AddressDisplay, type AddressDisplayProps, type AddressDisplayVariant, AddressField, AddressFieldProps, AddressLabelProvider, type AddressLabelProviderProps, AddressListEntryMode, AddressListField, AddressListFieldLabels, AddressListFieldProps, AddressNameProvider, type AddressNameProviderProps, AddressSuggestionList, type AddressSuggestionListProps, AddressSuggestionProvider, type AddressSuggestionProviderProps, Alert, AlertDescription, AlertTitle, AmountField, AmountFieldProps, ArrayField, ArrayFieldProps, ArrayObjectField, ArrayObjectFieldProps, Banner, BannerProps, BannerSize, BannerVariant, BaseField, BaseFieldProps, BigIntField, BigIntFieldProps, BooleanField, BooleanFieldProps, Button, ButtonProps, BytesField, BytesFieldProps, Calendar, CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_ADDRESS_LIST_FIELD_LABELS, type DateRange, DateRangePicker, DateRangePickerProps, DateTimeField, DateTimeFieldProps, 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, EcosystemDropdownOption, EcosystemDropdownProps, EcosystemIcon, EcosystemIconProps, EmptyState, EmptyStateProps, EnumField, EnumFieldProps, EnumFieldValue, EnumMetadata, EnumVariant, ErrorMessage, ExternalLink, FileUploadField, FileUploadFieldProps, Footer, FooterProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GroupedSelectOption, Header, HeaderProps, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, type InjectedNameResolutionResult, type InjectedResolveName, Input, InputProps, Label, LoadingButton, LoadingButtonProps, MapEntryRow, MapField, MapFieldProps, MidnightIcon, NAME_RESOLUTION_DEBOUNCE_MS, NameResolverContext, NameResolverProvider, type NameResolverProviderProps, NetworkAvailabilityNotice, type NetworkAvailabilityNoticeProps, NetworkError, NetworkErrorNotificationProvider, NetworkErrorType, NetworkIcon, NetworkIconProps, NetworkSelector, NetworkSelectorProps, NetworkServiceErrorBanner, NetworkServiceErrorBannerProps, NetworkStatusBadge, NumberField, NumberFieldProps, ObjectField, ObjectFieldProps, OptionGroup, OverflowMenu, OverflowMenuItem, OverflowMenuProps, PasswordField, PasswordFieldProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioFieldProps, RadioGroup, RadioGroupItem, RadioOption, RelayerDetailsCard, type RelayerDetailsCardProps, Select, SelectContent, SelectField, SelectFieldProps, SelectGroup, SelectGroupedField, SelectGroupedFieldProps, SelectItem, SelectLabel, SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, type SidebarButtonProps, SidebarGroup, type SidebarGroupProps, SidebarLayout, type SidebarLayoutProps, SidebarSection, type SidebarSectionProps, type StepStatus, type StepVisualState, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextAreaFieldProps, TextField, TextFieldProps, Textarea, TextareaProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, type UseAddressLabelResult, type UseAddressNameResult, type UseAddressSuggestionFieldArgs, type UseAddressSuggestionFieldResult, type UseAddressSuggestionsResult, type UseInjectedNameResolutionParams, VERSION, ViewContractStateButton, WizardLayout, type WizardLayoutProps, WizardNavigation, type WizardNavigationProps, type WizardStepConfig, type WizardStepDef, WizardStepper, type WizardStepperProps, 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 };
|
|
3097
3499
|
//# sourceMappingURL=index.d.cts.map
|