@crowdfarming/oliva-ds 1.95.0 → 1.96.0-rc.1
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,117 @@ 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
|
-
|
|
4778
|
-
|
|
4779
|
-
readonly = false;
|
|
4780
|
-
isLoading = false;
|
|
4781
|
-
size = 'md';
|
|
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
|
+
requiredText = input('Field Required');
|
|
4775
|
+
successText = input('');
|
|
4776
|
+
error = input(false);
|
|
4777
|
+
success = input(false);
|
|
4778
|
+
required = input(false);
|
|
4779
|
+
readonly = input(false);
|
|
4780
|
+
isLoading = input(false);
|
|
4781
|
+
size = input('md');
|
|
4782
|
+
fullWidth = input(false);
|
|
4783
|
+
// Counter-specific inputs
|
|
4784
|
+
disabled = input(false);
|
|
4785
|
+
optionalLabel = input('');
|
|
4786
|
+
variant = input('default');
|
|
4787
|
+
minimum = input(1);
|
|
4788
|
+
maximum = input(undefined);
|
|
4789
|
+
step = input(1);
|
|
4790
|
+
allowDelete = input(false);
|
|
4791
|
+
// Number-formatting inputs (aligned with input-number).
|
|
4792
|
+
name = input('');
|
|
4793
|
+
autocomplete = input('off');
|
|
4794
|
+
allowDecimals = input(false);
|
|
4795
|
+
allowNegative = input(false);
|
|
4796
|
+
decimalSeparator = input('comma');
|
|
4797
|
+
maxDecimals = input(undefined);
|
|
4798
|
+
// Optional extra validation: typed value must match this pattern, else error
|
|
4799
|
+
regex = input(null);
|
|
4800
|
+
emitValue = output();
|
|
4801
|
+
// Disabled state set via ControlValueAccessor, combined with the `disabled` input
|
|
4802
|
+
formDisabled = signal(false);
|
|
4803
|
+
isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
4804
|
+
// Canonical numeric value (used for clamping / min-max / buttons); null = empty
|
|
4805
|
+
value = signal(this.minimum());
|
|
4806
|
+
// Formatted string shown in the text input
|
|
4807
|
+
displayValue = signal('');
|
|
4808
|
+
// Internal error raised when a required field is left empty on blur
|
|
4809
|
+
requiredError = signal(false);
|
|
4810
|
+
// Internal error raised when the typed value does not match `regex`
|
|
4811
|
+
regexError = signal(false);
|
|
4812
|
+
// Combined error state: external `error` input OR an internal validation
|
|
4813
|
+
hasError = computed(() => this.error() || this.requiredError() || this.regexError());
|
|
4814
|
+
// Message shown under the input: required-empty wins, otherwise `alertText`
|
|
4815
|
+
errorMessage = computed(() => this.requiredError() ? this.requiredText() : this.alertText());
|
|
4816
|
+
effectiveInputmode = computed(() => this.allowDecimals() ? 'decimal' : 'numeric');
|
|
4817
|
+
regexPattern = computed(() => {
|
|
4818
|
+
const negative = this.allowNegative() ? '-?' : '';
|
|
4819
|
+
const integer = '[0-9]*';
|
|
4820
|
+
if (!this.allowDecimals())
|
|
4821
|
+
return `^${negative}${integer}$`;
|
|
4822
|
+
const separator = this.decimalSeparator() === 'comma' ? ',' : '\\.';
|
|
4823
|
+
const decimal = this.maxDecimals() !== undefined
|
|
4824
|
+
? `[0-9]{0,${this.maxDecimals()}}`
|
|
4825
|
+
: '[0-9]*';
|
|
4826
|
+
return `^${negative}${integer}${separator}?${decimal}$`;
|
|
4827
|
+
});
|
|
4790
4828
|
get maxValue() {
|
|
4791
|
-
return this.maximum ?? Infinity;
|
|
4829
|
+
return this.maximum() ?? Infinity;
|
|
4792
4830
|
}
|
|
4793
4831
|
get effectiveMinimum() {
|
|
4794
|
-
return this.allowDelete ? 0 : this.minimum;
|
|
4795
|
-
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4832
|
+
return this.allowDelete() ? 0 : this.minimum();
|
|
4833
|
+
}
|
|
4834
|
+
// Decimal places used to round button increments (avoids floating-point drift)
|
|
4835
|
+
get decimals() {
|
|
4836
|
+
const max = this.maxDecimals();
|
|
4837
|
+
if (max !== undefined)
|
|
4838
|
+
return max;
|
|
4839
|
+
const stepStr = this.step().toString();
|
|
4840
|
+
const dot = stepStr.indexOf('.');
|
|
4841
|
+
return dot === -1 ? 0 : stepStr.length - dot - 1;
|
|
4842
|
+
}
|
|
4843
|
+
isAtMinimum = computed(() => {
|
|
4844
|
+
const current = this.value();
|
|
4845
|
+
return current !== null && current <= this.effectiveMinimum;
|
|
4846
|
+
});
|
|
4847
|
+
decrementIconName = computed(() => this.allowDelete() && this.value() === this.minimum()
|
|
4798
4848
|
? 'trash-regular'
|
|
4799
4849
|
: 'minus-regular');
|
|
4800
|
-
isAtMaximum = computed(() =>
|
|
4850
|
+
isAtMaximum = computed(() => {
|
|
4851
|
+
const current = this.value();
|
|
4852
|
+
return (this.maxValue !== Infinity && current !== null && current >= this.maxValue);
|
|
4853
|
+
});
|
|
4801
4854
|
constructor() {
|
|
4802
|
-
this.
|
|
4855
|
+
const initial = this.minimum();
|
|
4856
|
+
this.value.set(initial);
|
|
4857
|
+
this.displayValue.set(this.formatNumber(initial));
|
|
4803
4858
|
effect(() => {
|
|
4804
|
-
const
|
|
4805
|
-
if (
|
|
4806
|
-
let clampedValue = Math.max(this.minimum,
|
|
4859
|
+
const initialValue = this.initialValue();
|
|
4860
|
+
if (initialValue !== undefined) {
|
|
4861
|
+
let clampedValue = Math.max(this.minimum(), initialValue);
|
|
4807
4862
|
if (this.maxValue !== Infinity) {
|
|
4808
4863
|
clampedValue = Math.min(this.maxValue, clampedValue);
|
|
4809
4864
|
}
|
|
4810
4865
|
this.value.set(clampedValue);
|
|
4866
|
+
this.displayValue.set(this.formatNumber(clampedValue));
|
|
4811
4867
|
}
|
|
4812
4868
|
});
|
|
4813
4869
|
}
|
|
4814
4870
|
onChangeFn = () => { };
|
|
4815
4871
|
onTouchedFn = () => { };
|
|
4816
4872
|
writeValue(value) {
|
|
4817
|
-
|
|
4873
|
+
if (value === null || value === undefined) {
|
|
4874
|
+
this.value.set(null);
|
|
4875
|
+
this.displayValue.set('');
|
|
4876
|
+
return;
|
|
4877
|
+
}
|
|
4878
|
+
this.value.set(value);
|
|
4879
|
+
this.displayValue.set(this.formatNumber(value));
|
|
4818
4880
|
}
|
|
4819
4881
|
registerOnChange(fn) {
|
|
4820
4882
|
this.onChangeFn = fn;
|
|
@@ -4823,70 +4885,158 @@ class InputCounterComponent {
|
|
|
4823
4885
|
this.onTouchedFn = fn;
|
|
4824
4886
|
}
|
|
4825
4887
|
setDisabledState(isDisabled) {
|
|
4826
|
-
this.
|
|
4888
|
+
this.formDisabled.set(isDisabled);
|
|
4827
4889
|
}
|
|
4828
4890
|
get inputClass() {
|
|
4829
4891
|
return [
|
|
4830
4892
|
'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' : '',
|
|
4893
|
+
`c-text-input__input--${this.size()}`,
|
|
4894
|
+
this.hasError() ? 'is-error' : '',
|
|
4895
|
+
this.success() ? 'is-success' : '',
|
|
4896
|
+
this.isDisabled() ? 'is-disabled' : '',
|
|
4897
|
+
this.readonly() ? 'is-readonly' : '',
|
|
4898
|
+
this.isLoading() ? 'is-loading' : '',
|
|
4837
4899
|
].filter(Boolean);
|
|
4838
4900
|
}
|
|
4839
4901
|
get ariaDescribedBy() {
|
|
4840
|
-
return this.helperText ? 'search-input-helper' : null;
|
|
4902
|
+
return this.helperText() ? 'search-input-helper' : null;
|
|
4841
4903
|
}
|
|
4842
4904
|
onType(event) {
|
|
4843
|
-
const
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4905
|
+
const inputEl = event.target;
|
|
4906
|
+
const raw = inputEl.value;
|
|
4907
|
+
// Sanitize against the full-pattern regex; revert to the last valid text if invalid
|
|
4908
|
+
const sanitized = this.testRegex(raw) ? raw : this.displayValue();
|
|
4909
|
+
if (sanitized !== raw) {
|
|
4910
|
+
inputEl.value = sanitized;
|
|
4911
|
+
}
|
|
4912
|
+
this.displayValue.set(sanitized);
|
|
4913
|
+
// Emptying the field clears any error and notifies a null value
|
|
4914
|
+
if (sanitized === '') {
|
|
4915
|
+
this.value.set(null);
|
|
4916
|
+
this.requiredError.set(false);
|
|
4917
|
+
this.regexError.set(false);
|
|
4918
|
+
this.onChangeFn(null);
|
|
4919
|
+
this.emitValue.emit(null);
|
|
4920
|
+
return;
|
|
4847
4921
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4922
|
+
// Clear stale validation errors while the user is editing; revalidate on blur
|
|
4923
|
+
this.requiredError.set(false);
|
|
4924
|
+
this.regexError.set(false);
|
|
4925
|
+
// Emit the parsed number; incomplete input (trailing separator) waits for blur
|
|
4926
|
+
const parsed = this.parseNumber(sanitized);
|
|
4927
|
+
if (parsed !== null) {
|
|
4928
|
+
this.value.set(parsed);
|
|
4929
|
+
this.onChangeFn(parsed);
|
|
4930
|
+
this.emitValue.emit(parsed);
|
|
4850
4931
|
}
|
|
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
4932
|
}
|
|
4857
4933
|
upNumber() {
|
|
4858
|
-
|
|
4859
|
-
const
|
|
4934
|
+
// From empty, the first increment lands on the effective minimum
|
|
4935
|
+
const base = this.value() ?? this.effectiveMinimum - this.step();
|
|
4936
|
+
const newValue = this.round(base + this.step());
|
|
4860
4937
|
if (this.maxValue === Infinity || newValue <= this.maxValue) {
|
|
4861
|
-
this.
|
|
4862
|
-
this.onChangeFn(newValue);
|
|
4863
|
-
this.emitValue.emit(newValue);
|
|
4938
|
+
this.commit(newValue);
|
|
4864
4939
|
}
|
|
4865
4940
|
}
|
|
4866
4941
|
downNumber() {
|
|
4867
|
-
|
|
4868
|
-
const
|
|
4942
|
+
// From empty, the first decrement lands on the effective minimum
|
|
4943
|
+
const base = this.value() ?? this.effectiveMinimum + this.step();
|
|
4944
|
+
const newValue = this.round(base - this.step());
|
|
4869
4945
|
if (newValue >= this.effectiveMinimum) {
|
|
4870
|
-
this.
|
|
4871
|
-
this.onChangeFn(newValue);
|
|
4872
|
-
this.emitValue.emit(newValue);
|
|
4946
|
+
this.commit(newValue);
|
|
4873
4947
|
}
|
|
4874
4948
|
}
|
|
4875
4949
|
onBlur() {
|
|
4950
|
+
const raw = this.displayValue().trim();
|
|
4951
|
+
const parsed = this.parseNumber(raw);
|
|
4952
|
+
// Empty field: allowed when optional, flagged with requiredText when required
|
|
4953
|
+
if (raw === '') {
|
|
4954
|
+
const changed = this.value() !== null;
|
|
4955
|
+
this.value.set(null);
|
|
4956
|
+
this.displayValue.set('');
|
|
4957
|
+
this.requiredError.set(this.required());
|
|
4958
|
+
this.regexError.set(false);
|
|
4959
|
+
if (changed) {
|
|
4960
|
+
this.onChangeFn(null);
|
|
4961
|
+
this.emitValue.emit(null);
|
|
4962
|
+
}
|
|
4963
|
+
this.onTouchedFn();
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
// Normalize and clamp the value, reformatting the displayed string
|
|
4967
|
+
const next = this.clamp(parsed ?? this.value() ?? this.effectiveMinimum);
|
|
4968
|
+
const changed = next !== this.value();
|
|
4969
|
+
const formatted = this.formatNumber(next);
|
|
4970
|
+
this.value.set(next);
|
|
4971
|
+
this.displayValue.set(formatted);
|
|
4972
|
+
this.requiredError.set(false);
|
|
4973
|
+
// Flag a regex mismatch against the final displayed value (shows alertText)
|
|
4974
|
+
this.regexError.set(!this.matchesRegex(formatted));
|
|
4975
|
+
if (changed) {
|
|
4976
|
+
this.onChangeFn(next);
|
|
4977
|
+
this.emitValue.emit(next);
|
|
4978
|
+
}
|
|
4876
4979
|
this.onTouchedFn();
|
|
4877
4980
|
}
|
|
4981
|
+
// Set value + display + notify (used by buttons and blur)
|
|
4982
|
+
commit(value) {
|
|
4983
|
+
const formatted = this.formatNumber(value);
|
|
4984
|
+
this.value.set(value);
|
|
4985
|
+
this.displayValue.set(formatted);
|
|
4986
|
+
this.requiredError.set(false);
|
|
4987
|
+
this.regexError.set(!this.matchesRegex(formatted));
|
|
4988
|
+
this.onChangeFn(value);
|
|
4989
|
+
this.emitValue.emit(value);
|
|
4990
|
+
}
|
|
4991
|
+
// True when no extra regex is configured or the value matches it
|
|
4992
|
+
matchesRegex(value) {
|
|
4993
|
+
const pattern = this.regex();
|
|
4994
|
+
if (!pattern)
|
|
4995
|
+
return true;
|
|
4996
|
+
return new RegExp(pattern).test(value);
|
|
4997
|
+
}
|
|
4998
|
+
clamp(value) {
|
|
4999
|
+
let clamped = Math.max(this.effectiveMinimum, value);
|
|
5000
|
+
if (this.maxValue !== Infinity) {
|
|
5001
|
+
clamped = Math.min(this.maxValue, clamped);
|
|
5002
|
+
}
|
|
5003
|
+
return clamped;
|
|
5004
|
+
}
|
|
5005
|
+
round(value) {
|
|
5006
|
+
const factor = Math.pow(10, this.decimals);
|
|
5007
|
+
return Math.round(value * factor) / factor;
|
|
5008
|
+
}
|
|
5009
|
+
testRegex(value) {
|
|
5010
|
+
return new RegExp(this.regexPattern()).test(value);
|
|
5011
|
+
}
|
|
5012
|
+
// Convert typed string to number (comma/dot aware)
|
|
5013
|
+
parseNumber(value) {
|
|
5014
|
+
if (!value)
|
|
5015
|
+
return null;
|
|
5016
|
+
if (value.endsWith('.') || value.endsWith(',')) {
|
|
5017
|
+
return null;
|
|
5018
|
+
}
|
|
5019
|
+
const normalized = value.replace(',', '.');
|
|
5020
|
+
const parsed = parseFloat(normalized);
|
|
5021
|
+
return isNaN(parsed) ? null : parsed;
|
|
5022
|
+
}
|
|
5023
|
+
// Convert number to display string using the configured separator
|
|
5024
|
+
formatNumber(value) {
|
|
5025
|
+
const str = value.toString();
|
|
5026
|
+
return this.decimalSeparator() === 'comma' ? str.replace('.', ',') : str;
|
|
5027
|
+
}
|
|
4878
5028
|
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.
|
|
5029
|
+
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 }, requiredText: { classPropertyName: "requiredText", publicName: "requiredText", 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
5030
|
{
|
|
4881
5031
|
provide: NG_VALUE_ACCESSOR,
|
|
4882
5032
|
useExisting: forwardRef(() => InputCounterComponent),
|
|
4883
5033
|
multi: true,
|
|
4884
5034
|
},
|
|
4885
|
-
], ngImport: i0, template: "<div class=\"c-text-input\" [class.c-text-input--full-width]=\"fullWidth\">\n <lib-input-label\n
|
|
5035
|
+
], 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
5036
|
}
|
|
4887
5037
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputCounterComponent, decorators: [{
|
|
4888
5038
|
type: Component,
|
|
4889
|
-
args: [{ selector: 'lib-input-counter',
|
|
5039
|
+
args: [{ selector: 'lib-input-counter', imports: [
|
|
4890
5040
|
CommonModule,
|
|
4891
5041
|
ReactiveFormsModule,
|
|
4892
5042
|
InputLabelComponent,
|
|
@@ -4898,48 +5048,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
4898
5048
|
useExisting: forwardRef(() => InputCounterComponent),
|
|
4899
5049
|
multi: true,
|
|
4900
5050
|
},
|
|
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
|
-
}] } });
|
|
5051
|
+
], 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"] }]
|
|
5052
|
+
}], ctorParameters: () => [] });
|
|
4943
5053
|
|
|
4944
5054
|
class TextInputComponent {
|
|
4945
5055
|
label = '';
|