Skip to content

Commit f2c58da

Browse files
committed
pre bump
1 parent e3f6060 commit f2c58da

4 files changed

Lines changed: 319 additions & 76 deletions

File tree

README_IT.md

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,33 @@ type EuroPlateOptions = {
105105
preserveInputAttrs?: boolean; // NEW: se true, NON sovrascrive id/name esistenti
106106
autoFocusOnInit?: boolean; // NEW: default false (no focus su init)
107107

108+
// ⚙️ Configurazione UI (nuovo: TUTTO sotto "ui")
109+
ui?: {
110+
/**
111+
* Dove mostrare lo status:
112+
* - "block" → usa <div class="status"> sotto l’input (retro-compat, default)
113+
* - "inline" → overlay dentro l’input, non altera l’altezza
114+
* - "off" → non mostra testo/icona di stato
115+
*/
116+
statusMode?: "block" | "inline" | "off"; // default: "block"
117+
118+
/** Tipo di icona per lo status inline (ignorata in "block" e "off") */
119+
statusIcon?: "none" | "icon" | "pill"; // default: "none"
120+
121+
/** Se mostrare il testo di stato */
122+
showStatusText?: boolean; // default: block→true, inline→false
123+
124+
/** Posizione dell’icona inline */
125+
iconPosition?: "right" | "left"; // default: "right"
126+
127+
// Riferimenti opzionali a nodi già esistenti (se NON usi wrapper)
128+
flagIcon?: HTMLElement;
129+
flagLabel?: HTMLElement;
130+
dropdown?: HTMLElement;
131+
button?: HTMLElement;
132+
status?: HTMLElement;
133+
};
134+
108135
// UX/i18n
109136
mode?: "AUTO" | string; // paese fisso o AUTO (default)
110137
i18n?: "AUTO" | "IT" | "EN"; // default AUTO → navigator it/en
@@ -128,6 +155,19 @@ type EuroPlateOptions = {
128155
};
129156
```
130157

158+
#### Valori e default (UI)
159+
160+
| Chiave | Tipo | Valori | Default | Note |
161+
| --------------------------------------------- | ------------------------------ | -------------------- | ---------------------------- | ----------------------------------------------------------------------------------------- |
162+
| `ui.statusMode` | `"block" \| "inline" \| "off"` | block / inline / off | `"block"` | _block_ usa `<div class="status">`, _inline_ overlay nell’input, _off_ niente testo/icona |
163+
| `ui.statusIcon` | `"none" \| "icon" \| "pill"` | none / icon / pill | `"none"` | usata **solo** in `inline` |
164+
| `ui.showStatusText` | `boolean` | true / false | `block→true`, `inline→false` | testo breve in inline; completo in block |
165+
| `ui.iconPosition` | `"right" \| "left"` | right / left | `"right"` | posizione icona in inline |
166+
| `ui.status` | `HTMLElement` (opz.) || auto-creato/derivato | host esistente per lo status (se non usi `wrapper`) |
167+
| `ui.button`/`dropdown`/`flagIcon`/`flagLabel` | `HTMLElement` (opz.) || auto-creati se `wrapper` | per re-use di DOM esterno |
168+
169+
---
170+
131171
### Metodi istanza
132172

133173
```ts
@@ -152,10 +192,7 @@ type EuroPlateInstance = {
152192
### A) Passi tu `Inputmask` (UMD → `window.Inputmask`)
153193

154194
```html
155-
<link
156-
rel="stylesheet"
157-
href="https://cdn.jsdelivr.net/npm/@codecorn/euro-plate-validator@1.0.12/dist/assets/css/styles.css"
158-
/>
195+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@codecorn/euro-plate-validator@1.0.12/dist/assets/css/styles.css" />
159196
<script src="https://cdn.jsdelivr.net/npm/inputmask@5.0.9/dist/inputmask.min.js"></script>
160197

161198
<script type="module">
@@ -226,6 +263,70 @@ createEuroPlate(EuroMod, {
226263
</script>
227264
```
228265

266+
## F) Esempi per status
267+
268+
### A) Inline, **solo icona** a destra (senza testo)
269+
270+
```ts
271+
createEuroPlate(EuroMod, {
272+
wrapper: "#plate-wrap",
273+
ui: {
274+
statusMode: "inline",
275+
statusIcon: "icon",
276+
showStatusText: false,
277+
iconPosition: "right",
278+
},
279+
});
280+
```
281+
282+
### B) Inline, **pill + testo** a sinistra
283+
284+
```ts
285+
createEuroPlate(EuroMod, {
286+
input: document.getElementById("my-plate") as HTMLInputElement,
287+
ui: {
288+
statusMode: "inline",
289+
statusIcon: "pill",
290+
showStatusText: true,
291+
iconPosition: "left",
292+
},
293+
});
294+
```
295+
296+
### C) Nessuna icona, **status block** classico
297+
298+
```ts
299+
createEuroPlate(EuroMod, {
300+
wrapper: "#plate-wrap",
301+
ui: {
302+
statusMode: "block",
303+
statusIcon: "none",
304+
// showStatusText default true in "block"
305+
},
306+
});
307+
```
308+
309+
### D) **Nessuno** status (silenzioso)
310+
311+
```ts
312+
createEuroPlate(EuroMod, {
313+
wrapper: "#plate-wrap",
314+
ui: { statusMode: "off" },
315+
});
316+
```
317+
318+
### E) Re-attach su DOM esistente (niente `wrapper`)
319+
320+
```ts
321+
createEuroPlate(EuroMod, {
322+
input: document.getElementById("plate") as HTMLInputElement,
323+
ui: {
324+
status: document.getElementById("plate-status") as HTMLElement, // host esistente
325+
statusMode: "block",
326+
},
327+
});
328+
```
329+
229330
---
230331

231332
## 🧩 WordPress (WP) / Elementor

dist-types/client/europlate.client.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ export type EuroPlateUI = {
1818
dropdown?: HTMLElement;
1919
button?: HTMLElement;
2020
status?: HTMLElement;
21+
/** Nuove opzioni di rendering status */
22+
/**
23+
* Dove mostrare lo status:
24+
* - "block" → usa <div class="status"> sotto l’input (default, retro-compat)
25+
* - "inline" → overlay dentro l’input, non altera l’altezza
26+
* - "off" → non mostra nessuno status testuale
27+
*/
28+
statusMode?: "block" | "inline" | "off";
29+
statusIcon?: "none" | "icon" | "pill";
30+
showStatusText?: boolean;
31+
iconPosition?: "right" | "left";
2132
};
2233
/** Opzioni di configurazione per `createEuroPlate` (client-side SDK). */
2334
export type EuroPlateOptions = {

dist-types/client/europlate.client.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)