ngx-com 0.0.21 → 0.0.22
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/ngx-com-components-calendar.mjs +341 -43
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-form-field.mjs +2 -2
- package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
- package/fesm2022/ngx-com-components-native-control.mjs +170 -0
- package/fesm2022/ngx-com-components-native-control.mjs.map +1 -0
- package/fesm2022/ngx-com-components-switch.mjs +16 -7
- package/fesm2022/ngx-com-components-switch.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ngx-com-components-calendar.d.ts +158 -22
- package/types/ngx-com-components-native-control.d.ts +99 -0
- package/types/ngx-com-components-switch.d.ts +7 -2
|
@@ -117,12 +117,17 @@ class ComSwitch {
|
|
|
117
117
|
variant = input('primary', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
118
118
|
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
119
119
|
disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
120
|
-
|
|
120
|
+
htmlValue = input(undefined, { ...(ngDevMode ? { debugName: "htmlValue" } : {}), alias: 'value' });
|
|
121
121
|
name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : []));
|
|
122
122
|
id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
|
|
123
123
|
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : {}), alias: 'aria-label' });
|
|
124
124
|
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : {}), alias: 'aria-labelledby' });
|
|
125
125
|
ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : {}), alias: 'aria-describedby' });
|
|
126
|
+
// Signal Forms inputs — set automatically by [formField] via setInputOnDirectives
|
|
127
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
|
|
128
|
+
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : []));
|
|
129
|
+
sfErrors = input([], { ...(ngDevMode ? { debugName: "sfErrors" } : {}), alias: 'errors' });
|
|
130
|
+
sfRequired = input(false, { ...(ngDevMode ? { debugName: "sfRequired" } : {}), alias: 'required' });
|
|
126
131
|
// Outputs
|
|
127
132
|
changed = output();
|
|
128
133
|
// Computed state
|
|
@@ -155,6 +160,10 @@ class ComSwitch {
|
|
|
155
160
|
this.disabled.set(isDisabled);
|
|
156
161
|
}
|
|
157
162
|
// Event handlers
|
|
163
|
+
onBlur() {
|
|
164
|
+
this.onTouched();
|
|
165
|
+
this.touched.set(true);
|
|
166
|
+
}
|
|
158
167
|
onInputChange(event) {
|
|
159
168
|
const input = event.target;
|
|
160
169
|
const newChecked = input.checked;
|
|
@@ -178,7 +187,7 @@ class ComSwitch {
|
|
|
178
187
|
this.changed.emit({ checked: newChecked, source: this });
|
|
179
188
|
}
|
|
180
189
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
181
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.0", type: ComSwitch, isStandalone: true, selector: "com-switch", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null },
|
|
190
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.0", type: ComSwitch, isStandalone: true, selector: "com-switch", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, htmlValue: { classPropertyName: "htmlValue", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, sfErrors: { classPropertyName: "sfErrors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, sfRequired: { classPropertyName: "sfRequired", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", disabled: "disabledChange", touched: "touchedChange", changed: "changed" }, host: { properties: { "class.com-switch--disabled": "disabled()", "class.com-switch--checked": "checked()" }, classAttribute: "com-switch inline-block align-middle" }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputElement"], descendants: true, isSignal: true }], exportAs: ["comSwitch"], ngImport: i0, template: `
|
|
182
191
|
<label
|
|
183
192
|
class="group relative inline-flex items-center"
|
|
184
193
|
[class.cursor-pointer]="!disabled()"
|
|
@@ -193,12 +202,12 @@ class ComSwitch {
|
|
|
193
202
|
[checked]="checked()"
|
|
194
203
|
[disabled]="disabled()"
|
|
195
204
|
[attr.name]="name()"
|
|
196
|
-
[attr.value]="
|
|
205
|
+
[attr.value]="htmlValue()"
|
|
197
206
|
[attr.aria-label]="ariaLabel()"
|
|
198
207
|
[attr.aria-labelledby]="ariaLabelledby()"
|
|
199
208
|
[attr.aria-describedby]="ariaDescribedby()"
|
|
200
209
|
(change)="onInputChange($event)"
|
|
201
|
-
(blur)="
|
|
210
|
+
(blur)="onBlur()"
|
|
202
211
|
/>
|
|
203
212
|
<span [class]="trackClasses()">
|
|
204
213
|
<span [class]="thumbClasses()"></span>
|
|
@@ -226,12 +235,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
226
235
|
[checked]="checked()"
|
|
227
236
|
[disabled]="disabled()"
|
|
228
237
|
[attr.name]="name()"
|
|
229
|
-
[attr.value]="
|
|
238
|
+
[attr.value]="htmlValue()"
|
|
230
239
|
[attr.aria-label]="ariaLabel()"
|
|
231
240
|
[attr.aria-labelledby]="ariaLabelledby()"
|
|
232
241
|
[attr.aria-describedby]="ariaDescribedby()"
|
|
233
242
|
(change)="onInputChange($event)"
|
|
234
|
-
(blur)="
|
|
243
|
+
(blur)="onBlur()"
|
|
235
244
|
/>
|
|
236
245
|
<span [class]="trackClasses()">
|
|
237
246
|
<span [class]="thumbClasses()"></span>
|
|
@@ -245,7 +254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
245
254
|
'[class.com-switch--disabled]': 'disabled()',
|
|
246
255
|
'[class.com-switch--checked]': 'checked()',
|
|
247
256
|
}, styles: [".sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
|
|
248
|
-
}], ctorParameters: () => [], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ['inputElement', { isSignal: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }],
|
|
257
|
+
}], ctorParameters: () => [], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ['inputElement', { isSignal: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], htmlValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], sfErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], sfRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
249
258
|
|
|
250
259
|
// Public API for the switch component
|
|
251
260
|
// Main component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-com-components-switch.mjs","sources":["../../../projects/com/components/switch/switch.variants.ts","../../../projects/com/components/switch/switch.component.ts","../../../projects/com/components/switch/index.ts","../../../projects/com/components/switch/ngx-com-components-switch.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\n/** Switch size variants. */\nexport type SwitchSize = 'sm' | 'md' | 'lg';\n\n/** Switch color variants. */\nexport type SwitchVariant = 'primary' | 'accent' | 'warn';\n\n/**\n * CVA variants for the switch track (pill-shaped container).\n *\n * Uses `peer` selectors to style based on native input state:\n * - `peer-checked:` for on state\n * - `peer-focus-visible:` for keyboard focus\n * - `peer-disabled:` for disabled state\n *\n * @tokens `--color-primary`, `--color-primary-hover`,\n * `--color-accent`, `--color-accent-hover`,\n * `--color-warn`, `--color-warn-hover`,\n * `--color-muted`, `--color-muted-hover`,\n * `--color-disabled`, `--color-ring`, `--radius-pill`\n */\nexport const switchTrackVariants: (props?: {\n variant?: SwitchVariant;\n size?: SwitchSize;\n}) => string = cva(\n [\n 'com-switch__track',\n 'relative inline-flex shrink-0 cursor-pointer items-center',\n 'rounded-pill border-2 border-transparent',\n 'transition-colors duration-150',\n 'bg-muted hover:bg-muted-hover',\n 'peer-focus-visible:outline-[1px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-ring',\n 'peer-disabled:cursor-not-allowed peer-disabled:bg-disabled peer-disabled:hover:bg-disabled',\n ],\n {\n variants: {\n variant: {\n primary: [\n 'peer-checked:bg-primary peer-checked:hover:bg-primary-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n accent: [\n 'peer-checked:bg-accent peer-checked:hover:bg-accent-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n warn: [\n 'peer-checked:bg-warn peer-checked:hover:bg-warn-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n },\n size: {\n sm: 'h-5 w-9',\n md: 'h-6 w-11',\n lg: 'h-7 w-13',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n }\n);\n\n/** Size-based classes for the sliding thumb. */\nexport const SWITCH_THUMB_SIZES: Record<SwitchSize, string> = {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n};\n\n/** Size-based translate classes applied when the switch is checked. */\nexport const SWITCH_THUMB_TRANSLATE: Record<SwitchSize, string> = {\n sm: 'translate-x-4',\n md: 'translate-x-5',\n lg: 'translate-x-6',\n};\n\n/** Size-based classes for the label content. */\nexport const SWITCH_LABEL_SIZES: Record<SwitchSize, string> = {\n sm: 'text-sm ms-2',\n md: 'text-base ms-2.5',\n lg: 'text-lg ms-3',\n};\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n output,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type {\n InputSignal,\n ModelSignal,\n OutputEmitterRef,\n Signal,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport type { ControlValueAccessor } from '@angular/forms';\nimport {\n switchTrackVariants,\n SWITCH_THUMB_SIZES,\n SWITCH_THUMB_TRANSLATE,\n SWITCH_LABEL_SIZES,\n} from './switch.variants';\nimport type { SwitchSize, SwitchVariant } from './switch.variants';\n\n/** Event emitted when switch state changes. */\nexport interface SwitchChange {\n checked: boolean;\n source: ComSwitch;\n}\n\n/** Auto-incrementing ID counter for unique switch IDs. */\nlet nextId = 0;\n\n/**\n * Toggle switch component with full accessibility support.\n *\n * Uses a native `<input type=\"checkbox\" role=\"switch\">` for built-in keyboard\n * handling, `:checked` pseudo-class, and screen reader support.\n *\n * Implements `ControlValueAccessor` for Reactive Forms integration via\n * `NgControl` injection pattern (no `NG_VALUE_ACCESSOR` provider).\n *\n * @tokens `--color-primary`, `--color-primary-hover`,\n * `--color-accent`, `--color-accent-hover`,\n * `--color-warn`, `--color-warn-hover`,\n * `--color-muted`, `--color-muted-hover`,\n * `--color-background`, `--color-disabled`, `--color-disabled-foreground`,\n * `--color-ring`, `--radius-pill`\n *\n * @example Basic usage\n * ```html\n * <com-switch [(checked)]=\"darkMode\">Dark mode</com-switch>\n * ```\n *\n * @example With reactive forms\n * ```html\n * <com-switch formControlName=\"notifications\">Push notifications</com-switch>\n * ```\n *\n * @example Variants and sizes\n * ```html\n * <com-switch variant=\"accent\" size=\"lg\">Large accent switch</com-switch>\n * <com-switch variant=\"warn\" size=\"sm\">Small warning switch</com-switch>\n * ```\n */\n@Component({\n selector: 'com-switch',\n exportAs: 'comSwitch',\n template: `\n <label\n class=\"group relative inline-flex items-center\"\n [class.cursor-pointer]=\"!disabled()\"\n [class.cursor-not-allowed]=\"disabled()\"\n >\n <input\n #inputElement\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n [id]=\"inputId()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.name]=\"name()\"\n [attr.value]=\"value()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onTouched()\"\n />\n <span [class]=\"trackClasses()\">\n <span [class]=\"thumbClasses()\"></span>\n </span>\n <span [class]=\"labelClasses()\">\n <ng-content />\n </span>\n </label>\n `,\n styles: `\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'com-switch inline-block align-middle',\n '[class.com-switch--disabled]': 'disabled()',\n '[class.com-switch--checked]': 'checked()',\n },\n})\nexport class ComSwitch implements ControlValueAccessor {\n /** Optional NgControl for reactive forms integration. */\n readonly ngControl: NgControl | null = inject(NgControl, { optional: true, self: true });\n\n /** Reference to the native input element. */\n readonly inputRef: Signal<ElementRef<HTMLInputElement> | undefined> =\n viewChild<ElementRef<HTMLInputElement>>('inputElement');\n\n /** Unique ID for this switch instance. */\n private readonly uniqueId: string = `com-switch-${nextId++}`;\n\n // Inputs\n readonly size: InputSignal<SwitchSize> = input<SwitchSize>('md');\n readonly variant: InputSignal<SwitchVariant> = input<SwitchVariant>('primary');\n readonly checked: ModelSignal<boolean> = model<boolean>(false);\n readonly disabled: ModelSignal<boolean> = model<boolean>(false);\n readonly value: InputSignal<string | undefined> = input<string>();\n readonly name: InputSignal<string | undefined> = input<string>();\n readonly id: InputSignal<string | undefined> = input<string>();\n readonly ariaLabel: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-label' });\n readonly ariaLabelledby: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-labelledby' });\n readonly ariaDescribedby: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-describedby' });\n\n // Outputs\n readonly changed: OutputEmitterRef<SwitchChange> = output<SwitchChange>();\n\n // Computed state\n readonly inputId: Signal<string> = computed(() => this.id() ?? this.uniqueId);\n\n protected readonly trackClasses: Signal<string> = computed(() =>\n switchTrackVariants({ variant: this.variant(), size: this.size() })\n );\n\n protected readonly thumbClasses: Signal<string> = computed(() => {\n const base = `pointer-events-none block rounded-pill bg-background shadow-sm transition-transform duration-150 ${SWITCH_THUMB_SIZES[this.size()]}`;\n return this.checked() ? `${base} ${SWITCH_THUMB_TRANSLATE[this.size()]}` : base;\n });\n\n protected readonly labelClasses: Signal<string> = computed(() =>\n `com-switch__label select-none peer-disabled:cursor-not-allowed peer-disabled:text-disabled-foreground ${SWITCH_LABEL_SIZES[this.size()]}`\n );\n\n // CVA callbacks\n private onChange: (value: boolean) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n // ControlValueAccessor implementation\n writeValue(value: boolean): void {\n this.checked.set(value ?? false);\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n\n // Event handlers\n protected onInputChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n const newChecked = input.checked;\n\n this.checked.set(newChecked);\n this.onChange(newChecked);\n this.changed.emit({ checked: newChecked, source: this });\n }\n\n // Public API\n /** Focuses this switch's input element. */\n focus(): void {\n this.inputRef()?.nativeElement.focus();\n }\n\n /** Toggles the switch state programmatically. */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n const newChecked = !this.checked();\n this.checked.set(newChecked);\n this.onChange(newChecked);\n this.changed.emit({ checked: newChecked, source: this });\n }\n}\n","// Public API for the switch component\n\n// Main component\nexport { ComSwitch } from './switch.component';\n\n// Types\nexport type { SwitchChange } from './switch.component';\n\n// Variants (for advanced customization)\nexport {\n switchTrackVariants,\n SWITCH_THUMB_SIZES,\n SWITCH_THUMB_TRANSLATE,\n SWITCH_LABEL_SIZES,\n} from './switch.variants';\n\nexport type { SwitchSize, SwitchVariant } from './switch.variants';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAQA;;;;;;;;;;;;;AAaG;AACI,MAAM,mBAAmB,GAGjB,GAAG,CAChB;IACE,mBAAmB;IACnB,2DAA2D;IAC3D,0CAA0C;IAC1C,gCAAgC;IAChC,+BAA+B;IAC/B,sGAAsG;IACtG,4FAA4F;CAC7F,EACD;AACE,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EAAE;gBACP,6DAA6D;gBAC7D,wCAAwC;AACzC,aAAA;AACD,YAAA,MAAM,EAAE;gBACN,2DAA2D;gBAC3D,wCAAwC;AACzC,aAAA;AACD,YAAA,IAAI,EAAE;gBACJ,uDAAuD;gBACvD,wCAAwC;AACzC,aAAA;AACF,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,EAAE,EAAE,SAAS;AACb,YAAA,EAAE,EAAE,UAAU;AACd,YAAA,EAAE,EAAE,UAAU;AACf,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,IAAI,EAAE,IAAI;AACX,KAA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,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACjI1D;AAEA;;ACFA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-com-components-switch.mjs","sources":["../../../projects/com/components/switch/switch.variants.ts","../../../projects/com/components/switch/switch.component.ts","../../../projects/com/components/switch/index.ts","../../../projects/com/components/switch/ngx-com-components-switch.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\n/** Switch size variants. */\nexport type SwitchSize = 'sm' | 'md' | 'lg';\n\n/** Switch color variants. */\nexport type SwitchVariant = 'primary' | 'accent' | 'warn';\n\n/**\n * CVA variants for the switch track (pill-shaped container).\n *\n * Uses `peer` selectors to style based on native input state:\n * - `peer-checked:` for on state\n * - `peer-focus-visible:` for keyboard focus\n * - `peer-disabled:` for disabled state\n *\n * @tokens `--color-primary`, `--color-primary-hover`,\n * `--color-accent`, `--color-accent-hover`,\n * `--color-warn`, `--color-warn-hover`,\n * `--color-muted`, `--color-muted-hover`,\n * `--color-disabled`, `--color-ring`, `--radius-pill`\n */\nexport const switchTrackVariants: (props?: {\n variant?: SwitchVariant;\n size?: SwitchSize;\n}) => string = cva(\n [\n 'com-switch__track',\n 'relative inline-flex shrink-0 cursor-pointer items-center',\n 'rounded-pill border-2 border-transparent',\n 'transition-colors duration-150',\n 'bg-muted hover:bg-muted-hover',\n 'peer-focus-visible:outline-[1px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-ring',\n 'peer-disabled:cursor-not-allowed peer-disabled:bg-disabled peer-disabled:hover:bg-disabled',\n ],\n {\n variants: {\n variant: {\n primary: [\n 'peer-checked:bg-primary peer-checked:hover:bg-primary-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n accent: [\n 'peer-checked:bg-accent peer-checked:hover:bg-accent-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n warn: [\n 'peer-checked:bg-warn peer-checked:hover:bg-warn-hover',\n 'peer-disabled:peer-checked:bg-disabled',\n ],\n },\n size: {\n sm: 'h-5 w-9',\n md: 'h-6 w-11',\n lg: 'h-7 w-13',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n }\n);\n\n/** Size-based classes for the sliding thumb. */\nexport const SWITCH_THUMB_SIZES: Record<SwitchSize, string> = {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n};\n\n/** Size-based translate classes applied when the switch is checked. */\nexport const SWITCH_THUMB_TRANSLATE: Record<SwitchSize, string> = {\n sm: 'translate-x-4',\n md: 'translate-x-5',\n lg: 'translate-x-6',\n};\n\n/** Size-based classes for the label content. */\nexport const SWITCH_LABEL_SIZES: Record<SwitchSize, string> = {\n sm: 'text-sm ms-2',\n md: 'text-base ms-2.5',\n lg: 'text-lg ms-3',\n};\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n output,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type {\n InputSignal,\n ModelSignal,\n OutputEmitterRef,\n Signal,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport type { ControlValueAccessor } from '@angular/forms';\nimport {\n switchTrackVariants,\n SWITCH_THUMB_SIZES,\n SWITCH_THUMB_TRANSLATE,\n SWITCH_LABEL_SIZES,\n} from './switch.variants';\nimport type { SwitchSize, SwitchVariant } from './switch.variants';\n\n/** Event emitted when switch state changes. */\nexport interface SwitchChange {\n checked: boolean;\n source: ComSwitch;\n}\n\n/** Auto-incrementing ID counter for unique switch IDs. */\nlet nextId = 0;\n\n/**\n * Toggle switch component with full accessibility support.\n *\n * Uses a native `<input type=\"checkbox\" role=\"switch\">` for built-in keyboard\n * handling, `:checked` pseudo-class, and screen reader support.\n *\n * Implements `ControlValueAccessor` for Reactive Forms integration via\n * `NgControl` injection pattern (no `NG_VALUE_ACCESSOR` provider).\n *\n * @tokens `--color-primary`, `--color-primary-hover`,\n * `--color-accent`, `--color-accent-hover`,\n * `--color-warn`, `--color-warn-hover`,\n * `--color-muted`, `--color-muted-hover`,\n * `--color-background`, `--color-disabled`, `--color-disabled-foreground`,\n * `--color-ring`, `--radius-pill`\n *\n * @example Basic usage\n * ```html\n * <com-switch [(checked)]=\"darkMode\">Dark mode</com-switch>\n * ```\n *\n * @example With reactive forms\n * ```html\n * <com-switch formControlName=\"notifications\">Push notifications</com-switch>\n * ```\n *\n * @example Variants and sizes\n * ```html\n * <com-switch variant=\"accent\" size=\"lg\">Large accent switch</com-switch>\n * <com-switch variant=\"warn\" size=\"sm\">Small warning switch</com-switch>\n * ```\n */\n@Component({\n selector: 'com-switch',\n exportAs: 'comSwitch',\n template: `\n <label\n class=\"group relative inline-flex items-center\"\n [class.cursor-pointer]=\"!disabled()\"\n [class.cursor-not-allowed]=\"disabled()\"\n >\n <input\n #inputElement\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n [id]=\"inputId()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.name]=\"name()\"\n [attr.value]=\"htmlValue()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n />\n <span [class]=\"trackClasses()\">\n <span [class]=\"thumbClasses()\"></span>\n </span>\n <span [class]=\"labelClasses()\">\n <ng-content />\n </span>\n </label>\n `,\n styles: `\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'com-switch inline-block align-middle',\n '[class.com-switch--disabled]': 'disabled()',\n '[class.com-switch--checked]': 'checked()',\n },\n})\nexport class ComSwitch implements ControlValueAccessor {\n /** Optional NgControl for reactive forms integration. */\n readonly ngControl: NgControl | null = inject(NgControl, { optional: true, self: true });\n\n /** Reference to the native input element. */\n readonly inputRef: Signal<ElementRef<HTMLInputElement> | undefined> =\n viewChild<ElementRef<HTMLInputElement>>('inputElement');\n\n /** Unique ID for this switch instance. */\n private readonly uniqueId: string = `com-switch-${nextId++}`;\n\n // Inputs\n readonly size: InputSignal<SwitchSize> = input<SwitchSize>('md');\n readonly variant: InputSignal<SwitchVariant> = input<SwitchVariant>('primary');\n readonly checked: ModelSignal<boolean> = model<boolean>(false);\n readonly disabled: ModelSignal<boolean> = model<boolean>(false);\n readonly htmlValue: InputSignal<string | undefined> = input<string | undefined>(undefined, { alias: 'value' });\n readonly name: InputSignal<string | undefined> = input<string>();\n readonly id: InputSignal<string | undefined> = input<string>();\n readonly ariaLabel: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-label' });\n readonly ariaLabelledby: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-labelledby' });\n readonly ariaDescribedby: InputSignal<string | null> = input<string | null>(null, { alias: 'aria-describedby' });\n\n // Signal Forms inputs — set automatically by [formField] via setInputOnDirectives\n readonly touched: ModelSignal<boolean> = model<boolean>(false);\n readonly invalid: InputSignal<boolean> = input<boolean>(false);\n readonly sfErrors: InputSignal<readonly unknown[]> = input<readonly unknown[]>([], { alias: 'errors' });\n readonly sfRequired: InputSignal<boolean> = input<boolean>(false, { alias: 'required' });\n\n // Outputs\n readonly changed: OutputEmitterRef<SwitchChange> = output<SwitchChange>();\n\n // Computed state\n readonly inputId: Signal<string> = computed(() => this.id() ?? this.uniqueId);\n\n protected readonly trackClasses: Signal<string> = computed(() =>\n switchTrackVariants({ variant: this.variant(), size: this.size() })\n );\n\n protected readonly thumbClasses: Signal<string> = computed(() => {\n const base = `pointer-events-none block rounded-pill bg-background shadow-sm transition-transform duration-150 ${SWITCH_THUMB_SIZES[this.size()]}`;\n return this.checked() ? `${base} ${SWITCH_THUMB_TRANSLATE[this.size()]}` : base;\n });\n\n protected readonly labelClasses: Signal<string> = computed(() =>\n `com-switch__label select-none peer-disabled:cursor-not-allowed peer-disabled:text-disabled-foreground ${SWITCH_LABEL_SIZES[this.size()]}`\n );\n\n // CVA callbacks\n private onChange: (value: boolean) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n // ControlValueAccessor implementation\n writeValue(value: boolean): void {\n this.checked.set(value ?? false);\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n\n // Event handlers\n protected onBlur(): void {\n this.onTouched();\n this.touched.set(true);\n }\n\n protected onInputChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n const newChecked = input.checked;\n\n this.checked.set(newChecked);\n this.onChange(newChecked);\n this.changed.emit({ checked: newChecked, source: this });\n }\n\n // Public API\n /** Focuses this switch's input element. */\n focus(): void {\n this.inputRef()?.nativeElement.focus();\n }\n\n /** Toggles the switch state programmatically. */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n const newChecked = !this.checked();\n this.checked.set(newChecked);\n this.onChange(newChecked);\n this.changed.emit({ checked: newChecked, source: this });\n }\n}\n","// Public API for the switch component\n\n// Main component\nexport { ComSwitch } from './switch.component';\n\n// Types\nexport type { SwitchChange } from './switch.component';\n\n// Variants (for advanced customization)\nexport {\n switchTrackVariants,\n SWITCH_THUMB_SIZES,\n SWITCH_THUMB_TRANSLATE,\n SWITCH_LABEL_SIZES,\n} from './switch.variants';\n\nexport type { SwitchSize, SwitchVariant } from './switch.variants';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],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UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACjI1D;AAEA;;ACFA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-com",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/avs2001/ngx-com"
|
|
@@ -111,6 +111,10 @@
|
|
|
111
111
|
"types": "./types/ngx-com-components-menu.d.ts",
|
|
112
112
|
"default": "./fesm2022/ngx-com-components-menu.mjs"
|
|
113
113
|
},
|
|
114
|
+
"./components/native-control": {
|
|
115
|
+
"types": "./types/ngx-com-components-native-control.d.ts",
|
|
116
|
+
"default": "./fesm2022/ngx-com-components-native-control.mjs"
|
|
117
|
+
},
|
|
114
118
|
"./components/paginator": {
|
|
115
119
|
"types": "./types/ngx-com-components-paginator.d.ts",
|
|
116
120
|
"default": "./fesm2022/ngx-com-components-paginator.mjs"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, InputSignal, TemplateRef, OutputEmitterRef, Signal, WritableSignal, Provider, OnDestroy } from '@angular/core';
|
|
2
|
+
import { InjectionToken, InputSignal, TemplateRef, OutputEmitterRef, Signal, WritableSignal, Provider, OnDestroy, ModelSignal } from '@angular/core';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import { ControlValueAccessor, Validator, ValidationErrors } from '@angular/forms';
|
|
4
|
+
import { ControlValueAccessor, Validator, NgControl, ValidationErrors } from '@angular/forms';
|
|
5
5
|
import { IconSize } from 'ngx-com/components/icon';
|
|
6
|
+
import { FormFieldControl, ErrorStateMatcher, FormFieldAppearance } from 'ngx-com/components/form-field';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Calendar shared types and interfaces
|
|
@@ -1210,7 +1211,7 @@ type DatepickerPanelWidth = 'auto' | 'trigger' | `${number}px` | `${number}rem`;
|
|
|
1210
1211
|
/** Size variants for datepicker components */
|
|
1211
1212
|
type DatepickerSize = 'sm' | 'default' | 'lg';
|
|
1212
1213
|
/** Visual variant for datepicker trigger */
|
|
1213
|
-
type DatepickerVariant = 'default' | 'outline' | 'ghost' | 'filled';
|
|
1214
|
+
type DatepickerVariant = 'default' | 'outline' | 'ghost' | 'filled' | 'naked';
|
|
1214
1215
|
/** Validation state for datepicker */
|
|
1215
1216
|
type DatepickerState = 'default' | 'error' | 'success';
|
|
1216
1217
|
/** Configuration for datepicker footer actions */
|
|
@@ -1347,7 +1348,7 @@ declare function generateTimePickerId(): string;
|
|
|
1347
1348
|
/** Size variants for time picker */
|
|
1348
1349
|
type TimePickerSize = 'sm' | 'default' | 'lg';
|
|
1349
1350
|
/** Visual variant */
|
|
1350
|
-
type TimePickerVariant = 'standalone' | 'embedded';
|
|
1351
|
+
type TimePickerVariant = 'standalone' | 'embedded' | 'naked';
|
|
1351
1352
|
/** Validation state */
|
|
1352
1353
|
type TimePickerState = 'default' | 'error' | 'success';
|
|
1353
1354
|
/** Period for 12-hour format */
|
|
@@ -1377,15 +1378,18 @@ type TimeSegment = 'hours' | 'minutes' | 'seconds';
|
|
|
1377
1378
|
* />
|
|
1378
1379
|
* ```
|
|
1379
1380
|
*/
|
|
1380
|
-
declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDestroy {
|
|
1381
|
+
declare class ComDatepicker<D> implements ControlValueAccessor, FormFieldControl<D | null>, Validator, OnDestroy {
|
|
1381
1382
|
private readonly elementRef;
|
|
1382
1383
|
private readonly destroyRef;
|
|
1383
1384
|
private readonly overlay;
|
|
1384
1385
|
private readonly viewContainerRef;
|
|
1385
1386
|
private readonly document;
|
|
1386
1387
|
private readonly dateAdapter;
|
|
1387
|
-
/**
|
|
1388
|
-
|
|
1388
|
+
/** NgControl bound to this datepicker (if using reactive forms). */
|
|
1389
|
+
readonly ngControl: NgControl | null;
|
|
1390
|
+
private readonly defaultErrorStateMatcher;
|
|
1391
|
+
private readonly parentForm;
|
|
1392
|
+
private readonly parentFormGroup;
|
|
1389
1393
|
/** Reference to the trigger element. */
|
|
1390
1394
|
private readonly triggerRef;
|
|
1391
1395
|
/** Reference to the input element. */
|
|
@@ -1397,7 +1401,7 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1397
1401
|
/** Unique ID for the datepicker. */
|
|
1398
1402
|
private readonly datepickerId;
|
|
1399
1403
|
/** Current value. */
|
|
1400
|
-
readonly value:
|
|
1404
|
+
readonly value: ModelSignal<D | null>;
|
|
1401
1405
|
/** Minimum selectable date. */
|
|
1402
1406
|
readonly min: InputSignal<D | null>;
|
|
1403
1407
|
/** Maximum selectable date. */
|
|
@@ -1444,6 +1448,11 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1444
1448
|
readonly ariaLabel: InputSignal<string | null>;
|
|
1445
1449
|
/** ID of element describing the input. */
|
|
1446
1450
|
readonly ariaDescribedBy: InputSignal<string | null>;
|
|
1451
|
+
/** Custom error state matcher for determining when to show errors. */
|
|
1452
|
+
readonly errorStateMatcher: InputSignal<ErrorStateMatcher | undefined>;
|
|
1453
|
+
readonly touched: ModelSignal<boolean>;
|
|
1454
|
+
readonly invalid: InputSignal<boolean>;
|
|
1455
|
+
readonly sfErrors: InputSignal<readonly unknown[]>;
|
|
1447
1456
|
/** Whether to show the time picker below the calendar. */
|
|
1448
1457
|
readonly showTimePicker: InputSignal<boolean>;
|
|
1449
1458
|
/** 12h vs 24h format for the time picker. `null` = auto-detect. */
|
|
@@ -1466,7 +1475,30 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1466
1475
|
readonly calendarActiveDate: WritableSignal<D>;
|
|
1467
1476
|
/** Live announcements for screen readers. */
|
|
1468
1477
|
readonly liveAnnouncement: WritableSignal<string>;
|
|
1469
|
-
/**
|
|
1478
|
+
/** Whether the input is focused (not panel). */
|
|
1479
|
+
private readonly _inputFocused;
|
|
1480
|
+
/** IDs for aria-describedby (set by form-field). */
|
|
1481
|
+
private readonly _describedByIds;
|
|
1482
|
+
/** Form field appearance (set by form-field). */
|
|
1483
|
+
private readonly _appearance;
|
|
1484
|
+
/** Whether the datepicker is focused (input focused or panel open). Implements FormFieldControl. */
|
|
1485
|
+
readonly focused: Signal<boolean>;
|
|
1486
|
+
/** Whether the label should float. Label floats when focused or has a value. */
|
|
1487
|
+
readonly shouldLabelFloat: Signal<boolean>;
|
|
1488
|
+
/** Whether the control is in an error state. Implements FormFieldControl. */
|
|
1489
|
+
readonly errorState: Signal<boolean>;
|
|
1490
|
+
/** Structured validation errors from Signal Forms, exposed for the parent form field. */
|
|
1491
|
+
readonly errors: Signal<readonly unknown[] | null>;
|
|
1492
|
+
/** Unique ID for the control. Implements FormFieldControl. */
|
|
1493
|
+
readonly id: Signal<string>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Effective state combining manual state with automatic error detection.
|
|
1496
|
+
* Manual state takes precedence over auto-detected error state.
|
|
1497
|
+
*/
|
|
1498
|
+
readonly effectiveState: Signal<DatepickerState>;
|
|
1499
|
+
/** Combined aria-describedby from form-field and manual input. */
|
|
1500
|
+
readonly effectiveAriaDescribedBy: Signal<string | null>;
|
|
1501
|
+
/** Input element ID (alias for FormFieldControl id). */
|
|
1470
1502
|
readonly inputId: Signal<string>;
|
|
1471
1503
|
/** Panel element ID. */
|
|
1472
1504
|
readonly panelId: Signal<string>;
|
|
@@ -1521,6 +1553,7 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1521
1553
|
clear(event?: Event): void;
|
|
1522
1554
|
/** Selects today's date. */
|
|
1523
1555
|
selectToday(): void;
|
|
1556
|
+
protected onInputFocus(): void;
|
|
1524
1557
|
protected onTriggerClick(): void;
|
|
1525
1558
|
protected onTriggerKeydown(event: KeyboardEvent): void;
|
|
1526
1559
|
protected onInputKeydown(event: KeyboardEvent): void;
|
|
@@ -1530,6 +1563,21 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1530
1563
|
protected onDateSelected(date: D): void;
|
|
1531
1564
|
protected onTimeChange(time: ComTimeValue | null): void;
|
|
1532
1565
|
protected onActiveDateChange(date: D): void;
|
|
1566
|
+
/**
|
|
1567
|
+
* Called when the form field container is clicked.
|
|
1568
|
+
* Implements FormFieldControl.
|
|
1569
|
+
*/
|
|
1570
|
+
onContainerClick(event: MouseEvent): void;
|
|
1571
|
+
/**
|
|
1572
|
+
* Sets the describedBy IDs from the form field.
|
|
1573
|
+
* Called by the parent form field component.
|
|
1574
|
+
*/
|
|
1575
|
+
setDescribedByIds(ids: string): void;
|
|
1576
|
+
/**
|
|
1577
|
+
* Sets the appearance for styling.
|
|
1578
|
+
* Called by the parent form field component.
|
|
1579
|
+
*/
|
|
1580
|
+
setAppearance(appearance: FormFieldAppearance): void;
|
|
1533
1581
|
private createOverlay;
|
|
1534
1582
|
private destroyOverlay;
|
|
1535
1583
|
private updateValue;
|
|
@@ -1537,7 +1585,7 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1537
1585
|
private isDateValid;
|
|
1538
1586
|
private announce;
|
|
1539
1587
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComDatepicker<any>, never>;
|
|
1540
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ComDatepicker<any>, "com-datepicker", ["comDatepicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "startView": { "alias": "startView"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "dateFormat"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showTodayButton": { "alias": "showTodayButton"; "required": false; "isSignal": true; }; "showFooterClearButton": { "alias": "showFooterClearButton"; "required": false; "isSignal": true; }; "keepOpen": { "alias": "keepOpen"; "required": false; "isSignal": true; }; "allowManualInput": { "alias": "allowManualInput"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "showTimePicker": { "alias": "showTimePicker"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, { "dateChange": "dateChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
1588
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComDatepicker<any>, "com-datepicker", ["comDatepicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "startView": { "alias": "startView"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "dateFormat"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showTodayButton": { "alias": "showTodayButton"; "required": false; "isSignal": true; }; "showFooterClearButton": { "alias": "showFooterClearButton"; "required": false; "isSignal": true; }; "keepOpen": { "alias": "keepOpen"; "required": false; "isSignal": true; }; "allowManualInput": { "alias": "allowManualInput"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "sfErrors": { "alias": "errors"; "required": false; "isSignal": true; }; "showTimePicker": { "alias": "showTimePicker"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "touched": "touchedChange"; "dateChange": "dateChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
1541
1589
|
}
|
|
1542
1590
|
|
|
1543
1591
|
/**
|
|
@@ -1563,15 +1611,18 @@ declare class ComDatepicker<D> implements ControlValueAccessor, Validator, OnDes
|
|
|
1563
1611
|
* />
|
|
1564
1612
|
* ```
|
|
1565
1613
|
*/
|
|
1566
|
-
declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator, OnDestroy {
|
|
1614
|
+
declare class ComDateRangePicker<D> implements ControlValueAccessor, FormFieldControl<DateRangeValue<D> | null>, Validator, OnDestroy {
|
|
1567
1615
|
private readonly elementRef;
|
|
1568
1616
|
private readonly destroyRef;
|
|
1569
1617
|
private readonly overlay;
|
|
1570
1618
|
private readonly viewContainerRef;
|
|
1571
1619
|
private readonly document;
|
|
1572
1620
|
private readonly dateAdapter;
|
|
1573
|
-
/**
|
|
1574
|
-
|
|
1621
|
+
/** NgControl bound to this date range picker (if using reactive forms). */
|
|
1622
|
+
readonly ngControl: NgControl | null;
|
|
1623
|
+
private readonly defaultErrorStateMatcher;
|
|
1624
|
+
private readonly parentForm;
|
|
1625
|
+
private readonly parentFormGroup;
|
|
1575
1626
|
/** Reference to the trigger element. */
|
|
1576
1627
|
private readonly triggerRef;
|
|
1577
1628
|
/** Reference to the start input element. */
|
|
@@ -1585,7 +1636,7 @@ declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator,
|
|
|
1585
1636
|
/** Unique ID for the datepicker. */
|
|
1586
1637
|
private readonly datepickerId;
|
|
1587
1638
|
/** Current value. */
|
|
1588
|
-
readonly value:
|
|
1639
|
+
readonly value: ModelSignal<DateRangeValue<D> | null>;
|
|
1589
1640
|
/** Minimum selectable date. */
|
|
1590
1641
|
readonly min: InputSignal<D | null>;
|
|
1591
1642
|
/** Maximum selectable date. */
|
|
@@ -1634,6 +1685,11 @@ declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator,
|
|
|
1634
1685
|
readonly startAriaLabel: InputSignal<string | null>;
|
|
1635
1686
|
/** Accessible label for the end input. */
|
|
1636
1687
|
readonly endAriaLabel: InputSignal<string | null>;
|
|
1688
|
+
/** Custom error state matcher for determining when to show errors. */
|
|
1689
|
+
readonly errorStateMatcher: InputSignal<ErrorStateMatcher | undefined>;
|
|
1690
|
+
readonly touched: ModelSignal<boolean>;
|
|
1691
|
+
readonly invalid: InputSignal<boolean>;
|
|
1692
|
+
readonly sfErrors: InputSignal<readonly unknown[]>;
|
|
1637
1693
|
/** Whether to show time pickers below the calendar. */
|
|
1638
1694
|
readonly showTimePicker: InputSignal<boolean>;
|
|
1639
1695
|
/** 12h vs 24h format for the time pickers. `null` = auto-detect. */
|
|
@@ -1658,7 +1714,29 @@ declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator,
|
|
|
1658
1714
|
readonly calendarActiveDate: WritableSignal<D>;
|
|
1659
1715
|
/** Live announcements for screen readers. */
|
|
1660
1716
|
readonly liveAnnouncement: WritableSignal<string>;
|
|
1661
|
-
/**
|
|
1717
|
+
/** Whether any input is focused. */
|
|
1718
|
+
private readonly _inputFocused;
|
|
1719
|
+
/** IDs for aria-describedby (set by form-field). */
|
|
1720
|
+
private readonly _describedByIds;
|
|
1721
|
+
/** Form field appearance (set by form-field). */
|
|
1722
|
+
private readonly _appearance;
|
|
1723
|
+
/** Whether the date range picker is focused. Implements FormFieldControl. */
|
|
1724
|
+
readonly focused: Signal<boolean>;
|
|
1725
|
+
/** Whether the label should float. */
|
|
1726
|
+
readonly shouldLabelFloat: Signal<boolean>;
|
|
1727
|
+
/** Whether the control is in an error state. Implements FormFieldControl. */
|
|
1728
|
+
readonly errorState: Signal<boolean>;
|
|
1729
|
+
/** Structured validation errors from Signal Forms. */
|
|
1730
|
+
readonly errors: Signal<readonly unknown[] | null>;
|
|
1731
|
+
/** Unique ID for the control (maps to start input). Implements FormFieldControl. */
|
|
1732
|
+
readonly id: Signal<string>;
|
|
1733
|
+
/**
|
|
1734
|
+
* Effective state combining manual state with automatic error detection.
|
|
1735
|
+
*/
|
|
1736
|
+
readonly effectiveState: Signal<DatepickerState>;
|
|
1737
|
+
/** Combined aria-describedby from form-field. */
|
|
1738
|
+
readonly effectiveAriaDescribedBy: Signal<string | null>;
|
|
1739
|
+
/** Start input element ID (alias for FormFieldControl id). */
|
|
1662
1740
|
readonly startInputId: Signal<string>;
|
|
1663
1741
|
/** End input element ID. */
|
|
1664
1742
|
readonly endInputId: Signal<string>;
|
|
@@ -1739,6 +1817,21 @@ declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator,
|
|
|
1739
1817
|
protected onActiveDateChange(date: D): void;
|
|
1740
1818
|
protected onStartTimeChange(time: ComTimeValue | null): void;
|
|
1741
1819
|
protected onEndTimeChange(time: ComTimeValue | null): void;
|
|
1820
|
+
/**
|
|
1821
|
+
* Called when the form field container is clicked.
|
|
1822
|
+
* Implements FormFieldControl.
|
|
1823
|
+
*/
|
|
1824
|
+
onContainerClick(event: MouseEvent): void;
|
|
1825
|
+
/**
|
|
1826
|
+
* Sets the describedBy IDs from the form field.
|
|
1827
|
+
* Called by the parent form field component.
|
|
1828
|
+
*/
|
|
1829
|
+
setDescribedByIds(ids: string): void;
|
|
1830
|
+
/**
|
|
1831
|
+
* Sets the appearance for styling.
|
|
1832
|
+
* Called by the parent form field component.
|
|
1833
|
+
*/
|
|
1834
|
+
setAppearance(appearance: FormFieldAppearance): void;
|
|
1742
1835
|
private createOverlay;
|
|
1743
1836
|
private destroyOverlay;
|
|
1744
1837
|
private updateValue;
|
|
@@ -1748,7 +1841,7 @@ declare class ComDateRangePicker<D> implements ControlValueAccessor, Validator,
|
|
|
1748
1841
|
private formatDate;
|
|
1749
1842
|
private announce;
|
|
1750
1843
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComDateRangePicker<any>, never>;
|
|
1751
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ComDateRangePicker<any>, "com-date-range-picker", ["comDateRangePicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "startView": { "alias": "startView"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "startPlaceholder": { "alias": "startPlaceholder"; "required": false; "isSignal": true; }; "endPlaceholder": { "alias": "endPlaceholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "dateFormat"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showTodayButton": { "alias": "showTodayButton"; "required": false; "isSignal": true; }; "showFooterClearButton": { "alias": "showFooterClearButton"; "required": false; "isSignal": true; }; "keepOpen": { "alias": "keepOpen"; "required": false; "isSignal": true; }; "allowManualInput": { "alias": "allowManualInput"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "startAriaLabel": { "alias": "startAriaLabel"; "required": false; "isSignal": true; }; "endAriaLabel": { "alias": "endAriaLabel"; "required": false; "isSignal": true; }; "showTimePicker": { "alias": "showTimePicker"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, { "rangeChange": "rangeChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
1844
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComDateRangePicker<any>, "com-date-range-picker", ["comDateRangePicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "startView": { "alias": "startView"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "startPlaceholder": { "alias": "startPlaceholder"; "required": false; "isSignal": true; }; "endPlaceholder": { "alias": "endPlaceholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "dateFormat"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showTodayButton": { "alias": "showTodayButton"; "required": false; "isSignal": true; }; "showFooterClearButton": { "alias": "showFooterClearButton"; "required": false; "isSignal": true; }; "keepOpen": { "alias": "keepOpen"; "required": false; "isSignal": true; }; "allowManualInput": { "alias": "allowManualInput"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "startAriaLabel": { "alias": "startAriaLabel"; "required": false; "isSignal": true; }; "endAriaLabel": { "alias": "endAriaLabel"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "sfErrors": { "alias": "errors"; "required": false; "isSignal": true; }; "showTimePicker": { "alias": "showTimePicker"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "touched": "touchedChange"; "rangeChange": "rangeChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
1752
1845
|
}
|
|
1753
1846
|
|
|
1754
1847
|
/**
|
|
@@ -1845,18 +1938,21 @@ type TimepickerLabelVariants = VariantProps<typeof timepickerLabelVariants>;
|
|
|
1845
1938
|
* <com-time-picker variant="embedded" [value]="time" (timeChange)="onTime($event)" />
|
|
1846
1939
|
* ```
|
|
1847
1940
|
*/
|
|
1848
|
-
declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
1941
|
+
declare class ComTimePicker implements ControlValueAccessor, FormFieldControl<ComTimeValue | null>, Validator {
|
|
1849
1942
|
private readonly localeId;
|
|
1850
|
-
|
|
1943
|
+
readonly ngControl: NgControl | null;
|
|
1944
|
+
private readonly defaultErrorStateMatcher;
|
|
1945
|
+
private readonly parentForm;
|
|
1946
|
+
private readonly parentFormGroup;
|
|
1851
1947
|
private readonly timepickerId;
|
|
1852
1948
|
private readonly hoursInputRef;
|
|
1853
1949
|
private readonly minutesInputRef;
|
|
1854
1950
|
private readonly secondsInputRef;
|
|
1855
1951
|
private readonly periodButtonRef;
|
|
1856
1952
|
/** Current time value. */
|
|
1857
|
-
readonly value:
|
|
1953
|
+
readonly value: ModelSignal<ComTimeValue | null>;
|
|
1858
1954
|
/** Whether the time picker is disabled. */
|
|
1859
|
-
readonly disabled:
|
|
1955
|
+
readonly disabled: ModelSignal<boolean>;
|
|
1860
1956
|
/** Whether the time picker is required. */
|
|
1861
1957
|
readonly required: InputSignal<boolean>;
|
|
1862
1958
|
/** Whether to show the seconds segment. */
|
|
@@ -1883,6 +1979,11 @@ declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
|
1883
1979
|
readonly userClass: InputSignal<string>;
|
|
1884
1980
|
/** Placeholder text for empty segments. */
|
|
1885
1981
|
readonly placeholder: InputSignal<string>;
|
|
1982
|
+
/** Custom error state matcher for determining when to show errors. */
|
|
1983
|
+
readonly errorStateMatcher: InputSignal<ErrorStateMatcher | undefined>;
|
|
1984
|
+
readonly touched: ModelSignal<boolean>;
|
|
1985
|
+
readonly invalid: InputSignal<boolean>;
|
|
1986
|
+
readonly sfErrors: InputSignal<readonly unknown[]>;
|
|
1886
1987
|
/** Emitted when time value changes. */
|
|
1887
1988
|
readonly timeChange: OutputEmitterRef<ComTimeValue | null>;
|
|
1888
1989
|
/** Internal value state. */
|
|
@@ -1893,6 +1994,26 @@ declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
|
1893
1994
|
readonly pendingDigits: WritableSignal<string>;
|
|
1894
1995
|
/** Live announcements for screen readers. */
|
|
1895
1996
|
readonly liveAnnouncement: WritableSignal<string>;
|
|
1997
|
+
/** IDs for aria-describedby (set by form-field). */
|
|
1998
|
+
private readonly _describedByIds;
|
|
1999
|
+
/** Form field appearance (set by form-field). */
|
|
2000
|
+
private readonly _appearance;
|
|
2001
|
+
/** Whether the time picker is focused. Implements FormFieldControl. */
|
|
2002
|
+
readonly focused: Signal<boolean>;
|
|
2003
|
+
/** Whether the label should float. */
|
|
2004
|
+
readonly shouldLabelFloat: Signal<boolean>;
|
|
2005
|
+
/** Whether the control is in an error state. Implements FormFieldControl. */
|
|
2006
|
+
readonly errorState: Signal<boolean>;
|
|
2007
|
+
/** Structured validation errors from Signal Forms. */
|
|
2008
|
+
readonly errors: Signal<readonly unknown[] | null>;
|
|
2009
|
+
/** Unique ID for the control (maps to hours input). Implements FormFieldControl. */
|
|
2010
|
+
readonly id: Signal<string>;
|
|
2011
|
+
/**
|
|
2012
|
+
* Effective state combining manual state with automatic error detection.
|
|
2013
|
+
*/
|
|
2014
|
+
readonly effectiveState: Signal<TimePickerState>;
|
|
2015
|
+
/** Combined aria-describedby from form-field. */
|
|
2016
|
+
readonly effectiveAriaDescribedBy: Signal<string | null>;
|
|
1896
2017
|
/** Whether to use 12-hour format. */
|
|
1897
2018
|
readonly is12Hour: Signal<boolean>;
|
|
1898
2019
|
/** Current period (AM/PM). */
|
|
@@ -1920,7 +2041,7 @@ declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
|
1920
2041
|
writeValue(value: ComTimeValue | null): void;
|
|
1921
2042
|
registerOnChange(fn: (value: ComTimeValue | null) => void): void;
|
|
1922
2043
|
registerOnTouched(fn: () => void): void;
|
|
1923
|
-
setDisabledState(
|
|
2044
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1924
2045
|
validate(): ValidationErrors | null;
|
|
1925
2046
|
registerOnValidatorChange(fn: () => void): void;
|
|
1926
2047
|
protected onSegmentFocus(segment: TimeSegment): void;
|
|
@@ -1929,6 +2050,21 @@ declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
|
1929
2050
|
protected onSegmentKeydown(event: KeyboardEvent, segment: TimeSegment): void;
|
|
1930
2051
|
protected onPeriodKeydown(event: KeyboardEvent): void;
|
|
1931
2052
|
protected togglePeriod(): void;
|
|
2053
|
+
/**
|
|
2054
|
+
* Called when the form field container is clicked.
|
|
2055
|
+
* Implements FormFieldControl.
|
|
2056
|
+
*/
|
|
2057
|
+
onContainerClick(_event: MouseEvent): void;
|
|
2058
|
+
/**
|
|
2059
|
+
* Sets the describedBy IDs from the form field.
|
|
2060
|
+
* Called by the parent form field component.
|
|
2061
|
+
*/
|
|
2062
|
+
setDescribedByIds(ids: string): void;
|
|
2063
|
+
/**
|
|
2064
|
+
* Sets the appearance for styling.
|
|
2065
|
+
* Called by the parent form field component.
|
|
2066
|
+
*/
|
|
2067
|
+
setAppearance(appearance: FormFieldAppearance): void;
|
|
1932
2068
|
private setPeriod;
|
|
1933
2069
|
private incrementSegment;
|
|
1934
2070
|
private handleDigitInput;
|
|
@@ -1939,7 +2075,7 @@ declare class ComTimePicker implements ControlValueAccessor, Validator {
|
|
|
1939
2075
|
private focusPrevSegment;
|
|
1940
2076
|
private updateValue;
|
|
1941
2077
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComTimePicker, never>;
|
|
1942
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ComTimePicker, "com-time-picker", ["comTimePicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "minTime": { "alias": "minTime"; "required": false; "isSignal": true; }; "maxTime": { "alias": "maxTime"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; }, { "timeChange": "timeChange"; }, never, never, true, never>;
|
|
2078
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComTimePicker, "com-time-picker", ["comTimePicker"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "use12HourFormat": { "alias": "use12HourFormat"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "minTime": { "alias": "minTime"; "required": false; "isSignal": true; }; "maxTime": { "alias": "maxTime"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "sfErrors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "disabled": "disabledChange"; "touched": "touchedChange"; "timeChange": "timeChange"; }, never, never, true, never>;
|
|
1943
2079
|
}
|
|
1944
2080
|
|
|
1945
2081
|
export { CALENDAR_SELECTION_STRATEGY, CalendarSelectionStrategy, CalendarViewBase, ComCalendar, ComCalendarCell, ComCalendarHeader, ComCalendarMonthView, ComCalendarMultiYearView, ComCalendarYearView, ComDateRangePicker, ComDatepicker, ComTimePicker, DATE_ADAPTER, DAYS_PER_WEEK, DateAdapter, MONTHS_PER_ROW, MultiSelectionStrategy, NativeDateAdapter, RangeSelectionStrategy, SingleSelectionStrategy, WEEKS_PER_MONTH, WeekSelectionStrategy, YEARS_PER_PAGE, YEARS_PER_ROW, calendarCellVariants, calendarCellWrapperVariants, calendarHeaderButtonVariants, calendarHeaderVariants, calendarVariants, compareTime, createCalendarCell, createDateRange, createDateRangeValue, createGrid, createTimeValue, datepickerClearVariants, datepickerDisabledVariants, datepickerFooterButtonVariants, datepickerFooterVariants, datepickerIconVariants, datepickerInputVariants, datepickerPanelVariants, datepickerRangeSeparatorVariants, datepickerTriggerVariants, generateDatepickerId, generateTimePickerId, getMultiYearStartingYear, getWeekdayHeaders, isDateDisabled, isMonthDisabled, isYearDisabled, navigateGrid, provideMultiSelectionStrategy, provideNativeDateAdapter, provideRangeSelectionStrategy, provideSingleSelectionStrategy, provideWeekSelectionStrategy, timepickerContainerVariants, timepickerDisabledVariants, timepickerLabelVariants, timepickerPeriodVariants, timepickerSectionVariants, timepickerSegmentVariants, timepickerSeparatorVariants };
|