@agence-zef/astro 0.7.0 → 0.7.1
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/components/Form.astro +6 -2
- package/dist/ui.js +1 -0
- package/package.json +1 -1
- package/styles.css +24 -1
package/components/Form.astro
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* - slots `start` (avant les champs) et `end` (après le bouton) ;
|
|
14
14
|
* - `submitLabel` : remplace le libellé du bouton saisi dans le CMS.
|
|
15
15
|
*
|
|
16
|
-
* Après l'envoi, le
|
|
17
|
-
*
|
|
16
|
+
* Après l'envoi, le message de confirmation remplace le formulaire (`.zef-form__done`, avec une
|
|
17
|
+
* coche `.zef-form__done-icon`) ; les slots `start` et `end` partent avec le formulaire ; l'évènement `zef-form:success` part du formulaire, et `resetForm`
|
|
18
18
|
* (`@agence-zef/astro/ui`) le remet à zéro pour une nouvelle saisie.
|
|
19
19
|
*/
|
|
20
20
|
import type { PublicForm, Reference } from "@agence-zef/schema";
|
|
@@ -304,8 +304,12 @@ const inputType = {
|
|
|
304
304
|
const done = document.createElement("div");
|
|
305
305
|
done.className = "zef-form__done";
|
|
306
306
|
done.setAttribute("role", "status");
|
|
307
|
+
done.innerHTML =
|
|
308
|
+
'<span class="zef-form__done-icon" aria-hidden="true"><svg width="24" height="24" viewBox="0 0 24 24"><path d="m5 12.5 4.5 4.5L19 7.5" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"/></svg></span>';
|
|
307
309
|
done.append(template?.content.cloneNode(true) ?? "");
|
|
310
|
+
// Le message remplace le formulaire (style en ligne : passe devant le `display` du site).
|
|
308
311
|
form.hidden = true;
|
|
312
|
+
form.style.display = "none";
|
|
309
313
|
form.after(done);
|
|
310
314
|
form.dispatchEvent(new CustomEvent("zef-form:success", { bubbles: true }));
|
|
311
315
|
return;
|
package/dist/ui.js
CHANGED
|
@@ -143,6 +143,7 @@ export function resetForm(target) {
|
|
|
143
143
|
if (done?.classList.contains("zef-form__done"))
|
|
144
144
|
done.remove();
|
|
145
145
|
form.hidden = false;
|
|
146
|
+
form.style.removeProperty("display");
|
|
146
147
|
form.reset();
|
|
147
148
|
for (const el of form.querySelectorAll(".zef-form__error, .zef-form__status")) {
|
|
148
149
|
el.hidden = true;
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -367,9 +367,32 @@
|
|
|
367
367
|
border-radius: var(--zef-radius);
|
|
368
368
|
background: var(--zef-surface-muted);
|
|
369
369
|
}
|
|
370
|
-
:where(.zef-account__success, .zef-cart__success, .zef-subscriptions__success
|
|
370
|
+
:where(.zef-account__success, .zef-cart__success, .zef-subscriptions__success) {
|
|
371
371
|
color: var(--zef-success);
|
|
372
372
|
}
|
|
373
|
+
/* Confirmation d'un formulaire du CMS : coche et message centrés, à la place du formulaire. */
|
|
374
|
+
:where(.zef-form__done) {
|
|
375
|
+
display: flex;
|
|
376
|
+
flex-direction: column;
|
|
377
|
+
align-items: center;
|
|
378
|
+
gap: 1rem;
|
|
379
|
+
padding: 1.5rem 0;
|
|
380
|
+
font-family: var(--zef-font);
|
|
381
|
+
text-align: center;
|
|
382
|
+
}
|
|
383
|
+
:where(.zef-form__done-icon) {
|
|
384
|
+
display: grid;
|
|
385
|
+
flex-shrink: 0;
|
|
386
|
+
place-items: center;
|
|
387
|
+
width: 3.25rem;
|
|
388
|
+
height: 3.25rem;
|
|
389
|
+
border-radius: 999px;
|
|
390
|
+
background: color-mix(in srgb, var(--zef-success) 14%, transparent);
|
|
391
|
+
color: var(--zef-success);
|
|
392
|
+
}
|
|
393
|
+
:where(.zef-form__done) :where(p) {
|
|
394
|
+
margin: 0;
|
|
395
|
+
}
|
|
373
396
|
|
|
374
397
|
/* ---------- Boutons ---------- */
|
|
375
398
|
|