@thalassic/ui 22.17.5 → 22.17.6

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.
@@ -4722,6 +4722,12 @@ class FormItem {
4722
4722
  _config = inject(FORM_ITEM_CONFIG);
4723
4723
  control = contentChild(FORM_CONTROL, /* @ts-ignore */
4724
4724
  ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
4725
+ /**
4726
+ * Content of the label, rendered inside the item's own `<label>` element so the `for` /
4727
+ * `aria-labelledby` wiring is kept. Replaces the label text and the required / optional markers.
4728
+ */
4729
+ labelTemplate = contentChild('labelTemplate', /* @ts-ignore */
4730
+ ...(ngDevMode ? [{ debugName: "labelTemplate" }] : /* istanbul ignore next */ []));
4725
4731
  /** Stable id for the label element, linked to the control via `aria-labelledby`. */
4726
4732
  labelId = `tls-form-item-label-${FormItem._counter}`;
4727
4733
  /** Stable id assigned to the native control element, linked from the label via `for`. */
@@ -4775,6 +4781,16 @@ class FormItem {
4775
4781
  return !control.required();
4776
4782
  }, /* @ts-ignore */
4777
4783
  ...(ngDevMode ? [{ debugName: "showOptional" }] : /* istanbul ignore next */ []));
4784
+ /** Whether a label is rendered, from either the `label` input or a custom label template. */
4785
+ hasLabel = computed(() => Boolean(this.label()) || Boolean(this.labelTemplate()), /* @ts-ignore */
4786
+ ...(ngDevMode ? [{ debugName: "hasLabel" }] : /* istanbul ignore next */ []));
4787
+ labelContext = computed(() => ({
4788
+ $implicit: this.label(),
4789
+ required: this.showRequired(),
4790
+ optionalText: this.showOptional() ? this.optionalText() : undefined,
4791
+ invalid: this.isInvalid(),
4792
+ }), /* @ts-ignore */
4793
+ ...(ngDevMode ? [{ debugName: "labelContext" }] : /* istanbul ignore next */ []));
4778
4794
  labelFor = computed(() => {
4779
4795
  const control = this.control();
4780
4796
  if (!control || !control.supportsLabelFor)
@@ -4821,7 +4837,7 @@ class FormItem {
4821
4837
  return;
4822
4838
  // Point the control's aria-labelledby at the rendered label element so screen readers
4823
4839
  // announce the visible label text when the control receives focus.
4824
- control.labelId.set(this.label() ? this.labelId : null);
4840
+ control.labelId.set(this.hasLabel() ? this.labelId : null);
4825
4841
  // Assign the stable control id so the label's `for` attribute can target the native element.
4826
4842
  control.formItemInputId.set(control.supportsLabelFor ? this.controlId : null);
4827
4843
  // Point the control's aria-describedby at the rendered error element (and clear it when no
@@ -4846,12 +4862,12 @@ class FormItem {
4846
4862
  return array;
4847
4863
  }
4848
4864
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
4849
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FormItem, isStandalone: true, selector: "tls-form-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, spread: { classPropertyName: "spread", publicName: "spread", isSignal: true, isRequired: false, transformFunction: null }, reserveErrorSpace: { classPropertyName: "reserveErrorSpace", publicName: "reserveErrorSpace", isSignal: true, isRequired: false, transformFunction: null }, reserveLabelSpace: { classPropertyName: "reserveLabelSpace", publicName: "reserveLabelSpace", isSignal: true, isRequired: false, transformFunction: null }, displayErrors: { classPropertyName: "displayErrors", publicName: "displayErrors", isSignal: true, isRequired: false, transformFunction: null }, showRequiredMarker: { classPropertyName: "showRequiredMarker", publicName: "showRequiredMarker", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "control", first: true, predicate: FORM_CONTROL, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"form-item-main\">\n @if (label() || reserveLabelSpace()) {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n </label>\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n</div>\n@if (displayErrors()) {\n <small class=\"form-item-error\">\n @if (isInvalid()) {\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n }\n </small>\n}\n" });
4865
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FormItem, isStandalone: true, selector: "tls-form-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, spread: { classPropertyName: "spread", publicName: "spread", isSignal: true, isRequired: false, transformFunction: null }, reserveErrorSpace: { classPropertyName: "reserveErrorSpace", publicName: "reserveErrorSpace", isSignal: true, isRequired: false, transformFunction: null }, reserveLabelSpace: { classPropertyName: "reserveLabelSpace", publicName: "reserveLabelSpace", isSignal: true, isRequired: false, transformFunction: null }, displayErrors: { classPropertyName: "displayErrors", publicName: "displayErrors", isSignal: true, isRequired: false, transformFunction: null }, showRequiredMarker: { classPropertyName: "showRequiredMarker", publicName: "showRequiredMarker", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "control", first: true, predicate: FORM_CONTROL, descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"form-item-main\">\n @if (hasLabel() || reserveLabelSpace()) {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"labelContext()\" />\n } @else {\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n }\n </label>\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n</div>\n@if (displayErrors()) {\n <small class=\"form-item-error\">\n @if (isInvalid()) {\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n }\n </small>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
4850
4866
  }
4851
4867
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormItem, decorators: [{
4852
4868
  type: Component,
4853
- args: [{ selector: 'tls-form-item', imports: [], host: { '[class]': 'hostClasses()' }, template: "<div class=\"form-item-main\">\n @if (label() || reserveLabelSpace()) {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n </label>\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n</div>\n@if (displayErrors()) {\n <small class=\"form-item-error\">\n @if (isInvalid()) {\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n }\n </small>\n}\n" }]
4854
- }], ctorParameters: () => [], propDecorators: { control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FORM_CONTROL), { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], spread: [{ type: i0.Input, args: [{ isSignal: true, alias: "spread", required: false }] }], reserveErrorSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveErrorSpace", required: false }] }], reserveLabelSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveLabelSpace", required: false }] }], displayErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayErrors", required: false }] }], showRequiredMarker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRequiredMarker", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }] } });
4869
+ args: [{ selector: 'tls-form-item', imports: [NgTemplateOutlet], host: { '[class]': 'hostClasses()' }, template: "<div class=\"form-item-main\">\n @if (hasLabel() || reserveLabelSpace()) {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"labelContext()\" />\n } @else {\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n }\n </label>\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n</div>\n@if (displayErrors()) {\n <small class=\"form-item-error\">\n @if (isInvalid()) {\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n }\n </small>\n}\n" }]
4870
+ }], ctorParameters: () => [], propDecorators: { control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FORM_CONTROL), { isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['labelTemplate', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], spread: [{ type: i0.Input, args: [{ isSignal: true, alias: "spread", required: false }] }], reserveErrorSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveErrorSpace", required: false }] }], reserveLabelSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveLabelSpace", required: false }] }], displayErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayErrors", required: false }] }], showRequiredMarker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRequiredMarker", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }] } });
4855
4871
 
4856
4872
  const DEFAULT_LOADER_CONFIG = {
4857
4873
  size: 'md',