igniteui-webcomponents 6.4.0 → 6.5.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.
- package/CHANGELOG.md +77 -0
- package/components/calendar/base.d.ts +7 -3
- package/components/calendar/base.js +10 -14
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.d.ts +48 -46
- package/components/calendar/calendar.js +259 -242
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +49 -27
- package/components/calendar/days-view/days-view.js +167 -160
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/helpers.js +40 -28
- package/components/calendar/helpers.js.map +1 -1
- package/components/calendar/model.d.ts +9 -3
- package/components/calendar/model.js +29 -19
- package/components/calendar/model.js.map +1 -1
- package/components/calendar/months-view/months-view.d.ts +6 -7
- package/components/calendar/months-view/months-view.js +24 -27
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/years-view/years-view.d.ts +6 -5
- package/components/calendar/years-view/years-view.js +11 -14
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/checkbox/checkbox-base.d.ts +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.fluent.css.js +1 -1
- package/components/chip/themes/light/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/light/chip.indigo.css.js +1 -1
- package/components/chip/themes/light/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.shared.css.js +1 -1
- package/components/chip/themes/light/chip.shared.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/common/definitions/defineAllComponents.js +2 -0
- package/components/common/definitions/defineAllComponents.js.map +1 -1
- package/components/date-picker/date-picker.js +1 -1
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-picker/themes/shared/date-picker.common.css.js +1 -1
- package/components/date-picker/themes/shared/date-picker.common.css.js.map +1 -1
- package/components/date-range-picker/date-range-picker.js +1 -1
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-time-input/date-time-input.d.ts +4 -1
- package/components/date-time-input/date-time-input.js +17 -6
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/file-input/file-input.d.ts +15 -13
- package/components/file-input/file-input.js +49 -47
- package/components/file-input/file-input.js.map +1 -1
- package/components/input/input-base.d.ts +31 -34
- package/components/input/input-base.js +58 -83
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +18 -7
- package/components/input/input.js +34 -19
- package/components/input/input.js.map +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/mask-input/mask-input-base.d.ts +10 -4
- package/components/mask-input/mask-input-base.js +18 -14
- package/components/mask-input/mask-input-base.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +9 -3
- package/components/mask-input/mask-input.js +26 -6
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/mask-input/validators.js +1 -1
- package/components/mask-input/validators.js.map +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
- package/components/theme-provider/theme-provider.d.ts +65 -0
- package/components/theme-provider/theme-provider.js +58 -0
- package/components/theme-provider/theme-provider.js.map +1 -0
- package/components/tile-manager/tile.js +6 -3
- package/components/tile-manager/tile.js.map +1 -1
- package/components/validation-container/themes/validator.base.css.js +1 -1
- package/components/validation-container/themes/validator.base.css.js.map +1 -1
- package/components/validation-container/validation-container.d.ts +1 -0
- package/components/validation-container/validation-container.js +3 -0
- package/components/validation-container/validation-container.js.map +1 -1
- package/custom-elements.json +2142 -1596
- package/extras/chat-markdown-renderer.d.ts +72 -4
- package/extras/chat-markdown-renderer.js +19 -7
- package/extras/chat-markdown-renderer.js.map +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/themes/dark/bootstrap.css +1 -1
- package/themes/dark/fluent.css +1 -1
- package/themes/dark/indigo.css +1 -1
- package/themes/dark/material.css +1 -1
- package/themes/light/bootstrap.css +1 -1
- package/themes/light/fluent.css +1 -1
- package/themes/light/indigo.css +1 -1
- package/themes/light/material.css +1 -1
- package/theming/context.d.ts +36 -0
- package/theming/context.js +3 -0
- package/theming/context.js.map +1 -0
- package/theming/theming-controller.d.ts +7 -1
- package/theming/theming-controller.js +48 -12
- package/theming/theming-controller.js.map +1 -1
- package/theming/utils.d.ts +10 -0
- package/theming/utils.js +8 -42
- package/theming/utils.js.map +1 -1
- package/web-types.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, nothing, type TemplateResult } from 'lit';
|
|
2
|
+
import type { ThemingController } from '../../theming/theming-controller.js';
|
|
3
|
+
import type { SlotController } from '../common/controllers/slot.js';
|
|
2
4
|
import type { Constructor } from '../common/mixins/constructor.js';
|
|
3
|
-
import type { RangeTextSelectMode, SelectionRangeDirection } from '../types.js';
|
|
4
5
|
export interface IgcInputComponentEventMap {
|
|
5
6
|
igcInput: CustomEvent<string>;
|
|
6
7
|
igcChange: CustomEvent<string>;
|
|
@@ -9,26 +10,21 @@ export interface IgcInputComponentEventMap {
|
|
|
9
10
|
}
|
|
10
11
|
declare const IgcInputBaseComponent_base: Constructor<import("../common/mixins/forms/types.js").FormRequiredInterface & import("../common/mixins/forms/types.js").FormAssociatedElementInterface> & Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcInputComponentEventMap>> & Constructor<LitElement>;
|
|
11
12
|
export declare abstract class IgcInputBaseComponent extends IgcInputBaseComponent_base {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
protected readonly
|
|
15
|
-
protected
|
|
16
|
-
/** The value attribute of the control.
|
|
13
|
+
protected abstract readonly _themes: ThemingController;
|
|
14
|
+
protected abstract readonly _slots: SlotController<any>;
|
|
15
|
+
protected readonly _inputId: string;
|
|
16
|
+
protected readonly _input?: HTMLInputElement;
|
|
17
|
+
/** The value attribute of the control.
|
|
18
|
+
* Type varies based on the input type and can be string, Date or null.
|
|
19
|
+
*/
|
|
17
20
|
abstract value: string | Date | null;
|
|
18
|
-
protected input: HTMLInputElement;
|
|
19
|
-
protected _helperText: Array<HTMLElement>;
|
|
20
|
-
protected prefixes: Array<HTMLElement>;
|
|
21
|
-
protected suffixes: Array<HTMLElement>;
|
|
22
21
|
/**
|
|
23
22
|
* Whether the control will have outlined appearance.
|
|
23
|
+
*
|
|
24
24
|
* @attr
|
|
25
|
+
* @default false
|
|
25
26
|
*/
|
|
26
27
|
outlined: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Makes the control a readonly field.
|
|
29
|
-
* @attr readonly
|
|
30
|
-
*/
|
|
31
|
-
readOnly: boolean;
|
|
32
28
|
/**
|
|
33
29
|
* The placeholder attribute of the control.
|
|
34
30
|
* @attr
|
|
@@ -39,29 +35,30 @@ export declare abstract class IgcInputBaseComponent extends IgcInputBaseComponen
|
|
|
39
35
|
* @attr
|
|
40
36
|
*/
|
|
41
37
|
label: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected abstract renderInput(): TemplateResult;
|
|
48
|
-
protected renderValidatorContainer(): TemplateResult;
|
|
49
|
-
protected resolvePartNames(base: string): {
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the part names for the container based on the current state.
|
|
40
|
+
* Used to apply conditional styling via CSS parts.
|
|
41
|
+
*/
|
|
42
|
+
protected _resolvePartNames(base: string): {
|
|
50
43
|
[x: string]: boolean;
|
|
51
44
|
prefixed: boolean;
|
|
52
45
|
suffixed: boolean;
|
|
53
46
|
filled: boolean;
|
|
54
47
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
private
|
|
64
|
-
private
|
|
65
|
-
|
|
48
|
+
/** Selects all the text inside the input. */
|
|
49
|
+
select(): void;
|
|
50
|
+
/** Sets focus on the control. */
|
|
51
|
+
focus(options?: FocusOptions): void;
|
|
52
|
+
/** Removes focus from the control. */
|
|
53
|
+
blur(): void;
|
|
54
|
+
protected abstract _renderInput(): TemplateResult;
|
|
55
|
+
protected _renderFileParts(): TemplateResult | typeof nothing;
|
|
56
|
+
private _renderValidatorContainer;
|
|
57
|
+
private _renderPrefix;
|
|
58
|
+
private _renderSuffix;
|
|
59
|
+
private _renderLabel;
|
|
60
|
+
private _renderMaterial;
|
|
61
|
+
private _renderStandard;
|
|
62
|
+
protected render(): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/cache.js").CacheDirective>;
|
|
66
63
|
}
|
|
67
64
|
export {};
|
|
@@ -4,139 +4,114 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var IgcInputBaseComponent_1;
|
|
8
7
|
import { html, LitElement, nothing } from 'lit';
|
|
9
|
-
import { property, query
|
|
10
|
-
import {
|
|
8
|
+
import { property, query } from 'lit/decorators.js';
|
|
9
|
+
import { cache } from 'lit/directives/cache.js';
|
|
11
10
|
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
|
|
12
11
|
import { shadowOptions } from '../common/decorators/shadow-options.js';
|
|
13
12
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
14
13
|
import { FormAssociatedRequiredMixin } from '../common/mixins/forms/associated-required.js';
|
|
15
14
|
import { partMap } from '../common/part-map.js';
|
|
16
|
-
import { createCounter } from '../common/util.js';
|
|
17
15
|
import IgcValidationContainerComponent from '../validation-container/validation-container.js';
|
|
18
|
-
|
|
19
|
-
import { styles as shared } from './themes/shared/input.common.css.js';
|
|
20
|
-
import { all } from './themes/themes.js';
|
|
16
|
+
let nextId = 1;
|
|
21
17
|
let IgcInputBaseComponent = class IgcInputBaseComponent extends FormAssociatedRequiredMixin(EventEmitterMixin(LitElement)) {
|
|
22
18
|
constructor() {
|
|
23
19
|
super(...arguments);
|
|
24
|
-
this.
|
|
25
|
-
this.inputId = `input-${IgcInputBaseComponent_1.increment()}`;
|
|
20
|
+
this._inputId = `input-${nextId++}`;
|
|
26
21
|
this.outlined = false;
|
|
27
|
-
this.readOnly = false;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
|
-
static { this.styles = [styles, shared]; }
|
|
31
|
-
static { this.increment = createCounter(); }
|
|
32
|
-
createRenderRoot() {
|
|
33
|
-
const root = super.createRenderRoot();
|
|
34
|
-
root.addEventListener('slotchange', () => this.requestUpdate());
|
|
35
|
-
return root;
|
|
36
|
-
}
|
|
37
|
-
focus(options) {
|
|
38
|
-
this.input.focus(options);
|
|
39
|
-
}
|
|
40
|
-
blur() {
|
|
41
|
-
this.input.blur();
|
|
42
|
-
}
|
|
43
|
-
renderValidatorContainer() {
|
|
44
|
-
return IgcValidationContainerComponent.create(this);
|
|
45
|
-
}
|
|
46
|
-
resolvePartNames(base) {
|
|
23
|
+
_resolvePartNames(base) {
|
|
47
24
|
return {
|
|
48
25
|
[base]: true,
|
|
49
|
-
prefixed: this.
|
|
50
|
-
|
|
26
|
+
prefixed: this._slots.hasAssignedElements('prefix', {
|
|
27
|
+
selector: '[slot="prefix"]:not([hidden])',
|
|
28
|
+
}),
|
|
29
|
+
suffixed: this._slots.hasAssignedElements('suffix', {
|
|
30
|
+
selector: '[slot="suffix"]:not([hidden])',
|
|
31
|
+
}),
|
|
51
32
|
filled: !!this.value,
|
|
52
33
|
};
|
|
53
34
|
}
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
select() {
|
|
36
|
+
this._input?.select();
|
|
37
|
+
}
|
|
38
|
+
focus(options) {
|
|
39
|
+
this._input?.focus(options);
|
|
56
40
|
}
|
|
57
|
-
|
|
58
|
-
this.
|
|
41
|
+
blur() {
|
|
42
|
+
this._input?.blur();
|
|
43
|
+
}
|
|
44
|
+
_renderFileParts() {
|
|
45
|
+
return nothing;
|
|
59
46
|
}
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
_renderValidatorContainer() {
|
|
48
|
+
return IgcValidationContainerComponent.create(this);
|
|
62
49
|
}
|
|
63
|
-
|
|
64
|
-
return html
|
|
65
|
-
<
|
|
66
|
-
|
|
50
|
+
_renderPrefix() {
|
|
51
|
+
return html `
|
|
52
|
+
<div part="prefix">
|
|
53
|
+
<slot name="prefix"></slot>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
67
56
|
}
|
|
68
|
-
|
|
69
|
-
return html
|
|
70
|
-
<
|
|
71
|
-
|
|
57
|
+
_renderSuffix() {
|
|
58
|
+
return html `
|
|
59
|
+
<div part="suffix">
|
|
60
|
+
<slot name="suffix"></slot>
|
|
61
|
+
</div>
|
|
62
|
+
`;
|
|
72
63
|
}
|
|
73
|
-
|
|
64
|
+
_renderLabel() {
|
|
74
65
|
return this.label
|
|
75
|
-
? html `<label part="label" for=${this.
|
|
66
|
+
? html `<label part="label" for=${this._inputId}>${this.label}</label>`
|
|
76
67
|
: nothing;
|
|
77
68
|
}
|
|
78
|
-
|
|
69
|
+
_renderMaterial() {
|
|
79
70
|
return html `
|
|
80
71
|
<div
|
|
81
72
|
part=${partMap({
|
|
82
|
-
...this.
|
|
73
|
+
...this._resolvePartNames('container'),
|
|
83
74
|
labelled: !!this.label,
|
|
84
75
|
})}
|
|
85
76
|
>
|
|
86
|
-
<div part="start">${this.
|
|
87
|
-
${this.
|
|
88
|
-
<div part="notch">${this.
|
|
77
|
+
<div part="start">${this._renderPrefix()}</div>
|
|
78
|
+
${this._renderInput()} ${this._renderFileParts()}
|
|
79
|
+
<div part="notch">${this._renderLabel()}</div>
|
|
89
80
|
<div part="filler"></div>
|
|
90
|
-
<div part="end">${this.
|
|
81
|
+
<div part="end">${this._renderSuffix()}</div>
|
|
91
82
|
</div>
|
|
92
|
-
${this.
|
|
83
|
+
${this._renderValidatorContainer()}
|
|
93
84
|
`;
|
|
94
85
|
}
|
|
95
|
-
|
|
96
|
-
return html
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
${this.
|
|
86
|
+
_renderStandard() {
|
|
87
|
+
return html `
|
|
88
|
+
${this._renderLabel()}
|
|
89
|
+
<div part=${partMap(this._resolvePartNames('container'))}>
|
|
90
|
+
${this._renderPrefix()}${this._renderFileParts()}
|
|
91
|
+
${this._renderInput()}${this._renderSuffix()}
|
|
100
92
|
</div>
|
|
101
|
-
${this.
|
|
93
|
+
${this._renderValidatorContainer()}
|
|
94
|
+
`;
|
|
102
95
|
}
|
|
103
96
|
render() {
|
|
104
|
-
return this._themes.theme === 'material'
|
|
105
|
-
? this.
|
|
106
|
-
: this.
|
|
97
|
+
return cache(this._themes.theme === 'material'
|
|
98
|
+
? this._renderMaterial()
|
|
99
|
+
: this._renderStandard());
|
|
107
100
|
}
|
|
108
101
|
};
|
|
109
102
|
__decorate([
|
|
110
103
|
query('input')
|
|
111
|
-
], IgcInputBaseComponent.prototype, "
|
|
112
|
-
__decorate([
|
|
113
|
-
queryAssignedElements({ slot: 'helper-text' })
|
|
114
|
-
], IgcInputBaseComponent.prototype, "_helperText", void 0);
|
|
104
|
+
], IgcInputBaseComponent.prototype, "_input", void 0);
|
|
115
105
|
__decorate([
|
|
116
|
-
|
|
117
|
-
slot: 'prefix',
|
|
118
|
-
selector: '[slot="prefix"]:not([hidden])',
|
|
119
|
-
})
|
|
120
|
-
], IgcInputBaseComponent.prototype, "prefixes", void 0);
|
|
121
|
-
__decorate([
|
|
122
|
-
queryAssignedElements({
|
|
123
|
-
slot: 'suffix',
|
|
124
|
-
selector: '[slot="suffix"]:not([hidden])',
|
|
125
|
-
})
|
|
126
|
-
], IgcInputBaseComponent.prototype, "suffixes", void 0);
|
|
127
|
-
__decorate([
|
|
128
|
-
property({ reflect: true, type: Boolean })
|
|
106
|
+
property({ type: Boolean, reflect: true })
|
|
129
107
|
], IgcInputBaseComponent.prototype, "outlined", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
property({ type: Boolean, reflect: true, attribute: 'readonly' })
|
|
132
|
-
], IgcInputBaseComponent.prototype, "readOnly", void 0);
|
|
133
108
|
__decorate([
|
|
134
109
|
property()
|
|
135
110
|
], IgcInputBaseComponent.prototype, "placeholder", void 0);
|
|
136
111
|
__decorate([
|
|
137
112
|
property()
|
|
138
113
|
], IgcInputBaseComponent.prototype, "label", void 0);
|
|
139
|
-
IgcInputBaseComponent =
|
|
114
|
+
IgcInputBaseComponent = __decorate([
|
|
140
115
|
blazorDeepImport,
|
|
141
116
|
shadowOptions({ delegatesFocus: true })
|
|
142
117
|
], IgcInputBaseComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-base.js","sourceRoot":"","sources":["../../../src/components/input/input-base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input-base.js","sourceRoot":"","sources":["../../../src/components/input/input-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;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AAK,UAAU;YAC/B,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE;YACxB,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAC3B,CAAC;IACJ,CAAC;CACF,CAAA;AArIoB;IADlB,KAAK,CAAC,OAAO,CAAC;qDAC8B;AAetC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACnB;AAOjB;IADN,QAAQ,EAAE;0DACiB;AAOrB;IADN,QAAQ,EAAE;oDACW;AAxCF,qBAAqB;IAF1C,gBAAgB;IAChB,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GAClB,qBAAqB,CAgJ1C","sourcesContent":["import { html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport type { ThemingController } from '../../theming/theming-controller.js';\nimport type { SlotController } from '../common/controllers/slot.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { shadowOptions } from '../common/decorators/shadow-options.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '../common/mixins/forms/associated-required.js';\nimport { partMap } from '../common/part-map.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\n\nexport interface IgcInputComponentEventMap {\n /* alternateName: inputOcurred */\n igcInput: CustomEvent<string>;\n /* blazorSuppress */\n igcChange: CustomEvent<string>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\nlet nextId = 1;\n\n@blazorDeepImport\n@shadowOptions({ delegatesFocus: true })\nexport abstract class IgcInputBaseComponent extends FormAssociatedRequiredMixin(\n EventEmitterMixin<IgcInputComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n protected abstract readonly _themes: ThemingController;\n protected abstract readonly _slots: SlotController<any>;\n\n protected readonly _inputId = `input-${nextId++}`;\n\n @query('input')\n protected readonly _input?: HTMLInputElement;\n\n /* blazorSuppress */\n /** The value attribute of the control.\n * Type varies based on the input type and can be string, Date or null.\n */\n public abstract value: string | Date | null;\n\n /**\n * Whether the control will have outlined appearance.\n *\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public outlined = false;\n\n /**\n * The placeholder attribute of the control.\n * @attr\n */\n @property()\n public placeholder!: string;\n\n /**\n * The label for the control.\n * @attr\n */\n @property()\n public label!: string;\n\n /**\n * Resolves the part names for the container based on the current state.\n * Used to apply conditional styling via CSS parts.\n */\n protected _resolvePartNames(base: string) {\n return {\n [base]: true,\n prefixed: this._slots.hasAssignedElements('prefix', {\n selector: '[slot=\"prefix\"]:not([hidden])',\n }),\n suffixed: this._slots.hasAssignedElements('suffix', {\n selector: '[slot=\"suffix\"]:not([hidden])',\n }),\n filled: !!this.value,\n };\n }\n\n /** Selects all the text inside the input. */\n public select(): void {\n this._input?.select();\n }\n\n /* alternateName: focusComponent */\n /** Sets focus on the control. */\n public override focus(options?: FocusOptions): void {\n this._input?.focus(options);\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the control. */\n public override blur(): void {\n this._input?.blur();\n }\n\n protected abstract _renderInput(): TemplateResult;\n\n protected _renderFileParts(): TemplateResult | typeof nothing {\n return nothing;\n }\n\n private _renderValidatorContainer(): TemplateResult {\n return IgcValidationContainerComponent.create(this);\n }\n\n private _renderPrefix() {\n return html`\n <div part=\"prefix\">\n <slot name=\"prefix\"></slot>\n </div>\n `;\n }\n\n private _renderSuffix() {\n return html`\n <div part=\"suffix\">\n <slot name=\"suffix\"></slot>\n </div>\n `;\n }\n\n private _renderLabel() {\n return this.label\n ? html`<label part=\"label\" for=${this._inputId}>${this.label}</label>`\n : nothing;\n }\n\n private _renderMaterial() {\n return html`\n <div\n part=${partMap({\n ...this._resolvePartNames('container'),\n labelled: !!this.label,\n })}\n >\n <div part=\"start\">${this._renderPrefix()}</div>\n ${this._renderInput()} ${this._renderFileParts()}\n <div part=\"notch\">${this._renderLabel()}</div>\n <div part=\"filler\"></div>\n <div part=\"end\">${this._renderSuffix()}</div>\n </div>\n ${this._renderValidatorContainer()}\n `;\n }\n\n private _renderStandard() {\n return html`\n ${this._renderLabel()}\n <div part=${partMap(this._resolvePartNames('container'))}>\n ${this._renderPrefix()}${this._renderFileParts()}\n ${this._renderInput()}${this._renderSuffix()}\n </div>\n ${this._renderValidatorContainer()}\n `;\n }\n\n protected override render() {\n return cache(\n this._themes.theme === 'material'\n ? this._renderMaterial()\n : this._renderStandard()\n );\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputType, RangeTextSelectMode } from '../types.js';
|
|
1
|
+
import type { InputType, RangeTextSelectMode, SelectionRangeDirection } from '../types.js';
|
|
2
2
|
import { IgcInputBaseComponent } from './input-base.js';
|
|
3
3
|
/**
|
|
4
4
|
* @element igc-input
|
|
@@ -29,7 +29,10 @@ import { IgcInputBaseComponent } from './input-base.js';
|
|
|
29
29
|
*/
|
|
30
30
|
export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
31
31
|
static readonly tagName = "igc-input";
|
|
32
|
+
static styles: import("lit").CSSResult[];
|
|
32
33
|
static register(): void;
|
|
34
|
+
protected readonly _themes: import("../../theming/theming-controller.js").ThemingController;
|
|
35
|
+
protected readonly _slots: import("../common/controllers/slot.js").SlotController<"invalid" | "prefix" | "[default]" | "helper-text" | "suffix" | "value-missing" | "range-overflow" | "range-underflow" | "custom-error" | "type-mismatch" | "pattern-mismatch" | "too-long" | "too-short" | "step-mismatch">;
|
|
33
36
|
protected readonly _formValue: import("../common/mixins/forms/form-value.js").FormValue<string>;
|
|
34
37
|
protected get __validators(): import("../common/validators.js").Validator<IgcInputComponent>[];
|
|
35
38
|
private _min?;
|
|
@@ -49,6 +52,13 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
|
49
52
|
* @attr
|
|
50
53
|
*/
|
|
51
54
|
type: InputType;
|
|
55
|
+
/**
|
|
56
|
+
* Makes the control a readonly field.
|
|
57
|
+
*
|
|
58
|
+
* @attr readonly
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
readOnly: boolean;
|
|
52
62
|
/**
|
|
53
63
|
* The input mode attribute of the control.
|
|
54
64
|
* See [relevant MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
|
|
@@ -106,19 +116,20 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
|
106
116
|
* string-type inputs or allows spin buttons to exceed the predefined `min/max` limits for number-type inputs.
|
|
107
117
|
*
|
|
108
118
|
* @attr validate-only
|
|
119
|
+
* @default false
|
|
109
120
|
*/
|
|
110
121
|
validateOnly: boolean;
|
|
111
122
|
/** Replaces the selected text in the input. */
|
|
112
|
-
setRangeText(replacement: string, start
|
|
113
|
-
/**
|
|
114
|
-
|
|
123
|
+
setRangeText(replacement: string, start?: number, end?: number, selectMode?: RangeTextSelectMode): void;
|
|
124
|
+
/** Sets the text selection range of the control */
|
|
125
|
+
setSelectionRange(start?: number, end?: number, direction?: SelectionRangeDirection): void;
|
|
115
126
|
/** Increments the numeric value of the input by one or more steps. */
|
|
116
127
|
stepUp(n?: number): void;
|
|
117
128
|
/** Decrements the numeric value of the input by one or more steps. */
|
|
118
129
|
stepDown(n?: number): void;
|
|
119
|
-
private
|
|
120
|
-
private
|
|
121
|
-
protected
|
|
130
|
+
private _handleInput;
|
|
131
|
+
private _handleChange;
|
|
132
|
+
protected _renderInput(): import("lit-html").TemplateResult<1>;
|
|
122
133
|
}
|
|
123
134
|
declare global {
|
|
124
135
|
interface HTMLElementTagNameMap {
|
|
@@ -8,23 +8,35 @@ import { html } from 'lit';
|
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
10
|
import { live } from 'lit/directives/live.js';
|
|
11
|
+
import { addThemingController } from '../../theming/theming-controller.js';
|
|
12
|
+
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
11
13
|
import { registerComponent } from '../common/definitions/register.js';
|
|
12
14
|
import { createFormValueState } from '../common/mixins/forms/form-value.js';
|
|
13
15
|
import { partMap } from '../common/part-map.js';
|
|
14
|
-
import { bindIf
|
|
16
|
+
import { bindIf } from '../common/util.js';
|
|
15
17
|
import IgcValidationContainerComponent from '../validation-container/validation-container.js';
|
|
16
18
|
import { IgcInputBaseComponent } from './input-base.js';
|
|
19
|
+
import { styles } from './themes/input.base.css.js';
|
|
20
|
+
import { styles as shared } from './themes/shared/input.common.css.js';
|
|
21
|
+
import { all } from './themes/themes.js';
|
|
17
22
|
import { numberValidators, stringValidators } from './validators.js';
|
|
23
|
+
const Slots = setSlots('prefix', 'suffix', 'helper-text', 'value-missing', 'type-mismatch', 'pattern-mismatch', 'too-long', 'too-short', 'range-overflow', 'range-underflow', 'step-mismatch', 'custom-error', 'invalid');
|
|
18
24
|
export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
19
25
|
constructor() {
|
|
20
26
|
super(...arguments);
|
|
27
|
+
this._themes = addThemingController(this, all);
|
|
28
|
+
this._slots = addSlotController(this, {
|
|
29
|
+
slots: Slots,
|
|
30
|
+
});
|
|
21
31
|
this._formValue = createFormValueState(this, {
|
|
22
32
|
initialValue: '',
|
|
23
33
|
});
|
|
24
34
|
this.type = 'text';
|
|
35
|
+
this.readOnly = false;
|
|
25
36
|
this.validateOnly = false;
|
|
26
37
|
}
|
|
27
38
|
static { this.tagName = 'igc-input'; }
|
|
39
|
+
static { this.styles = [styles, shared]; }
|
|
28
40
|
static register() {
|
|
29
41
|
registerComponent(IgcInputComponent, IgcValidationContainerComponent);
|
|
30
42
|
}
|
|
@@ -80,37 +92,37 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
|
80
92
|
return this._step;
|
|
81
93
|
}
|
|
82
94
|
setRangeText(replacement, start, end, selectMode = 'preserve') {
|
|
83
|
-
|
|
84
|
-
this.value = this.
|
|
95
|
+
this._input?.setRangeText(replacement, start, end, selectMode);
|
|
96
|
+
this.value = this._input?.value ?? '';
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
|
|
98
|
+
setSelectionRange(start, end, direction = 'none') {
|
|
99
|
+
this._input?.setSelectionRange(start ?? null, end ?? null, direction);
|
|
88
100
|
}
|
|
89
101
|
stepUp(n) {
|
|
90
|
-
this.
|
|
91
|
-
this.value = this.
|
|
102
|
+
this._input?.stepUp(n);
|
|
103
|
+
this.value = this._input?.value ?? '';
|
|
92
104
|
}
|
|
93
105
|
stepDown(n) {
|
|
94
|
-
this.
|
|
95
|
-
this.value = this.
|
|
106
|
+
this._input?.stepDown(n);
|
|
107
|
+
this.value = this._input?.value ?? '';
|
|
96
108
|
}
|
|
97
|
-
|
|
109
|
+
_handleInput() {
|
|
98
110
|
this._setTouchedState();
|
|
99
|
-
this.value = this.
|
|
111
|
+
this.value = this._input?.value ?? '';
|
|
100
112
|
this.emitEvent('igcInput', { detail: this.value });
|
|
101
113
|
}
|
|
102
|
-
|
|
114
|
+
_handleChange() {
|
|
103
115
|
this._setTouchedState();
|
|
104
|
-
this.value = this.
|
|
116
|
+
this.value = this._input?.value ?? '';
|
|
105
117
|
this.emitEvent('igcChange', { detail: this.value });
|
|
106
118
|
}
|
|
107
|
-
|
|
119
|
+
_renderInput() {
|
|
108
120
|
const hasNegativeTabIndex = this.getAttribute('tabindex') === '-1';
|
|
109
|
-
const hasHelperText =
|
|
121
|
+
const hasHelperText = this._slots.hasAssignedElements('helper-text');
|
|
110
122
|
return html `
|
|
111
123
|
<input
|
|
112
|
-
id=${this.
|
|
113
|
-
part=${partMap(this.
|
|
124
|
+
id=${this._inputId}
|
|
125
|
+
part=${partMap(this._resolvePartNames('input'))}
|
|
114
126
|
name=${ifDefined(this.name)}
|
|
115
127
|
type=${ifDefined(this.type)}
|
|
116
128
|
pattern=${ifDefined(this.pattern)}
|
|
@@ -129,8 +141,8 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
|
|
|
129
141
|
maxlength=${bindIf(!this.validateOnly, this.maxLength)}
|
|
130
142
|
step=${ifDefined(this.step)}
|
|
131
143
|
aria-describedby=${bindIf(hasHelperText, 'helper-text')}
|
|
132
|
-
@change=${this.
|
|
133
|
-
@input=${this.
|
|
144
|
+
@change=${this._handleChange}
|
|
145
|
+
@input=${this._handleInput}
|
|
134
146
|
@blur=${this._handleBlur}
|
|
135
147
|
/>
|
|
136
148
|
`;
|
|
@@ -142,6 +154,9 @@ __decorate([
|
|
|
142
154
|
__decorate([
|
|
143
155
|
property({ reflect: true })
|
|
144
156
|
], IgcInputComponent.prototype, "type", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: Boolean, reflect: true })
|
|
159
|
+
], IgcInputComponent.prototype, "readOnly", void 0);
|
|
145
160
|
__decorate([
|
|
146
161
|
property({ attribute: 'inputmode' })
|
|
147
162
|
], IgcInputComponent.prototype, "inputMode", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,+BAA+B,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CA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AAE,eAAe,EAAE,CAAC;uDAC3C","sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\n\nimport { registerComponent } from '../common/definitions/register.js';\nimport { createFormValueState } from '../common/mixins/forms/form-value.js';\nimport { partMap } from '../common/part-map.js';\nimport { bindIf, isEmpty } from '../common/util.js';\nimport type { InputType, RangeTextSelectMode } from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { IgcInputBaseComponent } from './input-base.js';\nimport { numberValidators, stringValidators } from './validators.js';\n\n/**\n * @element igc-input\n *\n * @slot prefix - Renders content before the input.\n * @slot suffix - Renders content after input.\n * @slot helper-text - Renders content below the input.\n * @slot value-missing - Renders content when the required validation fails.\n * @slot type-mismatch - Renders content when the a type url/email input pattern validation fails.\n * @slot pattern-mismatch - Renders content when the pattern validation fails.\n * @slot too-long - Renders content when the maxlength validation fails.\n * @slot too-short - Renders content when the minlength validation fails.\n * @slot range-overflow - Renders content when the max validation fails.\n * @slot range-underflow - Renders content when the min validation fails.\n * @slot step-mismatch - Renders content when the step validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n *\n * @fires igcInput - Emitted when the control input receives user input.\n * @fires igcChange - Emitted when the control's checked state changes.\n *\n * @csspart container - The main wrapper that holds all main input elements.\n * @csspart input - The native input element.\n * @csspart label - The native label element.\n * @csspart prefix - The prefix wrapper.\n * @csspart suffix - The suffix wrapper.\n * @csspart helper-text - The helper text wrapper.\n */\nexport default class IgcInputComponent extends IgcInputBaseComponent {\n public static readonly tagName = 'igc-input';\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcInputComponent, IgcValidationContainerComponent);\n }\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n protected override get __validators() {\n return this.type !== 'number' ? stringValidators : numberValidators;\n }\n\n private _min?: number;\n private _max?: number;\n private _minLength?: number;\n private _maxLength?: number;\n private _pattern?: string;\n private _step?: number;\n\n /* @tsTwoWayProperty(true, \"igcChange\", \"detail\", false) */\n /**\n * The value of the control.\n * @attr\n */\n @property()\n public set value(value: string) {\n this._formValue.setValueAndFormState(value);\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /* alternateName: displayType */\n /**\n * The type attribute of the control.\n * @attr\n */\n @property({ reflect: true })\n public type: InputType = 'text';\n\n /**\n * The input mode attribute of the control.\n * See [relevant MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)\n * @attr inputmode\n */\n @property({ attribute: 'inputmode' })\n public override inputMode!: string;\n\n /**\n * The pattern attribute of the control.\n * @attr\n */\n @property()\n public set pattern(value: string | undefined) {\n this._pattern = value;\n this._validate();\n }\n\n public get pattern(): string | undefined {\n return this._pattern;\n }\n\n /**\n * The minimum string length required by the control.\n * @attr minlength\n */\n @property({ type: Number, attribute: 'minlength' })\n public set minLength(value: number | undefined) {\n this._minLength = value;\n this._validate();\n }\n\n public get minLength(): number | undefined {\n return this._minLength;\n }\n\n /**\n * The maximum string length of the control.\n * @attr maxlength\n */\n @property({ type: Number, attribute: 'maxlength' })\n public set maxLength(value: number | undefined) {\n this._maxLength = value;\n this._validate();\n }\n\n public get maxLength(): number | undefined {\n return this._maxLength;\n }\n\n /**\n * The min attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set min(value: number | undefined) {\n this._min = value;\n this._validate();\n }\n\n public get min(): number | undefined {\n return this._min;\n }\n\n /**\n * The max attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set max(value: number | undefined) {\n this._max = value;\n this._validate();\n }\n\n public get max(): number | undefined {\n return this._max;\n }\n\n /**\n * The step attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set step(value: number | undefined) {\n this._step = value;\n this._validate();\n }\n\n public get step(): number | undefined {\n return this._step;\n }\n\n /**\n * The autofocus attribute of the control.\n * @attr\n */\n @property({ type: Boolean })\n public override autofocus!: boolean;\n\n /**\n * The autocomplete attribute of the control.\n * @attr\n */\n @property()\n public autocomplete!: string;\n\n /**\n * Enables validation rules to be evaluated without restricting user input. This applies to the `maxLength` property for\n * string-type inputs or allows spin buttons to exceed the predefined `min/max` limits for number-type inputs.\n *\n * @attr validate-only\n */\n @property({ type: Boolean, reflect: true, attribute: 'validate-only' })\n public validateOnly = false;\n\n /* blazorSuppress */\n /** Replaces the selected text in the input. */\n public override setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectMode: RangeTextSelectMode = 'preserve'\n ) {\n super.setRangeText(replacement, start, end, selectMode);\n this.value = this.input.value;\n }\n\n /** Selects all text within the input. */\n public select() {\n return this.input.select();\n }\n\n /** Increments the numeric value of the input by one or more steps. */\n public stepUp(n?: number) {\n this.input.stepUp(n);\n this.value = this.input.value;\n }\n\n /** Decrements the numeric value of the input by one or more steps. */\n public stepDown(n?: number) {\n this.input.stepDown(n);\n this.value = this.input.value;\n }\n\n private handleInput() {\n this._setTouchedState();\n this.value = this.input.value;\n this.emitEvent('igcInput', { detail: this.value });\n }\n\n private handleChange() {\n this._setTouchedState();\n this.value = this.input.value;\n this.emitEvent('igcChange', { detail: this.value });\n }\n\n protected renderInput() {\n const hasNegativeTabIndex = this.getAttribute('tabindex') === '-1';\n const hasHelperText = !isEmpty(this._helperText);\n\n return html`\n <input\n id=${this.inputId}\n part=${partMap(this.resolvePartNames('input'))}\n name=${ifDefined(this.name)}\n type=${ifDefined(this.type)}\n pattern=${ifDefined(this.pattern)}\n placeholder=${ifDefined(this.placeholder)}\n .value=${live(this.value)}\n ?readonly=${this.readOnly}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?autofocus=${this.autofocus}\n tabindex=${bindIf(hasNegativeTabIndex, -1)}\n autocomplete=${ifDefined(this.autocomplete as any)}\n inputmode=${ifDefined(this.inputMode)}\n min=${bindIf(!this.validateOnly, this.min)}\n max=${bindIf(!this.validateOnly, this.max)}\n minlength=${ifDefined(this.minLength)}\n maxlength=${bindIf(!this.validateOnly, this.maxLength)}\n step=${ifDefined(this.step)}\n aria-describedby=${bindIf(hasHelperText, 'helper-text')}\n @change=${this.handleChange}\n @input=${this.handleInput}\n @blur=${this._handleBlur}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-input': IgcInputComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM3C,OAAO,+BAA+B,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,KAAK,GAAG,QAAQ,CACpB,QAAQ,EACR,QAAQ,EACR,aA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;AAWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;kDAIlD;AAWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;kDAIlD;AAWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAI1B;AAWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAI1B;AAWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAI1B;AAWe;IADf,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACQ;AAO7B;IADN,QAAQ,EAAE;uDACkB;AAUtB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;uDAC3C","sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport { createFormValueState } from '../common/mixins/forms/form-value.js';\nimport { partMap } from '../common/part-map.js';\nimport { bindIf } from '../common/util.js';\nimport type {\n InputType,\n RangeTextSelectMode,\n SelectionRangeDirection,\n} from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { IgcInputBaseComponent } from './input-base.js';\nimport { styles } from './themes/input.base.css.js';\nimport { styles as shared } from './themes/shared/input.common.css.js';\nimport { all } from './themes/themes.js';\nimport { numberValidators, stringValidators } from './validators.js';\n\nconst Slots = setSlots(\n 'prefix',\n 'suffix',\n 'helper-text',\n 'value-missing',\n 'type-mismatch',\n 'pattern-mismatch',\n 'too-long',\n 'too-short',\n 'range-overflow',\n 'range-underflow',\n 'step-mismatch',\n 'custom-error',\n 'invalid'\n);\n\n/**\n * @element igc-input\n *\n * @slot prefix - Renders content before the input.\n * @slot suffix - Renders content after input.\n * @slot helper-text - Renders content below the input.\n * @slot value-missing - Renders content when the required validation fails.\n * @slot type-mismatch - Renders content when the a type url/email input pattern validation fails.\n * @slot pattern-mismatch - Renders content when the pattern validation fails.\n * @slot too-long - Renders content when the maxlength validation fails.\n * @slot too-short - Renders content when the minlength validation fails.\n * @slot range-overflow - Renders content when the max validation fails.\n * @slot range-underflow - Renders content when the min validation fails.\n * @slot step-mismatch - Renders content when the step validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n *\n * @fires igcInput - Emitted when the control input receives user input.\n * @fires igcChange - Emitted when the control's checked state changes.\n *\n * @csspart container - The main wrapper that holds all main input elements.\n * @csspart input - The native input element.\n * @csspart label - The native label element.\n * @csspart prefix - The prefix wrapper.\n * @csspart suffix - The suffix wrapper.\n * @csspart helper-text - The helper text wrapper.\n */\nexport default class IgcInputComponent extends IgcInputBaseComponent {\n public static readonly tagName = 'igc-input';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcInputComponent, IgcValidationContainerComponent);\n }\n\n protected override readonly _themes = addThemingController(this, all);\n\n protected override readonly _slots = addSlotController(this, {\n slots: Slots,\n });\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n protected override get __validators() {\n return this.type !== 'number' ? stringValidators : numberValidators;\n }\n\n private _min?: number;\n private _max?: number;\n private _minLength?: number;\n private _maxLength?: number;\n private _pattern?: string;\n private _step?: number;\n\n /* @tsTwoWayProperty(true, \"igcChange\", \"detail\", false) */\n /**\n * The value of the control.\n * @attr\n */\n @property()\n public set value(value: string) {\n this._formValue.setValueAndFormState(value);\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /* alternateName: displayType */\n /**\n * The type attribute of the control.\n * @attr\n */\n @property({ reflect: true })\n public type: InputType = 'text';\n\n /**\n * Makes the control a readonly field.\n *\n * @attr readonly\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public readOnly = false;\n\n /**\n * The input mode attribute of the control.\n * See [relevant MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)\n * @attr inputmode\n */\n @property({ attribute: 'inputmode' })\n public override inputMode!: string;\n\n /**\n * The pattern attribute of the control.\n * @attr\n */\n @property()\n public set pattern(value: string | undefined) {\n this._pattern = value;\n this._validate();\n }\n\n public get pattern(): string | undefined {\n return this._pattern;\n }\n\n /**\n * The minimum string length required by the control.\n * @attr minlength\n */\n @property({ type: Number, attribute: 'minlength' })\n public set minLength(value: number | undefined) {\n this._minLength = value;\n this._validate();\n }\n\n public get minLength(): number | undefined {\n return this._minLength;\n }\n\n /**\n * The maximum string length of the control.\n * @attr maxlength\n */\n @property({ type: Number, attribute: 'maxlength' })\n public set maxLength(value: number | undefined) {\n this._maxLength = value;\n this._validate();\n }\n\n public get maxLength(): number | undefined {\n return this._maxLength;\n }\n\n /**\n * The min attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set min(value: number | undefined) {\n this._min = value;\n this._validate();\n }\n\n public get min(): number | undefined {\n return this._min;\n }\n\n /**\n * The max attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set max(value: number | undefined) {\n this._max = value;\n this._validate();\n }\n\n public get max(): number | undefined {\n return this._max;\n }\n\n /**\n * The step attribute of the control.\n * @attr\n */\n @property({ type: Number })\n public set step(value: number | undefined) {\n this._step = value;\n this._validate();\n }\n\n public get step(): number | undefined {\n return this._step;\n }\n\n /**\n * The autofocus attribute of the control.\n * @attr\n */\n @property({ type: Boolean })\n public override autofocus!: boolean;\n\n /**\n * The autocomplete attribute of the control.\n * @attr\n */\n @property()\n public autocomplete!: string;\n\n /**\n * Enables validation rules to be evaluated without restricting user input. This applies to the `maxLength` property for\n * string-type inputs or allows spin buttons to exceed the predefined `min/max` limits for number-type inputs.\n *\n * @attr validate-only\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'validate-only' })\n public validateOnly = false;\n\n /* blazorSuppress */\n /** Replaces the selected text in the input. */\n public setRangeText(\n replacement: string,\n start?: number,\n end?: number,\n selectMode: RangeTextSelectMode = 'preserve'\n ): void {\n this._input?.setRangeText(replacement, start!, end!, selectMode);\n this.value = this._input?.value ?? '';\n }\n\n /* blazorSuppress */\n /** Sets the text selection range of the control */\n public setSelectionRange(\n start?: number,\n end?: number,\n direction: SelectionRangeDirection = 'none'\n ): void {\n this._input?.setSelectionRange(start ?? null, end ?? null, direction);\n }\n\n /** Increments the numeric value of the input by one or more steps. */\n public stepUp(n?: number): void {\n this._input?.stepUp(n);\n this.value = this._input?.value ?? '';\n }\n\n /** Decrements the numeric value of the input by one or more steps. */\n public stepDown(n?: number): void {\n this._input?.stepDown(n);\n this.value = this._input?.value ?? '';\n }\n\n private _handleInput(): void {\n this._setTouchedState();\n this.value = this._input?.value ?? '';\n this.emitEvent('igcInput', { detail: this.value });\n }\n\n private _handleChange(): void {\n this._setTouchedState();\n this.value = this._input?.value ?? '';\n this.emitEvent('igcChange', { detail: this.value });\n }\n\n protected _renderInput() {\n const hasNegativeTabIndex = this.getAttribute('tabindex') === '-1';\n const hasHelperText = this._slots.hasAssignedElements('helper-text');\n\n return html`\n <input\n id=${this._inputId}\n part=${partMap(this._resolvePartNames('input'))}\n name=${ifDefined(this.name)}\n type=${ifDefined(this.type)}\n pattern=${ifDefined(this.pattern)}\n placeholder=${ifDefined(this.placeholder)}\n .value=${live(this.value)}\n ?readonly=${this.readOnly}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?autofocus=${this.autofocus}\n tabindex=${bindIf(hasNegativeTabIndex, -1)}\n autocomplete=${ifDefined(this.autocomplete as any)}\n inputmode=${ifDefined(this.inputMode)}\n min=${bindIf(!this.validateOnly, this.min)}\n max=${bindIf(!this.validateOnly, this.max)}\n minlength=${ifDefined(this.minLength)}\n maxlength=${bindIf(!this.validateOnly, this.maxLength)}\n step=${ifDefined(this.step)}\n aria-describedby=${bindIf(hasHelperText, 'helper-text')}\n @change=${this._handleChange}\n @input=${this._handleInput}\n @blur=${this._handleBlur}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-input': IgcInputComponent;\n }\n}\n"]}
|