@stratametriq/id-card-designer 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/LICENSE +21 -0
- package/README.md +352 -0
- package/dist/index-D0zsRI-j.mjs +18930 -0
- package/dist/index.css +997 -0
- package/dist/index.es-CdYxDcOg.mjs +5645 -0
- package/dist/index.es.js +15 -0
- package/dist/index.js +508 -0
- package/dist/purify.es-Bo7Q7b72.mjs +471 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stratametriq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# 📦 @stratametriq/id-card-designer
|
|
2
|
+
|
|
3
|
+
A universal, dynamic, and highly customizable ID Card Designer, Turnkey Dashboard & A4 Multi-Page PDF Rendering Engine for React, Vue, Angular, and Vanilla JS.
|
|
4
|
+
|
|
5
|
+
Whether you are building an **Educational ERP / Student Information System**, **Faculty & Staff Directory**, **Hospital / Medical Access Portal**, **Corporate Employee Directory**, or **Event Badge Generator**, `@stratametriq/id-card-designer` gives your users a professional visual canvas right inside your application to design, customize, preview, and batch export PVC ID cards.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🌟 Features
|
|
10
|
+
|
|
11
|
+
- **🎨 Turnkey All-In-One Dashboard (`<IdCardManager />`):** Drop in a complete, ready-to-use workspace containing department tabs, live vector stage, batch A4 print setup, and roster selection table.
|
|
12
|
+
- **✨ Interactive Visual Studio Canvas:** Drag-and-drop element positioning (`react-draggable`), real-time zoom controls (`80% - 200%`), grid snapping (`1mm / 5mm`), and Z-index layering.
|
|
13
|
+
- **📏 Technical Precision Rulers & Grid Overlay:** Toggleable millimeter measurement rulers (`0mm - 86mm`) and radial matrix grid overlays for exact PVC card alignment.
|
|
14
|
+
- **🔄 Undo & Redo History Control:** Full history stack tracking (`Ctrl+Z` / `Cmd+Z` to undo, `Ctrl+Y` / `Cmd+Shift+Z` to redo) alongside keyboard arrow key precision nudging (`1px` or `5px` with Shift).
|
|
15
|
+
- **📝 Signature & Image File Uploads:** Upload Principal/Director signatures, employee photos, or organization logos (`PNG/JPG`) directly from the property inspector with live base64 conversion.
|
|
16
|
+
- **🔄 Multi-Orientation Support:** Seamless switching between standard PVC card dimensions: **Vertical (54×86 mm)** and **Horizontal (86×54 mm)**.
|
|
17
|
+
- **⚡ Professional Built-in Presets:** Starter templates including *Classic Traditional*, *Minimalist Modern*, *Sage Table Banner*, *Corporate Executive*, and *Medical Staff Pass*.
|
|
18
|
+
- **🧩 Universal Element Types:** Dynamic text fields, static labels, custom shapes/dividers, profile photos, organization logos, signature slots, and visual barcodes/QRs.
|
|
19
|
+
- **🔍 Inspector Panel & Property Editor:** Fine-grained styling for font family, size, weight, text alignment, text casing (`uppercase`, `lowercase`, `capitalize`, `togglecase`), background/border colors, radii, and prefixes/suffixes.
|
|
20
|
+
- **📄 High-Resolution Batch PDF Export Engine:** Built-in multi-page A4 / Letter grid layout calculation with toggleable hardware guillotine cut marks, perimeter outlines, and registration headers (`html2canvas` + `jspdf`).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📦 Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @stratametriq/id-card-designer
|
|
28
|
+
# or
|
|
29
|
+
yarn add @stratametriq/id-card-designer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Include the stylesheet in your project root (`main.jsx` or `App.jsx`):
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import "@stratametriq/id-card-designer/dist/index.css";
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🌐 Multi-Framework & Vanilla JS Support (`Vue`, `Angular`, `Svelte`, `Next.js` & `HTML`)
|
|
41
|
+
|
|
42
|
+
While the visual UI components (`<IdCardManager />` and `<IdCardDesignerModal />`) are built with React hooks and drag-and-drop vector canvas state (`react-draggable`), **this npm package can be used across any frontend framework or vanilla JavaScript project**:
|
|
43
|
+
|
|
44
|
+
### 1. Using in React & Next.js (`React 18 / Vite / Remix / Next.js`)
|
|
45
|
+
Simply import our components directly into your React JSX/TSX tree:
|
|
46
|
+
```jsx
|
|
47
|
+
import { IdCardManager } from "@stratametriq/id-card-designer";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Using in Vue, Angular, Svelte, or Vanilla HTML (`Micro-Frontend Mounting`)
|
|
51
|
+
If your application is built with **Vue.js**, **Angular**, **Svelte**, or plain **HTML/JS**, you can easily mount the turnkey `<IdCardManager />` dashboard into any DOM element using `createRoot` in just a few lines of code:
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<!-- Inside index.html or your Vue/Angular/Svelte component template -->
|
|
55
|
+
<div id="id-card-manager-root"></div>
|
|
56
|
+
|
|
57
|
+
<script type="module">
|
|
58
|
+
import React from 'react';
|
|
59
|
+
import { createRoot } from 'react-dom/client';
|
|
60
|
+
import { IdCardManager } from '@stratametriq/id-card-designer';
|
|
61
|
+
import '@stratametriq/id-card-designer/dist/index.css';
|
|
62
|
+
|
|
63
|
+
// Mount the visual ID Card Dashboard cleanly inside any HTML div
|
|
64
|
+
const rootElement = document.getElementById('id-card-manager-root');
|
|
65
|
+
const root = createRoot(rootElement);
|
|
66
|
+
|
|
67
|
+
root.render(React.createElement(IdCardManager, {
|
|
68
|
+
onBatchExportComplete: (category, records) => {
|
|
69
|
+
console.log(`Exported ${records.length} cards in ${category}`);
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Framework-Agnostic Pure JS Batch Print Engine (`generateIdCardsPdf`)
|
|
76
|
+
The core multi-page A4 and US Letter PDF rendering engine (**`generateIdCardsPdf`**) is completely framework-agnostic! Whether you are writing pure TypeScript, Node/Express frontend scripts, Vue, or Angular, you can import and run `generateIdCardsPdf()` directly without mounting any React UI components:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
import { generateIdCardsPdf } from "@stratametriq/id-card-designer";
|
|
80
|
+
|
|
81
|
+
// Works natively across Vue, Angular, Svelte, and Vanilla JS!
|
|
82
|
+
await generateIdCardsPdf({
|
|
83
|
+
records: myDatabaseArray,
|
|
84
|
+
templateSchema: myLoadedJsonSchema,
|
|
85
|
+
orientation: "vertical",
|
|
86
|
+
fileName: "Batch_Job_Output.pdf"
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 📖 Public API & Turnkey Dashboard Reference
|
|
93
|
+
|
|
94
|
+
When developers install `@stratametriq/id-card-designer` via npm, they can choose between two usage modes:
|
|
95
|
+
1. **Turnkey Dashboard Mode (`<IdCardManager />`)**: Drop in a single component to instantly display the complete multi-department dashboard (navigation tabs, live card stage, roster directory table, and batch PDF export engine).
|
|
96
|
+
2. **Custom Building Blocks Mode (`<IdCardDesignerModal />` + `<IdCardPreview />`)**: Import atomic components to embed only the popup studio or live card preview into custom-built interfaces.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 1. `<IdCardManager />` (Turnkey All-in-One Dashboard & 4-Step Master Workflow)
|
|
101
|
+
|
|
102
|
+
The `<IdCardManager />` is the complete, out-of-the-box management suite. We engineered a **clean, full-width unified layout** with zero redundant navigation tabs so operators and end-users get a sleek, ultra-fast 4-step workflow:
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
import React from "react";
|
|
106
|
+
import { IdCardManager } from "@stratametriq/id-card-designer";
|
|
107
|
+
import "@stratametriq/id-card-designer/dist/index.css";
|
|
108
|
+
|
|
109
|
+
export function MyOrganizationPortal() {
|
|
110
|
+
return (
|
|
111
|
+
<IdCardManager
|
|
112
|
+
onSaveCategoryTemplate={(categoryKey, newTemplate) => {
|
|
113
|
+
console.log(`Saved template for ${categoryKey}:`, newTemplate);
|
|
114
|
+
}}
|
|
115
|
+
onBatchExportComplete={(categoryKey, exportedRecords) => {
|
|
116
|
+
console.log(`Exported ${exportedRecords.length} cards for ${categoryKey}`);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### 🧩 The Clean 4-Step Master Workflow Architecture
|
|
124
|
+
|
|
125
|
+
When users open `<IdCardManager />`, they interact with a unified, professional full-width screen broken into four logical steps:
|
|
126
|
+
|
|
127
|
+
| Workflow Step | Section Title & Purpose | Detailed Functionality & Mathematical Features |
|
|
128
|
+
| :--- | :--- | :--- |
|
|
129
|
+
| **Step 1** | **Select Department / Organization Category** | A clean 4-card header grid showing your configured organization categories (e.g., *Student IDs*, *Faculty & Admin*, *Corporate HR*, *Hospital Portal*). Each card displays the number of bound data fields (`{fieldDefinitions.length} fields`) and template layouts (`{templateCount} template`). Clicking any card instantly switches the active category, isolating state, templates, and roster tables cleanly. |
|
|
130
|
+
| **Step 2** | **Live Stage Preview & Studio Launcher** | A high-resolution vector canvas preview displaying the currently selected person's ID card in real-time. Includes:<br>• **Interactive Zoom Controls (`80% - 150%`)** alongside instant reset buttons.<br>• **Toggleable Grid & Measurement Rulers (`0-80mm`)** for visual precision inspection.<br>• **Launch Studio Canvas Button:** Opens our popup drag-and-drop design studio modal where operators can add new text fields, upload background textures, bind database keys, and drag elements around with snap-to-grid accuracy. |
|
|
131
|
+
| **Step 3** | **Batch A4 Print Engine (`⚡ Live Sheet Matrix`)** | A commercial print-engine sidebar that calculates and exports production-ready multi-page grid sheets:<br>• **⚡ Live Sheet Matrix Calculation Box:** Dynamically computes physical sheet mathematics in real-time right before your eyes! When you toggle **Paper Sheet Size (`A4` vs `US Letter`)**, **Orientation (`Portrait` vs `Landscape` Sheet)**, or **Card Cut Size (`86×54mm Standard ID-1`, `90×50mm Business Card`, `100×70mm Event Badge`)**, the matrix immediately recalculates the exact column × row capacity (`e.g., 3 Cols × 3 Rows = 9 cards/page`) and total job pages required.<br>• **Hardware Cut Guides Checkboxes:** Toggle corner crosshair cut marks (`0.35mm stroke`), card perimeter cut outline guides, and technical registration headers (`PRECISION CUT SHEET — JOB SPECIFICATIONS`) for print shop operators. |
|
|
132
|
+
| **Step 4** | **Live Roster Directory Table** | Displays a dynamic, paginated table of all people in that department. Columns automatically reflect your category's database fields (`studentName`, `admissionNo`, `classSec`, etc.). Check or uncheck individual records to include them in the Batch A4 Print Engine, or click any row to preview their rendered card live in Step 2! |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
#### ⚡ Zero-Configuration Automatic Field Discovery (`Auto-Detecting User Database Columns`)
|
|
137
|
+
|
|
138
|
+
You **never have to worry about missing fields**. If your database or user records contain custom columns that are not explicitly defined in `fieldDefinitions`, `<IdCardManager />` and our Studio Canvas (`ElementPropertyEditor`) handle them automatically:
|
|
139
|
+
1. **Auto-Discovery Scan:** When you open the Studio Canvas, our property engine scans `Object.keys(sampleData[0])` directly from the live database records you passed in.
|
|
140
|
+
2. **Auto-Formatting:** Raw database keys like `bloodGroup`, `busRouteNo`, `emergencyPhone`, `allergyAlert`, or `parkingSlot` are automatically transformed into clean human-readable titles (e.g., **"Bus Route No (`busRouteNo`)"**).
|
|
141
|
+
3. **Instant Binding:** Every discovered key is automatically merged into the **`Data Field Key`** dropdown in the right sidebar under `4. ELEMENT PROPERTIES`. Any user can click `+ Add Element` ➡️ `Dynamic Field`, select their custom database key, and bind it immediately without writing a single line of code!
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### 2. Customizing Categories & Dynamic Fields (`categories` & `sampleRecords` Props)
|
|
146
|
+
|
|
147
|
+
By default, `<IdCardManager />` includes four global starter categories: **Student ID Cards (Education)**, **Faculty & Administration**, **Corporate Employee Badges**, and **Healthcare & Medical Pass**.
|
|
148
|
+
|
|
149
|
+
You can pass your own custom categories and live database records directly via props without editing the library:
|
|
150
|
+
|
|
151
|
+
```jsx
|
|
152
|
+
const myCustomCategories = {
|
|
153
|
+
university: {
|
|
154
|
+
id: "university",
|
|
155
|
+
label: "University Engineering Students",
|
|
156
|
+
badge: "🎓 Higher Education",
|
|
157
|
+
themeColor: "#0d6efd",
|
|
158
|
+
defaultOrientation: "vertical",
|
|
159
|
+
templateCount: 2,
|
|
160
|
+
description: "Dynamic field binding tailored for enrollment numbers, engineering departments, and library barcodes.",
|
|
161
|
+
fieldDefinitions: [
|
|
162
|
+
{ key: "studentName", label: "Student Full Name", defaultValue: "Aarav Sharma" },
|
|
163
|
+
{ key: "enrollmentNo", label: "Enrollment Number", defaultValue: "ENR-2026-991" },
|
|
164
|
+
{ key: "branch", label: "Engineering Branch", defaultValue: "Computer Science & Engineering" },
|
|
165
|
+
{ key: "year", label: "Academic Year", defaultValue: "B.Tech Year 3" },
|
|
166
|
+
{ key: "bloodGroup", label: "Blood Group", defaultValue: 'O+ POSITIVE' }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
executives: {
|
|
170
|
+
id: "executives",
|
|
171
|
+
label: "Global Executive Badges",
|
|
172
|
+
badge: "🏢 Corporate HQ",
|
|
173
|
+
themeColor: "#6f42c1",
|
|
174
|
+
defaultOrientation: "horizontal",
|
|
175
|
+
templateCount: 1,
|
|
176
|
+
description: "Dynamic field binding tailored for corporate executive designations, floor security clearance, and access barcodes.",
|
|
177
|
+
fieldDefinitions: [
|
|
178
|
+
{ key: "execName", label: "Executive Full Name", defaultValue: "Elena Rostova" },
|
|
179
|
+
{ key: "designation", label: "Designation / Role", defaultValue: "VP of Cloud Engineering" },
|
|
180
|
+
{ key: "empCode", label: "Employee ID Code", defaultValue: "EMP-HQ-402" },
|
|
181
|
+
{ key: "clearance", label: "Security Clearance", defaultValue: "Level 5 (All Floors & Server Rooms)" }
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const myLiveRecords = {
|
|
187
|
+
university: [
|
|
188
|
+
{ studentName: "Aarav Sharma", enrollmentNo: "ENR-2026-991", branch: "Computer Science", year: "B.Tech Year 3", bloodGroup: "O+ POSITIVE" },
|
|
189
|
+
{ studentName: "Diya Patel", enrollmentNo: "ENR-2026-992", branch: "Electronics & Comm", year: "B.Tech Year 2", bloodGroup: "B+ POSITIVE" }
|
|
190
|
+
],
|
|
191
|
+
executives: [
|
|
192
|
+
{ execName: "Elena Rostova", designation: "VP of Cloud Engineering", empCode: "EMP-HQ-402", clearance: "Level 5" }
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export function CustomApp() {
|
|
197
|
+
return (
|
|
198
|
+
<IdCardManager
|
|
199
|
+
categories={myCustomCategories}
|
|
200
|
+
sampleRecords={myLiveRecords}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### 3. `<IdCardDesignerModal />` (Standalone Studio Modal)
|
|
209
|
+
|
|
210
|
+
The standalone interactive modal component for designing and modifying ID card templates. Use this when embedding only the popup studio inside your own custom interface without the turnkey dashboard.
|
|
211
|
+
|
|
212
|
+
| Prop Name | Type | Default | Description |
|
|
213
|
+
| :--- | :--- | :--- | :--- |
|
|
214
|
+
| `show` | `boolean` | `false` | Controls visibility of the designer modal. |
|
|
215
|
+
| `onHide` | `function` | `() => {}` | Callback triggered when closing the modal. |
|
|
216
|
+
| `initialOrientation` | `string` | `"vertical"` | Default card orientation (`"vertical"` \| `"horizontal"`). |
|
|
217
|
+
| `initialTemplate` | `object` | `null` | Existing JSON template schema to edit. If null, loads preset. |
|
|
218
|
+
| `fieldDefinitions` | `array` | `[]` | Array of dynamic field options (`[{ key, label, defaultValue }]`). |
|
|
219
|
+
| `sampleData` | `array` | `[]` | Array of data records to preview during designing. |
|
|
220
|
+
| `themeColors` | `object` | `{ primary: "#424343", text: "#faf4f4" }` | Default primary header and text colors. |
|
|
221
|
+
| `orgAssets` | `object` | `{ logoUrl, signatureUrl, defaultAvatarUrl }` | Default image URLs for logo, signature, and fallback photo. |
|
|
222
|
+
| `onSaveTemplate` | `function` | `(templateSchema) => {}` | Callback returning the finalized JSON template object on save. |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### 4. `<IdCardPreview />` (Atomic Card Renderer)
|
|
227
|
+
|
|
228
|
+
A lightweight component for rendering a single high-resolution vector ID card anywhere in your UI.
|
|
229
|
+
|
|
230
|
+
| Prop Name | Type | Default | Description |
|
|
231
|
+
| :--- | :--- | :--- | :--- |
|
|
232
|
+
| `templateSchema` | `object` | *Required* | The JSON template schema generated by the designer. |
|
|
233
|
+
| `data` | `object` | `{}` | The record object containing dynamic field values to display. |
|
|
234
|
+
| `orientation` | `string` | `"vertical"` | Orientation (`"vertical"` or `"horizontal"`). |
|
|
235
|
+
| `zoom` | `number` | `1` | Scaling factor (`1` = exact physical dimensions, `1.5` = 150% size). |
|
|
236
|
+
| `className` | `string` | `""` | Optional CSS class name for outer wrapper. |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### 5. `generateIdCardsPdf(options)` (Programmatic Batch Print Utility)
|
|
241
|
+
|
|
242
|
+
An asynchronous utility function to generate multi-page, high-resolution A4 or Letter PDFs for batch printing from anywhere in your application.
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
import { generateIdCardsPdf } from "@stratametriq/id-card-designer";
|
|
246
|
+
|
|
247
|
+
await generateIdCardsPdf({
|
|
248
|
+
records: [...], // Array of data records to render
|
|
249
|
+
templateSchema: {...}, // JSON template schema object
|
|
250
|
+
orientation: "vertical", // "vertical" | "horizontal"
|
|
251
|
+
fileName: "ID_Cards_Sheet.pdf", // Name of the downloaded file
|
|
252
|
+
pageOptions: {
|
|
253
|
+
format: "a4", // Paper size ("a4" | "letter")
|
|
254
|
+
scale: 2, // Resolution scale for html2canvas (2 = High DPI)
|
|
255
|
+
marginMm: 10, // Top/side page margins in mm
|
|
256
|
+
spacingMm: 10, // Gap between cards in mm
|
|
257
|
+
showCropMarks: true, // Add corner crosshair cut guides
|
|
258
|
+
showCutOutline: true, // Add faint card perimeter borders
|
|
259
|
+
showHeader: true // Add technical registration header
|
|
260
|
+
},
|
|
261
|
+
onProgress: (current, total) => {
|
|
262
|
+
console.log(`Rendered page ${current} of ${total}`);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### 6. JSON Template Schema Structure (`templateSchema`)
|
|
270
|
+
|
|
271
|
+
Every design created in `<IdCardDesignerModal />` is stored and exported as a clean, serializable JSON schema:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"id": "tpl_school_vertical_01",
|
|
276
|
+
"name": "Classic Vertical ID",
|
|
277
|
+
"orientation": "vertical",
|
|
278
|
+
"width": 54,
|
|
279
|
+
"height": 86,
|
|
280
|
+
"background": {
|
|
281
|
+
"color": "#ffffff",
|
|
282
|
+
"image": "https://myportal.com/assets/card-bg-watermark.png",
|
|
283
|
+
"size": "cover"
|
|
284
|
+
},
|
|
285
|
+
"elements": [
|
|
286
|
+
{
|
|
287
|
+
"id": "el_header_box",
|
|
288
|
+
"type": "shape",
|
|
289
|
+
"label": "Top Header Box",
|
|
290
|
+
"x": 0, "y": 0, "width": 54, "height": 14,
|
|
291
|
+
"backgroundColor": "#0d6efd",
|
|
292
|
+
"zIndex": 1
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"id": "el_photo_slot",
|
|
296
|
+
"type": "image",
|
|
297
|
+
"subtype": "photo",
|
|
298
|
+
"fieldKey": "profilePhoto",
|
|
299
|
+
"label": "Student Photo",
|
|
300
|
+
"x": 14, "y": 18, "width": 26, "height": 28,
|
|
301
|
+
"borderWidth": 1.5, "borderColor": "#0d6efd", "borderRadius": 4,
|
|
302
|
+
"zIndex": 3
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"id": "el_student_name",
|
|
306
|
+
"type": "field",
|
|
307
|
+
"fieldKey": "studentName",
|
|
308
|
+
"label": "Student Name",
|
|
309
|
+
"x": 2, "y": 48, "width": 50, "height": 7,
|
|
310
|
+
"fontFamily": "Inter, sans-serif",
|
|
311
|
+
"fontSize": 11, "fontWeight": "bold", "color": "#111111",
|
|
312
|
+
"textAlign": "center", "textTransform": "uppercase",
|
|
313
|
+
"zIndex": 4
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 🏢 Multi-Department Architecture (The Dictionary Pattern)
|
|
322
|
+
|
|
323
|
+
If your software serves multiple organizational departments (e.g., **Students** vs. **Teachers** vs. **Hospital Doctors** vs. **Corporate HR**), you **do not need multiple modal components or hardcoded libraries**. Instead, use the **Dictionary Pattern** to silo category schemas while sharing a single universal `<IdCardDesignerModal />` or `<IdCardManager />` instance:
|
|
324
|
+
|
|
325
|
+
```javascript
|
|
326
|
+
const CATEGORY_CONFIGS = {
|
|
327
|
+
student: {
|
|
328
|
+
title: "Student ID Cards",
|
|
329
|
+
defaultOrientation: "vertical",
|
|
330
|
+
fieldDefinitions: [
|
|
331
|
+
{ key: "studentName", label: "Student Full Name", defaultValue: "Aarav Sharma" },
|
|
332
|
+
{ key: "admissionNo", label: "Admission Number", defaultValue: "ADM-2026-089" },
|
|
333
|
+
{ key: "classSec", label: "Class & Section", defaultValue: "Grade 10 [A]" }
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
staff: {
|
|
337
|
+
title: "Faculty & Staff Directory",
|
|
338
|
+
defaultOrientation: "horizontal",
|
|
339
|
+
fieldDefinitions: [
|
|
340
|
+
{ key: "facultyName", label: "Faculty / Staff Name", defaultValue: "Dr. Ananya Iyer" },
|
|
341
|
+
{ key: "empCode", label: "Employee ID Code", defaultValue: "EMP-FAC-104" },
|
|
342
|
+
{ key: "designation", label: "Job Designation", defaultValue: "Senior Physics Lecturer" }
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 📜 License
|
|
351
|
+
|
|
352
|
+
MIT © Stratametriq
|