@4sh/ui-kit 0.15.0 → 0.16.0
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.
- package/README.fr.md +8 -0
- package/README.md +8 -0
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +69 -22
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +13 -4
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +12 -4
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +19 -8
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +30 -9
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +8 -3
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +10 -4
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms.mjs +46 -2
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/mcp/data/component-api.json +14 -0
- package/mcp/data/text-search-docs.json +29 -9
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/styles/utils/_mixins.scss +11 -0
- package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +16 -3
- package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +2 -0
- package/types/4sh-ui-kit-forms-ui-input-number.d.ts +4 -1
- package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +5 -1
- package/types/4sh-ui-kit-forms-ui-input.d.ts +2 -0
- package/types/4sh-ui-kit-forms-ui-textarea.d.ts +2 -0
- package/types/4sh-ui-kit-forms.d.ts +25 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, booleanAttribute, output, viewChild, signal, computed, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { BaseFormField, parseMaskRanges, buildMaskSlots, applyMaskTemplate, extractMaskData, caretForMask } from '@4sh/ui-kit/forms';
|
|
4
|
+
import { BaseFormField, parseMaskRanges, buildMaskSlots, applyMaskTemplate, extractMaskData, hasFocus, caretForMask, UiBrowserFill } from '@4sh/ui-kit/forms';
|
|
5
5
|
import { UiField } from '@4sh/ui-kit/forms/ui-field';
|
|
6
6
|
import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
|
|
7
7
|
|
|
@@ -95,9 +95,17 @@ class UiInputMask extends BaseFormField {
|
|
|
95
95
|
// Apply synchronously + restore the caret after the Nth typed character
|
|
96
96
|
// (auto-inserted literals skipped). The [value] binding becomes a no-op.
|
|
97
97
|
el.value = display;
|
|
98
|
+
// A fill without focus has no caret to restore.
|
|
99
|
+
if (!hasFocus(el))
|
|
100
|
+
return;
|
|
98
101
|
const pos = caretForMask(built.tokenIndices, dataBeforeCaret, display.length);
|
|
99
102
|
el.setSelectionRange(pos, pos);
|
|
100
103
|
}
|
|
104
|
+
/** @ignore Value written by the browser without an `input` event. */
|
|
105
|
+
onBrowserFill() {
|
|
106
|
+
if (this.inputEl().nativeElement.value !== this.text())
|
|
107
|
+
this.onInput();
|
|
108
|
+
}
|
|
101
109
|
/** @ignore */
|
|
102
110
|
onBlur(event) {
|
|
103
111
|
this.emitTouch();
|
|
@@ -110,13 +118,13 @@ class UiInputMask extends BaseFormField {
|
|
|
110
118
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputMask, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
111
119
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiInputMask, isStandalone: true, selector: "ui-input-mask", inputs: { mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: true, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, slotChar: { classPropertyName: "slotChar", publicName: "slotChar", isSignal: true, isRequired: false, transformFunction: null }, unmask: { classPropertyName: "unmask", publicName: "unmask", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, iconLeft: { classPropertyName: "iconLeft", publicName: "iconLeft", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", inputBlur: "inputBlur" }, providers: [
|
|
112
120
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputMask), multi: true },
|
|
113
|
-
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n", styles: [".ui-input-mask-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-mask-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-mask-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-mask-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-mask-native._small{font-size:var(--ui-input-mask-font-size-small, var(--size-typography-text-md))}.ui-input-mask-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-mask-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
|
|
121
|
+
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-mask-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-mask-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-mask-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-mask-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-mask-native._small{font-size:var(--ui-input-mask-font-size-small, var(--size-typography-text-md))}.ui-input-mask-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-mask-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
|
|
114
122
|
}
|
|
115
123
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputMask, decorators: [{
|
|
116
124
|
type: Component,
|
|
117
|
-
args: [{ selector: 'ui-input-mask', imports: [UiField, UiIcon], providers: [
|
|
125
|
+
args: [{ selector: 'ui-input-mask', imports: [UiField, UiIcon, UiBrowserFill], providers: [
|
|
118
126
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputMask), multi: true },
|
|
119
|
-
], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n", styles: [".ui-input-mask-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-mask-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-mask-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-mask-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-mask-native._small{font-size:var(--ui-input-mask-font-size-small, var(--size-typography-text-md))}.ui-input-mask-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-mask-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
127
|
+
], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-mask-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-mask-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-mask-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-mask-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-mask-native._small{font-size:var(--ui-input-mask-font-size-small, var(--size-typography-text-md))}.ui-input-mask-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-mask-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-mask-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
120
128
|
}], propDecorators: { mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: true }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], slotChar: [{ type: i0.Input, args: [{ isSignal: true, alias: "slotChar", required: false }] }], unmask: [{ type: i0.Input, args: [{ isSignal: true, alias: "unmask", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], iconLeft: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconLeft", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputEl: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }] } });
|
|
121
129
|
|
|
122
130
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4sh-ui-kit-forms-ui-input-mask.mjs","sources":["../../../projects/ui-kit/forms/ui-input-mask/src/lib/ui-input-mask.ts","../../../projects/ui-kit/forms/ui-input-mask/src/lib/ui-input-mask.html","../../../projects/ui-kit/forms/ui-input-mask/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-mask/src/4sh-ui-kit-forms-ui-input-mask.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n forwardRef,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon, UiIconSize } from '@4sh/ui-kit/base/ui-icon';\nimport {\n applyMaskTemplate,\n buildMaskSlots,\n caretForMask,\n extractMaskData,\n MaskBounds,\n MaskSlot,\n parseMaskRanges,\n} from '@4sh/ui-kit/forms';\n\n/**\n * ui-input-mask — headless masked field (`ui-field` shell).\n *\n * `mask` describes the template: `9` digit, `a` letter, `*` alphanumeric; any\n * other character is a literal inserted automatically (e.g. `99/99/9999`,\n * `(999) 999-9999`). Empty positions show `slotChar`.\n *\n * Model value = string: masked (`12/09/2024`) by default, or raw (`12092024`)\n * when `unmask`. Standalone, `[(ngModel)]` or reactive forms.\n */\n@Component({\n selector: 'ui-input-mask',\n imports: [UiField, UiIcon],\n templateUrl: './ui-input-mask.html',\n styleUrl: './ui-input-mask.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputMask), multi: true },\n ],\n})\nexport class UiInputMask extends BaseFormField<string> {\n /** Mask template (9 digit · a letter · * alphanumeric · other = literal). */\n mask = input.required<string>();\n /**\n * Inclusive bounds of each numeric segment (run of consecutive `9` tokens),\n * in mask order and space-separated: `\"0-23 0-59\"` for `99:99`,\n * `\"1-31 1-12 1900-2100\"` for `99/99/9999`. `*` leaves a segment unbounded.\n * A character that could not lead to an in-range segment is rejected.\n */\n ranges = input('');\n /** Fill character for empty positions. */\n slotChar = input('_');\n /** Emit the raw value (without literals) instead of the masked value. */\n unmask = input(false, { transform: booleanAttribute });\n /** Native placeholder (shown when the field is empty). */\n placeholder = input<string>();\n /** Left FontAwesome icon name (decorative). */\n iconLeft = input<string>();\n\n /** Emitted on each value change. */\n valueChange = output<string>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n /** @ignore Masked displayed text. */\n protected readonly text = signal('');\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.text() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n\n /** @ignore */\n protected readonly iconSize = computed<UiIconSize>(() => (this.size() === 'small' ? 'sm' : 'md'));\n\n /** @ignore Bounds declared by `ranges`, one entry per numeric segment (`null` = unbounded). */\n private readonly parsedRanges = computed<(MaskBounds | null)[]>(() =>\n parseMaskRanges(this.ranges()),\n );\n\n /**\n * @ignore The mask resolved once per template: literals, input slots, and the\n * `ranges` bounds attached to every slot of the numeric segment it belongs to.\n */\n private readonly slots = computed<MaskSlot[]>(() =>\n buildMaskSlots(this.mask(), this.parsedRanges()),\n );\n\n override writeValue(value: string | null): void {\n const built = applyMaskTemplate(this.slots(), extractMaskData(value ?? ''), this.slotChar());\n this.modelValue.set(this.emitValue(built));\n this.text.set(built.data.length ? built.display : '');\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** @ignore Input: apply the mask, update model + display + caret. */\n protected onInput(): void {\n const el = this.inputEl().nativeElement;\n const raw = el.value;\n const caret = el.selectionStart ?? raw.length;\n // Number of data characters located BEFORE the caret (stable anchor).\n const dataBeforeCaret = extractMaskData(raw.slice(0, caret)).length;\n\n const built = applyMaskTemplate(this.slots(), extractMaskData(raw), this.slotChar());\n const value = this.emitValue(built);\n const display = built.data.length ? built.display : '';\n\n this.text.set(display);\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n\n // Apply synchronously + restore the caret after the Nth typed character\n // (auto-inserted literals skipped). The [value] binding becomes a no-op.\n el.value = display;\n const pos = caretForMask(built.tokenIndices, dataBeforeCaret, display.length);\n el.setSelectionRange(pos, pos);\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n\n /** @ignore Emitted value depending on `unmask`. */\n private emitValue(built: { masked: string; data: string }): string {\n return this.unmask() ? built.data : built.masked;\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input-mask\n */\n\nexport * from './lib/ui-input-mask';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAyBA;;;;;;;;;AASG;AAUG,MAAO,WAAY,SAAQ,aAAqB,CAAA;AATtD,IAAA,WAAA,GAAA;;;QAWE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,QAAQ;iFAAU;AAC/B;;;;;AAKG;QACH,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,EAAE;mFAAC;;QAElB,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,GAAG;qFAAC;;QAErB,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,KAAK,8EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAEtD,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAU;;AAE7B,QAAA,IAA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CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAOd,WAAW,EAAA,UAAA,EAAA,CAAA;kBATvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,WAChB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA,SAAA,EAGf;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AACxF,qBAAA,EAAA,QAAA,EAAA,s2CAAA,EAAA,MAAA,EAAA,CAAA,sgDAAA,CAAA,EAAA;4uBA2B2E,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErEvF;;AAEG;;ACFH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"4sh-ui-kit-forms-ui-input-mask.mjs","sources":["../../../projects/ui-kit/forms/ui-input-mask/src/lib/ui-input-mask.ts","../../../projects/ui-kit/forms/ui-input-mask/src/lib/ui-input-mask.html","../../../projects/ui-kit/forms/ui-input-mask/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-mask/src/4sh-ui-kit-forms-ui-input-mask.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n forwardRef,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField, hasFocus, UiBrowserFill } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon, UiIconSize } from '@4sh/ui-kit/base/ui-icon';\nimport {\n applyMaskTemplate,\n buildMaskSlots,\n caretForMask,\n extractMaskData,\n MaskBounds,\n MaskSlot,\n parseMaskRanges,\n} from '@4sh/ui-kit/forms';\n\n/**\n * ui-input-mask — headless masked field (`ui-field` shell).\n *\n * `mask` describes the template: `9` digit, `a` letter, `*` alphanumeric; any\n * other character is a literal inserted automatically (e.g. `99/99/9999`,\n * `(999) 999-9999`). Empty positions show `slotChar`.\n *\n * Model value = string: masked (`12/09/2024`) by default, or raw (`12092024`)\n * when `unmask`. Standalone, `[(ngModel)]` or reactive forms.\n */\n@Component({\n selector: 'ui-input-mask',\n imports: [UiField, UiIcon, UiBrowserFill],\n templateUrl: './ui-input-mask.html',\n styleUrl: './ui-input-mask.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputMask), multi: true },\n ],\n})\nexport class UiInputMask extends BaseFormField<string> {\n /** Mask template (9 digit · a letter · * alphanumeric · other = literal). */\n mask = input.required<string>();\n /**\n * Inclusive bounds of each numeric segment (run of consecutive `9` tokens),\n * in mask order and space-separated: `\"0-23 0-59\"` for `99:99`,\n * `\"1-31 1-12 1900-2100\"` for `99/99/9999`. `*` leaves a segment unbounded.\n * A character that could not lead to an in-range segment is rejected.\n */\n ranges = input('');\n /** Fill character for empty positions. */\n slotChar = input('_');\n /** Emit the raw value (without literals) instead of the masked value. */\n unmask = input(false, { transform: booleanAttribute });\n /** Native placeholder (shown when the field is empty). */\n placeholder = input<string>();\n /** Left FontAwesome icon name (decorative). */\n iconLeft = input<string>();\n\n /** Emitted on each value change. */\n valueChange = output<string>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n /** @ignore Masked displayed text. */\n protected readonly text = signal('');\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.text() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n\n /** @ignore */\n protected readonly iconSize = computed<UiIconSize>(() => (this.size() === 'small' ? 'sm' : 'md'));\n\n /** @ignore Bounds declared by `ranges`, one entry per numeric segment (`null` = unbounded). */\n private readonly parsedRanges = computed<(MaskBounds | null)[]>(() =>\n parseMaskRanges(this.ranges()),\n );\n\n /**\n * @ignore The mask resolved once per template: literals, input slots, and the\n * `ranges` bounds attached to every slot of the numeric segment it belongs to.\n */\n private readonly slots = computed<MaskSlot[]>(() =>\n buildMaskSlots(this.mask(), this.parsedRanges()),\n );\n\n override writeValue(value: string | null): void {\n const built = applyMaskTemplate(this.slots(), extractMaskData(value ?? ''), this.slotChar());\n this.modelValue.set(this.emitValue(built));\n this.text.set(built.data.length ? built.display : '');\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** @ignore Input: apply the mask, update model + display + caret. */\n protected onInput(): void {\n const el = this.inputEl().nativeElement;\n const raw = el.value;\n const caret = el.selectionStart ?? raw.length;\n // Number of data characters located BEFORE the caret (stable anchor).\n const dataBeforeCaret = extractMaskData(raw.slice(0, caret)).length;\n\n const built = applyMaskTemplate(this.slots(), extractMaskData(raw), this.slotChar());\n const value = this.emitValue(built);\n const display = built.data.length ? built.display : '';\n\n this.text.set(display);\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n\n // Apply synchronously + restore the caret after the Nth typed character\n // (auto-inserted literals skipped). The [value] binding becomes a no-op.\n el.value = display;\n // A fill without focus has no caret to restore.\n if (!hasFocus(el)) return;\n const pos = caretForMask(built.tokenIndices, dataBeforeCaret, display.length);\n el.setSelectionRange(pos, pos);\n }\n\n /** @ignore Value written by the browser without an `input` event. */\n protected onBrowserFill(): void {\n if (this.inputEl().nativeElement.value !== this.text()) this.onInput();\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n\n /** @ignore Emitted value depending on `unmask`. */\n private emitValue(built: { masked: string; data: string }): string {\n return this.unmask() ? built.data : built.masked;\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-mask-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-mask-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (blur)=\"onBlur($event)\"\n />\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input-mask\n */\n\nexport * from './lib/ui-input-mask';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAyBA;;;;;;;;;AASG;AAUG,MAAO,WAAY,SAAQ,aAAqB,CAAA;AATtD,IAAA,WAAA,GAAA;;;QAWE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,QAAQ;iFAAU;AAC/B;;;;;AAKG;QACH,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,EAAE;mFAAC;;QAElB,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,GAAG;qFAAC;;QAErB,IAAA,CAAA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AA,MAAA,EAAA,OAAA,EAAA,YAAA,EAAA,QAAA,EAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,YAAA,EAAA,SAAA,EAAA,WAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,WAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,MAAM,2HAAE,aAAa,EAAA,QAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAO7B,WAAW,EAAA,UAAA,EAAA,CAAA;kBATvB,SAAS;+BACE,eAAe,EAAA,OAAA,EAChB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAA,SAAA,EAG9B;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AACxF,qBAAA,EAAA,QAAA,EAAA,g6CAAA,EAAA,MAAA,EAAA,CAAA,8mDAAA,CAAA,EAAA;4uBA2B2E,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErEvF;;AAEG;;ACFH;;AAEG;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, numberAttribute, booleanAttribute, output, viewChild, signal, computed, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { BaseFormField } from '@4sh/ui-kit/forms';
|
|
4
|
+
import { BaseFormField, hasFocus, UiBrowserFill } from '@4sh/ui-kit/forms';
|
|
5
5
|
import { UiField } from '@4sh/ui-kit/forms/ui-field';
|
|
6
6
|
import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
|
|
7
7
|
|
|
@@ -124,11 +124,22 @@ class UiInputNumber extends BaseFormField {
|
|
|
124
124
|
this.text.set(this.editable(v));
|
|
125
125
|
this.inputFocus.emit(event);
|
|
126
126
|
}
|
|
127
|
-
/** @ignore Input: parse without reformatting the text (caret preserved).
|
|
127
|
+
/** @ignore Input: parse without reformatting the text (caret preserved). A value written by
|
|
128
|
+
* the browser without focus is reformatted at once: no blur will follow to do it. */
|
|
128
129
|
onInput() {
|
|
129
|
-
const
|
|
130
|
+
const el = this.inputEl().nativeElement;
|
|
131
|
+
const raw = el.value;
|
|
132
|
+
const filled = !hasFocus(el);
|
|
130
133
|
this.text.set(raw);
|
|
131
|
-
this.commit(this.parse(raw), { reformat:
|
|
134
|
+
this.commit(this.parse(raw), { reformat: filled });
|
|
135
|
+
// The binding skips a reformatted text equal to the one rendered before the fill.
|
|
136
|
+
if (filled)
|
|
137
|
+
el.value = this.text();
|
|
138
|
+
}
|
|
139
|
+
/** @ignore Value written by the browser without an `input` event. */
|
|
140
|
+
onBrowserFill() {
|
|
141
|
+
if (this.inputEl().nativeElement.value !== this.text())
|
|
142
|
+
this.onInput();
|
|
132
143
|
}
|
|
133
144
|
/** @ignore Blur: clamp + rich reformatting. */
|
|
134
145
|
onBlur(event) {
|
|
@@ -160,7 +171,7 @@ class UiInputNumber extends BaseFormField {
|
|
|
160
171
|
}
|
|
161
172
|
/** @ignore Does the input currently have focus? */
|
|
162
173
|
isFocused() {
|
|
163
|
-
return (
|
|
174
|
+
return hasFocus(this.inputEl().nativeElement);
|
|
164
175
|
}
|
|
165
176
|
/** @ignore Update model + emit; reformat the text when requested. */
|
|
166
177
|
commit(value, opts) {
|
|
@@ -226,13 +237,13 @@ class UiInputNumber extends BaseFormField {
|
|
|
226
237
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputNumber, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
227
238
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiInputNumber, isStandalone: true, selector: "ui-input-number", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, allowDecimals: { classPropertyName: "allowDecimals", publicName: "allowDecimals", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, incrementAriaLabel: { classPropertyName: "incrementAriaLabel", publicName: "incrementAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, decrementAriaLabel: { classPropertyName: "decrementAriaLabel", publicName: "decrementAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, useGrouping: { classPropertyName: "useGrouping", publicName: "useGrouping", isSignal: true, isRequired: false, transformFunction: null }, minFractionDigits: { classPropertyName: "minFractionDigits", publicName: "minFractionDigits", isSignal: true, isRequired: false, transformFunction: null }, maxFractionDigits: { classPropertyName: "maxFractionDigits", publicName: "maxFractionDigits", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [
|
|
228
239
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputNumber), multi: true },
|
|
229
|
-
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n", styles: [".ui-input-number-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-number-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-number-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-number-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-number-native._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-number-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-number-unit{font-family:var(--ui-input-number-font-family, var(--fontfamily-base));font-size:var(--ui-input-number-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-number-unit._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-spinner{display:flex;flex-direction:column;align-self:stretch;flex-shrink:0;width:var(--ui-input-number-spinner-width, 1.875rem);border-left:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}.ui-input-number-spinner button{display:flex;flex:1 1 50%;align-items:center;justify-content:center;min-height:0;padding:0;border:none;background:none;line-height:0;color:var(--ui-form-field-spinner-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-number-spinner button:hover:not(:disabled){color:var(--ui-form-field-spinner-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-spinner-surface-hover, var(--form-high-surface-hover))}.ui-input-number-spinner button:disabled{cursor:not-allowed;color:var(--ui-form-field-spinner-color-disabled, var(--form-high-content-disabled))}.ui-input-number-spinner button+button{border-top:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
|
|
240
|
+
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-number-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-number-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-number-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-number-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-number-native._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-number-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-number-unit{font-family:var(--ui-input-number-font-family, var(--fontfamily-base));font-size:var(--ui-input-number-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-number-unit._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-spinner{display:flex;flex-direction:column;align-self:stretch;flex-shrink:0;width:var(--ui-input-number-spinner-width, 1.875rem);border-left:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}.ui-input-number-spinner button{display:flex;flex:1 1 50%;align-items:center;justify-content:center;min-height:0;padding:0;border:none;background:none;line-height:0;color:var(--ui-form-field-spinner-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-number-spinner button:hover:not(:disabled){color:var(--ui-form-field-spinner-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-spinner-surface-hover, var(--form-high-surface-hover))}.ui-input-number-spinner button:disabled{cursor:not-allowed;color:var(--ui-form-field-spinner-color-disabled, var(--form-high-content-disabled))}.ui-input-number-spinner button+button{border-top:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
|
|
230
241
|
}
|
|
231
242
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputNumber, decorators: [{
|
|
232
243
|
type: Component,
|
|
233
|
-
args: [{ selector: 'ui-input-number', imports: [UiField, UiIcon], providers: [
|
|
244
|
+
args: [{ selector: 'ui-input-number', imports: [UiField, UiIcon, UiBrowserFill], providers: [
|
|
234
245
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputNumber), multi: true },
|
|
235
|
-
], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n", styles: [".ui-input-number-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-number-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-number-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-number-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-number-native._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-number-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-number-unit{font-family:var(--ui-input-number-font-family, var(--fontfamily-base));font-size:var(--ui-input-number-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-number-unit._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-spinner{display:flex;flex-direction:column;align-self:stretch;flex-shrink:0;width:var(--ui-input-number-spinner-width, 1.875rem);border-left:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}.ui-input-number-spinner button{display:flex;flex:1 1 50%;align-items:center;justify-content:center;min-height:0;padding:0;border:none;background:none;line-height:0;color:var(--ui-form-field-spinner-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-number-spinner button:hover:not(:disabled){color:var(--ui-form-field-spinner-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-spinner-surface-hover, var(--form-high-surface-hover))}.ui-input-number-spinner button:disabled{cursor:not-allowed;color:var(--ui-form-field-spinner-color-disabled, var(--form-high-content-disabled))}.ui-input-number-spinner button+button{border-top:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}\n"] }]
|
|
246
|
+
], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-number-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-number-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-number-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-number-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-number-native._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-number-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-number-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-number-unit{font-family:var(--ui-input-number-font-family, var(--fontfamily-base));font-size:var(--ui-input-number-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-number-unit._small{font-size:var(--ui-input-number-font-size-small, var(--size-typography-text-md))}.ui-input-number-spinner{display:flex;flex-direction:column;align-self:stretch;flex-shrink:0;width:var(--ui-input-number-spinner-width, 1.875rem);border-left:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}.ui-input-number-spinner button{display:flex;flex:1 1 50%;align-items:center;justify-content:center;min-height:0;padding:0;border:none;background:none;line-height:0;color:var(--ui-form-field-spinner-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-number-spinner button:hover:not(:disabled){color:var(--ui-form-field-spinner-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-spinner-surface-hover, var(--form-high-surface-hover))}.ui-input-number-spinner button:disabled{cursor:not-allowed;color:var(--ui-form-field-spinner-color-disabled, var(--form-high-content-disabled))}.ui-input-number-spinner button+button{border-top:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-form-field-spinner-stroke, var(--form-high-stroke-default))}\n"] }]
|
|
236
247
|
}], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], allowDecimals: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDecimals", required: false }] }], unit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unit", required: false }] }], showButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtons", required: false }] }], incrementAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "incrementAriaLabel", required: false }] }], decrementAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "decrementAriaLabel", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }], useGrouping: [{ type: i0.Input, args: [{ isSignal: true, alias: "useGrouping", required: false }] }], minFractionDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "minFractionDigits", required: false }] }], maxFractionDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFractionDigits", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputEl: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }] } });
|
|
237
248
|
|
|
238
249
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4sh-ui-kit-forms-ui-input-number.mjs","sources":["../../../projects/ui-kit/forms/ui-input-number/src/lib/ui-input-number.ts","../../../projects/ui-kit/forms/ui-input-number/src/lib/ui-input-number.html","../../../projects/ui-kit/forms/ui-input-number/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-number/src/4sh-ui-kit-forms-ui-input-number.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n forwardRef,\n input,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon } from '@4sh/ui-kit/base/ui-icon';\n\n/**\n * ui-input-number — headless numeric field (`ui-field` shell).\n *\n * Model value = `number | null`. Lenient input: the text is **not** reformatted\n * while typing (no caret jump) — the field shows an editable form on focus, and\n * the **rich format** (thousands grouping, currency, decimals via\n * `Intl.NumberFormat`) is applied **on blur**. `min`/`max`/`step`, ± spinner,\n * ↑/↓ arrow keys, clamp on blur.\n *\n * Formatting is driven by `locale`/`currency`/`useGrouping`/`*FractionDigits`;\n * for a very specific case, override the protected `format()` method.\n */\n@Component({\n selector: 'ui-input-number',\n imports: [UiField, UiIcon],\n templateUrl: './ui-input-number.html',\n styleUrl: './ui-input-number.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputNumber), multi: true },\n ],\n})\nexport class UiInputNumber extends BaseFormField<number | null> {\n /** Native placeholder. */\n placeholder = input<string>();\n /** Minimum value (clamp on blur + disables \"−\" at the bound). */\n min = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Maximum value (clamp on blur + disables \"+\" at the bound). */\n max = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Increment step (spinner + arrow keys). */\n step = input<number, unknown>(1, { transform: numberAttribute });\n /** Allow decimals. */\n allowDecimals = input(true, { transform: booleanAttribute });\n /** Suffix unit (e.g. \"kg\"). Ignored when `currency` is set. */\n unit = input<string>();\n /** Show the ± spinner. */\n showButtons = input(true, { transform: booleanAttribute });\n /** Accessible label of the increment spinner button. */\n incrementAriaLabel = input<string>('Augmenter');\n /** Accessible label of the decrement spinner button. */\n decrementAriaLabel = input<string>('Diminuer');\n\n // --- Formatting (Intl.NumberFormat) --------------------------------\n /** BCP-47 locale (e.g. `fr-FR`). Defaults to the browser locale. */\n locale = input<string>();\n /** ISO currency code (e.g. `EUR`) → currency formatting on blur. */\n currency = input<string>();\n /** Thousands separators on blur. */\n useGrouping = input(true, { transform: booleanAttribute });\n /** Minimum fraction digits shown on blur. */\n minFractionDigits = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Maximum fraction digits shown on blur. */\n maxFractionDigits = input<number, unknown>(undefined, { transform: numberAttribute });\n\n /** Emitted on each numeric value change. */\n valueChange = output<number | null>();\n /** Emitted when the input receives focus. */\n inputFocus = output<FocusEvent>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n /** @ignore Raw displayed text (independent from the model while typing). */\n protected readonly text = signal('');\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.text() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n\n /** @ignore Suffix unit, ignored when `currency` is set (the formatted value already carries it). */\n protected readonly displayUnit = computed(() => (this.currency() ? null : (this.unit() ?? null)));\n\n /** @ignore */\n protected readonly unitSmall = computed(() => this.size() === 'small');\n /** @ignore Bounds reached (disable the spinner buttons). */\n protected readonly atMax = computed(() => {\n const v = this.modelValue();\n const max = this.max();\n return v != null && max != null && v >= max;\n });\n protected readonly atMin = computed(() => {\n const v = this.modelValue();\n const min = this.min();\n return v != null && min != null && v <= min;\n });\n /** @ignore `numberAttribute(undefined)` yields NaN, and `aria-valuemin=\"NaN\"` is an invalid\n * ARIA value — omit the attribute entirely rather than advertise a bound that does not exist. */\n protected readonly ariaValueMin = computed(() => (Number.isFinite(this.min()) ? this.min() : null));\n /** @ignore Same as `ariaValueMin`, for the upper bound. */\n protected readonly ariaValueMax = computed(() => (Number.isFinite(this.max()) ? this.max() : null));\n\n /** @ignore Group/decimal separators of the current locale. */\n private readonly separators = computed(() => {\n const parts = new Intl.NumberFormat(this.locale()).formatToParts(11111.1);\n return {\n group: parts.find((p) => p.type === 'group')?.value ?? '',\n decimal: parts.find((p) => p.type === 'decimal')?.value ?? '.',\n };\n });\n\n override writeValue(value: number | null): void {\n this.modelValue.set(value ?? undefined);\n this.text.set(value === null || value === undefined ? '' : this.format(value));\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** @ignore Focus: switch to an editable form (no grouping/currency). */\n protected onFocus(event: FocusEvent): void {\n const v = this.modelValue();\n if (v != null) this.text.set(this.editable(v));\n this.inputFocus.emit(event);\n }\n\n /** @ignore Input: parse without reformatting the text (caret preserved). */\n protected onInput(): void {\n const raw = this.inputEl().nativeElement.value;\n this.text.set(raw);\n this.commit(this.parse(raw), { reformat: false });\n }\n\n /** @ignore Blur: clamp + rich reformatting. */\n protected onBlur(event: FocusEvent): void {\n this.commit(this.clamp(this.modelValue() ?? null), { reformat: true });\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n\n /** @ignore ↑/↓ arrow keys. */\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.stepBy(1);\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.stepBy(-1);\n }\n }\n\n /** @ignore ± spinner. */\n protected stepBy(direction: 1 | -1): void {\n if (this.isDisabled() || this.readonly()) return;\n const base = this.modelValue() ?? 0;\n const next = this.clamp(base + direction * this.step());\n this.commit(next, { reformat: !this.isFocused() });\n if (this.isFocused()) this.text.set(next === null ? '' : this.editable(next));\n this.inputEl().nativeElement.focus();\n }\n\n /** @ignore Does the input currently have focus? */\n private isFocused(): boolean {\n return (\n typeof document !== 'undefined' && document.activeElement === this.inputEl().nativeElement\n );\n }\n\n /** @ignore Update model + emit; reformat the text when requested. */\n private commit(value: number | null, opts: { reformat: boolean }): void {\n this.modelValue.set(value ?? undefined);\n if (opts.reformat) this.text.set(value === null ? '' : this.format(value));\n this.emitChange(value);\n this.valueChange.emit(value);\n }\n\n /** @ignore Parse a lenient (locale-aware) input → number or null. */\n private parse(raw: string): number | null {\n const { group, decimal } = this.separators();\n let s = raw.trim();\n if (group) s = s.split(group).join('');\n s = s\n .replace(/\\s/g, '') // spaces (incl. U+202F/U+00A0 grouping separators)\n .replace(decimal, '.')\n .replace(/[^0-9.-]/g, ''); // strip currency/symbols\n if (s === '' || s === '-' || s === '.' || s === '-.') return null;\n const n = Number(s);\n if (Number.isNaN(n)) return null;\n return this.allowDecimals() ? n : Math.trunc(n);\n }\n\n /** @ignore Clamp the value into [min, max]. */\n private clamp(value: number | null): number | null {\n if (value === null) return null;\n const min = this.min();\n const max = this.max();\n let v = value;\n if (min != null && v < min) v = min;\n if (max != null && v > max) v = max;\n return v;\n }\n\n /** @ignore Editable form on focus: locale decimals, no grouping or currency. */\n private editable(value: number): string {\n return new Intl.NumberFormat(this.locale(), {\n useGrouping: false,\n maximumFractionDigits: 20,\n }).format(value);\n }\n\n /**\n * Display formatting on blur (overridable). Defaults to `Intl.NumberFormat`\n * with `locale`/`currency`/`useGrouping`/`*FractionDigits`.\n */\n protected format(value: number): string {\n const options: Intl.NumberFormatOptions = { useGrouping: this.useGrouping() };\n if (this.currency()) {\n options.style = 'currency';\n options.currency = this.currency();\n }\n if (this.minFractionDigits() != null) options.minimumFractionDigits = this.minFractionDigits();\n if (this.maxFractionDigits() != null) options.maximumFractionDigits = this.maxFractionDigits();\n return new Intl.NumberFormat(this.locale(), options).format(value);\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input-number\n */\n\nexport * from './lib/ui-input-number';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAiBA;;;;;;;;;;;AAWG;AAUG,MAAO,aAAc,SAAQ,aAA4B,CAAA;AAT/D,IAAA,WAAA,GAAA;;;AAWE,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAU;;QAE7B,IAAA,CAAA,GAAG,GAAG,KAAK,CAAkB,SAAS,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEvE,IAAA,CAAA,GAAG,GAAG,KAAK,CAAkB,SAAS,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEvE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAkB,CAAC,4EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEhE,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC,IAAI,qFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAE5D,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK;4FAAU;;QAEtB,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,IAAI,mFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAE1D,IAAA,CAAA,kBAAkB,GAAG,KAAK,CAAS,WAAW;+FAAC;;QAE/C,IAAA,CAAA,kBAAkB,GAAG,KAAK,CAAS,UAAU;+FAAC;;;AAI9C,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK;8FAAU;;AAExB,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK;gGAAU;;QAE1B,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,IAAI,mFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAE1D,IAAA,CAAA,iBAAiB,GAAG,KAAK,CAAkB,SAAS,yFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAErF,IAAA,CAAA,iBAAiB,GAAG,KAA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A,s1GAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,ED7CY,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,KAAA,EAAA,UAAA,EAAA,MAAA,EAAA,OAAA,EAAA,YAAA,EAAA,QAAA,EAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,YAAA,EAAA,SAAA,EAAA,WAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,WAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,MAAM,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,QAAA,EAAA,YAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAOd,aAAa,EAAA,UAAA,EAAA,CAAA;kBATzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,WAClB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA,SAAA,EAGf;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AAC1F,qBAAA,EAAA,QAAA,EAAA,+vEAAA,EAAA,MAAA,EAAA,CAAA,s1GAAA,CAAA,EAAA;gnDA0C2E,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9EvF;;AAEG;;ACFH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"4sh-ui-kit-forms-ui-input-number.mjs","sources":["../../../projects/ui-kit/forms/ui-input-number/src/lib/ui-input-number.ts","../../../projects/ui-kit/forms/ui-input-number/src/lib/ui-input-number.html","../../../projects/ui-kit/forms/ui-input-number/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-number/src/4sh-ui-kit-forms-ui-input-number.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n forwardRef,\n input,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField, hasFocus, UiBrowserFill } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon } from '@4sh/ui-kit/base/ui-icon';\n\n/**\n * ui-input-number — headless numeric field (`ui-field` shell).\n *\n * Model value = `number | null`. Lenient input: the text is **not** reformatted\n * while typing (no caret jump) — the field shows an editable form on focus, and\n * the **rich format** (thousands grouping, currency, decimals via\n * `Intl.NumberFormat`) is applied **on blur**. `min`/`max`/`step`, ± spinner,\n * ↑/↓ arrow keys, clamp on blur.\n *\n * Formatting is driven by `locale`/`currency`/`useGrouping`/`*FractionDigits`;\n * for a very specific case, override the protected `format()` method.\n */\n@Component({\n selector: 'ui-input-number',\n imports: [UiField, UiIcon, UiBrowserFill],\n templateUrl: './ui-input-number.html',\n styleUrl: './ui-input-number.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputNumber), multi: true },\n ],\n})\nexport class UiInputNumber extends BaseFormField<number | null> {\n /** Native placeholder. */\n placeholder = input<string>();\n /** Minimum value (clamp on blur + disables \"−\" at the bound). */\n min = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Maximum value (clamp on blur + disables \"+\" at the bound). */\n max = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Increment step (spinner + arrow keys). */\n step = input<number, unknown>(1, { transform: numberAttribute });\n /** Allow decimals. */\n allowDecimals = input(true, { transform: booleanAttribute });\n /** Suffix unit (e.g. \"kg\"). Ignored when `currency` is set. */\n unit = input<string>();\n /** Show the ± spinner. */\n showButtons = input(true, { transform: booleanAttribute });\n /** Accessible label of the increment spinner button. */\n incrementAriaLabel = input<string>('Augmenter');\n /** Accessible label of the decrement spinner button. */\n decrementAriaLabel = input<string>('Diminuer');\n\n // --- Formatting (Intl.NumberFormat) --------------------------------\n /** BCP-47 locale (e.g. `fr-FR`). Defaults to the browser locale. */\n locale = input<string>();\n /** ISO currency code (e.g. `EUR`) → currency formatting on blur. */\n currency = input<string>();\n /** Thousands separators on blur. */\n useGrouping = input(true, { transform: booleanAttribute });\n /** Minimum fraction digits shown on blur. */\n minFractionDigits = input<number, unknown>(undefined, { transform: numberAttribute });\n /** Maximum fraction digits shown on blur. */\n maxFractionDigits = input<number, unknown>(undefined, { transform: numberAttribute });\n\n /** Emitted on each numeric value change. */\n valueChange = output<number | null>();\n /** Emitted when the input receives focus. */\n inputFocus = output<FocusEvent>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n /** @ignore Raw displayed text (independent from the model while typing). */\n protected readonly text = signal('');\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.text() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n\n /** @ignore Suffix unit, ignored when `currency` is set (the formatted value already carries it). */\n protected readonly displayUnit = computed(() => (this.currency() ? null : (this.unit() ?? null)));\n\n /** @ignore */\n protected readonly unitSmall = computed(() => this.size() === 'small');\n /** @ignore Bounds reached (disable the spinner buttons). */\n protected readonly atMax = computed(() => {\n const v = this.modelValue();\n const max = this.max();\n return v != null && max != null && v >= max;\n });\n protected readonly atMin = computed(() => {\n const v = this.modelValue();\n const min = this.min();\n return v != null && min != null && v <= min;\n });\n /** @ignore `numberAttribute(undefined)` yields NaN, and `aria-valuemin=\"NaN\"` is an invalid\n * ARIA value — omit the attribute entirely rather than advertise a bound that does not exist. */\n protected readonly ariaValueMin = computed(() => (Number.isFinite(this.min()) ? this.min() : null));\n /** @ignore Same as `ariaValueMin`, for the upper bound. */\n protected readonly ariaValueMax = computed(() => (Number.isFinite(this.max()) ? this.max() : null));\n\n /** @ignore Group/decimal separators of the current locale. */\n private readonly separators = computed(() => {\n const parts = new Intl.NumberFormat(this.locale()).formatToParts(11111.1);\n return {\n group: parts.find((p) => p.type === 'group')?.value ?? '',\n decimal: parts.find((p) => p.type === 'decimal')?.value ?? '.',\n };\n });\n\n override writeValue(value: number | null): void {\n this.modelValue.set(value ?? undefined);\n this.text.set(value === null || value === undefined ? '' : this.format(value));\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** @ignore Focus: switch to an editable form (no grouping/currency). */\n protected onFocus(event: FocusEvent): void {\n const v = this.modelValue();\n if (v != null) this.text.set(this.editable(v));\n this.inputFocus.emit(event);\n }\n\n /** @ignore Input: parse without reformatting the text (caret preserved). A value written by\n * the browser without focus is reformatted at once: no blur will follow to do it. */\n protected onInput(): void {\n const el = this.inputEl().nativeElement;\n const raw = el.value;\n const filled = !hasFocus(el);\n this.text.set(raw);\n this.commit(this.parse(raw), { reformat: filled });\n // The binding skips a reformatted text equal to the one rendered before the fill.\n if (filled) el.value = this.text();\n }\n\n /** @ignore Value written by the browser without an `input` event. */\n protected onBrowserFill(): void {\n if (this.inputEl().nativeElement.value !== this.text()) this.onInput();\n }\n\n /** @ignore Blur: clamp + rich reformatting. */\n protected onBlur(event: FocusEvent): void {\n this.commit(this.clamp(this.modelValue() ?? null), { reformat: true });\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n\n /** @ignore ↑/↓ arrow keys. */\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.stepBy(1);\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.stepBy(-1);\n }\n }\n\n /** @ignore ± spinner. */\n protected stepBy(direction: 1 | -1): void {\n if (this.isDisabled() || this.readonly()) return;\n const base = this.modelValue() ?? 0;\n const next = this.clamp(base + direction * this.step());\n this.commit(next, { reformat: !this.isFocused() });\n if (this.isFocused()) this.text.set(next === null ? '' : this.editable(next));\n this.inputEl().nativeElement.focus();\n }\n\n /** @ignore Does the input currently have focus? */\n private isFocused(): boolean {\n return hasFocus(this.inputEl().nativeElement);\n }\n\n /** @ignore Update model + emit; reformat the text when requested. */\n private commit(value: number | null, opts: { reformat: boolean }): void {\n this.modelValue.set(value ?? undefined);\n if (opts.reformat) this.text.set(value === null ? '' : this.format(value));\n this.emitChange(value);\n this.valueChange.emit(value);\n }\n\n /** @ignore Parse a lenient (locale-aware) input → number or null. */\n private parse(raw: string): number | null {\n const { group, decimal } = this.separators();\n let s = raw.trim();\n if (group) s = s.split(group).join('');\n s = s\n .replace(/\\s/g, '') // spaces (incl. U+202F/U+00A0 grouping separators)\n .replace(decimal, '.')\n .replace(/[^0-9.-]/g, ''); // strip currency/symbols\n if (s === '' || s === '-' || s === '.' || s === '-.') return null;\n const n = Number(s);\n if (Number.isNaN(n)) return null;\n return this.allowDecimals() ? n : Math.trunc(n);\n }\n\n /** @ignore Clamp the value into [min, max]. */\n private clamp(value: number | null): number | null {\n if (value === null) return null;\n const min = this.min();\n const max = this.max();\n let v = value;\n if (min != null && v < min) v = min;\n if (max != null && v > max) v = max;\n return v;\n }\n\n /** @ignore Editable form on focus: locale decimals, no grouping or currency. */\n private editable(value: number): string {\n return new Intl.NumberFormat(this.locale(), {\n useGrouping: false,\n maximumFractionDigits: 20,\n }).format(value);\n }\n\n /**\n * Display formatting on blur (overridable). Defaults to `Intl.NumberFormat`\n * with `locale`/`currency`/`useGrouping`/`*FractionDigits`.\n */\n protected format(value: number): string {\n const options: Intl.NumberFormatOptions = { useGrouping: this.useGrouping() };\n if (this.currency()) {\n options.style = 'currency';\n options.currency = this.currency();\n }\n if (this.minFractionDigits() != null) options.minimumFractionDigits = this.minFractionDigits();\n if (this.maxFractionDigits() != null) options.maximumFractionDigits = this.maxFractionDigits();\n return new Intl.NumberFormat(this.locale(), options).format(value);\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-number-native\"\n [class._small]=\"size() === 'small'\"\n type=\"text\"\n inputmode=\"decimal\"\n [id]=\"resolvedId()\"\n [value]=\"text()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n role=\"spinbutton\"\n [attr.aria-valuenow]=\"modelValue() ?? null\"\n [attr.aria-valuemin]=\"ariaValueMin()\"\n [attr.aria-valuemax]=\"ariaValueMax()\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (displayUnit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-number-unit\"\n [class._small]=\"unitSmall()\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (showButtons()) {\n <span uiFieldSuffix class=\"ui-input-number-spinner\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <ui-icon name=\"angle-up\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementAriaLabel()\"\n [disabled]=\"isDisabled() || readonly() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <ui-icon name=\"angle-down\" size=\"sm\" />\n </button>\n </span>\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input-number\n */\n\nexport * from './lib/ui-input-number';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAiBA;;;;;;;;;;;AAWG;AAUG,MAAO,aAAc,SAAQ,aAA4B,CAAA;AAT/D,IAAA,WAAA,GAAA;;;AAWE,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAU;;QAE7B,IAAA,CAAA,GAAG,GAAG,KAAK,CAAkB,SAAS,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEvE,IAAA,CAAA,GAAG,GAAG,KAAK,CAAkB,SAAS,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEvE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAkB,CAAC,4EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEhE,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC,IAAI,qFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAE5D,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK;4FAAU;;QAEtB,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,IAAI,mFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAE1D,IAAA,CAAA,kBAAkB,GAAG,KAAK,CAAS,WAAW;+FAAC;;QAE/C,IAAA,CAAA,kBAAkB,GAAG,KAAK,CAAS,UAAU;+FAAC;;;AAI9C,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK;8FAAU;;AAExB,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK;gGAAU;;QAE1B,IAAA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,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AAC1F,qBAAA,EAAA,QAAA,EAAA,yzEAAA,EAAA,MAAA,EAAA,CAAA,87GAAA,CAAA,EAAA;gnDA0C2E,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9EvF;;AAEG;;ACFH;;AAEG;;"}
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, numberAttribute, booleanAttribute, output, contentChild, inject, ElementRef, signal, computed, afterNextRender, isDevMode, effect, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
-
import { BaseFieldControl, warnMissingAccessibleName } from '@4sh/ui-kit/forms';
|
|
5
|
+
import { BaseFieldControl, warnMissingAccessibleName, hasFocus, UiBrowserFill } from '@4sh/ui-kit/forms';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* ui-input-otp — headless one-time-password field: a row of single-character
|
|
@@ -121,6 +121,7 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
121
121
|
/* touched is emitted on group focusout */
|
|
122
122
|
},
|
|
123
123
|
paste: (event) => this.onPaste(event, index),
|
|
124
|
+
browserFill: (event) => this.onBrowserFill(event, index),
|
|
124
125
|
};
|
|
125
126
|
}
|
|
126
127
|
/** @ignore Cell input: single source of the per-cell value (view → form). */
|
|
@@ -129,23 +130,37 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
129
130
|
return;
|
|
130
131
|
const target = event.target;
|
|
131
132
|
const raw = this.sanitize(target.value);
|
|
133
|
+
// A value written by the browser into a cell without focus must not pull the focus in.
|
|
134
|
+
const typed = hasFocus(target);
|
|
132
135
|
// Multi-char (autofill / paste into a cell) → distribute across cells.
|
|
133
136
|
if (raw.length > 1) {
|
|
134
|
-
|
|
137
|
+
target.value = raw.charAt(0);
|
|
138
|
+
this.setFromIndex(index, raw, typed);
|
|
135
139
|
return;
|
|
136
140
|
}
|
|
137
141
|
const tokens = [...this.tokens()];
|
|
138
142
|
tokens[index] = raw;
|
|
139
143
|
target.value = raw; // reflect the sanitised value
|
|
140
144
|
this.commit(tokens);
|
|
145
|
+
if (!typed)
|
|
146
|
+
return;
|
|
141
147
|
const inputType = event.inputType;
|
|
142
148
|
if (raw)
|
|
143
149
|
this.focusCell(index + 1);
|
|
144
150
|
else if (inputType === 'deleteContentBackward')
|
|
145
151
|
this.focusCell(index - 1);
|
|
146
152
|
}
|
|
153
|
+
/** @ignore Value written by the browser into a cell without an `input` event. */
|
|
154
|
+
onBrowserFill(event, index) {
|
|
155
|
+
if (event.target.value !== this.cellValue(index)) {
|
|
156
|
+
this.onInput(event, index);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
147
159
|
/** @ignore Keyboard navigation + input guards. */
|
|
148
160
|
onKeydown(event, index) {
|
|
161
|
+
// Chrome's autofill dispatches a bare `Event`, without `key`.
|
|
162
|
+
if (!(event instanceof KeyboardEvent))
|
|
163
|
+
return;
|
|
149
164
|
if (event.altKey || event.ctrlKey || event.metaKey)
|
|
150
165
|
return;
|
|
151
166
|
const target = event.target;
|
|
@@ -192,8 +207,13 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
192
207
|
}
|
|
193
208
|
/** @ignore Select the cell content on focus + track the roving index. */
|
|
194
209
|
onFocus(event, index) {
|
|
210
|
+
const cell = event.target;
|
|
211
|
+
// Chrome's autofill sends a focus event to a cell it fills without focusing it,
|
|
212
|
+
// and `select()` would pull the focus in.
|
|
213
|
+
if (!hasFocus(cell))
|
|
214
|
+
return;
|
|
195
215
|
this.focusedIndex.set(index);
|
|
196
|
-
|
|
216
|
+
cell.select?.();
|
|
197
217
|
}
|
|
198
218
|
/** @ignore Distribute a pasted code across the cells from `index`. */
|
|
199
219
|
onPaste(event, index) {
|
|
@@ -210,8 +230,8 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
210
230
|
if (!next || !this.host.nativeElement.contains(next))
|
|
211
231
|
this.emitTouch();
|
|
212
232
|
}
|
|
213
|
-
/** @ignore Write `chars` into the cells starting at `from`, then commit + focus. */
|
|
214
|
-
setFromIndex(from, chars) {
|
|
233
|
+
/** @ignore Write `chars` into the cells starting at `from`, then commit (+ focus). */
|
|
234
|
+
setFromIndex(from, chars, moveFocus = true) {
|
|
215
235
|
const tokens = [...this.tokens()];
|
|
216
236
|
const max = this.length();
|
|
217
237
|
let i = from;
|
|
@@ -221,7 +241,8 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
221
241
|
tokens[i++] = ch;
|
|
222
242
|
}
|
|
223
243
|
this.commit(tokens);
|
|
224
|
-
|
|
244
|
+
if (moveFocus)
|
|
245
|
+
this.focusCell(Math.min(i, max - 1));
|
|
225
246
|
}
|
|
226
247
|
/** @ignore Persist the tokens, emit the joined value (+ `completed` when full). */
|
|
227
248
|
commit(tokens) {
|
|
@@ -258,11 +279,11 @@ class UiInputOtp extends BaseFieldControl {
|
|
|
258
279
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
259
280
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiInputOtp, isStandalone: true, selector: "ui-input-otp", inputs: { length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, integerOnly: { classPropertyName: "integerOnly", publicName: "integerOnly", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, charAriaLabel: { classPropertyName: "charAriaLabel", publicName: "charAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", completed: "completed" }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onFocusOut($event)" }, properties: { "class._small": "size() === 'small'", "class._large": "size() === 'large'", "class._disabled": "isDisabled()", "class._readonly": "readonly()", "class._invalid": "isInvalid()", "attr.aria-label": "ariaLabel() || null", "attr.aria-labelledby": "ariaLabelledBy() || null", "attr.aria-invalid": "isInvalid() ? 'true' : null", "attr.aria-disabled": "isDisabled() ? 'true' : null" }, classAttribute: "ui-input-otp" }, providers: [
|
|
260
281
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputOtp), multi: true },
|
|
261
|
-
], queries: [{ propertyName: "inputTemplate", first: true, predicate: ["input"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:var(--ui-input-otp-gap, var(--units-sm));font-family:var(--ui-input-otp-font-family, var(--fontfamily-base))}:host .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size, var(--size-components-default));block-size:var(--ui-input-otp-cell-size, var(--size-components-default));font-size:var(--ui-input-otp-font-size, var(--size-typography-text-default))}:host._small .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));block-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));font-size:var(--ui-input-otp-font-size-small, var(--size-typography-text-md))}:host._large .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));block-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));font-size:var(--ui-input-otp-font-size-large, var(--size-typography-text-lg))}.ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke, var(--form-high-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover, var(--form-high-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus, var(--form-high-stroke-focused));box-sizing:border-box;min-inline-size:0;margin:0;padding:0;border:var(--ui-input-otp-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--_stroke);border-radius:var(--ui-input-otp-radius, var(--ui-form-field-radius, var(--radius-sm)));background-color:var(--ui-input-otp-cell-surface, var(--form-high-surface-default));color:var(--ui-input-otp-cell-color, var(--form-high-content-default));font-family:inherit;font-weight:var(--ui-input-otp-weight, var(--weight-bold));text-align:center;caret-color:var(--ui-input-otp-cell-color, var(--form-high-content-default));transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-otp-cell:hover:not(:disabled):not(:focus){border-color:var(--_stroke-hover)}.ui-input-otp-cell:focus,.ui-input-otp-cell:focus-visible{outline:none;border-color:var(--_stroke-focus);box-shadow:0 0 0 var(--ui-input-otp-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) rgb(from var(--_stroke-focus) r g b/50%)}.ui-input-otp-cell:disabled{border-color:var(--ui-input-otp-cell-stroke-disabled, var(--form-high-stroke-disabled));background-color:var(--ui-input-otp-cell-surface-disabled, var(--form-high-surface-disabled));color:var(--ui-input-otp-cell-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}:host._readonly .ui-input-otp-cell{cursor:default}:host._invalid .ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke-invalid, var(--form-error-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover-invalid, var(--form-error-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus-invalid, var(--form-error-stroke-focused))}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
282
|
+
], queries: [{ propertyName: "inputTemplate", first: true, predicate: ["input"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n uiBrowserFill\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (browserFill)=\"onBrowserFill($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:var(--ui-input-otp-gap, var(--units-sm));font-family:var(--ui-input-otp-font-family, var(--fontfamily-base))}:host .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size, var(--size-components-default));block-size:var(--ui-input-otp-cell-size, var(--size-components-default));font-size:var(--ui-input-otp-font-size, var(--size-typography-text-default))}:host._small .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));block-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));font-size:var(--ui-input-otp-font-size-small, var(--size-typography-text-md))}:host._large .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));block-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));font-size:var(--ui-input-otp-font-size-large, var(--size-typography-text-lg))}@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke, var(--form-high-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover, var(--form-high-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus, var(--form-high-stroke-focused));box-sizing:border-box;min-inline-size:0;margin:0;padding:0;border:var(--ui-input-otp-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--_stroke);border-radius:var(--ui-input-otp-radius, var(--ui-form-field-radius, var(--radius-sm)));background-color:var(--ui-input-otp-cell-surface, var(--form-high-surface-default));color:var(--ui-input-otp-cell-color, var(--form-high-content-default));font-family:inherit;font-weight:var(--ui-input-otp-weight, var(--weight-bold));text-align:center;caret-color:var(--ui-input-otp-cell-color, var(--form-high-content-default));transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-otp-cell:hover:not(:disabled):not(:focus){border-color:var(--_stroke-hover)}.ui-input-otp-cell:focus,.ui-input-otp-cell:focus-visible{outline:none;border-color:var(--_stroke-focus);box-shadow:0 0 0 var(--ui-input-otp-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) rgb(from var(--_stroke-focus) r g b/50%)}.ui-input-otp-cell:disabled{border-color:var(--ui-input-otp-cell-stroke-disabled, var(--form-high-stroke-disabled));background-color:var(--ui-input-otp-cell-surface-disabled, var(--form-high-surface-disabled));color:var(--ui-input-otp-cell-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}:host._readonly .ui-input-otp-cell{cursor:default}:host._invalid .ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke-invalid, var(--form-error-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover-invalid, var(--form-error-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus-invalid, var(--form-error-stroke-focused))}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
|
|
262
283
|
}
|
|
263
284
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInputOtp, decorators: [{
|
|
264
285
|
type: Component,
|
|
265
|
-
args: [{ selector: 'ui-input-otp', imports: [NgTemplateOutlet], providers: [
|
|
286
|
+
args: [{ selector: 'ui-input-otp', imports: [NgTemplateOutlet, UiBrowserFill], providers: [
|
|
266
287
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputOtp), multi: true },
|
|
267
288
|
], host: {
|
|
268
289
|
class: 'ui-input-otp',
|
|
@@ -277,7 +298,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
277
298
|
'[attr.aria-invalid]': "isInvalid() ? 'true' : null",
|
|
278
299
|
'[attr.aria-disabled]': "isDisabled() ? 'true' : null",
|
|
279
300
|
'(focusout)': 'onFocusOut($event)',
|
|
280
|
-
}, template: "@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:var(--ui-input-otp-gap, var(--units-sm));font-family:var(--ui-input-otp-font-family, var(--fontfamily-base))}:host .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size, var(--size-components-default));block-size:var(--ui-input-otp-cell-size, var(--size-components-default));font-size:var(--ui-input-otp-font-size, var(--size-typography-text-default))}:host._small .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));block-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));font-size:var(--ui-input-otp-font-size-small, var(--size-typography-text-md))}:host._large .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));block-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));font-size:var(--ui-input-otp-font-size-large, var(--size-typography-text-lg))}.ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke, var(--form-high-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover, var(--form-high-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus, var(--form-high-stroke-focused));box-sizing:border-box;min-inline-size:0;margin:0;padding:0;border:var(--ui-input-otp-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--_stroke);border-radius:var(--ui-input-otp-radius, var(--ui-form-field-radius, var(--radius-sm)));background-color:var(--ui-input-otp-cell-surface, var(--form-high-surface-default));color:var(--ui-input-otp-cell-color, var(--form-high-content-default));font-family:inherit;font-weight:var(--ui-input-otp-weight, var(--weight-bold));text-align:center;caret-color:var(--ui-input-otp-cell-color, var(--form-high-content-default));transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-otp-cell:hover:not(:disabled):not(:focus){border-color:var(--_stroke-hover)}.ui-input-otp-cell:focus,.ui-input-otp-cell:focus-visible{outline:none;border-color:var(--_stroke-focus);box-shadow:0 0 0 var(--ui-input-otp-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) rgb(from var(--_stroke-focus) r g b/50%)}.ui-input-otp-cell:disabled{border-color:var(--ui-input-otp-cell-stroke-disabled, var(--form-high-stroke-disabled));background-color:var(--ui-input-otp-cell-surface-disabled, var(--form-high-surface-disabled));color:var(--ui-input-otp-cell-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}:host._readonly .ui-input-otp-cell{cursor:default}:host._invalid .ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke-invalid, var(--form-error-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover-invalid, var(--form-error-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus-invalid, var(--form-error-stroke-focused))}\n"] }]
|
|
301
|
+
}, template: "@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n uiBrowserFill\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (browserFill)=\"onBrowserFill($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:var(--ui-input-otp-gap, var(--units-sm));font-family:var(--ui-input-otp-font-family, var(--fontfamily-base))}:host .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size, var(--size-components-default));block-size:var(--ui-input-otp-cell-size, var(--size-components-default));font-size:var(--ui-input-otp-font-size, var(--size-typography-text-default))}:host._small .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));block-size:var(--ui-input-otp-cell-size-small, var(--size-components-sm));font-size:var(--ui-input-otp-font-size-small, var(--size-typography-text-md))}:host._large .ui-input-otp-cell{inline-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));block-size:var(--ui-input-otp-cell-size-large, var(--size-components-xl));font-size:var(--ui-input-otp-font-size-large, var(--size-typography-text-lg))}@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke, var(--form-high-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover, var(--form-high-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus, var(--form-high-stroke-focused));box-sizing:border-box;min-inline-size:0;margin:0;padding:0;border:var(--ui-input-otp-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--_stroke);border-radius:var(--ui-input-otp-radius, var(--ui-form-field-radius, var(--radius-sm)));background-color:var(--ui-input-otp-cell-surface, var(--form-high-surface-default));color:var(--ui-input-otp-cell-color, var(--form-high-content-default));font-family:inherit;font-weight:var(--ui-input-otp-weight, var(--weight-bold));text-align:center;caret-color:var(--ui-input-otp-cell-color, var(--form-high-content-default));transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-otp-cell:hover:not(:disabled):not(:focus){border-color:var(--_stroke-hover)}.ui-input-otp-cell:focus,.ui-input-otp-cell:focus-visible{outline:none;border-color:var(--_stroke-focus);box-shadow:0 0 0 var(--ui-input-otp-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) rgb(from var(--_stroke-focus) r g b/50%)}.ui-input-otp-cell:disabled{border-color:var(--ui-input-otp-cell-stroke-disabled, var(--form-high-stroke-disabled));background-color:var(--ui-input-otp-cell-surface-disabled, var(--form-high-surface-disabled));color:var(--ui-input-otp-cell-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}:host._readonly .ui-input-otp-cell{cursor:default}:host._invalid .ui-input-otp-cell{--_stroke: var(--ui-input-otp-cell-stroke-invalid, var(--form-error-stroke-default));--_stroke-hover: var(--ui-input-otp-cell-stroke-hover-invalid, var(--form-error-stroke-hover));--_stroke-focus: var(--ui-input-otp-cell-stroke-focus-invalid, var(--form-error-stroke-focused))}\n"] }]
|
|
281
302
|
}], ctorParameters: () => [], propDecorators: { length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: false }] }], integerOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "integerOnly", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], charAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "charAriaLabel", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], completed: [{ type: i0.Output, args: ["completed"] }], inputTemplate: [{ type: i0.ContentChild, args: ['input', { isSignal: true }] }] } });
|
|
282
303
|
|
|
283
304
|
/*
|