@radix-ng/primitives 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/radix-ng-primitives-autocomplete.mjs +43 -9
- package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +89 -8
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-combobox.mjs +43 -9
- package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +208 -2
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +50 -9
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-editable.mjs +31 -5
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-field.mjs +265 -46
- package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-form.mjs +110 -26
- package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-input.mjs +16 -6
- package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +32 -7
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +4 -2
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +18 -4
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +26 -8
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-signal-forms.mjs +184 -0
- package/fesm2022/radix-ng-primitives-signal-forms.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-slider.mjs +24 -8
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +29 -5
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +49 -9
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +23 -12
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/package.json +11 -1
- package/types/radix-ng-primitives-autocomplete.d.ts +21 -2
- package/types/radix-ng-primitives-checkbox.d.ts +53 -4
- package/types/radix-ng-primitives-combobox.d.ts +51 -2
- package/types/radix-ng-primitives-core.d.ts +206 -3
- package/types/radix-ng-primitives-date-field.d.ts +27 -2
- package/types/radix-ng-primitives-editable.d.ts +15 -2
- package/types/radix-ng-primitives-field.d.ts +136 -33
- package/types/radix-ng-primitives-form.d.ts +115 -21
- package/types/radix-ng-primitives-input.d.ts +8 -1
- package/types/radix-ng-primitives-number-field.d.ts +14 -3
- package/types/radix-ng-primitives-radio.d.ts +7 -2
- package/types/radix-ng-primitives-select.d.ts +11 -3
- package/types/radix-ng-primitives-signal-forms.d.ts +97 -0
- package/types/radix-ng-primitives-slider.d.ts +9 -7
- package/types/radix-ng-primitives-switch.d.ts +15 -2
- package/types/radix-ng-primitives-time-field.d.ts +26 -2
- package/types/radix-ng-primitives-toggle-group.d.ts +6 -4
|
@@ -134,8 +134,16 @@ class RdxInputDirective {
|
|
|
134
134
|
* @group Emits
|
|
135
135
|
*/
|
|
136
136
|
this.touch = output();
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
/** The input's own binary invalidity (its `invalid` input or a non-empty `errors` list). */
|
|
138
|
+
this.ownInvalid = computed(() => this.invalid() || (this.errors()?.length ?? 0) > 0, /* @ts-ignore */
|
|
139
|
+
...(ngDevMode ? [{ debugName: "ownInvalid" }] : /* istanbul ignore next */ []));
|
|
140
|
+
/**
|
|
141
|
+
* Tri-state *displayed* validity: inside a `rdxFieldRoot` the field's gated `validState` is the single
|
|
142
|
+
* source (so a field whose `validationMode` defers display (e.g. `onBlur`) keeps the input neutral until revealed), otherwise
|
|
143
|
+
* the input's own binary invalidity. `true` valid / `false` invalid / `null` neutral.
|
|
144
|
+
*/
|
|
145
|
+
this.displayValid = computed(() => this.fieldRootContext ? this.fieldRootContext.validState() : this.ownInvalid() ? false : true, /* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [{ debugName: "displayValid" }] : /* istanbul ignore next */ []));
|
|
139
147
|
this.disabledState = computed(() => this.disabled() || Boolean(this.fieldRootContext?.disabledState()), /* @ts-ignore */
|
|
140
148
|
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
141
149
|
this.requiredState = computed(() => this.required() || Boolean(this.fieldRootContext?.requiredState()), /* @ts-ignore */
|
|
@@ -227,7 +235,7 @@ class RdxInputDirective {
|
|
|
227
235
|
this.syncFieldState();
|
|
228
236
|
}
|
|
229
237
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
230
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxInputDirective, isStandalone: true, selector: "input[rdxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", onValueChange: "onValueChange", touch: "touch" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()", "input": "onInput($event)", "change": "syncFieldState()" }, properties: { "attr.id": "id()", "attr.name": "name() || undefined", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "
|
|
238
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxInputDirective, isStandalone: true, selector: "input[rdxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", onValueChange: "onValueChange", touch: "touch" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()", "input": "onInput($event)", "change": "syncFieldState()" }, properties: { "attr.id": "id()", "attr.name": "name() || undefined", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "displayValid() === false ? \"true\" : undefined", "attr.aria-required": "requiredState() ? \"true\" : undefined", "attr.aria-disabled": "disabledState() ? \"true\" : undefined", "attr.disabled": "disabledState() ? \"\" : undefined", "attr.required": "requiredState() ? \"\" : undefined", "attr.readonly": "readonly() ? \"\" : undefined", "attr.minlength": "minLength() ?? undefined", "attr.maxlength": "maxLength() ?? undefined", "attr.pattern": "patternAttr()", "attr.data-invalid": "dataAttr(displayValid() === false)", "attr.data-valid": "dataAttr(displayValid() === true)", "attr.data-disabled": "dataAttr(disabledState())", "attr.data-required": "dataAttr(requiredState())", "attr.data-readonly": "dataAttr(readonly())", "attr.data-filled": "dataAttr(filledState())", "attr.data-focused": "dataAttr(focusedState())", "attr.data-touched": "dataAttr(touchedState())", "attr.data-dirty": "dataAttr(dirtyState())" } }, exportAs: ["rdxInput"], ngImport: i0 }); }
|
|
231
239
|
}
|
|
232
240
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxInputDirective, decorators: [{
|
|
233
241
|
type: Directive,
|
|
@@ -238,7 +246,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
238
246
|
'[attr.id]': 'id()',
|
|
239
247
|
'[attr.name]': 'name() || undefined',
|
|
240
248
|
'[attr.aria-describedby]': 'describedBy()',
|
|
241
|
-
'
|
|
249
|
+
// Validity follows the field's tri-state `displayValid` when inside a `rdxFieldRoot` (neutral →
|
|
250
|
+
// no aria-invalid, neither data-valid nor data-invalid), else the input's own binary invalidity.
|
|
251
|
+
'[attr.aria-invalid]': 'displayValid() === false ? "true" : undefined',
|
|
242
252
|
'[attr.aria-required]': 'requiredState() ? "true" : undefined',
|
|
243
253
|
'[attr.aria-disabled]': 'disabledState() ? "true" : undefined',
|
|
244
254
|
'[attr.disabled]': 'disabledState() ? "" : undefined',
|
|
@@ -247,8 +257,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
247
257
|
'[attr.minlength]': 'minLength() ?? undefined',
|
|
248
258
|
'[attr.maxlength]': 'maxLength() ?? undefined',
|
|
249
259
|
'[attr.pattern]': 'patternAttr()',
|
|
250
|
-
'[attr.data-invalid]': 'dataAttr(
|
|
251
|
-
'[attr.data-valid]': 'dataAttr(
|
|
260
|
+
'[attr.data-invalid]': 'dataAttr(displayValid() === false)',
|
|
261
|
+
'[attr.data-valid]': 'dataAttr(displayValid() === true)',
|
|
252
262
|
'[attr.data-disabled]': 'dataAttr(disabledState())',
|
|
253
263
|
'[attr.data-required]': 'dataAttr(requiredState())',
|
|
254
264
|
'[attr.data-readonly]': 'dataAttr(readonly())',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-input.mjs","sources":["../../../packages/primitives/input/src/input.directive.ts","../../../packages/primitives/input/radix-ng-primitives-input.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal\n} from '@angular/core';\nimport { BooleanInput, NumberInput, RdxFormValueControl, RdxValidationError } from '@radix-ng/primitives/core';\nimport { injectFieldRootContext } from '@radix-ng/primitives/field';\n\nlet inputId = 0;\n\nconst attr = (value: boolean) => (value ? '' : undefined);\nconst numberOrUndefined = (value: unknown): number | undefined =>\n value == null || value === '' ? undefined : Number(value);\n\n/**\n * The input value. Native text inputs always produce strings, so the model is\n * `string` — matching Signal Forms' `FormValueControl<string>` round-trip.\n */\nexport type RdxInputValue = string;\n\nexport interface RdxInputValueChangeEventDetails {\n event: Event;\n cancel: () => void;\n isCanceled: () => boolean;\n}\n\nexport interface RdxInputValueChangeEvent {\n value: string;\n eventDetails: RdxInputValueChangeEventDetails;\n}\n\n/**\n * A headless text input that can integrate with Field for accessible labeling,\n * descriptions, validation state, and data attributes.\n *\n * @group Components\n */\n@Directive({\n selector: 'input[rdxInput]',\n exportAs: 'rdxInput',\n host: {\n '[attr.id]': 'id()',\n '[attr.name]': 'name() || undefined',\n '[attr.aria-describedby]': 'describedBy()',\n '[attr.aria-invalid]': 'invalidState() ? \"true\" : undefined',\n '[attr.aria-required]': 'requiredState() ? \"true\" : undefined',\n '[attr.aria-disabled]': 'disabledState() ? \"true\" : undefined',\n '[attr.disabled]': 'disabledState() ? \"\" : undefined',\n '[attr.required]': 'requiredState() ? \"\" : undefined',\n '[attr.readonly]': 'readonly() ? \"\" : undefined',\n '[attr.minlength]': 'minLength() ?? undefined',\n '[attr.maxlength]': 'maxLength() ?? undefined',\n '[attr.pattern]': 'patternAttr()',\n '[attr.data-invalid]': 'dataAttr(invalidState())',\n '[attr.data-valid]': 'dataAttr(!invalidState())',\n '[attr.data-disabled]': 'dataAttr(disabledState())',\n '[attr.data-required]': 'dataAttr(requiredState())',\n '[attr.data-readonly]': 'dataAttr(readonly())',\n '[attr.data-filled]': 'dataAttr(filledState())',\n '[attr.data-focused]': 'dataAttr(focusedState())',\n '[attr.data-touched]': 'dataAttr(touchedState())',\n '[attr.data-dirty]': 'dataAttr(dirtyState())',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(input)': 'onInput($event)',\n '(change)': 'syncFieldState()'\n }\n})\nexport class RdxInputDirective implements RdxFormValueControl<RdxInputValue | undefined> {\n private readonly element = inject<ElementRef<HTMLInputElement>>(ElementRef).nativeElement;\n private readonly fieldRootContext = injectFieldRootContext(true);\n private initialValue = '';\n private defaultValueApplied = false;\n private readonly filledValue = signal(false);\n private readonly focusedValue = signal(false);\n private readonly dirtyValue = signal(false);\n\n /**\n * The input id. Field labels and descriptions use this value for accessible relationships.\n *\n * @group Props\n */\n readonly id = input(`rdx-input-${inputId++}`);\n\n /**\n * The name of the input, submitted with the form data and used by Form-level\n * error matching.\n *\n * @group Props\n */\n readonly name = input<string>();\n\n /**\n * The controlled input value.\n *\n * @group Props\n */\n readonly value = model<RdxInputValue | undefined>(undefined);\n\n /**\n * The initial value when the input is uncontrolled.\n *\n * @group Props\n */\n readonly defaultValue = input<RdxInputValue | undefined>(undefined);\n\n /**\n * Whether the input is disabled.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is read-only.\n *\n * @group Props\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is required.\n *\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is invalid.\n *\n * @group Props\n */\n readonly invalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input has been touched. A two-way model: the input sets it on\n * blur (emitting `touchedChange`, which Signal Forms' `[formField]` listens\n * to), and a form system can write it back.\n *\n * @group Props\n */\n readonly touched = model<boolean>(false);\n\n /**\n * Whether the input value has changed from its initial value. Merged with the\n * internally tracked state; a form system can own it through this input.\n *\n * @group Props\n */\n readonly dirty = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Validation errors for the input. A non-empty list marks the input invalid.\n *\n * @group Props\n */\n readonly errors = input<readonly RdxValidationError[]>([]);\n\n /**\n * Minimum number of characters.\n *\n * @group Props\n */\n readonly minLength = input<number | undefined, NumberInput>(undefined, { transform: numberOrUndefined });\n\n /**\n * Maximum number of characters.\n *\n * @group Props\n */\n readonly maxLength = input<number | undefined, NumberInput>(undefined, { transform: numberOrUndefined });\n\n /**\n * Patterns the value must match. Reflected to the native `pattern` attribute\n * only when exactly one pattern is provided (the attribute holds a single regex).\n *\n * @group Props\n */\n readonly pattern = input<readonly RegExp[]>([]);\n\n /**\n * Emits when the input value changes.\n *\n * @group Emits\n */\n readonly onValueChange = output<RdxInputValueChangeEvent>();\n\n /**\n * Emits on blur, notifying a form system the input was touched. Stable\n * Angular 22 Signal Forms listens to this `touch` output; the 21.x\n * experimental implementation listens to the `touched` model's\n * `touchedChange` instead — both are emitted, covering either version.\n *\n * @group Emits\n */\n readonly touch = output<void>();\n\n protected readonly invalidState = computed(\n () => this.invalid() || (this.errors()?.length ?? 0) > 0 || Boolean(this.fieldRootContext?.invalidState())\n );\n protected readonly disabledState = computed(\n () => this.disabled() || Boolean(this.fieldRootContext?.disabledState())\n );\n protected readonly requiredState = computed(\n () => this.required() || Boolean(this.fieldRootContext?.requiredState())\n );\n protected readonly filledState = computed(\n () => this.filledValue() || Boolean(this.fieldRootContext?.filledState())\n );\n protected readonly focusedState = computed(\n () => this.focusedValue() || Boolean(this.fieldRootContext?.focusedState())\n );\n protected readonly touchedState = computed(() => this.touched() || Boolean(this.fieldRootContext?.touchedState()));\n protected readonly dirtyState = computed(\n () => this.dirty() || this.dirtyValue() || Boolean(this.fieldRootContext?.dirtyState())\n );\n\n protected readonly patternAttr = computed(() => {\n const patterns = this.pattern();\n return patterns?.length === 1 ? patterns[0].source : undefined;\n });\n\n protected readonly describedBy = computed(() => {\n if (!this.fieldRootContext) {\n return undefined;\n }\n\n const ids = [\n ...this.fieldRootContext.descriptionIds(),\n ...(this.fieldRootContext.invalidState() ? this.fieldRootContext.errorIds() : [])\n ];\n\n return ids.length ? ids.join(' ') : undefined;\n });\n\n constructor() {\n effect(() => {\n const value = this.value();\n\n if (value !== undefined) {\n this.writeValue(value);\n }\n });\n\n effect(() => {\n const defaultValue = this.defaultValue();\n\n if (this.value() === undefined && defaultValue !== undefined && !this.defaultValueApplied) {\n this.defaultValueApplied = true;\n this.writeValue(defaultValue);\n }\n });\n\n effect(() => {\n this.fieldRootContext?.setControlId(this.id());\n });\n\n afterNextRender(() => {\n this.initialValue = this.element.value;\n this.syncFieldState();\n });\n }\n\n onFocus(): void {\n this.focusedValue.set(true);\n this.fieldRootContext?.setFocused(true);\n }\n\n onBlur(): void {\n this.focusedValue.set(false);\n this.touched.set(true);\n this.touch.emit();\n this.fieldRootContext?.setFocused(false);\n this.fieldRootContext?.setTouched(true);\n }\n\n onInput(event: Event): void {\n const nextValue = this.element.value;\n let canceled = false;\n\n const eventDetails: RdxInputValueChangeEventDetails = {\n event,\n cancel: () => {\n canceled = true;\n },\n isCanceled: () => canceled\n };\n\n this.onValueChange.emit({ value: nextValue, eventDetails });\n\n if (canceled) {\n this.writeValue(this.value() ?? this.defaultValue() ?? '');\n return;\n }\n\n this.value.set(nextValue);\n this.syncFieldState();\n }\n\n syncFieldState(): void {\n const value = this.element.value;\n\n this.filledValue.set(value !== '');\n this.dirtyValue.set(value !== this.initialValue);\n this.fieldRootContext?.setFilled(value !== '');\n this.fieldRootContext?.setDirty(value !== this.initialValue);\n }\n\n private writeValue(value: RdxInputValue): void {\n this.element.value = value;\n this.syncFieldState();\n }\n\n protected readonly dataAttr = attr;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAgBA,IAAI,OAAO,GAAG,CAAC;AAEf,MAAM,IAAI,GAAG,CAAC,KAAc,MAAM,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC;AACzD,MAAM,iBAAiB,GAAG,CAAC,KAAc,KACrC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,GAAG,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;AAmB7D;;;;;AAKG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,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,mBAAmB,EAAE,2BAA2B;AAChD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,sBAAsB,EAAE,sBAAsB;AAC9C,wBAAA,oBAAoB,EAAE,yBAAyB;AAC/C,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,mBAAmB,EAAE,wBAAwB;AAC7C,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,QAAQ,EAAE,UAAU;AACpB,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,UAAU,EAAE;AACf;AACJ,iBAAA;;;AC3ED;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-input.mjs","sources":["../../../packages/primitives/input/src/input.directive.ts","../../../packages/primitives/input/radix-ng-primitives-input.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal\n} from '@angular/core';\nimport { BooleanInput, NumberInput, RdxFormValueControl, RdxValidationError } from '@radix-ng/primitives/core';\nimport { injectFieldRootContext } from '@radix-ng/primitives/field';\n\nlet inputId = 0;\n\nconst attr = (value: boolean) => (value ? '' : undefined);\nconst numberOrUndefined = (value: unknown): number | undefined =>\n value == null || value === '' ? undefined : Number(value);\n\n/**\n * The input value. Native text inputs always produce strings, so the model is\n * `string` — matching Signal Forms' `FormValueControl<string>` round-trip.\n */\nexport type RdxInputValue = string;\n\nexport interface RdxInputValueChangeEventDetails {\n event: Event;\n cancel: () => void;\n isCanceled: () => boolean;\n}\n\nexport interface RdxInputValueChangeEvent {\n value: string;\n eventDetails: RdxInputValueChangeEventDetails;\n}\n\n/**\n * A headless text input that can integrate with Field for accessible labeling,\n * descriptions, validation state, and data attributes.\n *\n * @group Components\n */\n@Directive({\n selector: 'input[rdxInput]',\n exportAs: 'rdxInput',\n host: {\n '[attr.id]': 'id()',\n '[attr.name]': 'name() || undefined',\n '[attr.aria-describedby]': 'describedBy()',\n // Validity follows the field's tri-state `displayValid` when inside a `rdxFieldRoot` (neutral →\n // no aria-invalid, neither data-valid nor data-invalid), else the input's own binary invalidity.\n '[attr.aria-invalid]': 'displayValid() === false ? \"true\" : undefined',\n '[attr.aria-required]': 'requiredState() ? \"true\" : undefined',\n '[attr.aria-disabled]': 'disabledState() ? \"true\" : undefined',\n '[attr.disabled]': 'disabledState() ? \"\" : undefined',\n '[attr.required]': 'requiredState() ? \"\" : undefined',\n '[attr.readonly]': 'readonly() ? \"\" : undefined',\n '[attr.minlength]': 'minLength() ?? undefined',\n '[attr.maxlength]': 'maxLength() ?? undefined',\n '[attr.pattern]': 'patternAttr()',\n '[attr.data-invalid]': 'dataAttr(displayValid() === false)',\n '[attr.data-valid]': 'dataAttr(displayValid() === true)',\n '[attr.data-disabled]': 'dataAttr(disabledState())',\n '[attr.data-required]': 'dataAttr(requiredState())',\n '[attr.data-readonly]': 'dataAttr(readonly())',\n '[attr.data-filled]': 'dataAttr(filledState())',\n '[attr.data-focused]': 'dataAttr(focusedState())',\n '[attr.data-touched]': 'dataAttr(touchedState())',\n '[attr.data-dirty]': 'dataAttr(dirtyState())',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(input)': 'onInput($event)',\n '(change)': 'syncFieldState()'\n }\n})\nexport class RdxInputDirective implements RdxFormValueControl<RdxInputValue | undefined> {\n private readonly element = inject<ElementRef<HTMLInputElement>>(ElementRef).nativeElement;\n private readonly fieldRootContext = injectFieldRootContext(true);\n private initialValue = '';\n private defaultValueApplied = false;\n private readonly filledValue = signal(false);\n private readonly focusedValue = signal(false);\n private readonly dirtyValue = signal(false);\n\n /**\n * The input id. Field labels and descriptions use this value for accessible relationships.\n *\n * @group Props\n */\n readonly id = input(`rdx-input-${inputId++}`);\n\n /**\n * The name of the input, submitted with the form data and used by Form-level\n * error matching.\n *\n * @group Props\n */\n readonly name = input<string>();\n\n /**\n * The controlled input value.\n *\n * @group Props\n */\n readonly value = model<RdxInputValue | undefined>(undefined);\n\n /**\n * The initial value when the input is uncontrolled.\n *\n * @group Props\n */\n readonly defaultValue = input<RdxInputValue | undefined>(undefined);\n\n /**\n * Whether the input is disabled.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is read-only.\n *\n * @group Props\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is required.\n *\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is invalid.\n *\n * @group Props\n */\n readonly invalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input has been touched. A two-way model: the input sets it on\n * blur (emitting `touchedChange`, which Signal Forms' `[formField]` listens\n * to), and a form system can write it back.\n *\n * @group Props\n */\n readonly touched = model<boolean>(false);\n\n /**\n * Whether the input value has changed from its initial value. Merged with the\n * internally tracked state; a form system can own it through this input.\n *\n * @group Props\n */\n readonly dirty = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Validation errors for the input. A non-empty list marks the input invalid.\n *\n * @group Props\n */\n readonly errors = input<readonly RdxValidationError[]>([]);\n\n /**\n * Minimum number of characters.\n *\n * @group Props\n */\n readonly minLength = input<number | undefined, NumberInput>(undefined, { transform: numberOrUndefined });\n\n /**\n * Maximum number of characters.\n *\n * @group Props\n */\n readonly maxLength = input<number | undefined, NumberInput>(undefined, { transform: numberOrUndefined });\n\n /**\n * Patterns the value must match. Reflected to the native `pattern` attribute\n * only when exactly one pattern is provided (the attribute holds a single regex).\n *\n * @group Props\n */\n readonly pattern = input<readonly RegExp[]>([]);\n\n /**\n * Emits when the input value changes.\n *\n * @group Emits\n */\n readonly onValueChange = output<RdxInputValueChangeEvent>();\n\n /**\n * Emits on blur, notifying a form system the input was touched. Stable\n * Angular 22 Signal Forms listens to this `touch` output; the 21.x\n * experimental implementation listens to the `touched` model's\n * `touchedChange` instead — both are emitted, covering either version.\n *\n * @group Emits\n */\n readonly touch = output<void>();\n\n /** The input's own binary invalidity (its `invalid` input or a non-empty `errors` list). */\n private readonly ownInvalid = computed(() => this.invalid() || (this.errors()?.length ?? 0) > 0);\n\n /**\n * Tri-state *displayed* validity: inside a `rdxFieldRoot` the field's gated `validState` is the single\n * source (so a field whose `validationMode` defers display (e.g. `onBlur`) keeps the input neutral until revealed), otherwise\n * the input's own binary invalidity. `true` valid / `false` invalid / `null` neutral.\n */\n protected readonly displayValid = computed<boolean | null>(() =>\n this.fieldRootContext ? this.fieldRootContext.validState() : this.ownInvalid() ? false : true\n );\n protected readonly disabledState = computed(\n () => this.disabled() || Boolean(this.fieldRootContext?.disabledState())\n );\n protected readonly requiredState = computed(\n () => this.required() || Boolean(this.fieldRootContext?.requiredState())\n );\n protected readonly filledState = computed(\n () => this.filledValue() || Boolean(this.fieldRootContext?.filledState())\n );\n protected readonly focusedState = computed(\n () => this.focusedValue() || Boolean(this.fieldRootContext?.focusedState())\n );\n protected readonly touchedState = computed(() => this.touched() || Boolean(this.fieldRootContext?.touchedState()));\n protected readonly dirtyState = computed(\n () => this.dirty() || this.dirtyValue() || Boolean(this.fieldRootContext?.dirtyState())\n );\n\n protected readonly patternAttr = computed(() => {\n const patterns = this.pattern();\n return patterns?.length === 1 ? patterns[0].source : undefined;\n });\n\n protected readonly describedBy = computed(() => {\n if (!this.fieldRootContext) {\n return undefined;\n }\n\n const ids = [\n ...this.fieldRootContext.descriptionIds(),\n ...(this.fieldRootContext.invalidState() ? this.fieldRootContext.errorIds() : [])\n ];\n\n return ids.length ? ids.join(' ') : undefined;\n });\n\n constructor() {\n effect(() => {\n const value = this.value();\n\n if (value !== undefined) {\n this.writeValue(value);\n }\n });\n\n effect(() => {\n const defaultValue = this.defaultValue();\n\n if (this.value() === undefined && defaultValue !== undefined && !this.defaultValueApplied) {\n this.defaultValueApplied = true;\n this.writeValue(defaultValue);\n }\n });\n\n effect(() => {\n this.fieldRootContext?.setControlId(this.id());\n });\n\n afterNextRender(() => {\n this.initialValue = this.element.value;\n this.syncFieldState();\n });\n }\n\n onFocus(): void {\n this.focusedValue.set(true);\n this.fieldRootContext?.setFocused(true);\n }\n\n onBlur(): void {\n this.focusedValue.set(false);\n this.touched.set(true);\n this.touch.emit();\n this.fieldRootContext?.setFocused(false);\n this.fieldRootContext?.setTouched(true);\n }\n\n onInput(event: Event): void {\n const nextValue = this.element.value;\n let canceled = false;\n\n const eventDetails: RdxInputValueChangeEventDetails = {\n event,\n cancel: () => {\n canceled = true;\n },\n isCanceled: () => canceled\n };\n\n this.onValueChange.emit({ value: nextValue, eventDetails });\n\n if (canceled) {\n this.writeValue(this.value() ?? this.defaultValue() ?? '');\n return;\n }\n\n this.value.set(nextValue);\n this.syncFieldState();\n }\n\n syncFieldState(): void {\n const value = this.element.value;\n\n this.filledValue.set(value !== '');\n this.dirtyValue.set(value !== this.initialValue);\n this.fieldRootContext?.setFilled(value !== '');\n this.fieldRootContext?.setDirty(value !== this.initialValue);\n }\n\n private writeValue(value: RdxInputValue): void {\n this.element.value = value;\n this.syncFieldState();\n }\n\n protected readonly dataAttr = attr;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAgBA,IAAI,OAAO,GAAG,CAAC;AAEf,MAAM,IAAI,GAAG,CAAC,KAAc,MAAM,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC;AACzD,MAAM,iBAAiB,GAAG,CAAC,KAAc,KACrC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,GAAG,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;AAmB7D;;;;;AAKG;MAkCU,iBAAiB,CAAA;AA+K1B,IAAA,WAAA,GAAA;AA9KiB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAA+B,UAAU,CA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AgB,EAAE,eAAe;AACjC,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,mBAAmB,EAAE,mCAAmC;AACxD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,sBAAsB,EAAE,sBAAsB;AAC9C,wBAAA,oBAAoB,EAAE,yBAAyB;AAC/C,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,mBAAmB,EAAE,wBAAwB;AAC7C,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,QAAQ,EAAE,UAAU;AACpB,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,UAAU,EAAE;AACf;AACJ,iBAAA;;;AC7ED;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { numberAttribute, computed, signal, inject, DestroyRef, input, booleanAttribute, Directive, ElementRef, model, output, effect, untracked, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@radix-ng/primitives/core';
|
|
4
|
-
import { createContext, clamp, getActiveElement, injectControlValueAccessor, injectId, createCancelableChangeEventDetails, RdxControlValueAccessor } from '@radix-ng/primitives/core';
|
|
4
|
+
import { createContext, clamp, getActiveElement, RdxFormUiControlBase, injectControlValueAccessor, injectId, createCancelableChangeEventDetails, RdxControlValueAccessor } from '@radix-ng/primitives/core';
|
|
5
5
|
import { NumberFormatter, NumberParser } from '@internationalized/number';
|
|
6
6
|
import * as i1$1 from '@radix-ng/primitives/portal';
|
|
7
7
|
import { RdxPortal } from '@radix-ng/primitives/portal';
|
|
@@ -589,7 +589,7 @@ class RdxNumberFieldInput {
|
|
|
589
589
|
});
|
|
590
590
|
}
|
|
591
591
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxNumberFieldInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
592
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxNumberFieldInput, isStandalone: true, selector: "input[rdxNumberFieldInput]", host: { attributes: { "type": "text", "autocomplete": "off", "autocorrect": "off", "spellcheck": "false", "aria-roledescription": "Number field" }, listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)", "input": "onInput($event)", "beforeinput": "onBeforeInput($event)", "keydown": "onKeydown($event)", "paste": "onPaste($event)", "wheel": "onWheel($event)" }, properties: { "id": "rootContext.id()", "value": "rootContext.inputValue()", "attr.inputmode": "rootContext.inputMode()", "attr.aria-invalid": "rootContext.required() && rootContext.currentValue() === null ? \"true\" : undefined", "disabled": "rootContext.isDisabled()", "attr.readonly": "rootContext.readonly() ? \"\" : undefined", "required": "rootContext.required()", "attr.data-disabled": "rootContext.isDisabled() ? \"\" : undefined", "attr.data-readonly": "rootContext.readonly() ? \"\" : undefined", "attr.data-required": "rootContext.required() ? \"\" : undefined" } }, exportAs: ["rdxNumberFieldInput"], ngImport: i0 }); }
|
|
592
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxNumberFieldInput, isStandalone: true, selector: "input[rdxNumberFieldInput]", host: { attributes: { "type": "text", "autocomplete": "off", "autocorrect": "off", "spellcheck": "false", "aria-roledescription": "Number field" }, listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)", "input": "onInput($event)", "beforeinput": "onBeforeInput($event)", "keydown": "onKeydown($event)", "paste": "onPaste($event)", "wheel": "onWheel($event)" }, properties: { "id": "rootContext.id()", "value": "rootContext.inputValue()", "attr.inputmode": "rootContext.inputMode()", "attr.aria-invalid": "rootContext.displayValid() === false || (rootContext.displayValid() === true && rootContext.required() && rootContext.currentValue() === null) ? \"true\" : undefined", "disabled": "rootContext.isDisabled()", "attr.readonly": "rootContext.readonly() ? \"\" : undefined", "required": "rootContext.required()", "attr.data-disabled": "rootContext.isDisabled() ? \"\" : undefined", "attr.data-readonly": "rootContext.readonly() ? \"\" : undefined", "attr.data-required": "rootContext.required() ? \"\" : undefined", "attr.data-invalid": "rootContext.displayValid() === false ? \"\" : undefined", "attr.data-valid": "rootContext.displayValid() === true ? \"\" : undefined", "attr.data-touched": "rootContext.touchedState() ? \"\" : undefined", "attr.data-dirty": "rootContext.dirtyState() ? \"\" : undefined" } }, exportAs: ["rdxNumberFieldInput"], ngImport: i0 }); }
|
|
593
593
|
}
|
|
594
594
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxNumberFieldInput, decorators: [{
|
|
595
595
|
type: Directive,
|
|
@@ -605,13 +605,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
605
605
|
'[id]': 'rootContext.id()',
|
|
606
606
|
'[value]': 'rootContext.inputValue()',
|
|
607
607
|
'[attr.inputmode]': 'rootContext.inputMode()',
|
|
608
|
-
'
|
|
608
|
+
// Follows the field's tri-state `displayValid` (neutral → no aria-invalid); the required-empty a11y
|
|
609
|
+
// hint only fires standalone (where `displayValid` is `true`, never neutral inside a gated Field).
|
|
610
|
+
'[attr.aria-invalid]': 'rootContext.displayValid() === false || (rootContext.displayValid() === true && rootContext.required() && rootContext.currentValue() === null) ? "true" : undefined',
|
|
609
611
|
'[disabled]': 'rootContext.isDisabled()',
|
|
610
612
|
'[attr.readonly]': 'rootContext.readonly() ? "" : undefined',
|
|
611
613
|
'[required]': 'rootContext.required()',
|
|
612
614
|
'[attr.data-disabled]': 'rootContext.isDisabled() ? "" : undefined',
|
|
613
615
|
'[attr.data-readonly]': 'rootContext.readonly() ? "" : undefined',
|
|
614
616
|
'[attr.data-required]': 'rootContext.required() ? "" : undefined',
|
|
617
|
+
'[attr.data-invalid]': 'rootContext.displayValid() === false ? "" : undefined',
|
|
618
|
+
'[attr.data-valid]': 'rootContext.displayValid() === true ? "" : undefined',
|
|
619
|
+
'[attr.data-touched]': 'rootContext.touchedState() ? "" : undefined',
|
|
620
|
+
'[attr.data-dirty]': 'rootContext.dirtyState() ? "" : undefined',
|
|
615
621
|
'(focus)': 'onFocus($event)',
|
|
616
622
|
'(blur)': 'onBlur($event)',
|
|
617
623
|
'(input)': 'onInput($event)',
|
|
@@ -650,8 +656,9 @@ const INPUT_REASONS = [
|
|
|
650
656
|
*
|
|
651
657
|
* @see https://base-ui.com/react/components/number-field
|
|
652
658
|
*/
|
|
653
|
-
class RdxNumberFieldRoot {
|
|
659
|
+
class RdxNumberFieldRoot extends RdxFormUiControlBase {
|
|
654
660
|
constructor() {
|
|
661
|
+
super();
|
|
655
662
|
/** @ignore */
|
|
656
663
|
this.cva = injectControlValueAccessor();
|
|
657
664
|
/** The id of the input element. */
|
|
@@ -753,6 +760,12 @@ class RdxNumberFieldRoot {
|
|
|
753
760
|
/** @ignore */
|
|
754
761
|
this.isDisabled = computed(() => !!this.cva.disabled(), /* @ts-ignore */
|
|
755
762
|
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
763
|
+
/** @ignore */
|
|
764
|
+
this.invalidState = this.formUi.invalidState;
|
|
765
|
+
/** @ignore */
|
|
766
|
+
this.touchedState = this.formUi.touchedState;
|
|
767
|
+
/** @ignore */
|
|
768
|
+
this.dirtyState = this.formUi.dirtyState;
|
|
756
769
|
this.formatter = useNumberFormatter(this.locale, this.format);
|
|
757
770
|
this.parser = useNumberParser(this.locale, this.format);
|
|
758
771
|
/** @ignore The current numeric value (`null` when empty). */
|
|
@@ -840,9 +853,16 @@ class RdxNumberFieldRoot {
|
|
|
840
853
|
setInputValue(text) {
|
|
841
854
|
this.inputValue.set(text);
|
|
842
855
|
}
|
|
843
|
-
/**
|
|
856
|
+
/**
|
|
857
|
+
* @ignore Mark the field touched — CVA for Reactive forms, plus the `touched` model + `touch`
|
|
858
|
+
* output for Signal Forms.
|
|
859
|
+
*/
|
|
844
860
|
markAsTouched() {
|
|
845
|
-
this.
|
|
861
|
+
this.formUi.markAsTouched();
|
|
862
|
+
}
|
|
863
|
+
/** @ignore Bridge the CVA into `markAsTouched` (dual). */
|
|
864
|
+
formUiTouchTarget() {
|
|
865
|
+
return injectControlValueAccessor();
|
|
846
866
|
}
|
|
847
867
|
/**
|
|
848
868
|
* @ignore
|
|
@@ -902,9 +922,10 @@ class RdxNumberFieldRoot {
|
|
|
902
922
|
applyValue(value) {
|
|
903
923
|
this.value.set(value);
|
|
904
924
|
this.cva.setValue(value);
|
|
925
|
+
this.formUi.markDirty();
|
|
905
926
|
}
|
|
906
927
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxNumberFieldRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
907
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxNumberFieldRoot, isStandalone: true, selector: "div[rdxNumberFieldRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", 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 }, smallStep: { classPropertyName: "smallStep", publicName: "smallStep", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, snapOnStep: { classPropertyName: "snapOnStep", publicName: "snapOnStep", isSignal: true, isRequired: false, transformFunction: null }, allowOutOfRange: { classPropertyName: "allowOutOfRange", publicName: "allowOutOfRange", isSignal: true, isRequired: false, transformFunction: null }, allowWheelScrub: { classPropertyName: "allowWheelScrub", publicName: "allowWheelScrub", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange", onValueCommitted: "onValueCommitted" }, host: { attributes: { "role": "group" }, properties: { "attr.data-disabled": "isDisabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-required": "required() ? \"\" : undefined", "attr.data-scrubbing": "isScrubbing() ? \"\" : undefined" } }, providers: [provideNumberFieldRootContext(() => inject(RdxNumberFieldRoot))], exportAs: ["rdxNumberFieldRoot"], hostDirectives: [{ directive: i1.RdxControlValueAccessor, inputs: ["value", "value", "disabled", "disabled"] }], ngImport: i0 }); }
|
|
928
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxNumberFieldRoot, isStandalone: true, selector: "div[rdxNumberFieldRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", 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 }, smallStep: { classPropertyName: "smallStep", publicName: "smallStep", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, snapOnStep: { classPropertyName: "snapOnStep", publicName: "snapOnStep", isSignal: true, isRequired: false, transformFunction: null }, allowOutOfRange: { classPropertyName: "allowOutOfRange", publicName: "allowOutOfRange", isSignal: true, isRequired: false, transformFunction: null }, allowWheelScrub: { classPropertyName: "allowWheelScrub", publicName: "allowWheelScrub", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange", onValueCommitted: "onValueCommitted" }, host: { attributes: { "role": "group" }, properties: { "attr.data-disabled": "isDisabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-required": "required() ? \"\" : undefined", "attr.data-invalid": "displayValid() === false ? \"\" : undefined", "attr.data-valid": "displayValid() === true ? \"\" : undefined", "attr.data-touched": "touchedState() ? \"\" : undefined", "attr.data-dirty": "dirtyState() ? \"\" : undefined", "attr.data-scrubbing": "isScrubbing() ? \"\" : undefined" } }, providers: [provideNumberFieldRootContext(() => inject(RdxNumberFieldRoot))], exportAs: ["rdxNumberFieldRoot"], usesInheritance: true, hostDirectives: [{ directive: i1.RdxControlValueAccessor, inputs: ["value", "value", "disabled", "disabled"] }], ngImport: i0 }); }
|
|
908
929
|
}
|
|
909
930
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxNumberFieldRoot, decorators: [{
|
|
910
931
|
type: Directive,
|
|
@@ -923,6 +944,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
923
944
|
'[attr.data-disabled]': 'isDisabled() ? "" : undefined',
|
|
924
945
|
'[attr.data-readonly]': 'readonly() ? "" : undefined',
|
|
925
946
|
'[attr.data-required]': 'required() ? "" : undefined',
|
|
947
|
+
'[attr.data-invalid]': 'displayValid() === false ? "" : undefined',
|
|
948
|
+
'[attr.data-valid]': 'displayValid() === true ? "" : undefined',
|
|
949
|
+
'[attr.data-touched]': 'touchedState() ? "" : undefined',
|
|
950
|
+
'[attr.data-dirty]': 'dirtyState() ? "" : undefined',
|
|
926
951
|
'[attr.data-scrubbing]': 'isScrubbing() ? "" : undefined'
|
|
927
952
|
}
|
|
928
953
|
}]
|