@ewjdev/anyclick-react 1.1.1 → 1.3.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 +31 -3
- package/dist/index.d.mts +491 -40
- package/dist/index.d.ts +491 -40
- package/dist/index.js +5211 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5193 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -53,12 +53,12 @@ That's it! Users can now right-click any element to submit feedback.
|
|
|
53
53
|
|
|
54
54
|
| Prop | Type | Description |
|
|
55
55
|
| ----------------- | -------------------------- | ---------------------------------------------- |
|
|
56
|
-
| `adapter` | `
|
|
57
|
-
| `menuItems` | `
|
|
56
|
+
| `adapter` | `AnyclickAdapter` | Required. The adapter for submitting anyclick |
|
|
57
|
+
| `menuItems` | `ContextMenuItem[]` | Custom menu items |
|
|
58
58
|
| `metadata` | `Record<string, unknown>` | Additional data included with every submission |
|
|
59
59
|
| `theme` | `AnyclickTheme \| null` | Theme configuration (inherits from parent) |
|
|
60
60
|
| `scoped` | `boolean` | Limit capture to this provider's children only |
|
|
61
|
-
| `disabled` | `boolean` | Disable
|
|
61
|
+
| `disabled` | `boolean` | Disable anyclick capture |
|
|
62
62
|
| `onSubmitSuccess` | `(payload) => void` | Success callback |
|
|
63
63
|
| `onSubmitError` | `(error, payload) => void` | Error callback |
|
|
64
64
|
|
|
@@ -188,6 +188,34 @@ const userContext = { roles: ["user", "developer"] };
|
|
|
188
188
|
const menuItems = filterMenuItemsByRole(allMenuItems, userContext);
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
+
## Role-Based Presets
|
|
192
|
+
|
|
193
|
+
Skip hand-authoring menus by pulling in a preset for common roles. Coming-soon actions stay visible with a badge but are disabled by default.
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
import { AnyclickProvider, createPresetMenu } from "@ewjdev/anyclick-react";
|
|
197
|
+
|
|
198
|
+
const qaPreset = createPresetMenu("qa");
|
|
199
|
+
// Or: listPresets() to show available roles, createPresetMenu("developer", { includeComingSoon: false })
|
|
200
|
+
|
|
201
|
+
<AnyclickProvider
|
|
202
|
+
adapter={adapter}
|
|
203
|
+
menuItems={qaPreset.menuItems}
|
|
204
|
+
screenshotConfig={qaPreset.screenshotConfig}
|
|
205
|
+
metadata={qaPreset.metadata}
|
|
206
|
+
theme={qaPreset.theme}
|
|
207
|
+
>
|
|
208
|
+
{children}
|
|
209
|
+
</AnyclickProvider>;
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Preset defaults (examples):
|
|
213
|
+
|
|
214
|
+
- QA: bug / repro / UX papercut + “Performance trace” (coming soon)
|
|
215
|
+
- PM: feature idea / UX papercut + “Impact sizing” (coming soon)
|
|
216
|
+
- Designer: visual bug / accessibility + “Motion glitch” (coming soon)
|
|
217
|
+
- Developer: bug / refactor + diagnostics submenu (console/network traces marked coming soon)
|
|
218
|
+
|
|
191
219
|
## Highlight Configuration
|
|
192
220
|
|
|
193
221
|
```tsx
|