@cas-smartdesign/lit-input 7.1.3
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/LICENSE +8 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +502 -0
- package/dist/docs/index.html +28 -0
- package/dist/docs/misc-examples.js +1 -0
- package/dist/docs/monkey.svg +55 -0
- package/dist/docs/validation.js +1 -0
- package/dist/input-with-externals.js +123 -0
- package/dist/input-with-externals.js.map +7 -0
- package/dist/input.d.ts +81 -0
- package/dist/input.mjs +261 -0
- package/dist/input.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +37 -0
- package/readme.md +55 -0
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LitElement, PropertyValues, TemplateResult } from "lit";
|
|
2
|
+
import { ValidationLevel } from "@cas-smartdesign/field-validation-message";
|
|
3
|
+
declare const TAG_NAME = "sd-lit-input";
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
[TAG_NAME]: SDInput;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface IValueChangeEvent {
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CustomEventMap extends HTMLElementEventMap {
|
|
13
|
+
"immediate-value-change": CustomEvent<IValueChangeEvent>;
|
|
14
|
+
"value-change": CustomEvent<IValueChangeEvent>;
|
|
15
|
+
}
|
|
16
|
+
export default interface SDInput {
|
|
17
|
+
addEventListener<K extends keyof CustomEventMap>(event: K, listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null, options?: AddEventListenerOptions | boolean): void;
|
|
18
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
19
|
+
removeEventListener<K extends keyof CustomEventMap>(type: K, listener: (this: this, ev: CustomEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
20
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
21
|
+
dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;
|
|
22
|
+
}
|
|
23
|
+
export default class SDInput extends LitElement {
|
|
24
|
+
static readonly ID: string;
|
|
25
|
+
private static readonly DEFAULT_MAX_LENGTH;
|
|
26
|
+
static formAssociated: boolean;
|
|
27
|
+
label: string;
|
|
28
|
+
validationMessage: string;
|
|
29
|
+
validationIconSrc: string;
|
|
30
|
+
validationLevel: ValidationLevel;
|
|
31
|
+
currentText: any;
|
|
32
|
+
alwaysFloatLabel: boolean;
|
|
33
|
+
autocompleted: boolean;
|
|
34
|
+
rows: number;
|
|
35
|
+
effectiveDisabled: boolean;
|
|
36
|
+
extendedPrefix: boolean;
|
|
37
|
+
type: string;
|
|
38
|
+
placeholder: string;
|
|
39
|
+
sdAriaLabel: string;
|
|
40
|
+
maxlength: number;
|
|
41
|
+
readonly: boolean;
|
|
42
|
+
required: boolean;
|
|
43
|
+
name: string;
|
|
44
|
+
inactive: boolean;
|
|
45
|
+
autocomplete: AutoFill;
|
|
46
|
+
private _inputElement;
|
|
47
|
+
private _initialized;
|
|
48
|
+
private _needsAutocompletedCheck;
|
|
49
|
+
private _validationMessageId;
|
|
50
|
+
private _inputId;
|
|
51
|
+
private _internals;
|
|
52
|
+
private _initialValue;
|
|
53
|
+
static shadowRootOptions: ShadowRootInit;
|
|
54
|
+
constructor();
|
|
55
|
+
connectedCallback(): void;
|
|
56
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
57
|
+
private initAutocompleted;
|
|
58
|
+
private get activeShadyDOM();
|
|
59
|
+
private updateInitialValue;
|
|
60
|
+
get disabled(): boolean;
|
|
61
|
+
set disabled(disabled: boolean);
|
|
62
|
+
get inputElement(): HTMLInputElement;
|
|
63
|
+
get value(): string;
|
|
64
|
+
set value(newValue: string);
|
|
65
|
+
get selectionStart(): number;
|
|
66
|
+
focus(): void;
|
|
67
|
+
select(): void;
|
|
68
|
+
setSelectionRange(start: number, end: number): void;
|
|
69
|
+
static get styles(): import("lit").CSSResult[];
|
|
70
|
+
render(): TemplateResult;
|
|
71
|
+
protected updated(_changedProperties: PropertyValues): void;
|
|
72
|
+
update(changedProperties: PropertyValues): void;
|
|
73
|
+
protected fireValueChange(immediate?: boolean): void;
|
|
74
|
+
private shouldFloat;
|
|
75
|
+
protected setFormValue(value: string | File | FormData): void;
|
|
76
|
+
protected formResetCallback(): void;
|
|
77
|
+
protected formDisabledCallback(disabled: boolean): void;
|
|
78
|
+
protected formAssociatedCallback(_form: HTMLFormElement): void;
|
|
79
|
+
protected formStateRestoreCallback(state: File | string | FormData | null, reason: unknown): void;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
package/dist/input.mjs
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { LitElement as f, css as b, unsafeCSS as g, html as d, nothing as y } from "lit";
|
|
2
|
+
import { property as a } from "lit/decorators/property.js";
|
|
3
|
+
import { ifDefined as r } from "lit/directives/if-defined.js";
|
|
4
|
+
import { ValidationLevel as m } from "@cas-smartdesign/field-validation-message";
|
|
5
|
+
const x = ":host{display:inline-flex;position:relative;cursor:text;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;font-size:16px;color:#111;contain:layout style;flex-direction:column}:host([hidden]),:host([type=hidden]){display:none!important}:host([effective-disabled]){opacity:.6;cursor:default;filter:grayscale(100%)}:host([effective-disabled]) .unfocused-line,:host([effective-disabled]) .focused-line{border-bottom-style:dashed}:host(:not([effective-disabled]):focus) .focused-line,:host(:not([effective-disabled])[focused]) .focused-line{transform:none;transition:transform .25s}:host(:not([effective-disabled]):focus) .label.float,:host(:not([effective-disabled])[focused]) .label.float{color:var(--sd-input-focused-color, #1467ba)}:host([inactive]) .input{pointer-events:none}:host([effective-disabled]:focus),:host([effective-disabled][focused]){box-shadow:0 0 0 1px #111}:host(:not([effective-disabled])[validationlevel]) .focused-line{transform:none;transition:transform .25s}:host([validationlevel=warn i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #555555)}:host([validationlevel=warn i]) .label,:host([validationlevel=warn i]) .validation-message{color:var(--sd-input-validation-color, #555555)!important}:host([validationlevel=suggest i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #bf8800)}:host([validationlevel=suggest i]) .label,:host([validationlevel=suggest i]) .validation-message{color:var(--sd-input-validation-color, #bf8800)!important}:host([validationlevel=error i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #cc0017)}:host([validationlevel=error i]) .label,:host([validationlevel=error i]) .validation-message{color:var(--sd-input-validation-color, #cc0017)!important}:host([validationlevel=warn]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #555555)}:host([validationlevel=warn]) .label,:host([validationlevel=warn]) .validation-message{color:var(--sd-input-validation-color, #555555)!important}:host([validationlevel=suggest]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #bf8800)}:host([validationlevel=suggest]) .label,:host([validationlevel=suggest]) .validation-message{color:var(--sd-input-validation-color, #bf8800)!important}:host([validationlevel=error]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #cc0017)}:host([validationlevel=error]) .label,:host([validationlevel=error]) .validation-message{color:var(--sd-input-validation-color, #cc0017)!important}.validation-message-wrapper{position:relative}.validation-message{position:absolute;left:0;right:0}.label.float{transform:translateY(-75%) scale(.75);width:133%}.label:not(.float){max-width:100%}.floated-label-placeholder{height:20px;width:100%}.label{position:absolute;top:0;left:0;line-height:24px;pointer-events:none;color:var(--sd-input-color, #767676);transition:transform .25s,width .25s;transform-origin:left top}.input-wrapper{position:relative;display:flex;flex-direction:row;align-items:center;background-color:var(--input-wrapper-background-color)}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-wrapper{flex-direction:column;align-items:baseline}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-container{width:100%}:host([extended-prefix]:not(:focus-within)) .input-container,:host([extended-prefix][effective-disabled]) .input-container{width:0px}.input-container{line-height:var(--sd-input-line-height, 24px);flex:1 1 auto}.input{width:100%;background:var(--sd-input-background, transparent);font-family:inherit;font-size:inherit;text-align:inherit;color:inherit;border:none;outline:none;resize:none;padding-left:0;padding-right:0}.input:-webkit-autofill{animation-name:onautofillstart}.input:not(:-webkit-autofill){animation-name:onautofillcancel}@keyframes onautofillstart{0%{outline:none}}@keyframes onautofillcancel{0%{outline:none}}.label,input.input,.validation-message{text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.input::-ms-clear{display:none}.input::placeholder{color:var(--sd-input-color, #767676)}.input:-ms-input-placeholder{color:var(--sd-input-color, #767676)}.input::-ms-input-placeholder{color:var(--sd-input-color, #767676)}.underline{height:2px;width:100%;position:relative}.unfocused-line,.focused-line{position:absolute;top:0;right:0;bottom:0;left:0}.unfocused-line{border-bottom:1px solid var(--sd-input-underline-color, #959595)}.focused-line{border-bottom:2px solid var(--sd-input-focused-color, #1467ba);transform-origin:center center;transform:scale3d(0,1,1)}.prefix,.suffix{display:flex;flex-wrap:nowrap}.prefix ::slotted(*),.suffix ::slotted(*){display:flex}";
|
|
6
|
+
var w = Object.defineProperty, E = Object.getOwnPropertyDescriptor, o = (u, t, e, s) => {
|
|
7
|
+
for (var n = s > 1 ? void 0 : s ? E(t, e) : t, h = u.length - 1, p; h >= 0; h--)
|
|
8
|
+
(p = u[h]) && (n = (s ? p(t, e, n) : p(n)) || n);
|
|
9
|
+
return s && n && w(t, e, n), n;
|
|
10
|
+
};
|
|
11
|
+
const $ = "sd-lit-input", v = "delegatesFocus" in window.ShadowRoot.prototype;
|
|
12
|
+
let _ = 0;
|
|
13
|
+
var l;
|
|
14
|
+
const i = (l = class extends f {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(), this.rows = 1, this.effectiveDisabled = !1, this.type = "text", this.autocomplete = "off";
|
|
17
|
+
const t = _++;
|
|
18
|
+
this._validationMessageId = l.ID + "_message_" + t, this._inputId = l.ID + "_input_" + t, this.attachInternals && !this.activeShadyDOM && (this._internals = this.attachInternals());
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback(), this.hasAttribute("tabIndex") || (this.tabIndex = 0);
|
|
22
|
+
}
|
|
23
|
+
firstUpdated(t) {
|
|
24
|
+
super.firstUpdated(t), this.initAutocompleted(this.inputElement), this.updateInitialValue(), this.hasAttribute("disabled") && (this.disabled = !0), this.inputElement.oninput = (e) => {
|
|
25
|
+
this.autocompleted = e.inputType === "insertReplacementText" || !("data" in e), this.currentText = this.inputElement.value, this.fireValueChange(!0);
|
|
26
|
+
}, this.inputElement.onchange = () => this.fireValueChange(), v || (this.inputElement.onfocus = () => this.setAttribute("focused", ""), this.inputElement.onblur = () => this.removeAttribute("focused"), this.addEventListener("focus", (e) => {
|
|
27
|
+
e.target === this && this.inputElement.focus();
|
|
28
|
+
})), this.addEventListener("keydown", (e) => {
|
|
29
|
+
var s, n;
|
|
30
|
+
e.key == "Enter" && ((n = (s = this._internals) == null ? void 0 : s.form) == null || n.requestSubmit());
|
|
31
|
+
}), this._initialized = !0;
|
|
32
|
+
}
|
|
33
|
+
initAutocompleted(t) {
|
|
34
|
+
const e = (s) => {
|
|
35
|
+
/^onautofillstart(-sd-lit-input-\d+|\s?)$/.test(s.animationName) ? this.autocompleted = !0 : /^onautofillcancel(-sd-lit-input-\d+|\s?)$/.test(s.animationName) && (this.autocompleted = !1);
|
|
36
|
+
};
|
|
37
|
+
this.activeShadyDOM ? (this._needsAutocompletedCheck = !0, this.activeShadyDOM.nativeMethods.addEventListener.call(t, "animationstart", e)) : t.addEventListener("animationstart", e);
|
|
38
|
+
}
|
|
39
|
+
get activeShadyDOM() {
|
|
40
|
+
const t = window.ShadyDOM;
|
|
41
|
+
return t && t.inUse ? t : null;
|
|
42
|
+
}
|
|
43
|
+
updateInitialValue() {
|
|
44
|
+
typeof this.currentText < "u" ? this.value = this.currentText : this.value = this.getAttribute("value"), this.value && (this.currentText = this.inputElement.value), this._initialValue = this.value;
|
|
45
|
+
}
|
|
46
|
+
get disabled() {
|
|
47
|
+
return this.hasAttribute("disabled");
|
|
48
|
+
}
|
|
49
|
+
set disabled(t) {
|
|
50
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this._internals || (this.effectiveDisabled = t);
|
|
51
|
+
}
|
|
52
|
+
// It is public as hacking around due to IE 11 is a common task to do.
|
|
53
|
+
get inputElement() {
|
|
54
|
+
return this.shadowRoot && !this._inputElement && (this._inputElement = this.shadowRoot.querySelector(".input")), this._inputElement;
|
|
55
|
+
}
|
|
56
|
+
get value() {
|
|
57
|
+
return this.inputElement && this.inputElement.value;
|
|
58
|
+
}
|
|
59
|
+
set value(t) {
|
|
60
|
+
this.currentText = t || "", this.inputElement && (this.inputElement.value = this.currentText), this.setFormValue(this.currentText);
|
|
61
|
+
}
|
|
62
|
+
get selectionStart() {
|
|
63
|
+
return this.inputElement ? this.inputElement.selectionStart : 0;
|
|
64
|
+
}
|
|
65
|
+
focus() {
|
|
66
|
+
this.inputElement ? this.inputElement.focus() : super.focus();
|
|
67
|
+
}
|
|
68
|
+
select() {
|
|
69
|
+
this.inputElement && this.inputElement.select();
|
|
70
|
+
}
|
|
71
|
+
setSelectionRange(t, e) {
|
|
72
|
+
this.updateComplete.then(() => {
|
|
73
|
+
this.inputElement && this.inputElement.setSelectionRange(t, e);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static get styles() {
|
|
77
|
+
return [
|
|
78
|
+
b`
|
|
79
|
+
${g(x)}
|
|
80
|
+
`
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
let t;
|
|
85
|
+
return this.rows === 1 ? t = d`
|
|
86
|
+
<input
|
|
87
|
+
id=${this._inputId}
|
|
88
|
+
class="input"
|
|
89
|
+
.type=${this.type}
|
|
90
|
+
placeholder=${r(this.placeholder || void 0)}
|
|
91
|
+
name=${r(this.name || void 0)}
|
|
92
|
+
aria-disabled=${this.effectiveDisabled}
|
|
93
|
+
autocomplete=${this.autocomplete}
|
|
94
|
+
?disabled=${this.inactive}
|
|
95
|
+
?readonly=${this.readonly || this.effectiveDisabled}
|
|
96
|
+
?required=${this.required}
|
|
97
|
+
maxlength=${this.maxlength > 0 ? this.maxlength : l.DEFAULT_MAX_LENGTH}
|
|
98
|
+
aria-describedby=${this._validationMessageId}
|
|
99
|
+
aria-invalid=${r(!!this.validationMessage || void 0)}
|
|
100
|
+
aria-label=${r(this.sdAriaLabel || void 0)}
|
|
101
|
+
/>
|
|
102
|
+
` : t = d`
|
|
103
|
+
<textarea
|
|
104
|
+
id=${this._inputId}
|
|
105
|
+
class="input"
|
|
106
|
+
placeholder=${r(this.placeholder || void 0)}
|
|
107
|
+
name=${r(this.name || void 0)}
|
|
108
|
+
aria-disabled=${this.effectiveDisabled}
|
|
109
|
+
autocomplete=${this.autocomplete}
|
|
110
|
+
?disabled=${this.inactive}
|
|
111
|
+
?readonly=${this.readonly || this.effectiveDisabled}
|
|
112
|
+
?required=${this.required}
|
|
113
|
+
maxlength=${this.maxlength > 0 ? this.maxlength : l.DEFAULT_MAX_LENGTH}
|
|
114
|
+
rows=${this.rows}
|
|
115
|
+
aria-describedby=${this._validationMessageId}
|
|
116
|
+
aria-invalid=${r(!!this.validationMessage || void 0)}
|
|
117
|
+
aria-label=${r(this.sdAriaLabel || void 0)}
|
|
118
|
+
></textarea>
|
|
119
|
+
`, d`
|
|
120
|
+
${this.label ? d` <div class="floated-label-placeholder" aria-hidden="true"> </div> ` : y}
|
|
121
|
+
<div class="input-wrapper">
|
|
122
|
+
<span class="prefix"><slot name="prefix"></slot></span>
|
|
123
|
+
<div class="input-container" style="position:${this.shouldFloat() ? "static" : "relative"};">
|
|
124
|
+
${this.label && d`
|
|
125
|
+
<label for="${this._inputId}" class="label ${this.shouldFloat() ? "float" : ""}"
|
|
126
|
+
>${this.label}</label
|
|
127
|
+
>
|
|
128
|
+
`}
|
|
129
|
+
${t}
|
|
130
|
+
</div>
|
|
131
|
+
<span class="suffix"><slot name="suffix"></slot></span>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="underline" aria-hidden="true">
|
|
134
|
+
<div class="unfocused-line"></div>
|
|
135
|
+
<div class="focused-line"></div>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="validation-message-wrapper" aria-hidden="true">
|
|
138
|
+
${this.validationMessage && d`
|
|
139
|
+
<sd-field-validation-message
|
|
140
|
+
id=${this._validationMessageId}
|
|
141
|
+
class="validation-message"
|
|
142
|
+
.message=${this.validationMessage}
|
|
143
|
+
.icon=${this.validationIconSrc}
|
|
144
|
+
.level=${this.validationLevel}
|
|
145
|
+
>
|
|
146
|
+
</sd-field-validation-message>
|
|
147
|
+
`}
|
|
148
|
+
</div>
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
updated(t) {
|
|
152
|
+
super.updated(t), this._needsAutocompletedCheck && !this.autocompleted && setTimeout(() => {
|
|
153
|
+
try {
|
|
154
|
+
this.autocompleted = this.autocompleted || !!this.shadowRoot.querySelector(":-webkit-autofill");
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}, 0);
|
|
158
|
+
}
|
|
159
|
+
update(t) {
|
|
160
|
+
var e, s;
|
|
161
|
+
if (super.update(t), t.has("validationMessage") && (this.validationMessage ? (this.validationLevel || (this.validationLevel = m.Error), (e = this._internals) == null || e.setValidity({ customError: !0 }, this.validationMessage)) : (this.validationLevel = null, (s = this._internals) == null || s.setValidity({}))), this._initialized && t.has("rows"))
|
|
162
|
+
throw Error("rows attribute cannot be changed after the input is attached to the DOM");
|
|
163
|
+
}
|
|
164
|
+
fireValueChange(t) {
|
|
165
|
+
this.dispatchEvent(
|
|
166
|
+
new CustomEvent(`${t ? "immediate-" : ""}value-change`, {
|
|
167
|
+
detail: { value: this.value }
|
|
168
|
+
})
|
|
169
|
+
), this.setFormValue(this.value);
|
|
170
|
+
}
|
|
171
|
+
shouldFloat() {
|
|
172
|
+
return this.alwaysFloatLabel || this.currentText || this.placeholder || this.autocompleted;
|
|
173
|
+
}
|
|
174
|
+
setFormValue(t) {
|
|
175
|
+
var e;
|
|
176
|
+
(e = this._internals) == null || e.setFormValue(t);
|
|
177
|
+
}
|
|
178
|
+
formResetCallback() {
|
|
179
|
+
this.value = this._initialValue;
|
|
180
|
+
}
|
|
181
|
+
formDisabledCallback(t) {
|
|
182
|
+
this.effectiveDisabled = t || this.hasAttribute("disabled");
|
|
183
|
+
}
|
|
184
|
+
formAssociatedCallback(t) {
|
|
185
|
+
this._needsAutocompletedCheck = !0;
|
|
186
|
+
}
|
|
187
|
+
formStateRestoreCallback(t, e) {
|
|
188
|
+
typeof t == "string" && (this.value = t);
|
|
189
|
+
}
|
|
190
|
+
}, l.ID = $, l.DEFAULT_MAX_LENGTH = 524288, l.formAssociated = !0, l.shadowRootOptions = {
|
|
191
|
+
...f.shadowRootOptions,
|
|
192
|
+
delegatesFocus: v
|
|
193
|
+
}, l);
|
|
194
|
+
o([
|
|
195
|
+
a({ type: String, reflect: !0 })
|
|
196
|
+
], i.prototype, "label", 2);
|
|
197
|
+
o([
|
|
198
|
+
a({ type: String, attribute: !0 })
|
|
199
|
+
], i.prototype, "validationMessage", 2);
|
|
200
|
+
o([
|
|
201
|
+
a({ type: String, attribute: !0 })
|
|
202
|
+
], i.prototype, "validationIconSrc", 2);
|
|
203
|
+
o([
|
|
204
|
+
a({ type: m, attribute: !0, reflect: !0 })
|
|
205
|
+
], i.prototype, "validationLevel", 2);
|
|
206
|
+
o([
|
|
207
|
+
a({
|
|
208
|
+
type: String,
|
|
209
|
+
hasChanged(u, t) {
|
|
210
|
+
return t != null && t != u;
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
], i.prototype, "currentText", 2);
|
|
214
|
+
o([
|
|
215
|
+
a({ type: Boolean, attribute: !0 })
|
|
216
|
+
], i.prototype, "alwaysFloatLabel", 2);
|
|
217
|
+
o([
|
|
218
|
+
a({ type: Boolean, attribute: !0 })
|
|
219
|
+
], i.prototype, "autocompleted", 2);
|
|
220
|
+
o([
|
|
221
|
+
a({ type: Number, attribute: !0 })
|
|
222
|
+
], i.prototype, "rows", 2);
|
|
223
|
+
o([
|
|
224
|
+
a({ type: Boolean, reflect: !0, attribute: "effective-disabled" })
|
|
225
|
+
], i.prototype, "effectiveDisabled", 2);
|
|
226
|
+
o([
|
|
227
|
+
a({ type: Boolean, reflect: !0, attribute: "extended-prefix" })
|
|
228
|
+
], i.prototype, "extendedPrefix", 2);
|
|
229
|
+
o([
|
|
230
|
+
a({ type: String, reflect: !0 })
|
|
231
|
+
], i.prototype, "type", 2);
|
|
232
|
+
o([
|
|
233
|
+
a({ type: String, reflect: !0 })
|
|
234
|
+
], i.prototype, "placeholder", 2);
|
|
235
|
+
o([
|
|
236
|
+
a({ type: String, reflect: !0 })
|
|
237
|
+
], i.prototype, "sdAriaLabel", 2);
|
|
238
|
+
o([
|
|
239
|
+
a({ type: Number, reflect: !0 })
|
|
240
|
+
], i.prototype, "maxlength", 2);
|
|
241
|
+
o([
|
|
242
|
+
a({ type: Boolean, reflect: !0 })
|
|
243
|
+
], i.prototype, "readonly", 2);
|
|
244
|
+
o([
|
|
245
|
+
a({ type: Boolean, reflect: !0 })
|
|
246
|
+
], i.prototype, "required", 2);
|
|
247
|
+
o([
|
|
248
|
+
a({ type: String, reflect: !0 })
|
|
249
|
+
], i.prototype, "name", 2);
|
|
250
|
+
o([
|
|
251
|
+
a({ type: Boolean, reflect: !0 })
|
|
252
|
+
], i.prototype, "inactive", 2);
|
|
253
|
+
o([
|
|
254
|
+
a({ type: String, attribute: !0 })
|
|
255
|
+
], i.prototype, "autocomplete", 2);
|
|
256
|
+
let c = i;
|
|
257
|
+
customElements.get(c.ID) || customElements.define(c.ID, c);
|
|
258
|
+
export {
|
|
259
|
+
c as default
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.mjs","sources":["../input.ts"],"sourcesContent":["import { LitElement, html, PropertyValues, unsafeCSS, TemplateResult, css, nothing } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { ValidationLevel } from \"@cas-smartdesign/field-validation-message\";\n\nconst TAG_NAME = \"sd-lit-input\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: SDInput;\n }\n}\n\nimport style from \"./style.scss?inline\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst delegatesFocus = \"delegatesFocus\" in (window as any).ShadowRoot.prototype;\n\nlet idCounter = 0;\n\nexport interface IValueChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends HTMLElementEventMap {\n \"immediate-value-change\": CustomEvent<IValueChangeEvent>;\n \"value-change\": CustomEvent<IValueChangeEvent>;\n}\n\nexport default interface SDInput {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class SDInput extends LitElement {\n public static readonly ID: string = TAG_NAME;\n private static readonly DEFAULT_MAX_LENGTH: number = 524288;\n static formAssociated = true;\n\n @property({ type: String, reflect: true })\n public label: string;\n @property({ type: String, attribute: true })\n public validationMessage: string;\n @property({ type: String, attribute: true })\n public validationIconSrc: string;\n @property({ type: ValidationLevel, attribute: true, reflect: true })\n public validationLevel: ValidationLevel;\n @property({\n type: String,\n hasChanged(value, oldValue) {\n return oldValue != undefined && oldValue != value;\n },\n })\n public currentText;\n @property({ type: Boolean, attribute: true })\n public alwaysFloatLabel: boolean;\n @property({ type: Boolean, attribute: true })\n public autocompleted: boolean;\n @property({ type: Number, attribute: true })\n public rows = 1;\n @property({ type: Boolean, reflect: true, attribute: \"effective-disabled\" })\n public effectiveDisabled: boolean = false;\n @property({ type: Boolean, reflect: true, attribute: \"extended-prefix\" })\n public extendedPrefix: boolean;\n\n // delegated settings to input\n @property({ type: String, reflect: true })\n public type = \"text\";\n @property({ type: String, reflect: true })\n public placeholder: string;\n @property({ type: String, reflect: true })\n public sdAriaLabel: string;\n @property({ type: Number, reflect: true })\n public maxlength: number;\n @property({ type: Boolean, reflect: true })\n public readonly: boolean;\n @property({ type: Boolean, reflect: true })\n public required: boolean;\n @property({ type: String, reflect: true })\n public name: string;\n @property({ type: Boolean, reflect: true })\n public inactive: boolean;\n @property({ type: String, attribute: true })\n public autocomplete: AutoFill = \"off\";\n\n private _inputElement: HTMLInputElement;\n private _initialized: boolean;\n private _needsAutocompletedCheck: boolean;\n private _validationMessageId: string;\n private _inputId: string;\n private _internals: ElementInternals;\n private _initialValue: string;\n\n static shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus,\n };\n\n constructor() {\n super();\n const nextIdNumber = idCounter++;\n this._validationMessageId = SDInput.ID + \"_message_\" + nextIdNumber;\n this._inputId = SDInput.ID + \"_input_\" + nextIdNumber;\n if (this.attachInternals && !this.activeShadyDOM) {\n this._internals = this.attachInternals();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabIndex\")) {\n this.tabIndex = 0;\n }\n }\n\n protected firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n this.initAutocompleted(this.inputElement);\n this.updateInitialValue();\n\n if (this.hasAttribute(\"disabled\")) {\n this.disabled = true;\n }\n\n this.inputElement.oninput = (event: InputEvent) => {\n this.autocompleted = \"insertReplacementText\" === event.inputType || !(\"data\" in event);\n this.currentText = this.inputElement.value;\n this.fireValueChange(true);\n };\n this.inputElement.onchange = () => this.fireValueChange();\n if (!delegatesFocus) {\n // Provide a limited \"delegatesFocus\" behavior where it is not supported.\n // Note that clicking on non-focusable elements inside the shadow root\n // does not focus the first focusable element as it would have been expected.\n this.inputElement.onfocus = () => this.setAttribute(\"focused\", \"\");\n this.inputElement.onblur = () => this.removeAttribute(\"focused\");\n this.addEventListener(\"focus\", (event) => {\n if (event.target === this) {\n this.inputElement.focus();\n }\n });\n }\n this.addEventListener(\"keydown\", (event) => {\n if (event.key == \"Enter\") {\n this._internals?.form?.requestSubmit();\n }\n });\n this._initialized = true;\n }\n\n private initAutocompleted(target: HTMLElement) {\n const listener = (event) => {\n if (/^onautofillstart(-sd-lit-input-\\d+|\\s?)$/.test(event.animationName)) {\n this.autocompleted = true;\n } else if (/^onautofillcancel(-sd-lit-input-\\d+|\\s?)$/.test(event.animationName)) {\n this.autocompleted = false;\n }\n };\n if (this.activeShadyDOM) {\n this._needsAutocompletedCheck = true;\n this.activeShadyDOM.nativeMethods.addEventListener.call(target, \"animationstart\", listener);\n } else {\n target.addEventListener(\"animationstart\", listener);\n }\n }\n\n private get activeShadyDOM(): { nativeMethods } | null {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const shadyDOM = (window as any).ShadyDOM;\n return shadyDOM && shadyDOM.inUse ? shadyDOM : null;\n }\n\n private updateInitialValue(): void {\n if (typeof this.currentText !== \"undefined\") {\n this.value = this.currentText;\n } else {\n this.value = this.getAttribute(\"value\");\n }\n if (this.value) {\n this.currentText = this.inputElement.value;\n }\n this._initialValue = this.value;\n }\n\n public get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n public set disabled(disabled: boolean) {\n if (disabled) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n if (!this._internals) {\n this.effectiveDisabled = disabled;\n }\n }\n\n // It is public as hacking around due to IE 11 is a common task to do.\n public get inputElement(): HTMLInputElement {\n if (this.shadowRoot && !this._inputElement) {\n this._inputElement = this.shadowRoot.querySelector(\".input\");\n }\n return this._inputElement;\n }\n\n public get value(): string {\n return this.inputElement && this.inputElement.value;\n }\n\n public set value(newValue: string) {\n this.currentText = newValue || \"\";\n if (this.inputElement) {\n this.inputElement.value = this.currentText;\n }\n this.setFormValue(this.currentText);\n }\n\n public get selectionStart(): number {\n return this.inputElement ? this.inputElement.selectionStart : 0;\n }\n\n public focus(): void {\n if (this.inputElement) {\n this.inputElement.focus();\n } else {\n super.focus();\n }\n }\n\n public select(): void {\n if (this.inputElement) {\n this.inputElement.select();\n }\n }\n\n public setSelectionRange(start: number, end: number): void {\n this.updateComplete.then(() => {\n if (this.inputElement) {\n this.inputElement.setSelectionRange(start, end);\n }\n });\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public render(): TemplateResult {\n let inputPart;\n if (this.rows === 1) {\n inputPart = html`\n <input\n id=${this._inputId}\n class=\"input\"\n .type=${this.type}\n placeholder=${ifDefined(this.placeholder || undefined)}\n name=${ifDefined(this.name || undefined)}\n aria-disabled=${this.effectiveDisabled}\n autocomplete=${this.autocomplete}\n ?disabled=${this.inactive}\n ?readonly=${this.readonly || this.effectiveDisabled}\n ?required=${this.required}\n maxlength=${this.maxlength > 0 ? this.maxlength : SDInput.DEFAULT_MAX_LENGTH}\n aria-describedby=${this._validationMessageId}\n aria-invalid=${ifDefined(!!this.validationMessage || undefined)}\n aria-label=${ifDefined(this.sdAriaLabel || undefined)}\n />\n `;\n } else {\n inputPart = html`\n <textarea\n id=${this._inputId}\n class=\"input\"\n placeholder=${ifDefined(this.placeholder || undefined)}\n name=${ifDefined(this.name || undefined)}\n aria-disabled=${this.effectiveDisabled}\n autocomplete=${this.autocomplete}\n ?disabled=${this.inactive}\n ?readonly=${this.readonly || this.effectiveDisabled}\n ?required=${this.required}\n maxlength=${this.maxlength > 0 ? this.maxlength : SDInput.DEFAULT_MAX_LENGTH}\n rows=${this.rows}\n aria-describedby=${this._validationMessageId}\n aria-invalid=${ifDefined(!!this.validationMessage || undefined)}\n aria-label=${ifDefined(this.sdAriaLabel || undefined)}\n ></textarea>\n `;\n }\n return html`\n ${this.label ? html` <div class=\"floated-label-placeholder\" aria-hidden=\"true\"> </div> ` : nothing}\n <div class=\"input-wrapper\">\n <span class=\"prefix\"><slot name=\"prefix\"></slot></span>\n <div class=\"input-container\" style=\"position:${this.shouldFloat() ? \"static\" : \"relative\"};\">\n ${this.label &&\n html`\n <label for=\"${this._inputId}\" class=\"label ${this.shouldFloat() ? \"float\" : \"\"}\"\n >${this.label}</label\n >\n `}\n ${inputPart}\n </div>\n <span class=\"suffix\"><slot name=\"suffix\"></slot></span>\n </div>\n <div class=\"underline\" aria-hidden=\"true\">\n <div class=\"unfocused-line\"></div>\n <div class=\"focused-line\"></div>\n </div>\n <div class=\"validation-message-wrapper\" aria-hidden=\"true\">\n ${this.validationMessage &&\n html`\n <sd-field-validation-message\n id=${this._validationMessageId}\n class=\"validation-message\"\n .message=${this.validationMessage}\n .icon=${this.validationIconSrc}\n .level=${this.validationLevel}\n >\n </sd-field-validation-message>\n `}\n </div>\n `;\n }\n\n protected updated(_changedProperties: PropertyValues): void {\n super.updated(_changedProperties);\n if (this._needsAutocompletedCheck && !this.autocompleted) {\n setTimeout(() => {\n try {\n // In certain cases there is no animation event dispatched even if the animation itself is done (it is visible also in dev tools) when an autofill is done.\n this.autocompleted = this.autocompleted || !!this.shadowRoot.querySelector(\":-webkit-autofill\");\n } catch (ignored) {\n // the above used selector is not supported for example in Firefox\n }\n }, 0);\n }\n }\n\n public update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n if (changedProperties.has(\"validationMessage\")) {\n if (this.validationMessage) {\n if (!this.validationLevel) {\n this.validationLevel = ValidationLevel.Error;\n }\n this._internals?.setValidity({ customError: true }, this.validationMessage);\n } else {\n this.validationLevel = null;\n this._internals?.setValidity({});\n }\n }\n if (this._initialized && changedProperties.has(\"rows\")) {\n throw Error(\"rows attribute cannot be changed after the input is attached to the DOM\");\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n this.dispatchEvent(\n new CustomEvent<IValueChangeEvent>(`${immediate ? \"immediate-\" : \"\"}value-change`, {\n detail: { value: this.value },\n }),\n );\n this.setFormValue(this.value);\n }\n\n private shouldFloat() {\n return this.alwaysFloatLabel || this.currentText || this.placeholder || this.autocompleted;\n }\n\n protected setFormValue(value: string | File | FormData) {\n this._internals?.setFormValue(value);\n }\n\n protected formResetCallback() {\n this.value = this._initialValue;\n }\n\n protected formDisabledCallback(disabled: boolean) {\n this.effectiveDisabled = disabled || this.hasAttribute(\"disabled\");\n }\n\n protected formAssociatedCallback(_form: HTMLFormElement) {\n this._needsAutocompletedCheck = true;\n }\n\n protected formStateRestoreCallback(state: File | string | FormData | null, reason: unknown) {\n if (typeof state == \"string\") {\n this.value = state;\n }\n }\n}\n\nif (!customElements.get(SDInput.ID)) {\n customElements.define(SDInput.ID, SDInput);\n}\n"],"names":["TAG_NAME","delegatesFocus","idCounter","_SDInput","_a","LitElement","nextIdNumber","changedProperties","event","_b","target","listener","shadyDOM","disabled","newValue","start","end","css","unsafeCSS","style","inputPart","html","ifDefined","nothing","_changedProperties","ValidationLevel","immediate","value","_form","state","reason","__decorateClass","property","oldValue","SDInput"],"mappings":";;;;;;;;;;AAKA,MAAMA,IAAW,gBAWXC,IAAiB,oBAAqB,OAAe,WAAW;AAEtE,IAAIC,IAAY;;AAmChB,MAAqBC,KAArBC,IAAA,cAAqCC,EAAW;AAAA,EAgE5C,cAAc;AACJ,aAxCV,KAAO,OAAO,GAEd,KAAO,oBAA6B,IAMpC,KAAO,OAAO,QAgBd,KAAO,eAAyB;AAiB5B,UAAMC,IAAeJ;AAChB,SAAA,uBAAuBE,EAAQ,KAAK,cAAcE,GAClD,KAAA,WAAWF,EAAQ,KAAK,YAAYE,GACrC,KAAK,mBAAmB,CAAC,KAAK,mBACzB,KAAA,aAAa,KAAK;EAE/B;AAAA,EAE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AAAA,GA1CzB7B,EA2CV,WAAA,YAAA,CAAA;AAEA4B,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GA5CxB7B,EA6CV,WAAA,QAAA,CAAA;AAEA4B,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GA9CzB7B,EA+CV,WAAA,YAAA,CAAA;AAEA4B,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM;AAAA,GAhD1B7B,EAiDV,WAAA,gBAAA,CAAA;AAjDX,IAAqB+B,IAArB/B;AA2WK,eAAe,IAAI+B,EAAQ,EAAE,KACf,eAAA,OAAOA,EAAQ,IAAIA,CAAO;"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@cypress/vite-dev-server@5.0.7": {
|
|
3
|
+
"licenses": "MIT",
|
|
4
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
5
|
+
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/rollup/plugins",
|
|
10
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@types/node@20.10.6": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
28
|
+
"licenses": "BSD-2-Clause",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/ui@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"axe-core@4.8.3": {
|
|
43
|
+
"licenses": "MPL-2.0",
|
|
44
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"cypress-axe@1.5.0": {
|
|
48
|
+
"licenses": "MIT",
|
|
49
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
|
+
},
|
|
52
|
+
"cypress-real-events@1.13.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
+
},
|
|
57
|
+
"cypress@13.6.2": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
60
|
+
"licenseUrl": "https://cypress.io"
|
|
61
|
+
},
|
|
62
|
+
"esbuild@0.19.11": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
65
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
66
|
+
},
|
|
67
|
+
"eslint-config-google@0.14.0": {
|
|
68
|
+
"licenses": "Apache-2.0",
|
|
69
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
70
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-prettier@9.1.0": {
|
|
73
|
+
"licenses": "MIT",
|
|
74
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint@8.56.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/eslint/eslint",
|
|
80
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"github-markdown-css@5.5.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
|
+
},
|
|
87
|
+
"highlight.js@11.9.0": {
|
|
88
|
+
"licenses": "BSD-3-Clause",
|
|
89
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
|
+
},
|
|
92
|
+
"junit-report-builder@3.1.0": {
|
|
93
|
+
"licenses": "MIT",
|
|
94
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged@15.2.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lit@2.8.0": {
|
|
103
|
+
"licenses": "BSD-3-Clause",
|
|
104
|
+
"repository": "https://github.com/lit/lit",
|
|
105
|
+
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/lit-input",
|
|
3
|
+
"version": "7.1.3",
|
|
4
|
+
"description": "An input element based on LitElement & material components",
|
|
5
|
+
"main": "dist/input-with-externals.js",
|
|
6
|
+
"module": "dist/input.mjs",
|
|
7
|
+
"types": "dist/input.d.ts",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"lit": "^2.8.0",
|
|
11
|
+
"@cas-smartdesign/field-validation-message": "^5.0.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@cas-smartdesign/element-preview": "^0.2.1",
|
|
15
|
+
"@cas-smartdesign/styles": "^3.6.1",
|
|
16
|
+
"@cas-smartdesign/license-generator": "^1.6.1"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"npm-third-party-licenses.json"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"registry": "https://registry.npmjs.org/",
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"version": "pnpm version",
|
|
28
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
29
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
30
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
31
|
+
"watch": "vite build --watch",
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"generate-license": "sd-license-generator --r ../../",
|
|
34
|
+
"test:component": "pnpm cypress run --component --quiet --browser chrome",
|
|
35
|
+
"cypress:open": "pnpm cypress open --component"
|
|
36
|
+
}
|
|
37
|
+
}
|