@progress/kendo-angular-label 21.4.1-develop.1 → 22.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,157 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { getRootElement, inputElementHasAttr, isInputElement, nativeLabelForTargets } from './util';
6
- import { Directive, Input, HostBinding, ElementRef, Renderer2, NgZone } from '@angular/core';
7
- import { isDocumentAvailable, guid } from '@progress/kendo-angular-common';
8
- import * as i0 from "@angular/core";
9
- /**
10
- * Represents the [Kendo UI Label directive for Angular]({% slug label_directive %}).
11
- * Use the `LabelDirective` to link a focusable Angular component or HTML element to a `<label>` tag with the `[for]` property binding.
12
- *
13
- * To link a component with the `label` element:
14
- * - Set the `[for]` property binding to a [template reference variable](link:site.data.urls.angular['templatesyntax']#template-reference-variables--var-), or
15
- * - Set the `[for]` property binding to an `id` HTML string value.
16
- *
17
- * @example
18
- * ```ts
19
- * @Component({
20
- * selector: 'my-app',
21
- * template: `
22
- * <div class="row example-wrapper" style="min-height: 450px;">
23
- * <div class="col-xs-12 col-md-6 example-col">
24
- * <label [for]="datepicker">DatePicker: </label>
25
- * <kendo-datepicker #datepicker></kendo-datepicker>
26
- * </div>
27
- *
28
- * <div class="col-xs-12 col-md-6 example-col">
29
- * <label for="input">Input: </label>
30
- * <input id="input" />
31
- * </div>
32
- * </div>
33
- * `
34
- * })
35
- * class AppComponent { }
36
- * ```
37
- */
38
- export class LabelDirective {
39
- label;
40
- renderer;
41
- zone;
42
- /**
43
- * Sets the focusable target for the label.
44
- * Accepts a [template reference variable](link:site.data.urls.angular['templatesyntax']#template-reference-variables--var-) or an `id` HTML string value.
45
- */
46
- for;
47
- get labelFor() {
48
- if (typeof this.for === 'string') {
49
- return this.for;
50
- }
51
- if (!isDocumentAvailable()) {
52
- return null;
53
- }
54
- const component = this.getFocusableComponent() || {};
55
- if (isInputElement(component) && !inputElementHasAttr(component, 'id')) {
56
- this.renderer.setAttribute(component, 'id', `k-${guid()}`);
57
- }
58
- return component.focusableId || component.id || null;
59
- }
60
- /**
61
- * @hidden
62
- * Allows the user to specify if the label CSS class should be rendered or not.
63
- */
64
- labelClass = true;
65
- clickListener;
66
- constructor(label, renderer, zone) {
67
- this.label = label;
68
- this.renderer = renderer;
69
- this.zone = zone;
70
- }
71
- /**
72
- * @hidden
73
- */
74
- ngAfterViewInit() {
75
- this.setAriaLabelledby();
76
- this.zone.runOutsideAngular(() => this.clickListener = this.renderer.listen(this.label.nativeElement, 'click', this.handleClick));
77
- }
78
- /**
79
- * @hidden
80
- */
81
- ngOnDestroy() {
82
- if (this.clickListener) {
83
- this.clickListener();
84
- }
85
- }
86
- /**
87
- * @hidden
88
- */
89
- setAriaLabelledby() {
90
- if (!isDocumentAvailable()) {
91
- return;
92
- }
93
- const component = this.getFocusableComponent();
94
- if (component && component.focusableId) {
95
- const rootElement = getRootElement(this.label.nativeElement);
96
- const labelTarget = rootElement.querySelector(`#${component.focusableId}`);
97
- const labelElement = this.label.nativeElement;
98
- const id = labelElement.id || `k-${guid()}`;
99
- if (!labelElement.getAttribute('id')) {
100
- this.renderer.setAttribute(labelElement, 'id', id);
101
- }
102
- // Editor in iframe mode needs special treatment
103
- if (component.focusableId.startsWith('k-editor') && component.iframe) {
104
- component.contentAreaLoaded.subscribe(() => {
105
- this.zone.runOutsideAngular(() => {
106
- setTimeout(() => {
107
- const editableElement = component.container.element.nativeElement.contentDocument.body.firstElementChild;
108
- this.renderer.setAttribute(editableElement, 'aria-label', labelElement.textContent);
109
- });
110
- });
111
- });
112
- }
113
- if (!labelTarget) {
114
- return;
115
- }
116
- const existingAriaLabelledBy = labelTarget.hasAttribute('aria-labelledby') && labelTarget.getAttribute('aria-labelledby');
117
- // DropDowns with focusable input elements rely on the aria-labelledby attribute to set the same attribute on their popup listbox element
118
- // On the other hand, the aria-labelledby attribute is redundant on the Input element when there is label[for] association -
119
- // https://feedback.telerik.com/kendo-angular-ui/1648203-remove-aria-labelledby-when-native-html-elements-are-associated.
120
- // This addresses both cases, setting a special data-kendo-label-id attribute to be used internally by other components when the aria-describedby one is not applicable.
121
- this.renderer.setAttribute(labelTarget, nativeLabelForTargets.includes(labelTarget.tagName) ? 'data-kendo-label-id' : 'aria-labelledby', existingAriaLabelledBy && existingAriaLabelledBy !== id ? `${existingAriaLabelledBy} ${id}` : id);
122
- }
123
- }
124
- getFocusableComponent() {
125
- const target = this.for;
126
- return target && target.focus !== undefined ? target : null;
127
- }
128
- handleClick = () => {
129
- const component = this.getFocusableComponent();
130
- if (!component) {
131
- return;
132
- }
133
- if (component.focus) {
134
- component.focus();
135
- }
136
- };
137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
138
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LabelDirective, isStandalone: true, selector: "label[for]", inputs: { for: "for", labelClass: "labelClass" }, host: { properties: { "attr.for": "this.labelFor", "class.k-label": "this.labelClass" } }, ngImport: i0 });
139
- }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelDirective, decorators: [{
141
- type: Directive,
142
- args: [{
143
- // eslint-disable-next-line @angular-eslint/directive-selector
144
- selector: 'label[for]',
145
- standalone: true
146
- }]
147
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { for: [{
148
- type: Input
149
- }], labelFor: [{
150
- type: HostBinding,
151
- args: ['attr.for']
152
- }], labelClass: [{
153
- type: Input
154
- }, {
155
- type: HostBinding,
156
- args: ['class.k-label']
157
- }] } });
@@ -1,45 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { NgModule } from '@angular/core';
6
- import { KENDO_LABELS } from './directives';
7
- import * as i0 from "@angular/core";
8
- import * as i1 from "./label.directive";
9
- import * as i2 from "./label/label.component";
10
- import * as i3 from "./localization/custom-messages.component";
11
- import * as i4 from "./floating-label/floating-label.component";
12
- //IMPORTANT: NgModule export kept for backwards compatibility
13
- /**
14
- * Represents the [`NgModule`](link:site.data.urls.angular['ngmoduleapi']) definition for the Label component.
15
- * The module imports:
16
- * - `LabelDirective`
17
- * - `LabelComponent`
18
- * - `FloatingLabel`
19
- *
20
- * @example
21
- * ```ts
22
- * import { LabelModule } from '@progress/kendo-angular-label';
23
- * import { NgModule } from '@angular/core';
24
- * import { AppComponent } from './app.component';
25
- *
26
- * @NgModule({
27
- * declarations: [AppComponent],
28
- * imports: [BrowserModule, LabelModule],
29
- * bootstrap: [AppComponent]
30
- * })
31
- * export class AppModule {}
32
- * ```
33
- */
34
- export class LabelModule {
35
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
36
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LabelModule, imports: [i1.LabelDirective, i2.LabelComponent, i3.CustomMessagesComponent, i4.FloatingLabelComponent, i3.CustomMessagesComponent], exports: [i1.LabelDirective, i2.LabelComponent, i3.CustomMessagesComponent, i4.FloatingLabelComponent, i3.CustomMessagesComponent] });
37
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelModule });
38
- }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelModule, decorators: [{
40
- type: NgModule,
41
- args: [{
42
- imports: [...KENDO_LABELS],
43
- exports: [...KENDO_LABELS]
44
- }]
45
- }] });
@@ -1,44 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Component, forwardRef } from '@angular/core';
6
- import { LocalizationService } from '@progress/kendo-angular-l10n';
7
- import { Messages } from './messages';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "@progress/kendo-angular-l10n";
10
- /**
11
- * Use the `CustomMessagesComponent` to override default component messages. ([See example](slug:label_globalization#toc-internationalization))
12
- *
13
- */
14
- export class CustomMessagesComponent extends Messages {
15
- service;
16
- constructor(service) {
17
- super();
18
- this.service = service;
19
- }
20
- get override() {
21
- return true;
22
- }
23
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
24
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-label-messages, kendo-floatinglabel-messages", providers: [
25
- {
26
- provide: Messages,
27
- useExisting: forwardRef(() => CustomMessagesComponent)
28
- }
29
- ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
30
- }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CustomMessagesComponent, decorators: [{
32
- type: Component,
33
- args: [{
34
- providers: [
35
- {
36
- provide: Messages,
37
- useExisting: forwardRef(() => CustomMessagesComponent)
38
- }
39
- ],
40
- selector: 'kendo-label-messages, kendo-floatinglabel-messages',
41
- template: ``,
42
- standalone: true
43
- }]
44
- }], ctorParameters: () => [{ type: i1.LocalizationService }] });
@@ -1,42 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, forwardRef } from '@angular/core';
6
- import { LocalizationService } from '@progress/kendo-angular-l10n';
7
- import { Messages } from './messages';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "@progress/kendo-angular-l10n";
10
- /**
11
- * @hidden
12
- */
13
- export class LocalizedMessagesDirective extends Messages {
14
- service;
15
- constructor(service) {
16
- super();
17
- this.service = service;
18
- }
19
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
20
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LocalizedMessagesDirective, isStandalone: true, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n ", providers: [
21
- {
22
- provide: Messages,
23
- useExisting: forwardRef(() => LocalizedMessagesDirective)
24
- }
25
- ], usesInheritance: true, ngImport: i0 });
26
- }
27
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
28
- type: Directive,
29
- args: [{
30
- providers: [
31
- {
32
- provide: Messages,
33
- useExisting: forwardRef(() => LocalizedMessagesDirective)
34
- }
35
- ],
36
- selector: `
37
- [kendoLabelLocalizedMessages],
38
- [kendoFloatingLabelLocalizedMessages]
39
- `,
40
- standalone: true
41
- }]
42
- }], ctorParameters: () => [{ type: i1.LocalizationService }] });
@@ -1,27 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, Input } from '@angular/core';
6
- import { ComponentMessages } from '@progress/kendo-angular-l10n';
7
- import * as i0 from "@angular/core";
8
- /**
9
- * @hidden
10
- */
11
- export class Messages extends ComponentMessages {
12
- /**
13
- * The optional text.
14
- */
15
- optional;
16
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
17
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: Messages, selector: "kendo-label-messages-base", inputs: { optional: "optional" }, usesInheritance: true, ngImport: i0 });
18
- }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Messages, decorators: [{
20
- type: Directive,
21
- args: [{
22
- // eslint-disable-next-line @angular-eslint/directive-selector
23
- selector: 'kendo-label-messages-base'
24
- }]
25
- }], propDecorators: { optional: [{
26
- type: Input
27
- }] } });
@@ -1,16 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export const packageMetadata = {
9
- name: '@progress/kendo-angular-label',
10
- productName: 'Kendo UI for Angular',
11
- productCode: 'KENDOUIANGULAR',
12
- productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1768386444,
14
- version: '21.4.1-develop.1',
15
- licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
- };
@@ -1,8 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Generated bundle index. Do not edit.
7
- */
8
- export * from './index';
package/esm2022/util.mjs DELETED
@@ -1,33 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export const isInputElement = (component) => component instanceof HTMLElement;
9
- /**
10
- * @hidden
11
- */
12
- export const inputElementHasAttr = (element, attribute) => element.hasAttribute(attribute);
13
- /**
14
- * @hidden
15
- */
16
- export const getWrappedNativeInput = (element) => element.querySelector('kendo-label > input, kendo-label > textarea, kendo-label > select');
17
- /**
18
- * @hidden
19
- */
20
- export const getRootElement = (element) => {
21
- if (!element) {
22
- return null;
23
- }
24
- let rootElement = element;
25
- while (rootElement.parentElement) {
26
- rootElement = rootElement.parentElement;
27
- }
28
- return rootElement;
29
- };
30
- /**
31
- * @hidden
32
- */
33
- export const nativeLabelForTargets = ['BUTTON', 'INPUT', 'METER', 'OUTPUT', 'PROGRESS', 'SELECT', 'TEXTAREA']; // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label