@educarehq/solaris-components 0.2.7 → 0.2.9
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.
|
@@ -4445,6 +4445,8 @@ class FormField {
|
|
|
4445
4445
|
appearance = 'filled';
|
|
4446
4446
|
showErrors = 'dirtyOrTouched';
|
|
4447
4447
|
_tick = signal(0, ...(ngDevMode ? [{ debugName: "_tick" }] : []));
|
|
4448
|
+
customErrorKey = input('', ...(ngDevMode ? [{ debugName: "customErrorKey" }] : []));
|
|
4449
|
+
customErrorParams = input(undefined, ...(ngDevMode ? [{ debugName: "customErrorParams" }] : []));
|
|
4448
4450
|
constructor() {
|
|
4449
4451
|
effect((onCleanup) => {
|
|
4450
4452
|
const ac = this.field.control()?.control;
|
|
@@ -4496,30 +4498,38 @@ class FormField {
|
|
|
4496
4498
|
this._tick();
|
|
4497
4499
|
if (!this.invalidComputed())
|
|
4498
4500
|
return undefined;
|
|
4501
|
+
const customKey = this.customErrorKey()?.trim();
|
|
4502
|
+
if (customKey) {
|
|
4503
|
+
return this.customErrorParams();
|
|
4504
|
+
}
|
|
4499
4505
|
const errors = this.field.control()?.errors;
|
|
4500
4506
|
if (!errors)
|
|
4501
4507
|
return undefined;
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4508
|
+
if (errors['solarisPassword']) {
|
|
4509
|
+
return errors['solarisPassword'];
|
|
4510
|
+
}
|
|
4505
4511
|
return undefined;
|
|
4506
4512
|
}, ...(ngDevMode ? [{ debugName: "errorParams" }] : []));
|
|
4507
4513
|
errorKey = computed(() => {
|
|
4508
4514
|
this._tick();
|
|
4509
4515
|
if (!this.invalidComputed())
|
|
4510
4516
|
return '';
|
|
4517
|
+
const customKey = this.customErrorKey()?.trim();
|
|
4518
|
+
if (customKey)
|
|
4519
|
+
return customKey;
|
|
4511
4520
|
const errors = this.field.control()?.errors;
|
|
4512
4521
|
if (!errors)
|
|
4513
4522
|
return '';
|
|
4514
4523
|
const direct = this.getDirectErrorKey(errors);
|
|
4515
4524
|
if (direct)
|
|
4516
4525
|
return direct;
|
|
4517
|
-
if (errors['solarisPassword'])
|
|
4526
|
+
if (errors['solarisPassword']) {
|
|
4518
4527
|
return this.getPasswordErrorKey(errors['solarisPassword']);
|
|
4528
|
+
}
|
|
4519
4529
|
return 'solaris.validation.invalid';
|
|
4520
4530
|
}, ...(ngDevMode ? [{ debugName: "errorKey" }] : []));
|
|
4521
4531
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: FormField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4522
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: FormField, isStandalone: true, selector: "solaris-form-field", inputs: { hint: "hint", label: "label", hintKey: "hintKey", labelKey: "labelKey", invalid: "invalid", radius: "radius", appearance: "appearance", showErrors: "showErrors" }, providers: [
|
|
4532
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: FormField, isStandalone: true, selector: "solaris-form-field", inputs: { hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, hintKey: { classPropertyName: "hintKey", publicName: "hintKey", isSignal: false, isRequired: false, transformFunction: null }, labelKey: { classPropertyName: "labelKey", publicName: "labelKey", isSignal: false, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: false, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: false, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: false, isRequired: false, transformFunction: null }, showErrors: { classPropertyName: "showErrors", publicName: "showErrors", isSignal: false, isRequired: false, transformFunction: null }, customErrorKey: { classPropertyName: "customErrorKey", publicName: "customErrorKey", isSignal: true, isRequired: false, transformFunction: null }, customErrorParams: { classPropertyName: "customErrorParams", publicName: "customErrorParams", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
4523
4533
|
SolarisFormFieldController,
|
|
4524
4534
|
{ provide: SOLARIS_FORM_FIELD_CONTROLLER, useExisting: SolarisFormFieldController },
|
|
4525
4535
|
], queries: [{ propertyName: "prefix", first: true, predicate: SolarisPrefixDirective, descendants: true }, { propertyName: "suffix", first: true, predicate: SolarisSuffixDirective, descendants: true }], ngImport: i0, template: "<div class=\"solaris-form-field\" [class.solaris-form-field--has-prefix]=\"hasPrefix\" [attr.data-appearance]=\"appearance\"\r\n [attr.data-invalid]=\"invalidComputed() ? 'true' : null\" [attr.data-radius]=\"radius\">\r\n @if ((label || labelKey)) {\r\n <label class=\"solaris-form-field__label\">\r\n @if (labelKey) { {{ labelKey | translate }} }\r\n @else if (label) { {{ label }} }\r\n </label>\r\n }\r\n\r\n <div class=\"solaris-form-field__frame\">\r\n @if (hasPrefix) {\r\n <span class=\"solaris-form-field__prefix\" aria-hidden=\"true\">\r\n <ng-content select=\"[solaris-prefix]\"></ng-content>\r\n </span>\r\n }\r\n\r\n <div class=\"solaris-form-field__body\">\r\n <div class=\"solaris-form-field__control-slot\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n @if (hasSuffix || showPasswordToggle() || invalidComputed()) {\r\n <span class=\"solaris-form-field__suffix\">\r\n <ng-content select=\"[solaris-suffix]\"></ng-content>\r\n\r\n @if (showPasswordToggle()) {\r\n <solaris-password-toggle></solaris-password-toggle>\r\n }\r\n\r\n @if (invalidComputed()) {\r\n <span class=\"solaris-form-field__status\" aria-hidden=\"true\">\r\n <i class=\"ph ph-warning-circle\"></i>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (errorKey()) {\r\n <solaris-field-error [textKey]=\"errorKey()\" [textParams]=\"errorParams()\"></solaris-field-error>\r\n } @else {\r\n <ng-content select=\"[form-field-message]\"></ng-content>\r\n }\r\n\r\n @if (hint || hintKey) {\r\n <div class=\"solaris-form-field__hint\">\r\n @if (hintKey) { {{ hintKey | translate }} }\r\n @else { {{ hint }} }\r\n </div>\r\n }\r\n</div>\r\n", styles: [".solaris-form-field{display:grid;gap:var(--solaris-space-2);--solaris-form-field-radius: var(--solaris-radius-sm);--solaris-form-field-bg: var(--solaris-color-surface-2);--solaris-form-field-border: var(--solaris-color-border);--solaris-form-field-border-hover: color-mix(in srgb, var(--solaris-color-border) 70%, var(--solaris-color-text-muted))}.solaris-form-field[data-radius=none]{--solaris-form-field-radius: var(--solaris-radius-none)}.solaris-form-field[data-radius=xs]{--solaris-form-field-radius: var(--solaris-radius-xs)}.solaris-form-field[data-radius=sm]{--solaris-form-field-radius: var(--solaris-radius-sm)}.solaris-form-field[data-radius=md]{--solaris-form-field-radius: var(--solaris-radius-md)}.solaris-form-field[data-radius=lg]{--solaris-form-field-radius: var(--solaris-radius-lg)}.solaris-form-field[data-radius=full]{--solaris-form-field-radius: var(--solaris-radius-full)}.solaris-form-field[data-appearance=outline]{--solaris-form-field-bg: transparent;--solaris-form-field-border: color-mix(in srgb, var(--solaris-color-border) 85%, transparent);--solaris-form-field-border-hover: color-mix(in srgb, var(--solaris-color-border) 65%, var(--solaris-color-text-muted))}.solaris-form-field__label{font-weight:600;font-size:var(--solaris-fs-14);color:var(--solaris-color-text);margin-left:var(--solaris-space-1)}.solaris-form-field__frame{display:grid;min-height:3.8rem;align-items:stretch;grid-template-columns:1fr;background:var(--solaris-form-field-bg);border-radius:var(--solaris-form-field-radius);border:1px solid var(--solaris-form-field-border);transition:border-color .12s ease,box-shadow .12s ease,background-color .12s ease}.solaris-form-field--has-prefix .solaris-form-field__frame{grid-template-columns:3.8rem 1fr}.solaris-form-field__prefix{opacity:.5;display:grid;width:3.8rem;line-height:0;place-items:center;font-size:var(--solaris-fs-14);color:var(--solaris-color-text-muted);transition:opacity .3s ease,filter .3s ease;border-right:1px solid color-mix(in srgb,var(--solaris-color-border) 85%,transparent)}.solaris-form-field__frame:hover .solaris-form-field__prefix,.solaris-form-field__frame:focus-within .solaris-form-field__prefix{opacity:1;filter:brightness(1.05)}.solaris-form-field__prefix :is(i,svg,[solarisPrefixIcon]){display:block;line-height:1}.solaris-form-field__prefix i.ph{opacity:.6;font-size:var(--solaris-fs-18)}.solaris-form-field__prefix svg{width:var(--solaris-fs-18);height:var(--solaris-fs-18)}.solaris-form-field__body{min-width:0;display:grid;padding-right:0;position:relative;align-items:center;padding-left:var(--solaris-space-3);grid-template-columns:minmax(0,1fr) auto}.solaris-form-field__control-slot{width:100%;min-width:0;display:flex;flex:1 1 auto;align-items:center}.solaris-form-field__control-slot>*{flex:1 1 0;width:100%;min-width:0}.solaris-form-field__control-slot :is(input,textarea){margin:0;border:0;width:100%;min-width:0;outline:none;padding:.9rem 0;background:transparent;font-size:var(--solaris-fs-14);color:var(--solaris-color-text);line-height:var(--solaris-lh-normal)}.solaris-form-field__control-slot :is(input,textarea)::placeholder{opacity:.9;color:var(--solaris-color-text-muted)}.solaris-form-field__suffix{display:inline-flex;align-items:center;justify-content:center;padding-right:var(--solaris-space-3);gap:var(--solaris-space-2)}.solaris-form-field__suffix :is(button,a){height:3.6rem;align-self:stretch;align-items:center;display:inline-flex}.solaris-form-field__status{width:3.8rem;display:grid;opacity:.95;height:3.8rem;place-items:center;color:var(--solaris-color-error)}.solaris-form-field__status i.ph{line-height:1;font-size:var(--solaris-fs-18)}.solaris-form-field__hint{font-size:var(--solaris-fs-12);color:var(--solaris-color-text-muted)}.solaris-form-field__frame:has(:is(input,textarea,button)[disabled]){opacity:.45}.solaris-form-field__frame:has(:is(input,textarea,button)[disabled]) .solaris-form-field__prefix,.solaris-form-field__frame:has(:is(input,textarea,button)[disabled]) :is(.solaris-form-field__label,.solaris-form-field__hint){color:var(--solaris-color-text-muted)}.solaris-form-field__frame:has(:focus-visible){box-shadow:0 0 .5rem .25rem color-mix(in srgb,var(--solaris-color-primary) 5%,transparent);border-color:color-mix(in srgb,var(--solaris-color-primary) 70%,var(--solaris-color-border))}.solaris-form-field[data-invalid=true] .solaris-form-field__frame{box-shadow:0 0 .5rem .25rem color-mix(in srgb,var(--solaris-color-error) 5%,transparent);border-color:color-mix(in srgb,var(--solaris-color-error) 70%,var(--solaris-color-border))}.solaris-form-field[data-invalid=true] .solaris-form-field__frame:focus-within{border-color:color-mix(in srgb,var(--solaris-color-error) 80%,var(--solaris-color-border));box-shadow:0 0 .5rem .25rem color-mix(in srgb,var(--solaris-color-error) 16%,transparent)}.solaris-form-field[data-invalid=true] .solaris-form-field__prefix{border-right-color:color-mix(in srgb,var(--solaris-color-error) 30%,var(--solaris-color-border));color:color-mix(in srgb,var(--solaris-color-error) 75%,var(--solaris-color-text-muted))}.solaris-form-field[data-invalid=true] .solaris-form-field__control-slot :is(input,textarea)::placeholder{color:color-mix(in srgb,var(--solaris-color-error) 45%,var(--solaris-color-text-muted))}.solaris-form-field__body:has(solaris-phone-input){padding-left:0}\n"], dependencies: [{ kind: "component", type: PasswordToggle, selector: "solaris-password-toggle" }, { kind: "component", type: FieldErrorComponent, selector: "solaris-field-error", inputs: ["text", "textKey", "textParams"] }, { kind: "pipe", type: SolarisTranslationPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -4552,7 +4562,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
4552
4562
|
type: Input
|
|
4553
4563
|
}], showErrors: [{
|
|
4554
4564
|
type: Input
|
|
4555
|
-
}] } });
|
|
4565
|
+
}], customErrorKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "customErrorKey", required: false }] }], customErrorParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "customErrorParams", required: false }] }] } });
|
|
4556
4566
|
|
|
4557
4567
|
class SolarisSelect {
|
|
4558
4568
|
destroyRef = inject(DestroyRef);
|