@mydatavalue/polter 0.1.3 → 0.1.4
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 +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,28 @@ import { z } from 'zod';
|
|
|
79
79
|
</AgentAction>
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
**Modal interactions** — click a button to open a modal, type a value, then confirm:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// Parent — 3-step flow: open → type → confirm
|
|
86
|
+
<AgentAction name="apply_discount" parameters={z.object({ pct: z.number() })}
|
|
87
|
+
onExecute={async () => { /* await async work started by the confirm click */ }}>
|
|
88
|
+
<AgentStep label="Open settings">
|
|
89
|
+
<SettingsButton />
|
|
90
|
+
</AgentStep>
|
|
91
|
+
<AgentStep label="Set value" fromTarget="discount-input" setParam="pct" />
|
|
92
|
+
<AgentStep label="Confirm" fromTarget="confirm-btn" />
|
|
93
|
+
</AgentAction>
|
|
94
|
+
|
|
95
|
+
// Child (modal) — targets with prepareView to set up internal state
|
|
96
|
+
<AgentTarget name="discount-input" prepareView={() => setMode("custom")}>
|
|
97
|
+
<Input value={value} onChange={...} />
|
|
98
|
+
</AgentTarget>
|
|
99
|
+
<AgentTarget name="confirm-btn">
|
|
100
|
+
<ConfirmButton />
|
|
101
|
+
</AgentTarget>
|
|
102
|
+
```
|
|
103
|
+
|
|
82
104
|
### 3. Connect to your agent
|
|
83
105
|
|
|
84
106
|
```tsx
|