@crowdfarming/oliva-ds 1.95.0 → 1.96.0-rc.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.
|
@@ -4766,55 +4766,116 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
4766
4766
|
|
|
4767
4767
|
class InputCounterComponent {
|
|
4768
4768
|
initialValue = input(undefined);
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
required = false;
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4769
|
+
// Common inputs (signal-based, aligned with input-number; defaults kept from input-counter)
|
|
4770
|
+
label = input('');
|
|
4771
|
+
placeholder = input('');
|
|
4772
|
+
helperText = input('');
|
|
4773
|
+
alertText = input('');
|
|
4774
|
+
successText = input('');
|
|
4775
|
+
error = input(false);
|
|
4776
|
+
success = input(false);
|
|
4777
|
+
required = input(false);
|
|
4778
|
+
readonly = input(false);
|
|
4779
|
+
isLoading = input(false);
|
|
4780
|
+
size = input('md');
|
|
4781
|
+
fullWidth = input(false);
|
|
4782
|
+
// Counter-specific inputs
|
|
4783
|
+
disabled = input(false);
|
|
4784
|
+
optionalLabel = input('');
|
|
4785
|
+
variant = input('default');
|
|
4786
|
+
minimum = input(1);
|
|
4787
|
+
maximum = input(undefined);
|
|
4788
|
+
step = input(1);
|
|
4789
|
+
allowDelete = input(false);
|
|
4790
|
+
// Number-formatting inputs (aligned with input-number).
|
|
4791
|
+
name = input('');
|
|
4792
|
+
autocomplete = input('off');
|
|
4793
|
+
allowDecimals = input(false);
|
|
4794
|
+
allowNegative = input(false);
|
|
4795
|
+
decimalSeparator = input('comma');
|
|
4796
|
+
maxDecimals = input(undefined);
|
|
4797
|
+
// Optional extra validation: typed value must match this pattern, else error
|
|
4798
|
+
regex = input(null);
|
|
4799
|
+
emitValue = output();
|
|
4800
|
+
// Disabled state set via ControlValueAccessor, combined with the `disabled` input
|
|
4801
|
+
formDisabled = signal(false);
|
|
4802
|
+
isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
4803
|
+
// Canonical numeric value (used for clamping / min-max / buttons); null = empty
|
|
4804
|
+
value = signal(this.minimum());
|
|
4805
|
+
// Formatted string shown in the text input
|
|
4806
|
+
displayValue = signal('');
|
|
4807
|
+
// Internal error raised when a required field is left empty on blur
|
|
4808
|
+
requiredError = signal(false);
|
|
4809
|
+
// Internal error raised when the typed value does not match `regex`
|
|
4810
|
+
regexError = signal(false);
|
|
4811
|
+
// Combined error state: external `error` input OR an internal validation
|
|
4812
|
+
hasError = computed(() => this.error() || this.requiredError() || this.regexError());
|
|
4813
|
+
// Message shown under the input: any error state surfaces `alertText`
|
|
4814
|
+
errorMessage = computed(() => this.alertText());
|
|
4815
|
+
effectiveInputmode = computed(() => this.allowDecimals() ? 'decimal' : 'numeric');
|
|
4816
|
+
regexPattern = computed(() => {
|
|
4817
|
+
const negative = this.allowNegative() ? '-?' : '';
|
|
4818
|
+
const integer = '[0-9]*';
|
|
4819
|
+
if (!this.allowDecimals())
|
|
4820
|
+
return `^${negative}${integer}$`;
|
|
4821
|
+
const separator = this.decimalSeparator() === 'comma' ? ',' : '\\.';
|
|
4822
|
+
const decimal = this.maxDecimals() !== undefined
|
|
4823
|
+
? `[0-9]{0,${this.maxDecimals()}}`
|
|
4824
|
+
: '[0-9]*';
|
|
4825
|
+
return `^${negative}${integer}${separator}?${decimal}$`;
|
|
4826
|
+
});
|
|
4790
4827
|
get maxValue() {
|
|
4791
|
-
return this.maximum ?? Infinity;
|
|
4828
|
+
return this.maximum() ?? Infinity;
|
|
4792
4829
|
}
|
|
4793
4830
|
get effectiveMinimum() {
|
|
4794
|
-
return this.allowDelete ? 0 : this.minimum;
|
|
4795
|
-
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4831
|
+
return this.allowDelete() ? 0 : this.minimum();
|
|
4832
|
+
}
|
|
4833
|
+
// Decimal places used to round button increments (avoids floating-point drift)
|
|
4834
|
+
get decimals() {
|
|
4835
|
+
const max = this.maxDecimals();
|
|
4836
|
+
if (max !== undefined)
|
|
4837
|
+
return max;
|
|
4838
|
+
const stepStr = this.step().toString();
|
|
4839
|
+
const dot = stepStr.indexOf('.');
|
|
4840
|
+
return dot === -1 ? 0 : stepStr.length - dot - 1;
|
|
4841
|
+
}
|
|
4842
|
+
isAtMinimum = computed(() => {
|
|
4843
|
+
const current = this.value();
|
|
4844
|
+
return current !== null && current <= this.effectiveMinimum;
|
|
4845
|
+
});
|
|
4846
|
+
decrementIconName = computed(() => this.allowDelete() && this.value() === this.minimum()
|
|
4798
4847
|
? 'trash-regular'
|
|
4799
4848
|
: 'minus-regular');
|
|
4800
|
-
isAtMaximum = computed(() =>
|
|
4849
|
+
isAtMaximum = computed(() => {
|
|
4850
|
+
const current = this.value();
|
|
4851
|
+
return (this.maxValue !== Infinity && current !== null && current >= this.maxValue);
|
|
4852
|
+
});
|
|
4801
4853
|
constructor() {
|
|
4802
|
-
this.
|
|
4854
|
+
const initial = this.minimum();
|
|
4855
|
+
this.value.set(initial);
|
|
4856
|
+
this.displayValue.set(this.formatNumber(initial));
|
|
4803
4857
|
effect(() => {
|
|
4804
|
-
const
|
|
4805
|
-
if (
|
|
4806
|
-
let clampedValue = Math.max(this.minimum,
|
|
4858
|
+
const initialValue = this.initialValue();
|
|
4859
|
+
if (initialValue !== undefined) {
|
|
4860
|
+
let clampedValue = Math.max(this.minimum(), initialValue);
|
|
4807
4861
|
if (this.maxValue !== Infinity) {
|
|
4808
4862
|
clampedValue = Math.min(this.maxValue, clampedValue);
|
|
4809
4863
|
}
|
|
4810
4864
|
this.value.set(clampedValue);
|
|
4865
|
+
this.displayValue.set(this.formatNumber(clampedValue));
|
|
4811
4866
|
}
|
|
4812
4867
|
});
|
|
4813
4868
|
}
|
|
4814
4869
|
onChangeFn = () => { };
|
|
4815
4870
|
onTouchedFn = () => { };
|
|
4816
4871
|
writeValue(value) {
|
|
4817
|
-
|
|
4872
|
+
if (value === null || value === undefined) {
|
|
4873
|
+
this.value.set(null);
|
|
4874
|
+
this.displayValue.set('');
|
|
4875
|
+
return;
|
|
4876
|
+
}
|
|
4877
|
+
this.value.set(value);
|
|
4878
|
+
this.displayValue.set(this.formatNumber(value));
|
|
4818
4879
|
}
|
|
4819
4880
|
registerOnChange(fn) {
|
|
4820
4881
|
this.onChangeFn = fn;
|
|
@@ -4823,70 +4884,158 @@ class InputCounterComponent {
|
|
|
4823
4884
|
this.onTouchedFn = fn;
|
|
4824
4885
|
}
|
|
4825
4886
|
setDisabledState(isDisabled) {
|
|
4826
|
-
this.
|
|
4887
|
+
this.formDisabled.set(isDisabled);
|
|
4827
4888
|
}
|
|
4828
4889
|
get inputClass() {
|
|
4829
4890
|
return [
|
|
4830
4891
|
'c-text-input__input',
|
|
4831
|
-
`c-text-input__input--${this.size}`,
|
|
4832
|
-
this.
|
|
4833
|
-
this.success ? 'is-success' : '',
|
|
4834
|
-
this.
|
|
4835
|
-
this.readonly ? 'is-readonly' : '',
|
|
4836
|
-
this.isLoading ? 'is-loading' : '',
|
|
4892
|
+
`c-text-input__input--${this.size()}`,
|
|
4893
|
+
this.hasError() ? 'is-error' : '',
|
|
4894
|
+
this.success() ? 'is-success' : '',
|
|
4895
|
+
this.isDisabled() ? 'is-disabled' : '',
|
|
4896
|
+
this.readonly() ? 'is-readonly' : '',
|
|
4897
|
+
this.isLoading() ? 'is-loading' : '',
|
|
4837
4898
|
].filter(Boolean);
|
|
4838
4899
|
}
|
|
4839
4900
|
get ariaDescribedBy() {
|
|
4840
|
-
return this.helperText ? 'search-input-helper' : null;
|
|
4901
|
+
return this.helperText() ? 'search-input-helper' : null;
|
|
4841
4902
|
}
|
|
4842
4903
|
onType(event) {
|
|
4843
|
-
const
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4904
|
+
const inputEl = event.target;
|
|
4905
|
+
const raw = inputEl.value;
|
|
4906
|
+
// Sanitize against the full-pattern regex; revert to the last valid text if invalid
|
|
4907
|
+
const sanitized = this.testRegex(raw) ? raw : this.displayValue();
|
|
4908
|
+
if (sanitized !== raw) {
|
|
4909
|
+
inputEl.value = sanitized;
|
|
4910
|
+
}
|
|
4911
|
+
this.displayValue.set(sanitized);
|
|
4912
|
+
// Emptying the field clears any error and notifies a null value
|
|
4913
|
+
if (sanitized === '') {
|
|
4914
|
+
this.value.set(null);
|
|
4915
|
+
this.requiredError.set(false);
|
|
4916
|
+
this.regexError.set(false);
|
|
4917
|
+
this.onChangeFn(null);
|
|
4918
|
+
this.emitValue.emit(null);
|
|
4919
|
+
return;
|
|
4847
4920
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4921
|
+
// Clear stale validation errors while the user is editing; revalidate on blur
|
|
4922
|
+
this.requiredError.set(false);
|
|
4923
|
+
this.regexError.set(false);
|
|
4924
|
+
// Emit the parsed number; incomplete input (trailing separator) waits for blur
|
|
4925
|
+
const parsed = this.parseNumber(sanitized);
|
|
4926
|
+
if (parsed !== null) {
|
|
4927
|
+
this.value.set(parsed);
|
|
4928
|
+
this.onChangeFn(parsed);
|
|
4929
|
+
this.emitValue.emit(parsed);
|
|
4850
4930
|
}
|
|
4851
|
-
// Update the input value to reflect the clamped value
|
|
4852
|
-
input.value = newVal.toString();
|
|
4853
|
-
this.value.set(newVal);
|
|
4854
|
-
this.onChangeFn(newVal);
|
|
4855
|
-
this.emitValue.emit(newVal);
|
|
4856
4931
|
}
|
|
4857
4932
|
upNumber() {
|
|
4858
|
-
|
|
4859
|
-
const
|
|
4933
|
+
// From empty, the first increment lands on the effective minimum
|
|
4934
|
+
const base = this.value() ?? this.effectiveMinimum - this.step();
|
|
4935
|
+
const newValue = this.round(base + this.step());
|
|
4860
4936
|
if (this.maxValue === Infinity || newValue <= this.maxValue) {
|
|
4861
|
-
this.
|
|
4862
|
-
this.onChangeFn(newValue);
|
|
4863
|
-
this.emitValue.emit(newValue);
|
|
4937
|
+
this.commit(newValue);
|
|
4864
4938
|
}
|
|
4865
4939
|
}
|
|
4866
4940
|
downNumber() {
|
|
4867
|
-
|
|
4868
|
-
const
|
|
4941
|
+
// From empty, the first decrement lands on the effective minimum
|
|
4942
|
+
const base = this.value() ?? this.effectiveMinimum + this.step();
|
|
4943
|
+
const newValue = this.round(base - this.step());
|
|
4869
4944
|
if (newValue >= this.effectiveMinimum) {
|
|
4870
|
-
this.
|
|
4871
|
-
this.onChangeFn(newValue);
|
|
4872
|
-
this.emitValue.emit(newValue);
|
|
4945
|
+
this.commit(newValue);
|
|
4873
4946
|
}
|
|
4874
4947
|
}
|
|
4875
4948
|
onBlur() {
|
|
4949
|
+
const raw = this.displayValue().trim();
|
|
4950
|
+
const parsed = this.parseNumber(raw);
|
|
4951
|
+
// Empty field: allowed when optional, flagged with alertText when required
|
|
4952
|
+
if (raw === '') {
|
|
4953
|
+
const changed = this.value() !== null;
|
|
4954
|
+
this.value.set(null);
|
|
4955
|
+
this.displayValue.set('');
|
|
4956
|
+
this.requiredError.set(this.required());
|
|
4957
|
+
this.regexError.set(false);
|
|
4958
|
+
if (changed) {
|
|
4959
|
+
this.onChangeFn(null);
|
|
4960
|
+
this.emitValue.emit(null);
|
|
4961
|
+
}
|
|
4962
|
+
this.onTouchedFn();
|
|
4963
|
+
return;
|
|
4964
|
+
}
|
|
4965
|
+
// Normalize and clamp the value, reformatting the displayed string
|
|
4966
|
+
const next = this.clamp(parsed ?? this.value() ?? this.effectiveMinimum);
|
|
4967
|
+
const changed = next !== this.value();
|
|
4968
|
+
const formatted = this.formatNumber(next);
|
|
4969
|
+
this.value.set(next);
|
|
4970
|
+
this.displayValue.set(formatted);
|
|
4971
|
+
this.requiredError.set(false);
|
|
4972
|
+
// Flag a regex mismatch against the final displayed value (shows alertText)
|
|
4973
|
+
this.regexError.set(!this.matchesRegex(formatted));
|
|
4974
|
+
if (changed) {
|
|
4975
|
+
this.onChangeFn(next);
|
|
4976
|
+
this.emitValue.emit(next);
|
|
4977
|
+
}
|
|
4876
4978
|
this.onTouchedFn();
|
|
4877
4979
|
}
|
|
4980
|
+
// Set value + display + notify (used by buttons and blur)
|
|
4981
|
+
commit(value) {
|
|
4982
|
+
const formatted = this.formatNumber(value);
|
|
4983
|
+
this.value.set(value);
|
|
4984
|
+
this.displayValue.set(formatted);
|
|
4985
|
+
this.requiredError.set(false);
|
|
4986
|
+
this.regexError.set(!this.matchesRegex(formatted));
|
|
4987
|
+
this.onChangeFn(value);
|
|
4988
|
+
this.emitValue.emit(value);
|
|
4989
|
+
}
|
|
4990
|
+
// True when no extra regex is configured or the value matches it
|
|
4991
|
+
matchesRegex(value) {
|
|
4992
|
+
const pattern = this.regex();
|
|
4993
|
+
if (!pattern)
|
|
4994
|
+
return true;
|
|
4995
|
+
return new RegExp(pattern).test(value);
|
|
4996
|
+
}
|
|
4997
|
+
clamp(value) {
|
|
4998
|
+
let clamped = Math.max(this.effectiveMinimum, value);
|
|
4999
|
+
if (this.maxValue !== Infinity) {
|
|
5000
|
+
clamped = Math.min(this.maxValue, clamped);
|
|
5001
|
+
}
|
|
5002
|
+
return clamped;
|
|
5003
|
+
}
|
|
5004
|
+
round(value) {
|
|
5005
|
+
const factor = Math.pow(10, this.decimals);
|
|
5006
|
+
return Math.round(value * factor) / factor;
|
|
5007
|
+
}
|
|
5008
|
+
testRegex(value) {
|
|
5009
|
+
return new RegExp(this.regexPattern()).test(value);
|
|
5010
|
+
}
|
|
5011
|
+
// Convert typed string to number (comma/dot aware)
|
|
5012
|
+
parseNumber(value) {
|
|
5013
|
+
if (!value)
|
|
5014
|
+
return null;
|
|
5015
|
+
if (value.endsWith('.') || value.endsWith(',')) {
|
|
5016
|
+
return null;
|
|
5017
|
+
}
|
|
5018
|
+
const normalized = value.replace(',', '.');
|
|
5019
|
+
const parsed = parseFloat(normalized);
|
|
5020
|
+
return isNaN(parsed) ? null : parsed;
|
|
5021
|
+
}
|
|
5022
|
+
// Convert number to display string using the configured separator
|
|
5023
|
+
formatNumber(value) {
|
|
5024
|
+
const str = value.toString();
|
|
5025
|
+
return this.decimalSeparator() === 'comma' ? str.replace('.', ',') : str;
|
|
5026
|
+
}
|
|
4878
5027
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputCounterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4879
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
5028
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: InputCounterComponent, isStandalone: true, selector: "lib-input-counter", inputs: { initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, alertText: { classPropertyName: "alertText", publicName: "alertText", isSignal: true, isRequired: false, transformFunction: null }, successText: { classPropertyName: "successText", publicName: "successText", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, success: { classPropertyName: "success", publicName: "success", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, optionalLabel: { classPropertyName: "optionalLabel", publicName: "optionalLabel", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, minimum: { classPropertyName: "minimum", publicName: "minimum", isSignal: true, isRequired: false, transformFunction: null }, maximum: { classPropertyName: "maximum", publicName: "maximum", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, allowDelete: { classPropertyName: "allowDelete", publicName: "allowDelete", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, allowDecimals: { classPropertyName: "allowDecimals", publicName: "allowDecimals", isSignal: true, isRequired: false, transformFunction: null }, allowNegative: { classPropertyName: "allowNegative", publicName: "allowNegative", isSignal: true, isRequired: false, transformFunction: null }, decimalSeparator: { classPropertyName: "decimalSeparator", publicName: "decimalSeparator", isSignal: true, isRequired: false, transformFunction: null }, maxDecimals: { classPropertyName: "maxDecimals", publicName: "maxDecimals", isSignal: true, isRequired: false, transformFunction: null }, regex: { classPropertyName: "regex", publicName: "regex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { emitValue: "emitValue" }, providers: [
|
|
4880
5029
|
{
|
|
4881
5030
|
provide: NG_VALUE_ACCESSOR,
|
|
4882
5031
|
useExisting: forwardRef(() => InputCounterComponent),
|
|
4883
5032
|
multi: true,
|
|
4884
5033
|
},
|
|
4885
|
-
], ngImport: i0, template: "<div class=\"c-text-input\" [class.c-text-input--full-width]=\"fullWidth\">\n <lib-input-label\n
|
|
5034
|
+
], ngImport: i0, template: "<div class=\"c-text-input\" [class.c-text-input--full-width]=\"fullWidth()\">\n @if (label()) {\n <lib-input-label\n size=\"sm\"\n [required]=\"required()\"\n [text]=\"label()\"\n [textOptional]=\"optionalLabel()\"\n [isLoading]=\"isLoading()\"\n ></lib-input-label>\n }\n\n <div\n class=\"c-text-input__wrapper\"\n [class.c-text-input__wrapper--right]=\"variant() === 'right'\"\n >\n <input\n type=\"text\"\n [name]=\"name()\"\n [value]=\"isLoading() ? '' : displayValue()\"\n [placeholder]=\"isLoading() ? '' : placeholder()\"\n [disabled]=\"isDisabled() || isLoading()\"\n [readonly]=\"readonly()\"\n [class]=\"inputClass.join(' ')\"\n [attr.inputmode]=\"effectiveInputmode()\"\n [attr.autocomplete]=\"autocomplete()\"\n [attr.aria-invalid]=\"hasError() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy\"\n [required]=\"required()\"\n aria-label=\"number\"\n (input)=\"onType($event)\"\n (blur)=\"onBlur()\"\n />\n <lib-button-icon\n ariaLabel=\"menos\"\n [disabled]=\"isDisabled() || readonly() || isAtMinimum() || isLoading()\"\n [loading]=\"false\"\n variant=\"neutral\"\n size=\"sm\"\n class=\"c-text-input__less\"\n [iconName]=\"decrementIconName()\"\n (click)=\"downNumber()\"\n >\n </lib-button-icon>\n <lib-button-icon\n ariaLabel=\"m\u00E1s\"\n [disabled]=\"isDisabled() || readonly() || isAtMaximum() || isLoading()\"\n [loading]=\"false\"\n variant=\"neutral\"\n size=\"sm\"\n class=\"c-text-input__up\"\n iconName=\"plus-regular\"\n (click)=\"upNumber()\"\n >\n </lib-button-icon>\n </div>\n\n @if (helperText() && !hasError() && !success()) {\n <span id=\"search-input-helper\" class=\"c-text-input__helper\">\n <lib-helper-text\n [text]=\"helperText()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n } @if (hasError() && errorMessage()) {\n <span class=\"c-text-input__alert\">\n <lib-helper-text\n variant=\"danger\"\n [text]=\"errorMessage()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n } @if (successText() && success()) {\n <span class=\"c-text-input__success\">\n <lib-helper-text\n variant=\"success\"\n [text]=\"successText()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n }\n</div>\n", styles: [".c-text-input{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:var(--space-component-gap-sm);max-width:300px}.c-text-input--full-width{max-width:100%}.c-text-input__input{--input-padding-y: var(--space-component-padding-md);--input-padding-x: 2rem;width:100%;height:48px;box-sizing:border-box;border-radius:var(--size-textfield-border-radius);border:var(--size-textfield-border-width) solid var(--color-textfield-border-default);background:var(--color-textfield-background-default);padding:var(--input-padding-y) var(--input-padding-x);align-items:center;gap:var(--space-component-gap-sm);align-self:stretch;color:var(--color-textfield-content-default);font-family:var(--typography-label-md-default-family);font-size:var(--typography-label-md-default-size);font-style:normal;font-weight:var(--typography-label-md-default-weight);line-height:var(--typography-label-md-default-line-height);letter-spacing:var(--typography-label-md-default-letter-spacing);text-align:center}.c-text-input__input:focus-visible{border-width:2px;border-color:var(--color-textfield-border-active);padding:calc(var(--input-padding-y) - 1px) calc(var(--input-padding-x) - 1px);box-shadow:none;outline:none}.c-text-input__input--sm{height:32px;--input-padding-y: var(--space-component-padding-xs);--input-padding-x: 2rem}.c-text-input__input--md{height:40px;--input-padding-y: var(--space-component-padding-xs);--input-padding-x: 2rem}.c-text-input__input.is-error{border-color:var(--color-textfield-border-error)}.c-text-input__input.is-success{border-color:var(--color-feedback-success-strong)}.c-text-input__input.is-disabled{background-color:var(--color-textfield-background-disabled);border-color:var(--color-textfield-border-disabled);color:var(--color-textfield-content-disabled)}.c-text-input__input.is-readonly{background-color:var(--color-textfield-background-disabled);border-color:var(--color-textfield-border-disabled)}.c-text-input__input.is-loading{border-color:var(--color-effect-skeleton-soft, #e5eaea);background-color:var(--color-textfield-background-default);color:transparent}.c-text-input__alert{display:flex;gap:var(--space-component-gap-sm);color:var(--color-feedback-danger-default);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__success{display:flex;gap:var(--space-component-gap-sm);color:var(--color-feedback-success-default);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__helper{color:var(--color-core-content-soft);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__helper.is-error{color:var(--color-textfield-helper-error)}.c-text-input__helper.is-success{color:var(--color-textfield-helper-success)}.c-text-input__helper.is-default{color:var(--color-textfield-helper-default)}.c-text-input__up{position:absolute;top:50%;right:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}.c-text-input__less{position:absolute;top:50%;left:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}.c-text-input__wrapper{display:flex;position:relative;width:100%}.c-text-input__wrapper--right .c-text-input__input{text-align:left}.c-text-input__wrapper--right .c-text-input__less{position:absolute;top:50%;right:calc(2rem + var(--space-component-padding-sm));transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;left:initial}.c-text-input__wrapper--right .c-text-input__up{position:absolute;top:50%;right:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: InputLabelComponent, selector: "lib-input-label", inputs: ["text", "required", "size", "disabled", "for", "innerHTML", "isLoading", "textOptional"] }, { kind: "component", type: ButtonIconComponent, selector: "lib-button-icon", inputs: ["ariaLabel", "variant", "size", "iconName", "disabled", "loading", "rounded", "skeletonActive"], outputs: ["clicked"] }, { kind: "component", type: HelperTextComponent, selector: "lib-helper-text", inputs: ["variant", "text", "extraClass", "disabled", "isLoading"] }] });
|
|
4886
5035
|
}
|
|
4887
5036
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputCounterComponent, decorators: [{
|
|
4888
5037
|
type: Component,
|
|
4889
|
-
args: [{ selector: 'lib-input-counter',
|
|
5038
|
+
args: [{ selector: 'lib-input-counter', imports: [
|
|
4890
5039
|
CommonModule,
|
|
4891
5040
|
ReactiveFormsModule,
|
|
4892
5041
|
InputLabelComponent,
|
|
@@ -4898,48 +5047,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
4898
5047
|
useExisting: forwardRef(() => InputCounterComponent),
|
|
4899
5048
|
multi: true,
|
|
4900
5049
|
},
|
|
4901
|
-
], template: "<div class=\"c-text-input\" [class.c-text-input--full-width]=\"fullWidth\">\n <lib-input-label\n
|
|
4902
|
-
}], ctorParameters: () => []
|
|
4903
|
-
type: Input
|
|
4904
|
-
}], placeholder: [{
|
|
4905
|
-
type: Input
|
|
4906
|
-
}], helperText: [{
|
|
4907
|
-
type: Input
|
|
4908
|
-
}], alertText: [{
|
|
4909
|
-
type: Input
|
|
4910
|
-
}], successText: [{
|
|
4911
|
-
type: Input
|
|
4912
|
-
}], error: [{
|
|
4913
|
-
type: Input
|
|
4914
|
-
}], success: [{
|
|
4915
|
-
type: Input
|
|
4916
|
-
}], disabled: [{
|
|
4917
|
-
type: Input
|
|
4918
|
-
}], required: [{
|
|
4919
|
-
type: Input
|
|
4920
|
-
}], optionalLabel: [{
|
|
4921
|
-
type: Input
|
|
4922
|
-
}], readonly: [{
|
|
4923
|
-
type: Input
|
|
4924
|
-
}], isLoading: [{
|
|
4925
|
-
type: Input
|
|
4926
|
-
}], size: [{
|
|
4927
|
-
type: Input
|
|
4928
|
-
}], variant: [{
|
|
4929
|
-
type: Input
|
|
4930
|
-
}], fullWidth: [{
|
|
4931
|
-
type: Input
|
|
4932
|
-
}], minimum: [{
|
|
4933
|
-
type: Input
|
|
4934
|
-
}], maximum: [{
|
|
4935
|
-
type: Input
|
|
4936
|
-
}], step: [{
|
|
4937
|
-
type: Input
|
|
4938
|
-
}], allowDelete: [{
|
|
4939
|
-
type: Input
|
|
4940
|
-
}], emitValue: [{
|
|
4941
|
-
type: Output
|
|
4942
|
-
}] } });
|
|
5050
|
+
], template: "<div class=\"c-text-input\" [class.c-text-input--full-width]=\"fullWidth()\">\n @if (label()) {\n <lib-input-label\n size=\"sm\"\n [required]=\"required()\"\n [text]=\"label()\"\n [textOptional]=\"optionalLabel()\"\n [isLoading]=\"isLoading()\"\n ></lib-input-label>\n }\n\n <div\n class=\"c-text-input__wrapper\"\n [class.c-text-input__wrapper--right]=\"variant() === 'right'\"\n >\n <input\n type=\"text\"\n [name]=\"name()\"\n [value]=\"isLoading() ? '' : displayValue()\"\n [placeholder]=\"isLoading() ? '' : placeholder()\"\n [disabled]=\"isDisabled() || isLoading()\"\n [readonly]=\"readonly()\"\n [class]=\"inputClass.join(' ')\"\n [attr.inputmode]=\"effectiveInputmode()\"\n [attr.autocomplete]=\"autocomplete()\"\n [attr.aria-invalid]=\"hasError() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy\"\n [required]=\"required()\"\n aria-label=\"number\"\n (input)=\"onType($event)\"\n (blur)=\"onBlur()\"\n />\n <lib-button-icon\n ariaLabel=\"menos\"\n [disabled]=\"isDisabled() || readonly() || isAtMinimum() || isLoading()\"\n [loading]=\"false\"\n variant=\"neutral\"\n size=\"sm\"\n class=\"c-text-input__less\"\n [iconName]=\"decrementIconName()\"\n (click)=\"downNumber()\"\n >\n </lib-button-icon>\n <lib-button-icon\n ariaLabel=\"m\u00E1s\"\n [disabled]=\"isDisabled() || readonly() || isAtMaximum() || isLoading()\"\n [loading]=\"false\"\n variant=\"neutral\"\n size=\"sm\"\n class=\"c-text-input__up\"\n iconName=\"plus-regular\"\n (click)=\"upNumber()\"\n >\n </lib-button-icon>\n </div>\n\n @if (helperText() && !hasError() && !success()) {\n <span id=\"search-input-helper\" class=\"c-text-input__helper\">\n <lib-helper-text\n [text]=\"helperText()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n } @if (hasError() && errorMessage()) {\n <span class=\"c-text-input__alert\">\n <lib-helper-text\n variant=\"danger\"\n [text]=\"errorMessage()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n } @if (successText() && success()) {\n <span class=\"c-text-input__success\">\n <lib-helper-text\n variant=\"success\"\n [text]=\"successText()\"\n [isLoading]=\"isLoading()\"\n ></lib-helper-text>\n </span>\n }\n</div>\n", styles: [".c-text-input{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:var(--space-component-gap-sm);max-width:300px}.c-text-input--full-width{max-width:100%}.c-text-input__input{--input-padding-y: var(--space-component-padding-md);--input-padding-x: 2rem;width:100%;height:48px;box-sizing:border-box;border-radius:var(--size-textfield-border-radius);border:var(--size-textfield-border-width) solid var(--color-textfield-border-default);background:var(--color-textfield-background-default);padding:var(--input-padding-y) var(--input-padding-x);align-items:center;gap:var(--space-component-gap-sm);align-self:stretch;color:var(--color-textfield-content-default);font-family:var(--typography-label-md-default-family);font-size:var(--typography-label-md-default-size);font-style:normal;font-weight:var(--typography-label-md-default-weight);line-height:var(--typography-label-md-default-line-height);letter-spacing:var(--typography-label-md-default-letter-spacing);text-align:center}.c-text-input__input:focus-visible{border-width:2px;border-color:var(--color-textfield-border-active);padding:calc(var(--input-padding-y) - 1px) calc(var(--input-padding-x) - 1px);box-shadow:none;outline:none}.c-text-input__input--sm{height:32px;--input-padding-y: var(--space-component-padding-xs);--input-padding-x: 2rem}.c-text-input__input--md{height:40px;--input-padding-y: var(--space-component-padding-xs);--input-padding-x: 2rem}.c-text-input__input.is-error{border-color:var(--color-textfield-border-error)}.c-text-input__input.is-success{border-color:var(--color-feedback-success-strong)}.c-text-input__input.is-disabled{background-color:var(--color-textfield-background-disabled);border-color:var(--color-textfield-border-disabled);color:var(--color-textfield-content-disabled)}.c-text-input__input.is-readonly{background-color:var(--color-textfield-background-disabled);border-color:var(--color-textfield-border-disabled)}.c-text-input__input.is-loading{border-color:var(--color-effect-skeleton-soft, #e5eaea);background-color:var(--color-textfield-background-default);color:transparent}.c-text-input__alert{display:flex;gap:var(--space-component-gap-sm);color:var(--color-feedback-danger-default);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__success{display:flex;gap:var(--space-component-gap-sm);color:var(--color-feedback-success-default);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__helper{color:var(--color-core-content-soft);font-family:var(--typography-label-sm-default-family);font-size:var(--typography-label-sm-default-size);font-style:normal;font-weight:var(--typography-label-sm-default-weight);line-height:var(--typography-label-sm-default-line-height);letter-spacing:var(--typography-label-sm-default-letter-spacing)}.c-text-input__helper.is-error{color:var(--color-textfield-helper-error)}.c-text-input__helper.is-success{color:var(--color-textfield-helper-success)}.c-text-input__helper.is-default{color:var(--color-textfield-helper-default)}.c-text-input__up{position:absolute;top:50%;right:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}.c-text-input__less{position:absolute;top:50%;left:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}.c-text-input__wrapper{display:flex;position:relative;width:100%}.c-text-input__wrapper--right .c-text-input__input{text-align:left}.c-text-input__wrapper--right .c-text-input__less{position:absolute;top:50%;right:calc(2rem + var(--space-component-padding-sm));transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;left:initial}.c-text-input__wrapper--right .c-text-input__up{position:absolute;top:50%;right:var(--space-component-padding-sm);transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}\n"] }]
|
|
5051
|
+
}], ctorParameters: () => [] });
|
|
4943
5052
|
|
|
4944
5053
|
class TextInputComponent {
|
|
4945
5054
|
label = '';
|