@stamprally/admin-ui 0.11.0 → 0.12.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 +33 -0
- package/dist/index.cjs +600 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +598 -102
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @stamprally/admin-ui
|
|
2
|
+
|
|
3
|
+
Accessible authoring forms and a headless editor for rally management screens.
|
|
4
|
+
|
|
5
|
+
## Structured editor
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { AdminRallyEditor } from "@stamprally/admin-ui";
|
|
9
|
+
import "@stamprally/admin-ui/styles.css";
|
|
10
|
+
|
|
11
|
+
<AdminRallyEditor config={config} locale="en" onChange={setConfig} />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The editor provides structured fields for localized rally and reward content,
|
|
15
|
+
reward limits and expiry, all condition types, theme properties, and separate
|
|
16
|
+
public/server metadata sections. `JsonConfigIO` remains available for import/export
|
|
17
|
+
and validation workflows, but normal editing does not require JSON.
|
|
18
|
+
|
|
19
|
+
## Headless API
|
|
20
|
+
|
|
21
|
+
`useAdminRallyEditor(initialConfig)` returns immutable editing actions:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
const editor = useAdminRallyEditor(config, { onChange: saveDraft });
|
|
25
|
+
editor.addSpot({ name: { en: "Museum" }, conditions: [{ type: "qr", secretToken: "" }] });
|
|
26
|
+
editor.duplicateReward("reward-1");
|
|
27
|
+
editor.reorderSpots(2, 0);
|
|
28
|
+
editor.undo();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Use `canUndo`/`canRedo` to control history buttons. `resetConfig(newConfig)` replaces
|
|
32
|
+
the current draft when an external CMS update arrives. `updateLocalizedField` accepts
|
|
33
|
+
paths such as `title`, `description`, `spots.0.name`, or `spots.spot-1.name`.
|