@felleslosninger/minid-elements 0.0.140 → 0.1.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/README.md +69 -4
- package/dist/components/alert.component.d.ts +6 -4
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.js +33 -61
- package/dist/components/alert.js.map +1 -1
- package/dist/components/button.component.d.ts +1 -1
- package/dist/components/checkbox.component.d.ts +1 -2
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.js +25 -55
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-input-old.component.d.ts +1 -1
- package/dist/components/code-input-old.js +1 -1
- package/dist/components/code-input.component.d.ts +1 -1
- package/dist/components/code-input.component.d.ts.map +1 -1
- package/dist/components/code-input.js +232 -94
- package/dist/components/code-input.js.map +1 -1
- package/dist/components/combobox.component.d.ts +1 -1
- package/dist/components/countdown.component.d.ts +1 -1
- package/dist/components/dialog.component.d.ts +7 -1
- package/dist/components/dialog.component.d.ts.map +1 -1
- package/dist/components/dialog.js +19 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown.component.d.ts +1 -1
- package/dist/components/heading.component.d.ts +1 -1
- package/dist/components/heading.component.d.ts.map +1 -1
- package/dist/components/heading.js +1 -11
- package/dist/components/heading.js.map +1 -1
- package/dist/components/helptext.component.d.ts +1 -1
- package/dist/components/label.component.d.ts +1 -1
- package/dist/components/label.component.d.ts.map +1 -1
- package/dist/components/label.js +3 -12
- package/dist/components/label.js.map +1 -1
- package/dist/components/link.component.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/menu-item.component.d.ts +1 -1
- package/dist/components/menu.component.d.ts +1 -1
- package/dist/components/paragraph.component.d.ts +1 -1
- package/dist/components/paragraph.component.d.ts.map +1 -1
- package/dist/components/paragraph.js +2 -8
- package/dist/components/paragraph.js.map +1 -1
- package/dist/components/phone-input.component.d.ts +15 -3
- package/dist/components/phone-input.component.d.ts.map +1 -1
- package/dist/components/phone-input.js +37 -6
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popup.component.d.ts +1 -1
- package/dist/components/qr-code.component.d.ts +1 -1
- package/dist/components/radio-button.component.d.ts +1 -1
- package/dist/components/radio-group.component.d.ts +1 -1
- package/dist/components/radio.component.d.ts +1 -1
- package/dist/components/radio.component.d.ts.map +1 -1
- package/dist/components/radio.js +12 -16
- package/dist/components/radio.js.map +1 -1
- package/dist/components/search.component.d.ts +11 -4
- package/dist/components/search.component.d.ts.map +1 -1
- package/dist/components/search.js +75 -31
- package/dist/components/search.js.map +1 -1
- package/dist/components/spinner.component.d.ts +1 -1
- package/dist/components/step-indicator.component.d.ts +1 -1
- package/dist/components/textfield.component.d.ts +5 -3
- package/dist/components/textfield.component.d.ts.map +1 -1
- package/dist/components/textfield.js +76 -84
- package/dist/components/textfield.js.map +1 -1
- package/dist/components/tooltip.component.d.ts +1 -1
- package/dist/components/validation-message.component.d.ts +1 -1
- package/dist/controllers/lang.controller.d.ts +14 -0
- package/dist/controllers/lang.controller.d.ts.map +1 -0
- package/dist/designsystemet-tailwind.css +355 -297
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lang.controller-P4W-9ipy.js +32 -0
- package/dist/lang.controller-P4W-9ipy.js.map +1 -0
- package/dist/mixins/validators.d.ts +1 -0
- package/dist/mixins/validators.d.ts.map +1 -1
- package/dist/mixins/validators.js +18 -1
- package/dist/mixins/validators.js.map +1 -1
- package/dist/styles.css +5 -0
- package/dist/theme.css +1155 -0
- package/dist/utilities/lang.d.ts +6 -0
- package/dist/utilities/lang.d.ts.map +1 -0
- package/dist/utilities/lang.js +18 -0
- package/dist/utilities/lang.js.map +1 -0
- package/dist/utilities/translations.d.ts +43 -0
- package/dist/utilities/translations.d.ts.map +1 -0
- package/dist/utilities/translations.js +49 -0
- package/dist/utilities/translations.js.map +1 -0
- package/package.json +34 -16
|
@@ -7,10 +7,13 @@ import { styled } from "../mixins/tailwind.mixin.js";
|
|
|
7
7
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
8
8
|
import { HasSlotController } from "../internal/slot.js";
|
|
9
9
|
import { FormControlMixin } from "../mixins/form-control.mixin.js";
|
|
10
|
-
import { requiredValidator, maxLengthValidator, minLengthValidator, patternValidator } from "../mixins/validators.js";
|
|
10
|
+
import { requiredValidator, maxLengthValidator, minLengthValidator, patternValidator, typeMismatchValidator } from "../mixins/validators.js";
|
|
11
11
|
import { watch } from "../internal/watch.js";
|
|
12
12
|
import "./icon/icon.js";
|
|
13
13
|
import { MaskInput } from "maska";
|
|
14
|
+
import { getLang } from "../utilities/lang.js";
|
|
15
|
+
import { getTranslations } from "../utilities/translations.js";
|
|
16
|
+
import { L as LangController } from "../lang.controller-P4W-9ipy.js";
|
|
14
17
|
var __defProp = Object.defineProperty;
|
|
15
18
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
19
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -26,7 +29,7 @@ const styles = [
|
|
|
26
29
|
:host {
|
|
27
30
|
display: block;
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
|
|
30
33
|
/* Hide increment/decrement buttons on inputs */
|
|
31
34
|
input[type='number']::-webkit-outer-spin-button,
|
|
32
35
|
input[type='number']::-webkit-inner-spin-button,
|
|
@@ -35,15 +38,17 @@ const styles = [
|
|
|
35
38
|
margin: 0;
|
|
36
39
|
-moz-appearance: textfield !important;
|
|
37
40
|
}
|
|
41
|
+
|
|
42
|
+
.ds-field-affixes {
|
|
43
|
+
background: var(--ds-color-neutral-background-tinted);
|
|
44
|
+
}
|
|
38
45
|
`
|
|
39
46
|
];
|
|
40
47
|
let nextUniqueId = 0;
|
|
41
|
-
let MinidTextfield = class extends FormControlMixin(
|
|
42
|
-
styled(LitElement, styles)
|
|
43
|
-
) {
|
|
48
|
+
let MinidTextfield = class extends FormControlMixin(styled(LitElement, styles)) {
|
|
44
49
|
constructor() {
|
|
45
50
|
super();
|
|
46
|
-
this.hasSlotControler = new HasSlotController(this, "label");
|
|
51
|
+
this.hasSlotControler = new HasSlotController(this, "label", "prefix", "suffix");
|
|
47
52
|
this.initialValue = "";
|
|
48
53
|
this.label = "";
|
|
49
54
|
this.description = "";
|
|
@@ -61,6 +66,7 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
61
66
|
this.required = false;
|
|
62
67
|
this.hidelabel = false;
|
|
63
68
|
this.hasFocus = false;
|
|
69
|
+
new LangController(this);
|
|
64
70
|
nextUniqueId++;
|
|
65
71
|
this.inputId = `mid-textfield-input-${nextUniqueId}`;
|
|
66
72
|
this.descriptionId = `mid-textfield-description-${nextUniqueId}`;
|
|
@@ -72,13 +78,21 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
72
78
|
requiredValidator,
|
|
73
79
|
maxLengthValidator,
|
|
74
80
|
minLengthValidator,
|
|
75
|
-
patternValidator
|
|
81
|
+
patternValidator,
|
|
82
|
+
typeMismatchValidator
|
|
76
83
|
];
|
|
77
84
|
}
|
|
78
85
|
connectedCallback() {
|
|
79
86
|
super.connectedCallback();
|
|
80
87
|
this.initialValue = this.value;
|
|
81
88
|
}
|
|
89
|
+
get validationTarget() {
|
|
90
|
+
return this.input;
|
|
91
|
+
}
|
|
92
|
+
firstUpdated(_changedProperties) {
|
|
93
|
+
super.firstUpdated(_changedProperties);
|
|
94
|
+
this.setValue(this.value);
|
|
95
|
+
}
|
|
82
96
|
disconnectedCallback() {
|
|
83
97
|
this.inputMask?.destroy();
|
|
84
98
|
}
|
|
@@ -164,74 +178,55 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
164
178
|
});
|
|
165
179
|
}
|
|
166
180
|
render() {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const sm = this.size === "sm";
|
|
181
|
+
const lang = getLang(this);
|
|
182
|
+
const t = getTranslations(lang);
|
|
170
183
|
const hasLabelSlot = this.hasSlotControler.test("label");
|
|
171
184
|
const hasLabel = !!this.label || !!hasLabelSlot;
|
|
185
|
+
const hasPrefix = this.hasSlotControler.test("prefix");
|
|
186
|
+
const hasSuffix = this.hasSlotControler.test("suffix");
|
|
172
187
|
const hasClearIcon = this.clearable && !this.disabled && !this.readonly;
|
|
188
|
+
const hasAffixes = hasPrefix || hasSuffix || hasClearIcon || this.passwordtoggle && !this.disabled;
|
|
173
189
|
const isClearIconVisible = hasClearIcon && (typeof this.value === "number" || this.value.length > 0);
|
|
174
190
|
const describedBy = [
|
|
175
191
|
this.description ? this.descriptionId : void 0,
|
|
176
192
|
this.invalidmessage ? this.validationId : void 0
|
|
177
193
|
].filter(Boolean).join(" ");
|
|
178
194
|
return html`
|
|
179
|
-
<
|
|
195
|
+
<ds-field
|
|
180
196
|
part="field"
|
|
181
|
-
class="
|
|
182
|
-
|
|
183
|
-
"text-body-sm": sm,
|
|
184
|
-
"text-body-md": md,
|
|
185
|
-
"text-body-lg": lg
|
|
186
|
-
})} max-w-full"
|
|
197
|
+
class="ds-field"
|
|
198
|
+
data-size=${this.size}
|
|
187
199
|
>
|
|
188
200
|
<label
|
|
189
201
|
for="${this.inputId}"
|
|
190
202
|
class="${classMap({
|
|
191
203
|
"sr-only": this.hidelabel || !hasLabel
|
|
192
|
-
})}
|
|
204
|
+
})} ds-label"
|
|
193
205
|
>
|
|
194
|
-
${this.readonly ? html`<mid-icon
|
|
195
|
-
class="size-5"
|
|
196
|
-
library="system"
|
|
197
|
-
name="padlock-locked-fill"
|
|
198
|
-
></mid-icon>` : nothing}
|
|
199
206
|
<slot name="label"> ${this.label} </slot>
|
|
200
207
|
</label>
|
|
201
208
|
${this.description ? html`
|
|
202
209
|
<div
|
|
203
210
|
id="${this.descriptionId}"
|
|
204
211
|
part="description"
|
|
212
|
+
data-field="description"
|
|
205
213
|
class="${classMap({
|
|
206
214
|
"sr-only": this.hidelabel
|
|
207
|
-
})}
|
|
215
|
+
})}"
|
|
208
216
|
>
|
|
209
217
|
${this.description}
|
|
210
218
|
</div>
|
|
211
219
|
` : nothing}
|
|
212
220
|
<div
|
|
213
221
|
part="base"
|
|
214
|
-
class="${
|
|
215
|
-
"border-neutral": !this.invalidmessage && !this.readonly,
|
|
216
|
-
"border-danger": this.invalidmessage && !this.readonly,
|
|
217
|
-
"border-neutral-subtle": this.readonly,
|
|
218
|
-
"bg-neutral-surface-tinted": this.readonly,
|
|
219
|
-
"bg-neutral-surface": !this.readonly,
|
|
220
|
-
border: !this.invalidmessage,
|
|
221
|
-
"border-2": this.invalidmessage
|
|
222
|
-
})} focus-within:focus-ring flex h-12 items-center rounded-md px-3"
|
|
222
|
+
class="${hasAffixes ? "ds-field-affixes" : ""}"
|
|
223
223
|
>
|
|
224
|
-
|
|
225
|
-
<slot name="prefix"></slot>
|
|
226
|
-
</span>
|
|
224
|
+
${hasPrefix ? html`<span class="ds-field-affix"><slot name="prefix"></slot></span>` : html`<slot name="prefix"></slot>`}
|
|
227
225
|
<input
|
|
228
226
|
id="${this.inputId}"
|
|
229
|
-
class="
|
|
230
|
-
"w-full": !isClearIconVisible,
|
|
231
|
-
"w-[calc(100%-var(--spacing)*7)]": isClearIconVisible,
|
|
232
|
-
"[&::-webkit-search-cancel-button]:appearance-none": this.type === "search"
|
|
233
|
-
})} input grow overflow-clip focus-visible:outline-0"
|
|
227
|
+
class="ds-input"
|
|
234
228
|
part="input"
|
|
229
|
+
lang=${lang}
|
|
235
230
|
.value=${live(this.value)}
|
|
236
231
|
?disabled=${this.disabled}
|
|
237
232
|
?readonly=${this.readonly}
|
|
@@ -249,6 +244,7 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
249
244
|
min=${ifDefined(this.min)}
|
|
250
245
|
max=${ifDefined(this.max)}
|
|
251
246
|
pattern=${ifDefined(this.pattern)}
|
|
247
|
+
inputmode=${this.inputmode}
|
|
252
248
|
@input=${this.handleInput}
|
|
253
249
|
@change=${this.handleChange}
|
|
254
250
|
@focus=${this.handleFocus}
|
|
@@ -256,64 +252,60 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
256
252
|
@keydown=${this.handleKeydown}
|
|
257
253
|
/>
|
|
258
254
|
${isClearIconVisible ? html`
|
|
259
|
-
<button
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
255
|
+
<span class="ds-field-affix" part="clear-button">
|
|
256
|
+
<button
|
|
257
|
+
type="button"
|
|
258
|
+
class="focus-visible:focus-ring flex items-center justify-center rounded-sm"
|
|
259
|
+
aria-label=${t.clear}
|
|
260
|
+
@click=${this.handleClearClick}
|
|
261
|
+
>
|
|
262
|
+
<mid-icon
|
|
263
|
+
class="size-7"
|
|
264
|
+
library="nav-aksel"
|
|
265
|
+
name="trash"
|
|
266
|
+
></mid-icon>
|
|
267
|
+
</button>
|
|
268
|
+
</span>
|
|
272
269
|
` : ""}
|
|
273
270
|
${this.passwordtoggle && !this.disabled ? html`
|
|
274
|
-
<button
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
${this.passwordvisible ? html` <mid-icon
|
|
283
|
-
class="size-7"
|
|
284
|
-
library="system"
|
|
285
|
-
name="eye-slash"
|
|
286
|
-
></mid-icon>` : html`
|
|
287
|
-
<mid-icon
|
|
271
|
+
<span class="ds-field-affix" part="password-toggle-button">
|
|
272
|
+
<button
|
|
273
|
+
type="button"
|
|
274
|
+
class="focus-visible:focus-ring flex items-center justify-center rounded-sm"
|
|
275
|
+
aria-label=${this.passwordvisible ? t.hidePassword : t.showPassword}
|
|
276
|
+
@click=${this.handlePasswordToggle}
|
|
277
|
+
>
|
|
278
|
+
${this.passwordvisible ? html` <mid-icon
|
|
288
279
|
class="size-7"
|
|
289
280
|
library="system"
|
|
290
|
-
name="eye"
|
|
291
|
-
></mid-icon
|
|
292
|
-
|
|
293
|
-
|
|
281
|
+
name="eye-slash"
|
|
282
|
+
></mid-icon>` : html`
|
|
283
|
+
<mid-icon
|
|
284
|
+
class="size-7"
|
|
285
|
+
library="system"
|
|
286
|
+
name="eye"
|
|
287
|
+
></mid-icon>
|
|
288
|
+
`}
|
|
289
|
+
</button>
|
|
290
|
+
</span>
|
|
294
291
|
` : ""}
|
|
295
|
-
|
|
296
|
-
<slot name="suffix"></slot>
|
|
297
|
-
</span>
|
|
292
|
+
${hasSuffix ? html`<span part="suffix" class="ds-field-affix"><slot name="suffix"></slot></span>` : html`<slot name="suffix"></slot>`}
|
|
298
293
|
</div>
|
|
299
|
-
<
|
|
300
|
-
class="
|
|
294
|
+
<p
|
|
295
|
+
class="ds-validation-message"
|
|
296
|
+
data-field="validation"
|
|
301
297
|
id="${this.validationId}"
|
|
302
298
|
aria-live="polite"
|
|
303
299
|
?hidden=${!this.invalidmessage}
|
|
304
300
|
>
|
|
305
|
-
<mid-icon
|
|
306
|
-
name="xmark-octagon-fill"
|
|
307
|
-
class="mt-1 min-h-5 min-w-5"
|
|
308
|
-
></mid-icon>
|
|
309
301
|
${this.invalidmessage}
|
|
310
|
-
</
|
|
311
|
-
</
|
|
302
|
+
</p>
|
|
303
|
+
</ds-field>
|
|
312
304
|
`;
|
|
313
305
|
}
|
|
314
306
|
};
|
|
315
307
|
__decorateClass([
|
|
316
|
-
query("
|
|
308
|
+
query("input")
|
|
317
309
|
], MinidTextfield.prototype, "input", 2);
|
|
318
310
|
__decorateClass([
|
|
319
311
|
property()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\nimport { MaskInput, type MaskType } from 'maska';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n \n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly validationId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private inputMask?: MaskInput;\n private initialValue = '';\n\n @query('.input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode:\n 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n * */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Modify input value based on mask e.g: `\"##:##\"` = 12:34.\n * `#`: /[0-9]/\n * `@`: /[a-zA-Z]/\n * `*`: /[a-zA-Z0-9]/\n * For more information go to https://beholdr.github.io/maska\n */\n @property()\n mask?: MaskType;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n this.validationId = `mid-textfield-validation-${nextUniqueId}`;\n this.setValue(this.value);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n disconnectedCallback(): void {\n this.inputMask?.destroy();\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 handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n let tmp_value = this.input.value;\n\n if (this.type === 'number') {\n tmp_value = tmp_value.replace(/[^0-9]/g, '');\n }\n\n this.value = tmp_value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n @watch('mask')\n async handleMaskUpdate() {\n if (!this.mask) return;\n await this.updateComplete;\n this.inputMask?.destroy();\n this.inputMask = new MaskInput(this.input, {\n mask: this.mask,\n eager: true,\n });\n }\n\n override render() {\n const lg = this.size === 'lg';\n const md = this.size === 'md';\n const sm = this.size === 'sm';\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n const describedBy = [\n this.description ? this.descriptionId : undefined,\n this.invalidmessage ? this.validationId : undefined,\n ]\n .filter(Boolean)\n .join(' ');\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'opacity-disabled': this.disabled,\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })} max-w-full\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })} text-neutral-subtle mb-2\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${classMap({\n 'border-neutral': !this.invalidmessage && !this.readonly,\n 'border-danger': this.invalidmessage && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n border: !this.invalidmessage,\n 'border-2': this.invalidmessage,\n })} focus-within:focus-ring flex h-12 items-center rounded-md px-3\"\n >\n <span class=\"slotted:!mr-2 slotted:rounded flex items-center\">\n <slot name=\"prefix\"></slot>\n </span>\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n 'w-full': !isClearIconVisible,\n 'w-[calc(100%-var(--spacing)*7)]': isClearIconVisible,\n '[&::-webkit-search-cancel-button]:appearance-none':\n this.type === 'search',\n })} input grow overflow-clip focus-visible:outline-0\"\n part=\"input\"\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=${ifDefined(describedBy || undefined)}\n aria-invalid=${this.invalidmessage ? 'true' : 'false'}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <button\n part=\"clear-button\"\n type=\"button\"\n class=\"focus-visible:focus-ring ml-2 flex items-center justify-center rounded-sm\"\n aria-label=\"Tøm\"\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"xmark\"\n ></mid-icon>\n </button>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <button\n part=\"password-toggle-button\"\n type=\"button\"\n class=\"ml-2 flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? 'skjul passord'\n : 'vis passord'}\n @click=${this.handlePasswordToggle}\n tabindex=\"-1\"\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n `\n : ''}\n <span part=\"suffix\" class=\"slotted:!ml-2 slotted:rounded\">\n <slot name=\"suffix\"></slot>\n </span>\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcF;AAEA,IAAI,eAAe;AAuBZ,IAAM,iBAAN,cAA6B;AAAA,EAClC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAmKA,cAAc;AACZ,UAAA;AAhKF,SAAiB,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AAEvE,SAAQ,eAAe;AAMvB,SAAA,QAAQ;AAGR,SAAA,cAAc;AAGd,SAAA,QAAQ;AAGR,SAAA,OAA2B;AAS3B,SAAA,YAAY;AAoCZ,SAAA,iBAAiB;AAGjB,SAAA,OAaa;AAMb,SAAA,YAOgB;AAMhB,SAAA,YAAY;AAOZ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AAM;AAAA,GAtRF,eAuRL,WAAA,oBAAA,CAAA;AAvRK,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
|
|
1
|
+
{"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n typeMismatchValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\nimport { MaskInput, type MaskType } from 'maska';\nimport { getLang } from '../utilities/lang';\nimport { getTranslations } from '../utilities/translations';\nimport { LangController } from '../controllers/lang.controller.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n\n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n\n .ds-field-affixes {\n background: var(--ds-color-neutral-background-tinted);\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(styled(LitElement, styles)) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly validationId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label', 'prefix', 'suffix');\n private inputMask?: MaskInput;\n private initialValue = '';\n\n @query('input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode:\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Modify input value based on mask e.g: `\"##:##\"` = 12:34.\n * `#`: /[0-9]/\n * `@`: /[a-zA-Z]/\n * `*`: /[a-zA-Z0-9]/\n * For more information go to https://beholdr.github.io/maska\n */\n @property()\n mask?: MaskType;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n typeMismatchValidator,\n ];\n }\n\n constructor() {\n super();\n new LangController(this);\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n this.validationId = `mid-textfield-validation-${nextUniqueId}`;\n this.setValue(this.value);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n super.firstUpdated(_changedProperties);\n this.setValue(this.value);\n }\n\n disconnectedCallback(): void {\n this.inputMask?.destroy();\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n let tmp_value = this.input.value;\n\n if (this.type === 'number') {\n tmp_value = tmp_value.replace(/[^0-9]/g, '');\n }\n\n this.value = tmp_value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n @watch('mask')\n async handleMaskUpdate() {\n if (!this.mask) return;\n await this.updateComplete;\n this.inputMask?.destroy();\n this.inputMask = new MaskInput(this.input, {\n mask: this.mask,\n eager: true,\n });\n }\n\n override render() {\n const lang = getLang(this);\n const t = getTranslations(lang);\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasPrefix = this.hasSlotControler.test('prefix');\n const hasSuffix = this.hasSlotControler.test('suffix');\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const hasAffixes = hasPrefix || hasSuffix || hasClearIcon || (this.passwordtoggle && !this.disabled);\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n const describedBy = [\n this.description ? this.descriptionId : undefined,\n this.invalidmessage ? this.validationId : undefined,\n ]\n .filter(Boolean)\n .join(' ');\n\n return html`\n <ds-field\n part=\"field\"\n class=\"ds-field\"\n data-size=${this.size}\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} ds-label\"\n >\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n data-field=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })}\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${hasAffixes ? 'ds-field-affixes' : ''}\"\n >\n ${hasPrefix ? html`<span class=\"ds-field-affix\"><slot name=\"prefix\"></slot></span>` : html`<slot name=\"prefix\"></slot>`}\n <input\n id=\"${this.inputId}\"\n class=\"ds-input\"\n part=\"input\"\n lang=${lang}\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=${ifDefined(describedBy || undefined)}\n aria-invalid=${this.invalidmessage ? 'true' : 'false'}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n inputmode=${this.inputmode}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <span class=\"ds-field-affix\" part=\"clear-button\">\n <button\n type=\"button\"\n class=\"focus-visible:focus-ring flex items-center justify-center rounded-sm\"\n aria-label=${t.clear}\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"nav-aksel\"\n name=\"trash\"\n ></mid-icon>\n </button>\n </span>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <span class=\"ds-field-affix\" part=\"password-toggle-button\">\n <button\n type=\"button\"\n class=\"focus-visible:focus-ring flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? t.hidePassword\n : t.showPassword}\n @click=${this.handlePasswordToggle}\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n </span>\n `\n : ''}\n ${hasSuffix ? html`<span part=\"suffix\" class=\"ds-field-affix\"><slot name=\"suffix\"></slot></span>` : html`<slot name=\"suffix\"></slot>`}\n </div>\n <p\n class=\"ds-validation-message\"\n data-field=\"validation\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n ${this.invalidmessage}\n </p>\n </ds-field>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBF;AAEA,IAAI,eAAe;AAuBZ,IAAM,iBAAN,cAA6B,iBAAiB,OAAO,YAAY,MAAM,CAAC,EAAE;AAAA,EAoK/E,cAAc;AACZ,UAAA;AAjKF,SAAiB,mBAAmB,IAAI,kBAAkB,MAAM,SAAS,UAAU,QAAQ;AAE3F,SAAQ,eAAe;AAMvB,SAAA,QAAQ;AAGR,SAAA,cAAc;AAGd,SAAA,QAAQ;AAGR,SAAA,O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,MAAM;AAAA,GA1RF,eA2RL,WAAA,oBAAA,CAAA;AA3RK,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
|
|
@@ -88,7 +88,7 @@ export declare class MinidTooltip extends MinidTooltip_base {
|
|
|
88
88
|
* Hides the tooltip
|
|
89
89
|
*/
|
|
90
90
|
hide(): Promise<void>;
|
|
91
|
-
render(): import('lit
|
|
91
|
+
render(): import('lit').TemplateResult<1>;
|
|
92
92
|
}
|
|
93
93
|
export {};
|
|
94
94
|
//# sourceMappingURL=tooltip.component.d.ts.map
|
|
@@ -6,7 +6,7 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
declare const MinidValidationMessage_base: typeof LitElement;
|
|
8
8
|
export declare class MinidValidationMessage extends MinidValidationMessage_base {
|
|
9
|
-
render(): import('lit
|
|
9
|
+
render(): import('lit').TemplateResult<1>;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=validation-message.component.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Reactive controller that keeps a component in sync with the active language.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LangController implements ReactiveController {
|
|
6
|
+
private readonly host;
|
|
7
|
+
private readonly observer;
|
|
8
|
+
private managed;
|
|
9
|
+
constructor(host: ReactiveControllerHost & HTMLElement);
|
|
10
|
+
hostConnected(): void;
|
|
11
|
+
hostDisconnected(): void;
|
|
12
|
+
private handleDocumentLangChange;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=lang.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lang.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/lang.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAGtE;;GAEG;AACH,qBAAa,cAAe,YAAW,kBAAkB;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuC;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,EAAE,sBAAsB,GAAG,WAAW;IAKtD,aAAa;IAYb,gBAAgB;IAIhB,OAAO,CAAC,wBAAwB;CAOjC"}
|