@kouji-ui/core 0.3.0 → 0.5.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.
@@ -17374,11 +17374,15 @@ let kjFieldErrorIdCounter = 0;
17374
17374
  *
17375
17375
  * Carries `role="alert"` + `aria-live="polite"` so newly-shown errors
17376
17376
  * are announced. Hidden via `[hidden]` when the field is not in error
17377
- * state.
17377
+ * state — unless `kjFieldErrorReserve` is set, in which case the element
17378
+ * keeps its box (`data-hidden` + `visibility: hidden` styling) so error
17379
+ * text can appear and disappear without shifting the surrounding layout.
17378
17380
  *
17379
17381
  * @example
17380
17382
  * ```html
17381
17383
  * <span kjFieldError>Please enter a valid email.</span>
17384
+ * <!-- Reserve the line so showing the error never moves the layout: -->
17385
+ * <span kjFieldError kjFieldErrorReserve>Please enter a valid email.</span>
17382
17386
  * ```
17383
17387
  * @doc-category Core/Inputs
17384
17388
  * @doc
@@ -17389,6 +17393,12 @@ class KjFieldError {
17389
17393
  /** Override the auto-minted host id. */
17390
17394
  kjFieldErrorId = input(undefined, /* @ts-ignore */
17391
17395
  ...(ngDevMode ? [{ debugName: "kjFieldErrorId" }] : /* istanbul ignore next */ []));
17396
+ /**
17397
+ * When set, the element keeps its layout box while the field is valid
17398
+ * (`visibility: hidden` via `data-hidden` instead of `display: none`),
17399
+ * so the error appearing never repositions the fields around it.
17400
+ */
17401
+ kjFieldErrorReserve = input(false, { ...(ngDevMode ? { debugName: "kjFieldErrorReserve" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
17392
17402
  /** @internal */ id = (() => {
17393
17403
  const seq = ++kjFieldErrorIdCounter;
17394
17404
  return () => this.kjFieldErrorId() ?? `kj-field-error-${seq}`;
@@ -17399,7 +17409,7 @@ class KjFieldError {
17399
17409
  destroyRef.onDestroy(deregister);
17400
17410
  }
17401
17411
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: KjFieldError, deps: [], target: i0.ɵɵFactoryTarget.Directive });
17402
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: KjFieldError, isStandalone: true, selector: "[kjFieldError]", inputs: { kjFieldErrorId: { classPropertyName: "kjFieldErrorId", publicName: "kjFieldErrorId", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "alert", "aria-live": "polite" }, properties: { "attr.id": "id()", "attr.hidden": "!ctx.invalid() ? \"\" : null" } }, ngImport: i0 });
17412
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: KjFieldError, isStandalone: true, selector: "[kjFieldError]", inputs: { kjFieldErrorId: { classPropertyName: "kjFieldErrorId", publicName: "kjFieldErrorId", isSignal: true, isRequired: false, transformFunction: null }, kjFieldErrorReserve: { classPropertyName: "kjFieldErrorReserve", publicName: "kjFieldErrorReserve", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "alert", "aria-live": "polite" }, properties: { "attr.id": "id()", "attr.hidden": "(!ctx.invalid() && !kjFieldErrorReserve()) ? \"\" : null", "attr.data-hidden": "(!ctx.invalid() && kjFieldErrorReserve()) ? \"\" : null", "attr.data-reserve": "kjFieldErrorReserve() ? \"\" : null" } }, ngImport: i0 });
17403
17413
  }
17404
17414
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: KjFieldError, decorators: [{
17405
17415
  type: Directive,
@@ -17410,10 +17420,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
17410
17420
  role: 'alert',
17411
17421
  'aria-live': 'polite',
17412
17422
  '[attr.id]': 'id()',
17413
- '[attr.hidden]': '!ctx.invalid() ? "" : null',
17423
+ '[attr.hidden]': '(!ctx.invalid() && !kjFieldErrorReserve()) ? "" : null',
17424
+ '[attr.data-hidden]': '(!ctx.invalid() && kjFieldErrorReserve()) ? "" : null',
17425
+ '[attr.data-reserve]': 'kjFieldErrorReserve() ? "" : null',
17414
17426
  },
17415
17427
  }]
17416
- }], ctorParameters: () => [], propDecorators: { kjFieldErrorId: [{ type: i0.Input, args: [{ isSignal: true, alias: "kjFieldErrorId", required: false }] }] } });
17428
+ }], ctorParameters: () => [], propDecorators: { kjFieldErrorId: [{ type: i0.Input, args: [{ isSignal: true, alias: "kjFieldErrorId", required: false }] }], kjFieldErrorReserve: [{ type: i0.Input, args: [{ isSignal: true, alias: "kjFieldErrorReserve", required: false }] }] } });
17417
17429
 
17418
17430
  /**
17419
17431
  * Compound input layout inside a `[kjField]`. Wraps an input together