@openzeppelin/ui-renderer 1.0.4 → 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 +39 -0
- package/dist/index.cjs +694 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +81 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +694 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -63,6 +63,18 @@ Dialog for configuring network-specific settings like RPC endpoints and indexer
|
|
|
63
63
|
|
|
64
64
|
Composed wallet connection component with integrated settings controls.
|
|
65
65
|
|
|
66
|
+
### AddressBookWidget
|
|
67
|
+
|
|
68
|
+
Full-featured widget for managing a personal address book with aliases, search, network filtering, import/export, and CRUD operations. Designed to receive all data and mutations via props (dependency injection) from `useAddressBookWidgetProps` in `@openzeppelin/ui-storage`.
|
|
69
|
+
|
|
70
|
+
### AliasEditPopover
|
|
71
|
+
|
|
72
|
+
Floating popover for inline alias editing. Positioned near the edit trigger via an anchor rect. Includes address lookup and save/create functionality.
|
|
73
|
+
|
|
74
|
+
### useAliasEditState
|
|
75
|
+
|
|
76
|
+
Pure UI state hook for managing the inline alias edit popover. Returns `editing`, `onEditLabel`, `handleClose`, and `lastClickRef` for coordinating popover display with `AddressLabelProvider`.
|
|
77
|
+
|
|
66
78
|
### DynamicFormField
|
|
67
79
|
|
|
68
80
|
Renders form fields dynamically based on field type configuration.
|
|
@@ -189,12 +201,39 @@ function FormHeader() {
|
|
|
189
201
|
| `onToggleContractState` | `() => void` | (Optional) Toggle contract state widget |
|
|
190
202
|
| `isWidgetExpanded` | `boolean` | (Optional) Current widget expanded state |
|
|
191
203
|
|
|
204
|
+
### Address Book Usage
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
import { AddressBookWidget, AliasEditPopover, useAliasEditState } from '@openzeppelin/ui-renderer';
|
|
208
|
+
import { useAddressBookWidgetProps, useAliasEditCallbacks } from '@openzeppelin/ui-storage';
|
|
209
|
+
|
|
210
|
+
function Settings() {
|
|
211
|
+
const widgetProps = useAddressBookWidgetProps(db, { networkId: selectedNetwork?.id });
|
|
212
|
+
const editCallbacks = useAliasEditCallbacks(db);
|
|
213
|
+
const { editing, onEditLabel, handleClose, lastClickRef } = useAliasEditState(
|
|
214
|
+
selectedNetwork?.id
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div
|
|
219
|
+
onPointerDown={(e) => {
|
|
220
|
+
lastClickRef.current = { x: e.clientX, y: e.clientY };
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<AddressBookWidget {...widgetProps} />
|
|
224
|
+
{editing && <AliasEditPopover {...editing} onClose={handleClose} {...editCallbacks} />}
|
|
225
|
+
</div>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
192
230
|
## Package Structure
|
|
193
231
|
|
|
194
232
|
```text
|
|
195
233
|
renderer/
|
|
196
234
|
├── src/
|
|
197
235
|
│ ├── components/
|
|
236
|
+
│ │ ├── AddressBookWidget/ # Address book management widget
|
|
198
237
|
│ │ ├── ContractActionBar/ # Network status and actions
|
|
199
238
|
│ │ ├── ContractStateWidget/ # View function queries
|
|
200
239
|
│ │ ├── ExecutionConfigDisplay/ # EOA/Relayer configuration
|