@eagami/ui 5.71.1 → 5.71.2
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 +1 -0
- package/fesm2022/eagami-ui.mjs +3 -3
- package/fesm2022/eagami-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/eagami-ui.d.ts +26 -24
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ Everything else is a CSS custom property you can override. See [Design tokens](h
|
|
|
78
78
|
`showErrorsOn` sets when form components show a validation error:
|
|
79
79
|
|
|
80
80
|
- `'change'` (the default): once the user changes the field and leaves it, or submits the form. A field the user tabs past stays quiet, and a new error waits until focus leaves the field.
|
|
81
|
+
- `'blur'`: as soon as the user leaves the field, even unchanged, while a new error still waits until focus leaves the field.
|
|
81
82
|
- `'touch'`: as soon as the user leaves the field, even unchanged, and live while they edit it after that.
|
|
82
83
|
|
|
83
84
|
Set it app-wide with `forms`, or on a single field with the `showErrorsOn` input every form component takes:
|
package/fesm2022/eagami-ui.mjs
CHANGED
|
@@ -5570,7 +5570,7 @@ function controlErrorStateFrom(control, config) {
|
|
|
5570
5570
|
const destroyRef = inject(DestroyRef);
|
|
5571
5571
|
const host = inject(ElementRef, { optional: true });
|
|
5572
5572
|
const formsConfig = inject(EAGAMI_FORMS_CONFIG);
|
|
5573
|
-
const
|
|
5573
|
+
const showErrorsOn = computed(() => config.showErrorsOn?.() ?? formsConfig.showErrorsOn ?? "change", ...ngDevMode ? [{ debugName: "showErrorsOn" }] : /* istanbul ignore next */ []);
|
|
5574
5574
|
const revision = signal(0, ...ngDevMode ? [{ debugName: "revision" }] : /* istanbul ignore next */ []);
|
|
5575
5575
|
const editing = signal(false, ...ngDevMode ? [{ debugName: "editing" }] : /* istanbul ignore next */ []);
|
|
5576
5576
|
const revealedBySubmit = signal(false, ...ngDevMode ? [{ debugName: "revealedBySubmit" }] : /* istanbul ignore next */ []);
|
|
@@ -5634,14 +5634,14 @@ function controlErrorStateFrom(control, config) {
|
|
|
5634
5634
|
revision();
|
|
5635
5635
|
const ctrl = control();
|
|
5636
5636
|
if (!ctrl || !ctrl.invalid || !ctrl.touched || !ctrl.errors) return null;
|
|
5637
|
-
if (ctrl.pristine && passedThrough() &&
|
|
5637
|
+
if (ctrl.pristine && passedThrough() && showErrorsOn() === "change") return null;
|
|
5638
5638
|
return resolveValidationMessage(ctrl.errors, config.errorMessages(), i18n.messages());
|
|
5639
5639
|
}, ...ngDevMode ? [{ debugName: "validationError" }] : /* istanbul ignore next */ []);
|
|
5640
5640
|
const autoError = linkedSignal({
|
|
5641
5641
|
...ngDevMode ? { debugName: "autoError" } : /* istanbul ignore next */ {},
|
|
5642
5642
|
source: () => ({
|
|
5643
5643
|
message: validationError(),
|
|
5644
|
-
holding: revealPending() || editing() && !revealedBySubmit() &&
|
|
5644
|
+
holding: revealPending() || editing() && !revealedBySubmit() && showErrorsOn() !== "touch"
|
|
5645
5645
|
}),
|
|
5646
5646
|
computation: ({ message, holding }, previous) => previous?.value || !holding ? message : null
|
|
5647
5647
|
});
|