@lesterarte/sefin-ui 0.0.15-dev.1 → 0.0.16
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.
|
@@ -3729,6 +3729,364 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
3729
3729
|
args: ['document:keydown', ['$event']]
|
|
3730
3730
|
}] } });
|
|
3731
3731
|
|
|
3732
|
+
class TextareaComponent {
|
|
3733
|
+
textareaRef;
|
|
3734
|
+
/** Textarea variant style. Options: 'outlined' | 'filled' | 'standard' */
|
|
3735
|
+
variant = 'outlined';
|
|
3736
|
+
/** Textarea size. Options: 'sm' | 'md' | 'lg' */
|
|
3737
|
+
size = 'md';
|
|
3738
|
+
/** Placeholder text */
|
|
3739
|
+
placeholder = '';
|
|
3740
|
+
/** Helper text shown below the textarea */
|
|
3741
|
+
hint = '';
|
|
3742
|
+
/** Error message to display */
|
|
3743
|
+
errorMessage = '';
|
|
3744
|
+
/** Whether the field is required */
|
|
3745
|
+
required = false;
|
|
3746
|
+
/** Whether the field is disabled */
|
|
3747
|
+
disabled = false;
|
|
3748
|
+
/** Whether the field is readonly */
|
|
3749
|
+
readonly = false;
|
|
3750
|
+
/** Maximum length of the input */
|
|
3751
|
+
maxLength;
|
|
3752
|
+
/** Minimum length of the input */
|
|
3753
|
+
minLength;
|
|
3754
|
+
/** Pattern for validation (regex string) */
|
|
3755
|
+
pattern;
|
|
3756
|
+
/** Number of visible text lines */
|
|
3757
|
+
rows = 4;
|
|
3758
|
+
/** Number of visible text columns */
|
|
3759
|
+
cols;
|
|
3760
|
+
/** Whether to auto-resize based on content */
|
|
3761
|
+
autoResize = false;
|
|
3762
|
+
/** Minimum height when auto-resize is enabled */
|
|
3763
|
+
minHeight;
|
|
3764
|
+
/** Maximum height when auto-resize is enabled */
|
|
3765
|
+
maxHeight;
|
|
3766
|
+
/** Whether to show character counter */
|
|
3767
|
+
showCounter = false;
|
|
3768
|
+
/** Autocomplete attribute */
|
|
3769
|
+
autocomplete;
|
|
3770
|
+
/** Textarea name attribute */
|
|
3771
|
+
name = '';
|
|
3772
|
+
/** Textarea id attribute */
|
|
3773
|
+
id = '';
|
|
3774
|
+
/** Additional CSS classes */
|
|
3775
|
+
class = '';
|
|
3776
|
+
/** Custom validation function */
|
|
3777
|
+
customValidator;
|
|
3778
|
+
/** Event emitted when the value changes */
|
|
3779
|
+
valueChange = new EventEmitter();
|
|
3780
|
+
/** Event emitted when the textarea is focused */
|
|
3781
|
+
focused = new EventEmitter();
|
|
3782
|
+
/** Event emitted when the textarea is blurred */
|
|
3783
|
+
blurred = new EventEmitter();
|
|
3784
|
+
value = '';
|
|
3785
|
+
isFocused = false;
|
|
3786
|
+
hasError = false;
|
|
3787
|
+
internalErrorMessage = '';
|
|
3788
|
+
currentHeight = 0;
|
|
3789
|
+
onChange = (value) => { };
|
|
3790
|
+
onTouched = () => { };
|
|
3791
|
+
destroy$ = new Subject();
|
|
3792
|
+
control;
|
|
3793
|
+
ngOnInit() {
|
|
3794
|
+
this.generateIdIfNeeded();
|
|
3795
|
+
}
|
|
3796
|
+
ngAfterViewInit() {
|
|
3797
|
+
if (this.textareaRef?.nativeElement) {
|
|
3798
|
+
// Set initial value if provided
|
|
3799
|
+
if (this.value) {
|
|
3800
|
+
this.textareaRef.nativeElement.value = this.value;
|
|
3801
|
+
}
|
|
3802
|
+
// Initialize auto-resize if enabled
|
|
3803
|
+
if (this.autoResize) {
|
|
3804
|
+
this.adjustHeight();
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
ngOnDestroy() {
|
|
3809
|
+
this.destroy$.next();
|
|
3810
|
+
this.destroy$.complete();
|
|
3811
|
+
}
|
|
3812
|
+
generateIdIfNeeded() {
|
|
3813
|
+
if (!this.id) {
|
|
3814
|
+
this.id = `sefin-textarea-${Math.random().toString(36).substr(2, 9)}`;
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
onInput(event) {
|
|
3818
|
+
const target = event.target;
|
|
3819
|
+
this.value = target.value;
|
|
3820
|
+
this.onChange(this.value);
|
|
3821
|
+
this.valueChange.emit(this.value);
|
|
3822
|
+
this.validateField();
|
|
3823
|
+
// Auto-resize if enabled
|
|
3824
|
+
if (this.autoResize) {
|
|
3825
|
+
this.adjustHeight();
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
onFocus(event) {
|
|
3829
|
+
this.isFocused = true;
|
|
3830
|
+
this.focused.emit(event);
|
|
3831
|
+
}
|
|
3832
|
+
onBlur(event) {
|
|
3833
|
+
this.isFocused = false;
|
|
3834
|
+
this.onTouched();
|
|
3835
|
+
this.blurred.emit(event);
|
|
3836
|
+
this.validateField();
|
|
3837
|
+
}
|
|
3838
|
+
adjustHeight() {
|
|
3839
|
+
if (!this.textareaRef?.nativeElement || !this.autoResize) {
|
|
3840
|
+
return;
|
|
3841
|
+
}
|
|
3842
|
+
const textarea = this.textareaRef.nativeElement;
|
|
3843
|
+
// Reset height to get accurate scrollHeight
|
|
3844
|
+
textarea.style.height = 'auto';
|
|
3845
|
+
// Calculate new height
|
|
3846
|
+
let newHeight = textarea.scrollHeight;
|
|
3847
|
+
// Apply min height if specified
|
|
3848
|
+
if (this.minHeight) {
|
|
3849
|
+
newHeight = Math.max(newHeight, this.minHeight);
|
|
3850
|
+
}
|
|
3851
|
+
// Apply max height if specified
|
|
3852
|
+
if (this.maxHeight) {
|
|
3853
|
+
newHeight = Math.min(newHeight, this.maxHeight);
|
|
3854
|
+
}
|
|
3855
|
+
// Set the new height
|
|
3856
|
+
textarea.style.height = `${newHeight}px`;
|
|
3857
|
+
this.currentHeight = newHeight;
|
|
3858
|
+
}
|
|
3859
|
+
validateField() {
|
|
3860
|
+
this.hasError = false;
|
|
3861
|
+
this.internalErrorMessage = '';
|
|
3862
|
+
if (this.disabled || this.readonly) {
|
|
3863
|
+
return;
|
|
3864
|
+
}
|
|
3865
|
+
const value = this.value || '';
|
|
3866
|
+
// Required validation
|
|
3867
|
+
if (this.required && !value.trim()) {
|
|
3868
|
+
this.hasError = true;
|
|
3869
|
+
this.internalErrorMessage = 'Este campo es requerido';
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
3872
|
+
// Skip other validations if field is empty and not required
|
|
3873
|
+
if (!value.trim()) {
|
|
3874
|
+
return;
|
|
3875
|
+
}
|
|
3876
|
+
// Min length validation
|
|
3877
|
+
if (this.minLength && value.length < this.minLength) {
|
|
3878
|
+
this.hasError = true;
|
|
3879
|
+
this.internalErrorMessage = `Mínimo ${this.minLength} caracteres`;
|
|
3880
|
+
return;
|
|
3881
|
+
}
|
|
3882
|
+
// Max length validation
|
|
3883
|
+
if (this.maxLength && value.length > this.maxLength) {
|
|
3884
|
+
this.hasError = true;
|
|
3885
|
+
this.internalErrorMessage = `Máximo ${this.maxLength} caracteres`;
|
|
3886
|
+
return;
|
|
3887
|
+
}
|
|
3888
|
+
// Pattern validation
|
|
3889
|
+
if (this.pattern) {
|
|
3890
|
+
try {
|
|
3891
|
+
const regex = new RegExp(this.pattern);
|
|
3892
|
+
if (!regex.test(value)) {
|
|
3893
|
+
this.hasError = true;
|
|
3894
|
+
this.internalErrorMessage = 'El formato no es válido';
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
catch (e) {
|
|
3899
|
+
console.warn('Invalid pattern:', this.pattern);
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
// Custom validator
|
|
3903
|
+
if (this.customValidator) {
|
|
3904
|
+
const customError = this.customValidator(value);
|
|
3905
|
+
if (customError) {
|
|
3906
|
+
this.hasError = true;
|
|
3907
|
+
this.internalErrorMessage = customError;
|
|
3908
|
+
return;
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
get displayError() {
|
|
3913
|
+
return this.hasError && (!!this.errorMessage || !!this.internalErrorMessage);
|
|
3914
|
+
}
|
|
3915
|
+
get displayErrorMessage() {
|
|
3916
|
+
return this.errorMessage || this.internalErrorMessage;
|
|
3917
|
+
}
|
|
3918
|
+
get characterCount() {
|
|
3919
|
+
return this.value?.length || 0;
|
|
3920
|
+
}
|
|
3921
|
+
get textareaClasses() {
|
|
3922
|
+
return [
|
|
3923
|
+
'sefin-textarea',
|
|
3924
|
+
`sefin-textarea--${this.variant}`,
|
|
3925
|
+
`sefin-textarea--${this.size}`,
|
|
3926
|
+
this.isFocused ? 'sefin-textarea--focused' : '',
|
|
3927
|
+
this.hasError ? 'sefin-textarea--error' : '',
|
|
3928
|
+
this.disabled ? 'sefin-textarea--disabled' : '',
|
|
3929
|
+
this.readonly ? 'sefin-textarea--readonly' : '',
|
|
3930
|
+
this.autoResize ? 'sefin-textarea--auto-resize' : '',
|
|
3931
|
+
this.class,
|
|
3932
|
+
]
|
|
3933
|
+
.filter(Boolean)
|
|
3934
|
+
.join(' ');
|
|
3935
|
+
}
|
|
3936
|
+
// ControlValueAccessor implementation
|
|
3937
|
+
writeValue(value) {
|
|
3938
|
+
this.value = value || '';
|
|
3939
|
+
if (this.textareaRef?.nativeElement) {
|
|
3940
|
+
this.textareaRef.nativeElement.value = this.value;
|
|
3941
|
+
if (this.autoResize) {
|
|
3942
|
+
setTimeout(() => this.adjustHeight(), 0);
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
this.validateField();
|
|
3946
|
+
}
|
|
3947
|
+
registerOnChange(fn) {
|
|
3948
|
+
this.onChange = fn;
|
|
3949
|
+
}
|
|
3950
|
+
registerOnTouched(fn) {
|
|
3951
|
+
this.onTouched = fn;
|
|
3952
|
+
}
|
|
3953
|
+
setDisabledState(isDisabled) {
|
|
3954
|
+
this.disabled = isDisabled;
|
|
3955
|
+
}
|
|
3956
|
+
// Validator implementation
|
|
3957
|
+
validate(control) {
|
|
3958
|
+
this.control = control;
|
|
3959
|
+
const value = control.value || '';
|
|
3960
|
+
if (this.disabled || this.readonly) {
|
|
3961
|
+
return null;
|
|
3962
|
+
}
|
|
3963
|
+
// Required validation
|
|
3964
|
+
if (this.required && !value.trim()) {
|
|
3965
|
+
return { required: true };
|
|
3966
|
+
}
|
|
3967
|
+
// Skip other validations if field is empty and not required
|
|
3968
|
+
if (!value.trim()) {
|
|
3969
|
+
return null;
|
|
3970
|
+
}
|
|
3971
|
+
const errors = {};
|
|
3972
|
+
// Min length validation
|
|
3973
|
+
if (this.minLength && value.length < this.minLength) {
|
|
3974
|
+
errors['minlength'] = {
|
|
3975
|
+
requiredLength: this.minLength,
|
|
3976
|
+
actualLength: value.length,
|
|
3977
|
+
};
|
|
3978
|
+
}
|
|
3979
|
+
// Max length validation
|
|
3980
|
+
if (this.maxLength && value.length > this.maxLength) {
|
|
3981
|
+
errors['maxlength'] = {
|
|
3982
|
+
requiredLength: this.maxLength,
|
|
3983
|
+
actualLength: value.length,
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
// Pattern validation
|
|
3987
|
+
if (this.pattern) {
|
|
3988
|
+
try {
|
|
3989
|
+
const regex = new RegExp(this.pattern);
|
|
3990
|
+
if (!regex.test(value)) {
|
|
3991
|
+
errors['pattern'] = { requiredPattern: this.pattern, actualValue: value };
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
catch (e) {
|
|
3995
|
+
console.warn('Invalid pattern:', this.pattern);
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
// Custom validator
|
|
3999
|
+
if (this.customValidator) {
|
|
4000
|
+
const customError = this.customValidator(value);
|
|
4001
|
+
if (customError) {
|
|
4002
|
+
errors['custom'] = { message: customError };
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
return Object.keys(errors).length > 0 ? errors : null;
|
|
4006
|
+
}
|
|
4007
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4008
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: TextareaComponent, isStandalone: true, selector: "sefin-textarea", inputs: { variant: "variant", size: "size", placeholder: "placeholder", hint: "hint", errorMessage: "errorMessage", required: "required", disabled: "disabled", readonly: "readonly", maxLength: "maxLength", minLength: "minLength", pattern: "pattern", rows: "rows", cols: "cols", autoResize: "autoResize", minHeight: "minHeight", maxHeight: "maxHeight", showCounter: "showCounter", autocomplete: "autocomplete", name: "name", id: "id", class: "class", customValidator: "customValidator" }, outputs: { valueChange: "valueChange", focused: "focused", blurred: "blurred" }, providers: [
|
|
4009
|
+
{
|
|
4010
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4011
|
+
useExisting: forwardRef(() => TextareaComponent),
|
|
4012
|
+
multi: true,
|
|
4013
|
+
},
|
|
4014
|
+
{
|
|
4015
|
+
provide: NG_VALIDATORS,
|
|
4016
|
+
useExisting: forwardRef(() => TextareaComponent),
|
|
4017
|
+
multi: true,
|
|
4018
|
+
},
|
|
4019
|
+
], viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textareaRef"], descendants: true }], ngImport: i0, template: "<div [class]=\"textareaClasses\">\n <!-- Textarea Container -->\n <div class=\"sefin-textarea__container\">\n <!-- Textarea Wrapper -->\n <div class=\"sefin-textarea__wrapper\">\n <!-- Textarea -->\n <textarea\n #textareaRef\n [id]=\"id\"\n [name]=\"name\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n [attr.rows]=\"rows\"\n [attr.cols]=\"cols\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [autocomplete]=\"autocomplete\"\n [attr.aria-label]=\"placeholder\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"hasError\"\n [attr.aria-describedby]=\"displayError || hint || showCounter ? id + '-helper' : null\"\n class=\"sefin-textarea__textarea\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n </div>\n\n <!-- Outline/Filled border -->\n <div class=\"sefin-textarea__border\"></div>\n </div>\n\n <!-- Helper Text / Error Message -->\n <div\n *ngIf=\"displayError || hint || showCounter\"\n [id]=\"id + '-helper'\"\n class=\"sefin-textarea__helper\"\n [class.sefin-textarea__helper--error]=\"displayError\"\n >\n <span *ngIf=\"displayError\" class=\"sefin-textarea__error-message\">\n {{ displayErrorMessage }}\n </span>\n <span *ngIf=\"!displayError && hint\" class=\"sefin-textarea__hint\">\n {{ hint }}\n </span>\n <span\n *ngIf=\"showCounter && !displayError\"\n class=\"sefin-textarea__counter\"\n [class.sefin-textarea__counter--warning]=\"maxLength && characterCount > maxLength * 0.8\"\n >\n {{ characterCount }}{{ maxLength ? ' / ' + maxLength : '' }}\n </span>\n </div>\n</div>\n\n", styles: [".sefin-textarea{position:relative;display:inline-flex;flex-direction:column;width:100%;font-family:var(--sefin-font-family-base, sans-serif)}.sefin-textarea__container{position:relative;display:flex;flex-direction:column;width:100%;min-height:120px;overflow:visible;z-index:0}.sefin-textarea__wrapper{position:relative;flex:1;display:flex;flex-direction:column;height:100%;min-height:0;overflow:visible}.sefin-textarea__textarea{width:100%;font-family:var(--sefin-font-family-base, sans-serif);font-size:var(--sefin-font-size-base, 16px);font-weight:var(--sefin-font-weight-normal, 400);line-height:var(--sefin-line-height-normal, 1.5);color:var(--sefin-color-text, #1a1a1a);background-color:transparent;border:none;outline:none;padding:0;margin:0;box-sizing:border-box;resize:vertical;overflow-y:auto}.sefin-textarea__textarea::placeholder{color:#e0e0e0!important;opacity:1;transition:opacity .2s ease-in-out}.sefin-textarea__textarea::-webkit-input-placeholder{color:#e0e0e0!important}.sefin-textarea__textarea::-moz-placeholder{color:#e0e0e0!important;opacity:1}.sefin-textarea__textarea:-ms-input-placeholder{color:#e0e0e0!important}.sefin-textarea__textarea:focus::placeholder{opacity:1;color:#e0e0e0!important}.sefin-textarea__textarea:disabled,.sefin-textarea__textarea:read-only{cursor:not-allowed;color:var(--sefin-color-text-disabled, #999)}.sefin-textarea--auto-resize .sefin-textarea__textarea{resize:none;overflow-y:hidden}.sefin-textarea__border{position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--sefin-color-border, #e0e0e0);transition:background-color .2s ease-in-out,height .2s ease-in-out;pointer-events:none;z-index:0}.sefin-textarea__helper{display:flex;align-items:center;justify-content:space-between;margin-top:var(--sefin-spacing-xs, 4px);min-height:20px;font-family:var(--sefin-font-family-base, sans-serif);font-size:var(--sefin-font-size-xs, 12px);line-height:var(--sefin-line-height-normal, 1.5)}.sefin-textarea__hint{color:var(--sefin-color-text-secondary, #666)}.sefin-textarea__error-message{color:var(--sefin-color-error, #f44336);display:flex;align-items:center;gap:var(--sefin-spacing-xs, 4px)}.sefin-textarea__counter{color:var(--sefin-color-text-secondary, #666);margin-left:auto}.sefin-textarea__counter--warning{color:var(--sefin-color-warning, #ff9800)}.sefin-textarea--outlined .sefin-textarea__container{border:.5px solid var(--sefin-color-border, #e0e0e0);border-radius:var(--sefin-border-radius-md, 8px);background-color:var(--sefin-color-surface, #ffffff);transition:border-color .2s ease-in-out,box-shadow .2s ease-in-out}.sefin-textarea--outlined .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--outlined .sefin-textarea__textarea{padding:0;margin:0}.sefin-textarea--outlined .sefin-textarea__border{display:none}.sefin-textarea--outlined.sefin-textarea--focused .sefin-textarea__container{border-color:var(--sefin-color-primary, #1976d2);border-width:.5px;box-shadow:0 0 0 1px var(--sefin-color-primary-light, rgba(25, 118, 210, .1))}.sefin-textarea--outlined.sefin-textarea--error .sefin-textarea__container{border-color:var(--sefin-color-error, #f44336);border-width:.5px}.sefin-textarea--outlined.sefin-textarea--disabled .sefin-textarea__container{background-color:var(--sefin-color-surface-hover, #f5f5f5);border-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--filled .sefin-textarea__container{border:none;border-bottom:.5px solid var(--sefin-color-border, #e0e0e0);border-radius:var(--sefin-border-radius-md, 8px) var(--sefin-border-radius-md, 8px) 0 0;background-color:var(--sefin-color-surface-hover, #f5f5f5);transition:background-color .2s ease-in-out,border-color .2s ease-in-out}.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--filled .sefin-textarea__textarea{padding:0;margin:0}.sefin-textarea--filled .sefin-textarea__border{display:none}.sefin-textarea--filled.sefin-textarea--focused .sefin-textarea__container{background-color:var(--sefin-color-surface, #ffffff);border-bottom-color:var(--sefin-color-primary, #1976d2);border-bottom-width:.5px}.sefin-textarea--filled.sefin-textarea--error .sefin-textarea__container{border-bottom-color:var(--sefin-color-error, #f44336);border-bottom-width:.5px}.sefin-textarea--filled.sefin-textarea--disabled .sefin-textarea__container{background-color:var(--sefin-color-surface-hover, #f5f5f5);border-bottom-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--standard .sefin-textarea__container{border:none;background-color:transparent;transition:border-color .2s ease-in-out}.sefin-textarea--standard .sefin-textarea__wrapper{padding:0}.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-md, 16px) 0 var(--sefin-spacing-sm, 8px) 0;margin:0}.sefin-textarea--standard .sefin-textarea__border{height:1px}.sefin-textarea--standard.sefin-textarea--focused .sefin-textarea__border{height:1px;background-color:var(--sefin-color-primary, #1976d2)}.sefin-textarea--standard.sefin-textarea--error .sefin-textarea__border{height:1px;background-color:var(--sefin-color-error, #f44336)}.sefin-textarea--standard.sefin-textarea--disabled .sefin-textarea__container{border-bottom-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--sm .sefin-textarea__container{min-height:80px}.sefin-textarea--sm .sefin-textarea__textarea{font-size:var(--sefin-font-size-sm, 14px)}.sefin-textarea--sm.sefin-textarea--outlined .sefin-textarea__wrapper,.sefin-textarea--sm.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-sm, 8px)}.sefin-textarea--sm.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-sm, 8px) 0 var(--sefin-spacing-xs, 4px) 0}.sefin-textarea--md .sefin-textarea__container{min-height:120px}.sefin-textarea--lg .sefin-textarea__container{min-height:160px}.sefin-textarea--lg .sefin-textarea__textarea{font-size:var(--sefin-font-size-lg, 18px)}.sefin-textarea--lg.sefin-textarea--outlined .sefin-textarea__wrapper,.sefin-textarea--lg.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--lg.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-md, 16px) 0 var(--sefin-spacing-sm, 8px) 0}.sefin-textarea--disabled{cursor:not-allowed;opacity:.6}.sefin-textarea--readonly .sefin-textarea__textarea{cursor:default}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
4020
|
+
}
|
|
4021
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
4022
|
+
type: Component,
|
|
4023
|
+
args: [{ selector: 'sefin-textarea', standalone: true, imports: [CommonModule, IconComponent], changeDetection: ChangeDetectionStrategy.Default, providers: [
|
|
4024
|
+
{
|
|
4025
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4026
|
+
useExisting: forwardRef(() => TextareaComponent),
|
|
4027
|
+
multi: true,
|
|
4028
|
+
},
|
|
4029
|
+
{
|
|
4030
|
+
provide: NG_VALIDATORS,
|
|
4031
|
+
useExisting: forwardRef(() => TextareaComponent),
|
|
4032
|
+
multi: true,
|
|
4033
|
+
},
|
|
4034
|
+
], template: "<div [class]=\"textareaClasses\">\n <!-- Textarea Container -->\n <div class=\"sefin-textarea__container\">\n <!-- Textarea Wrapper -->\n <div class=\"sefin-textarea__wrapper\">\n <!-- Textarea -->\n <textarea\n #textareaRef\n [id]=\"id\"\n [name]=\"name\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n [attr.rows]=\"rows\"\n [attr.cols]=\"cols\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [autocomplete]=\"autocomplete\"\n [attr.aria-label]=\"placeholder\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"hasError\"\n [attr.aria-describedby]=\"displayError || hint || showCounter ? id + '-helper' : null\"\n class=\"sefin-textarea__textarea\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n </div>\n\n <!-- Outline/Filled border -->\n <div class=\"sefin-textarea__border\"></div>\n </div>\n\n <!-- Helper Text / Error Message -->\n <div\n *ngIf=\"displayError || hint || showCounter\"\n [id]=\"id + '-helper'\"\n class=\"sefin-textarea__helper\"\n [class.sefin-textarea__helper--error]=\"displayError\"\n >\n <span *ngIf=\"displayError\" class=\"sefin-textarea__error-message\">\n {{ displayErrorMessage }}\n </span>\n <span *ngIf=\"!displayError && hint\" class=\"sefin-textarea__hint\">\n {{ hint }}\n </span>\n <span\n *ngIf=\"showCounter && !displayError\"\n class=\"sefin-textarea__counter\"\n [class.sefin-textarea__counter--warning]=\"maxLength && characterCount > maxLength * 0.8\"\n >\n {{ characterCount }}{{ maxLength ? ' / ' + maxLength : '' }}\n </span>\n </div>\n</div>\n\n", styles: [".sefin-textarea{position:relative;display:inline-flex;flex-direction:column;width:100%;font-family:var(--sefin-font-family-base, sans-serif)}.sefin-textarea__container{position:relative;display:flex;flex-direction:column;width:100%;min-height:120px;overflow:visible;z-index:0}.sefin-textarea__wrapper{position:relative;flex:1;display:flex;flex-direction:column;height:100%;min-height:0;overflow:visible}.sefin-textarea__textarea{width:100%;font-family:var(--sefin-font-family-base, sans-serif);font-size:var(--sefin-font-size-base, 16px);font-weight:var(--sefin-font-weight-normal, 400);line-height:var(--sefin-line-height-normal, 1.5);color:var(--sefin-color-text, #1a1a1a);background-color:transparent;border:none;outline:none;padding:0;margin:0;box-sizing:border-box;resize:vertical;overflow-y:auto}.sefin-textarea__textarea::placeholder{color:#e0e0e0!important;opacity:1;transition:opacity .2s ease-in-out}.sefin-textarea__textarea::-webkit-input-placeholder{color:#e0e0e0!important}.sefin-textarea__textarea::-moz-placeholder{color:#e0e0e0!important;opacity:1}.sefin-textarea__textarea:-ms-input-placeholder{color:#e0e0e0!important}.sefin-textarea__textarea:focus::placeholder{opacity:1;color:#e0e0e0!important}.sefin-textarea__textarea:disabled,.sefin-textarea__textarea:read-only{cursor:not-allowed;color:var(--sefin-color-text-disabled, #999)}.sefin-textarea--auto-resize .sefin-textarea__textarea{resize:none;overflow-y:hidden}.sefin-textarea__border{position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--sefin-color-border, #e0e0e0);transition:background-color .2s ease-in-out,height .2s ease-in-out;pointer-events:none;z-index:0}.sefin-textarea__helper{display:flex;align-items:center;justify-content:space-between;margin-top:var(--sefin-spacing-xs, 4px);min-height:20px;font-family:var(--sefin-font-family-base, sans-serif);font-size:var(--sefin-font-size-xs, 12px);line-height:var(--sefin-line-height-normal, 1.5)}.sefin-textarea__hint{color:var(--sefin-color-text-secondary, #666)}.sefin-textarea__error-message{color:var(--sefin-color-error, #f44336);display:flex;align-items:center;gap:var(--sefin-spacing-xs, 4px)}.sefin-textarea__counter{color:var(--sefin-color-text-secondary, #666);margin-left:auto}.sefin-textarea__counter--warning{color:var(--sefin-color-warning, #ff9800)}.sefin-textarea--outlined .sefin-textarea__container{border:.5px solid var(--sefin-color-border, #e0e0e0);border-radius:var(--sefin-border-radius-md, 8px);background-color:var(--sefin-color-surface, #ffffff);transition:border-color .2s ease-in-out,box-shadow .2s ease-in-out}.sefin-textarea--outlined .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--outlined .sefin-textarea__textarea{padding:0;margin:0}.sefin-textarea--outlined .sefin-textarea__border{display:none}.sefin-textarea--outlined.sefin-textarea--focused .sefin-textarea__container{border-color:var(--sefin-color-primary, #1976d2);border-width:.5px;box-shadow:0 0 0 1px var(--sefin-color-primary-light, rgba(25, 118, 210, .1))}.sefin-textarea--outlined.sefin-textarea--error .sefin-textarea__container{border-color:var(--sefin-color-error, #f44336);border-width:.5px}.sefin-textarea--outlined.sefin-textarea--disabled .sefin-textarea__container{background-color:var(--sefin-color-surface-hover, #f5f5f5);border-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--filled .sefin-textarea__container{border:none;border-bottom:.5px solid var(--sefin-color-border, #e0e0e0);border-radius:var(--sefin-border-radius-md, 8px) var(--sefin-border-radius-md, 8px) 0 0;background-color:var(--sefin-color-surface-hover, #f5f5f5);transition:background-color .2s ease-in-out,border-color .2s ease-in-out}.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--filled .sefin-textarea__textarea{padding:0;margin:0}.sefin-textarea--filled .sefin-textarea__border{display:none}.sefin-textarea--filled.sefin-textarea--focused .sefin-textarea__container{background-color:var(--sefin-color-surface, #ffffff);border-bottom-color:var(--sefin-color-primary, #1976d2);border-bottom-width:.5px}.sefin-textarea--filled.sefin-textarea--error .sefin-textarea__container{border-bottom-color:var(--sefin-color-error, #f44336);border-bottom-width:.5px}.sefin-textarea--filled.sefin-textarea--disabled .sefin-textarea__container{background-color:var(--sefin-color-surface-hover, #f5f5f5);border-bottom-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--standard .sefin-textarea__container{border:none;background-color:transparent;transition:border-color .2s ease-in-out}.sefin-textarea--standard .sefin-textarea__wrapper{padding:0}.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-md, 16px) 0 var(--sefin-spacing-sm, 8px) 0;margin:0}.sefin-textarea--standard .sefin-textarea__border{height:1px}.sefin-textarea--standard.sefin-textarea--focused .sefin-textarea__border{height:1px;background-color:var(--sefin-color-primary, #1976d2)}.sefin-textarea--standard.sefin-textarea--error .sefin-textarea__border{height:1px;background-color:var(--sefin-color-error, #f44336)}.sefin-textarea--standard.sefin-textarea--disabled .sefin-textarea__container{border-bottom-color:var(--sefin-color-border, #e0e0e0);opacity:.6}.sefin-textarea--sm .sefin-textarea__container{min-height:80px}.sefin-textarea--sm .sefin-textarea__textarea{font-size:var(--sefin-font-size-sm, 14px)}.sefin-textarea--sm.sefin-textarea--outlined .sefin-textarea__wrapper,.sefin-textarea--sm.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-sm, 8px)}.sefin-textarea--sm.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-sm, 8px) 0 var(--sefin-spacing-xs, 4px) 0}.sefin-textarea--md .sefin-textarea__container{min-height:120px}.sefin-textarea--lg .sefin-textarea__container{min-height:160px}.sefin-textarea--lg .sefin-textarea__textarea{font-size:var(--sefin-font-size-lg, 18px)}.sefin-textarea--lg.sefin-textarea--outlined .sefin-textarea__wrapper,.sefin-textarea--lg.sefin-textarea--filled .sefin-textarea__wrapper{padding:var(--sefin-spacing-md, 16px)}.sefin-textarea--lg.sefin-textarea--standard .sefin-textarea__textarea{padding:var(--sefin-spacing-md, 16px) 0 var(--sefin-spacing-sm, 8px) 0}.sefin-textarea--disabled{cursor:not-allowed;opacity:.6}.sefin-textarea--readonly .sefin-textarea__textarea{cursor:default}\n"] }]
|
|
4035
|
+
}], propDecorators: { textareaRef: [{
|
|
4036
|
+
type: ViewChild,
|
|
4037
|
+
args: ['textareaRef', { static: false }]
|
|
4038
|
+
}], variant: [{
|
|
4039
|
+
type: Input
|
|
4040
|
+
}], size: [{
|
|
4041
|
+
type: Input
|
|
4042
|
+
}], placeholder: [{
|
|
4043
|
+
type: Input
|
|
4044
|
+
}], hint: [{
|
|
4045
|
+
type: Input
|
|
4046
|
+
}], errorMessage: [{
|
|
4047
|
+
type: Input
|
|
4048
|
+
}], required: [{
|
|
4049
|
+
type: Input
|
|
4050
|
+
}], disabled: [{
|
|
4051
|
+
type: Input
|
|
4052
|
+
}], readonly: [{
|
|
4053
|
+
type: Input
|
|
4054
|
+
}], maxLength: [{
|
|
4055
|
+
type: Input
|
|
4056
|
+
}], minLength: [{
|
|
4057
|
+
type: Input
|
|
4058
|
+
}], pattern: [{
|
|
4059
|
+
type: Input
|
|
4060
|
+
}], rows: [{
|
|
4061
|
+
type: Input
|
|
4062
|
+
}], cols: [{
|
|
4063
|
+
type: Input
|
|
4064
|
+
}], autoResize: [{
|
|
4065
|
+
type: Input
|
|
4066
|
+
}], minHeight: [{
|
|
4067
|
+
type: Input
|
|
4068
|
+
}], maxHeight: [{
|
|
4069
|
+
type: Input
|
|
4070
|
+
}], showCounter: [{
|
|
4071
|
+
type: Input
|
|
4072
|
+
}], autocomplete: [{
|
|
4073
|
+
type: Input
|
|
4074
|
+
}], name: [{
|
|
4075
|
+
type: Input
|
|
4076
|
+
}], id: [{
|
|
4077
|
+
type: Input
|
|
4078
|
+
}], class: [{
|
|
4079
|
+
type: Input
|
|
4080
|
+
}], customValidator: [{
|
|
4081
|
+
type: Input
|
|
4082
|
+
}], valueChange: [{
|
|
4083
|
+
type: Output
|
|
4084
|
+
}], focused: [{
|
|
4085
|
+
type: Output
|
|
4086
|
+
}], blurred: [{
|
|
4087
|
+
type: Output
|
|
4088
|
+
}] } });
|
|
4089
|
+
|
|
3732
4090
|
/**
|
|
3733
4091
|
* Molecules index
|
|
3734
4092
|
*/
|
|
@@ -3744,5 +4102,5 @@ const STYLES_PATH = './styles/index.scss';
|
|
|
3744
4102
|
* Generated bundle index. Do not edit.
|
|
3745
4103
|
*/
|
|
3746
4104
|
|
|
3747
|
-
export { AlertComponent, AutocompleteComponent, AvatarComponent, BORDER_RADIUS_TOKENS, BRAND_THEME, BadgeComponent, ButtonComponent, COLOR_TOKENS, CheckboxComponent, ChipComponent, ContainerComponent, DARK_THEME, DESIGN_TOKENS, DatepickerComponent, DividerComponent, FabButtonComponent, IconButtonComponent, IconComponent, LIGHT_THEME, LinkComponent, ProgressBarComponent, RadioComponent, SHADOW_TOKENS, SPACING_TOKENS, STYLES_PATH, SelectComponent, SpinnerComponent, StackComponent, SwitchComponent, TYPOGRAPHY_TOKENS, TagComponent, TextFieldComponent, ThemeLoader, ToastComponent, TooltipComponent, TypographyComponent };
|
|
4105
|
+
export { AlertComponent, AutocompleteComponent, AvatarComponent, BORDER_RADIUS_TOKENS, BRAND_THEME, BadgeComponent, ButtonComponent, COLOR_TOKENS, CheckboxComponent, ChipComponent, ContainerComponent, DARK_THEME, DESIGN_TOKENS, DatepickerComponent, DividerComponent, FabButtonComponent, IconButtonComponent, IconComponent, LIGHT_THEME, LinkComponent, ProgressBarComponent, RadioComponent, SHADOW_TOKENS, SPACING_TOKENS, STYLES_PATH, SelectComponent, SpinnerComponent, StackComponent, SwitchComponent, TYPOGRAPHY_TOKENS, TagComponent, TextFieldComponent, TextareaComponent, ThemeLoader, ToastComponent, TooltipComponent, TypographyComponent };
|
|
3748
4106
|
//# sourceMappingURL=lesterarte-sefin-ui.mjs.map
|