@felleslosninger/minid-elements 0.1.5 → 0.1.7
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/dist/components/checkbox.component.d.ts +8 -0
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.js +49 -3
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-input.component.d.ts +25 -0
- package/dist/components/code-input.component.d.ts.map +1 -1
- package/dist/components/code-input.js +188 -26
- package/dist/components/code-input.js.map +1 -1
- package/dist/components/textfield.component.d.ts +2 -0
- package/dist/components/textfield.component.d.ts.map +1 -1
- package/dist/components/textfield.js +165 -44
- package/dist/components/textfield.js.map +1 -1
- package/dist/mixins/form-control.mixin.d.ts.map +1 -1
- package/dist/mixins/form-control.mixin.js +19 -0
- package/dist/mixins/form-control.mixin.js.map +1 -1
- package/dist/types/form-control.d.ts +1 -0
- package/dist/types/form-control.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,17 @@ declare const MinidCheckbox_base: import('../types/mixin-constructor.ts').Constr
|
|
|
9
9
|
* @slot -- The default slot for the label text of the checkbox
|
|
10
10
|
* @slot description - The slot for the description text of the checkbox
|
|
11
11
|
*
|
|
12
|
+
* @csspart label - The checkbox's label.
|
|
13
|
+
* @csspart description - The checkbox's description.
|
|
14
|
+
* @csspart validation-message - The error message shown by `invalidmessage`.
|
|
15
|
+
*
|
|
12
16
|
* @event mid-change - Emitted when the checked state changes
|
|
13
17
|
*/
|
|
14
18
|
export declare class MinidCheckbox extends MinidCheckbox_base {
|
|
15
19
|
private input;
|
|
20
|
+
private readonly hasSlotController;
|
|
21
|
+
private readonly descriptionId;
|
|
22
|
+
private readonly validationId;
|
|
16
23
|
/**
|
|
17
24
|
* The name of the checkbox, submitted as a name/value pair with form data.
|
|
18
25
|
*/
|
|
@@ -26,6 +33,7 @@ export declare class MinidCheckbox extends MinidCheckbox_base {
|
|
|
26
33
|
disabled: boolean;
|
|
27
34
|
readonly: boolean;
|
|
28
35
|
invalid: boolean;
|
|
36
|
+
invalidmessage: string;
|
|
29
37
|
required: boolean;
|
|
30
38
|
static get formControlValidators(): import('../types/validator.type.ts').Validator[];
|
|
31
39
|
shouldFormValueUpdate(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAK5C,OAAO,0BAA0B,CAAC;AAOlC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,aAAa,CAAC;KAC/B;CACF;;AAUD;;;;;;;;;GASG;AAEH,qBACa,aAAc,SAAQ,kBAElC;IAEC,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAGhC;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;IAE7C;;OAEG;IAEH,IAAI,SAAM;IAEV;;OAEG;IAEH,KAAK,SAAQ;IAGb,OAAO,UAAS;IAGhB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,QAAQ,UAAS;IAGjB,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAGhB,cAAc,SAAM;IAGpB,QAAQ,UAAS;IAEjB,MAAM,KAAK,qBAAqB,qDAE/B;IAED,qBAAqB,IAAI,OAAO;IAIhC,IAAI,gBAAgB,qBAEnB;IAED,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B;;OAEG;IACH,IAAI;IAKJ,iBAAiB;IAKR,MAAM;CAoEhB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
1
|
+
import { css, LitElement, html } from "lit";
|
|
2
2
|
import { query, property, customElement } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
3
4
|
import { live } from "lit/directives/live.js";
|
|
4
5
|
import { styled } from "../mixins/tailwind.mixin.js";
|
|
5
6
|
import "./icon/icon.js";
|
|
@@ -7,6 +8,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
7
8
|
import { FormControlMixin } from "../mixins/form-control.mixin.js";
|
|
8
9
|
import { watch } from "../internal/watch.js";
|
|
9
10
|
import { requiredValidator } from "../mixins/validators.js";
|
|
11
|
+
import { HasSlotController } from "../internal/slot.js";
|
|
10
12
|
var __defProp = Object.defineProperty;
|
|
11
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
14
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -17,15 +19,31 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
19
|
if (kind && result) __defProp(target, key, result);
|
|
18
20
|
return result;
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
const styles = [
|
|
23
|
+
css`
|
|
24
|
+
.description {
|
|
25
|
+
color: var(--ds-color-neutral-text-subtle);
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
];
|
|
29
|
+
let MinidCheckbox = class extends FormControlMixin(
|
|
30
|
+
styled(LitElement, styles)
|
|
31
|
+
) {
|
|
21
32
|
constructor() {
|
|
22
33
|
super(...arguments);
|
|
34
|
+
this.hasSlotController = new HasSlotController(
|
|
35
|
+
this,
|
|
36
|
+
"description"
|
|
37
|
+
);
|
|
38
|
+
this.descriptionId = "description";
|
|
39
|
+
this.validationId = "validation";
|
|
23
40
|
this.name = "";
|
|
24
41
|
this.value = "on";
|
|
25
42
|
this.checked = false;
|
|
26
43
|
this.disabled = false;
|
|
27
44
|
this.readonly = false;
|
|
28
45
|
this.invalid = false;
|
|
46
|
+
this.invalidmessage = "";
|
|
29
47
|
this.required = false;
|
|
30
48
|
}
|
|
31
49
|
static get formControlValidators() {
|
|
@@ -73,6 +91,12 @@ let MinidCheckbox = class extends FormControlMixin(styled(LitElement)) {
|
|
|
73
91
|
this.setValue(this.value);
|
|
74
92
|
}
|
|
75
93
|
render() {
|
|
94
|
+
const hasDescription = !!this.description || this.hasSlotController.test("description");
|
|
95
|
+
const isInvalid = this.invalid || !!this.invalidmessage;
|
|
96
|
+
const describedBy = [
|
|
97
|
+
hasDescription ? this.descriptionId : void 0,
|
|
98
|
+
this.invalidmessage ? this.validationId : void 0
|
|
99
|
+
].filter(Boolean).join(" ") || void 0;
|
|
76
100
|
return html`
|
|
77
101
|
<ds-field class="ds-field">
|
|
78
102
|
<input
|
|
@@ -85,6 +109,11 @@ let MinidCheckbox = class extends FormControlMixin(styled(LitElement)) {
|
|
|
85
109
|
?checked=${this.checked}
|
|
86
110
|
?readonly=${this.readonly}
|
|
87
111
|
?required=${this.required}
|
|
112
|
+
aria-invalid=${isInvalid ? "true" : "false"}
|
|
113
|
+
aria-describedby=${ifDefined(describedBy)}
|
|
114
|
+
aria-errormessage=${ifDefined(
|
|
115
|
+
this.invalidmessage ? this.validationId : void 0
|
|
116
|
+
)}
|
|
88
117
|
@click=${this.handleClick}
|
|
89
118
|
@keydown=${this.handleKeydown}
|
|
90
119
|
/>
|
|
@@ -95,7 +124,11 @@ let MinidCheckbox = class extends FormControlMixin(styled(LitElement)) {
|
|
|
95
124
|
>
|
|
96
125
|
<slot></slot>
|
|
97
126
|
</label>
|
|
98
|
-
<div
|
|
127
|
+
<div
|
|
128
|
+
class="description"
|
|
129
|
+
id="${this.descriptionId}"
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
>
|
|
99
132
|
<slot
|
|
100
133
|
name="description"
|
|
101
134
|
part="description"
|
|
@@ -103,6 +136,16 @@ let MinidCheckbox = class extends FormControlMixin(styled(LitElement)) {
|
|
|
103
136
|
${this.description}
|
|
104
137
|
</slot>
|
|
105
138
|
</div>
|
|
139
|
+
<p
|
|
140
|
+
class="${classMap({
|
|
141
|
+
"ds-validation-message": !!this.invalidmessage
|
|
142
|
+
})}"
|
|
143
|
+
part="validation-message"
|
|
144
|
+
id="${this.validationId}"
|
|
145
|
+
aria-live="polite"
|
|
146
|
+
>
|
|
147
|
+
${this.invalidmessage}
|
|
148
|
+
</p>
|
|
106
149
|
</ds-field>
|
|
107
150
|
`;
|
|
108
151
|
}
|
|
@@ -131,6 +174,9 @@ __decorateClass([
|
|
|
131
174
|
__decorateClass([
|
|
132
175
|
property({ type: Boolean })
|
|
133
176
|
], MinidCheckbox.prototype, "invalid", 2);
|
|
177
|
+
__decorateClass([
|
|
178
|
+
property()
|
|
179
|
+
], MinidCheckbox.prototype, "invalidmessage", 2);
|
|
134
180
|
__decorateClass([
|
|
135
181
|
property({ type: Boolean, reflect: true })
|
|
136
182
|
], MinidCheckbox.prototype, "required", 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport './icon/icon.component.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { FormControlMixin } from '../mixins/form-control.mixin.ts';\nimport { watch } from '../internal/watch.ts';\nimport { requiredValidator } from '../mixins/validators.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-checkbox': MinidCheckbox;\n }\n}\n\n/**\n * @slot -- The default slot for the label text of the checkbox\n * @slot description - The slot for the description text of the checkbox\n *\n * @event mid-change - Emitted when the checked state changes\n */\n\n@customElement('mid-checkbox')\nexport class MinidCheckbox extends FormControlMixin(styled(LitElement)) {\n @query('input[type=\"checkbox\"]')\n private input!: HTMLInputElement;\n\n /**\n * The name of the checkbox, submitted as a name/value pair with form data.\n */\n @property()\n name = '';\n\n /**\n * The current value of the checkbox, submitted as a name/value pair with form data.\n */\n @property()\n value = 'on';\n\n @property({ type: Boolean })\n checked = false;\n\n @property()\n description?: string;\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: Boolean })\n readonly = false;\n\n @property({ type: Boolean })\n invalid = false;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n static get formControlValidators() {\n return [requiredValidator];\n }\n\n shouldFormValueUpdate(): boolean {\n return this.checked;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleClick() {\n this.checked = !this.checked;\n // this.indeterminate = false;\n this.dispatchEvent(new Event('mid-change'));\n }\n\n /**\n * Simulates a click on the checkbox.\n */\n click() {\n this.input.click();\n }\n\n /**\n * Sets focus on the checkbox.\n */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /**\n * Removes focus from the checkbox.\n */\n blur() {\n this.input.blur();\n }\n\n @watch(['checked', 'value'])\n handleStateChange() {\n // this.input.indeterminate = this.indeterminate; // force a sync update\n this.setValue(this.value);\n }\n\n override render() {\n\n return html`\n <ds-field class=\"ds-field\">\n <input\n id=\"input\"\n class=\"ds-input\"\n type=\"checkbox\"\n value=${ifDefined(this.value)}\n .checked=${live(this.checked)}\n ?disabled=${this.disabled}\n ?checked=${this.checked}\n ?readonly=${this.readonly}\n ?required=${this.required}\n @click=${this.handleClick}\n @keydown=${this.handleKeydown}\n />\n <label\n class=\"ds-label\"\n part=\"label\"\n for=\"input\"\n >\n <slot></slot>\n </label>\n <div
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.component.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport './icon/icon.component.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { FormControlMixin } from '../mixins/form-control.mixin.ts';\nimport { watch } from '../internal/watch.ts';\nimport { requiredValidator } from '../mixins/validators.ts';\nimport { HasSlotController } from '../internal/slot.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-checkbox': MinidCheckbox;\n }\n}\n\nconst styles = [\n css`\n .description {\n color: var(--ds-color-neutral-text-subtle);\n }\n `,\n];\n\n/**\n * @slot -- The default slot for the label text of the checkbox\n * @slot description - The slot for the description text of the checkbox\n *\n * @csspart label - The checkbox's label.\n * @csspart description - The checkbox's description.\n * @csspart validation-message - The error message shown by `invalidmessage`.\n *\n * @event mid-change - Emitted when the checked state changes\n */\n\n@customElement('mid-checkbox')\nexport class MinidCheckbox extends FormControlMixin(\n styled(LitElement, styles)\n) {\n @query('input[type=\"checkbox\"]')\n private input!: HTMLInputElement;\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'description'\n );\n\n private readonly descriptionId = 'description';\n private readonly validationId = 'validation';\n\n /**\n * The name of the checkbox, submitted as a name/value pair with form data.\n */\n @property()\n name = '';\n\n /**\n * The current value of the checkbox, submitted as a name/value pair with form data.\n */\n @property()\n value = 'on';\n\n @property({ type: Boolean })\n checked = false;\n\n @property()\n description?: string;\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: Boolean })\n readonly = false;\n\n @property({ type: Boolean })\n invalid = false;\n\n @property()\n invalidmessage = '';\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n static get formControlValidators() {\n return [requiredValidator];\n }\n\n shouldFormValueUpdate(): boolean {\n return this.checked;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleClick() {\n this.checked = !this.checked;\n // this.indeterminate = false;\n this.dispatchEvent(new Event('mid-change'));\n }\n\n /**\n * Simulates a click on the checkbox.\n */\n click() {\n this.input.click();\n }\n\n /**\n * Sets focus on the checkbox.\n */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /**\n * Removes focus from the checkbox.\n */\n blur() {\n this.input.blur();\n }\n\n @watch(['checked', 'value'])\n handleStateChange() {\n // this.input.indeterminate = this.indeterminate; // force a sync update\n this.setValue(this.value);\n }\n\n override render() {\n const hasDescription =\n !!this.description || this.hasSlotController.test('description');\n const isInvalid = this.invalid || !!this.invalidmessage;\n const describedBy =\n [\n hasDescription ? this.descriptionId : undefined,\n this.invalidmessage ? this.validationId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n // The description wrapper is aria-hidden. It is already announced through\n // the aria-describedby above, and without this the text is also reachable as\n // its own node when navigating the page, so it is read out twice.\n\n return html`\n <ds-field class=\"ds-field\">\n <input\n id=\"input\"\n class=\"ds-input\"\n type=\"checkbox\"\n value=${ifDefined(this.value)}\n .checked=${live(this.checked)}\n ?disabled=${this.disabled}\n ?checked=${this.checked}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-invalid=${isInvalid ? 'true' : 'false'}\n aria-describedby=${ifDefined(describedBy)}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n @click=${this.handleClick}\n @keydown=${this.handleKeydown}\n />\n <label\n class=\"ds-label\"\n part=\"label\"\n for=\"input\"\n >\n <slot></slot>\n </label>\n <div\n class=\"description\"\n id=\"${this.descriptionId}\"\n aria-hidden=\"true\"\n >\n <slot\n name=\"description\"\n part=\"description\"\n >\n ${this.description}\n </slot>\n </div>\n <p\n class=\"${classMap({\n 'ds-validation-message': !!this.invalidmessage,\n })}\"\n part=\"validation-message\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n >\n ${this.invalidmessage}\n </p>\n </ds-field>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAcO,IAAM,gBAAN,cAA4B;AAAA,EACjC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAFK,cAAA;AAAA,UAAA,GAAA,SAAA;AAML,SAAiB,oBAAoB,IAAI;AAAA,MACvC;AAAA,MACA;AAAA,IAAA;AAGF,SAAiB,gBAAgB;AACjC,SAAiB,eAAe;AAMhC,SAAA,OAAO;AAMP,SAAA,QAAQ;AAGR,SAAA,UAAU;AAMV,SAAA,WAAW;AAGX,SAAA,WAAW;AAGX,SAAA,UAAU;AAGV,SAAA,iBAAiB;AAGjB,SAAA,WAAW;AAAA,EAAA;AAAA,EAEX,WAAW,wBAAwB;AACjC,WAAO,CAAC,iBAAiB;AAAA,EAC3B;AAAA,EAEA,wBAAiC;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,cAAc,OAAsB;AAC1C,UAAM,cACJ,MAAM,WAAW,MAAM,WAAW,MAAM,YAAY,MAAM;AAI5D,QAAI,MAAM,QAAQ,WAAW,CAAC,aAAa;A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cAyGX,WAAA,qBAAA,CAAA;AAzGW,gBAAN,gBAAA;AAAA,EADN,cAAc,cAAc;AAAA,GAChB,aAAA;"}
|
|
@@ -14,10 +14,13 @@ declare const MinidCodeInput_base: import('../types/mixin-constructor.ts').Const
|
|
|
14
14
|
* @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown
|
|
15
15
|
*
|
|
16
16
|
* @slot label - The input's label if you need to use HTML. Alternatively, you can use the `label` attribute.
|
|
17
|
+
* @slot description - The input's description if you need to use HTML. Alternatively, you can use the `description` attribute.
|
|
17
18
|
*
|
|
18
19
|
* @csspart input-container - The wrapper around the input elements. This can be used to adjust font-size.
|
|
20
|
+
* @csspart description - The description shown between the label and the character boxes.
|
|
19
21
|
* @csspart character-boxes - The container for the visual character boxes.
|
|
20
22
|
* @csspart character-box - An individual character box.
|
|
23
|
+
* @csspart validation-message - The error message shown by `invalidmessage`.
|
|
21
24
|
*
|
|
22
25
|
* @method focus - Focuses the input element
|
|
23
26
|
* @method clear - Clears the input
|
|
@@ -25,10 +28,12 @@ declare const MinidCodeInput_base: import('../types/mixin-constructor.ts').Const
|
|
|
25
28
|
export declare class MinidCodeInput extends MinidCodeInput_base {
|
|
26
29
|
private readonly hasSlotControler;
|
|
27
30
|
private readonly labelId;
|
|
31
|
+
private readonly descriptionId;
|
|
28
32
|
private readonly validationId;
|
|
29
33
|
private inputElement;
|
|
30
34
|
value: string;
|
|
31
35
|
label: string;
|
|
36
|
+
description: string;
|
|
32
37
|
type: 'number' | 'text';
|
|
33
38
|
/**
|
|
34
39
|
* For displaying appropriate virtual keyboard
|
|
@@ -38,6 +43,7 @@ export declare class MinidCodeInput extends MinidCodeInput_base {
|
|
|
38
43
|
* Adjusts the font-size of the code inputs
|
|
39
44
|
*/
|
|
40
45
|
size: 'sm' | 'md' | 'lg';
|
|
46
|
+
labelsize?: 'sm' | 'md' | 'lg';
|
|
41
47
|
/**
|
|
42
48
|
* Number of input characters or digits
|
|
43
49
|
*/
|
|
@@ -59,6 +65,7 @@ export declare class MinidCodeInput extends MinidCodeInput_base {
|
|
|
59
65
|
* Visually hides `label` (still available for screen readers)
|
|
60
66
|
*/
|
|
61
67
|
hidelabel: boolean;
|
|
68
|
+
hidedescription: boolean;
|
|
62
69
|
/**
|
|
63
70
|
* Makes the input required
|
|
64
71
|
*/
|
|
@@ -68,20 +75,38 @@ export declare class MinidCodeInput extends MinidCodeInput_base {
|
|
|
68
75
|
*/
|
|
69
76
|
pattern?: string;
|
|
70
77
|
private isFocused;
|
|
78
|
+
private caretPosition;
|
|
79
|
+
private lastFormValue;
|
|
71
80
|
static get formControlValidators(): import('../types/validator.type.ts').Validator[];
|
|
72
81
|
get validationTarget(): HTMLInputElement;
|
|
73
82
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
83
|
+
connectedCallback(): void;
|
|
84
|
+
disconnectedCallback(): void;
|
|
74
85
|
private handleBoxClick;
|
|
86
|
+
/**
|
|
87
|
+
* Catches caret moves we did not make - arrow keys, Home/End, word jumps,
|
|
88
|
+
* shift-selection - without enumerating keys, and keeps up while a key is held.
|
|
89
|
+
*
|
|
90
|
+
* Must be listened for on the document: for a caret move the user made,
|
|
91
|
+
* Chromium fires it only there, not at the input and not into the shadow root,
|
|
92
|
+
* so an `@selectionchange` binding on either never runs.
|
|
93
|
+
*/
|
|
94
|
+
private handleSelectionChange;
|
|
95
|
+
private syncCaretPosition;
|
|
75
96
|
private handleFocus;
|
|
76
97
|
private handleBlur;
|
|
98
|
+
private filterValue;
|
|
77
99
|
private handleBeforeInput;
|
|
100
|
+
private handlePaste;
|
|
78
101
|
private handleInput;
|
|
79
102
|
private handleChange;
|
|
80
103
|
private handleKeydown;
|
|
81
104
|
clear(): void;
|
|
82
105
|
resetFormControl(): void;
|
|
83
106
|
focus(options?: FocusOptions): void;
|
|
107
|
+
private focusInput;
|
|
84
108
|
handleLengthChange(): void;
|
|
109
|
+
handleValueChange(): void;
|
|
85
110
|
render(): import('lit').TemplateResult<1>;
|
|
86
111
|
}
|
|
87
112
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-input.component.d.ts","sourceRoot":"","sources":["../../src/components/code-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,
|
|
1
|
+
{"version":3,"file":"code-input.component.d.ts","sourceRoot":"","sources":["../../src/components/code-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,cAAc,EAAE,MAAM,KAAK,CAAC;AASrE,OAAO,0BAA0B,CAAC;AASlC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,cAAc,CAAC;KAClC;CACF;;AA2PD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,cAAe,SAAQ,mBAEnC;IACC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAI/B;IACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkD;IAChF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiD;IAG9E,OAAO,CAAC,YAAY,CAAoB;IAGxC,KAAK,SAAM;IAGX,KAAK,SAAM;IAGX,WAAW,SAAM;IAGjB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAU;IAEjC;;OAEG;IAEH,SAAS,EAAE,SAAS,GAAG,MAAM,CAAa;IAE1C;;OAEG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAGhC,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE/B;;OAEG;IAEH,MAAM,SAAK;IAGX,QAAQ,UAAS;IAEjB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,cAAc,SAAM;IAEpB;;OAEG;IAEH,SAAS,UAAS;IAGlB,eAAe,UAAS;IAExB;;OAEG;IA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