@phcdevworks/spectre-components 1.0.0 → 1.2.0

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.
Files changed (66) hide show
  1. package/README.md +586 -107
  2. package/dist/base-B_9DJkh2.d.cts +38 -0
  3. package/dist/base-B_9DJkh2.d.ts +38 -0
  4. package/dist/button.cjs +252 -90
  5. package/dist/button.cjs.map +1 -1
  6. package/dist/button.d.cts +39 -37
  7. package/dist/button.d.ts +39 -37
  8. package/dist/button.js +252 -90
  9. package/dist/button.js.map +1 -1
  10. package/dist/checkbox.cjs +228 -67
  11. package/dist/checkbox.cjs.map +1 -1
  12. package/dist/checkbox.d.cts +21 -21
  13. package/dist/checkbox.d.ts +21 -21
  14. package/dist/checkbox.js +228 -67
  15. package/dist/checkbox.js.map +1 -1
  16. package/dist/fieldset.cjs +245 -56
  17. package/dist/fieldset.cjs.map +1 -1
  18. package/dist/fieldset.d.cts +35 -14
  19. package/dist/fieldset.d.ts +35 -14
  20. package/dist/fieldset.js +245 -56
  21. package/dist/fieldset.js.map +1 -1
  22. package/dist/form-9cZG1E9P.d.cts +10 -0
  23. package/dist/form-9cZG1E9P.d.ts +10 -0
  24. package/dist/index.cjs +647 -328
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +4 -4
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +647 -328
  29. package/dist/index.js.map +1 -1
  30. package/dist/input.cjs +262 -77
  31. package/dist/input.cjs.map +1 -1
  32. package/dist/input.d.cts +72 -40
  33. package/dist/input.d.ts +72 -40
  34. package/dist/input.js +262 -77
  35. package/dist/input.js.map +1 -1
  36. package/dist/label.cjs +217 -55
  37. package/dist/label.cjs.map +1 -1
  38. package/dist/label.d.cts +17 -10
  39. package/dist/label.d.ts +17 -10
  40. package/dist/label.js +217 -55
  41. package/dist/label.js.map +1 -1
  42. package/dist/{projectable-DcnBRiko.d.cts → projectable-CIfxi7dv.d.cts} +1 -1
  43. package/dist/{projectable-SzbPvXfM.d.ts → projectable-Ksv9eoIr.d.ts} +1 -1
  44. package/dist/radio.cjs +248 -67
  45. package/dist/radio.cjs.map +1 -1
  46. package/dist/radio.d.cts +23 -21
  47. package/dist/radio.d.ts +23 -21
  48. package/dist/radio.js +248 -67
  49. package/dist/radio.js.map +1 -1
  50. package/dist/select.cjs +230 -67
  51. package/dist/select.cjs.map +1 -1
  52. package/dist/select.d.cts +27 -27
  53. package/dist/select.d.ts +27 -27
  54. package/dist/select.js +230 -67
  55. package/dist/select.js.map +1 -1
  56. package/dist/textarea.cjs +256 -77
  57. package/dist/textarea.cjs.map +1 -1
  58. package/dist/textarea.d.cts +53 -32
  59. package/dist/textarea.d.ts +53 -32
  60. package/dist/textarea.js +256 -77
  61. package/dist/textarea.js.map +1 -1
  62. package/package.json +22 -12
  63. package/dist/base-DQtCQ-dP.d.cts +0 -22
  64. package/dist/base-DQtCQ-dP.d.ts +0 -22
  65. package/dist/form-iI7vV-3W.d.cts +0 -6
  66. package/dist/form-iI7vV-3W.d.ts +0 -6
package/dist/input.js CHANGED
@@ -7,22 +7,92 @@ import { getInputClasses } from '@phcdevworks/spectre-ui';
7
7
  var SpectreBaseElement = class extends LitElement {
8
8
  constructor() {
9
9
  super(...arguments);
10
- this.ariaLabel = null;
11
- this.ariaLabelledBy = null;
12
- this.ariaDescribedBy = null;
10
+ this._ariaLabel = null;
11
+ this._ariaLabelledBy = null;
12
+ this._ariaDescribedBy = null;
13
+ this._autocapitalize = "";
14
+ this._spellcheck = null;
15
+ this._title = "";
16
+ this._id = "";
17
+ }
18
+ get ariaLabel() {
19
+ return this._ariaLabel;
20
+ }
21
+ set ariaLabel(value) {
22
+ if (this._ariaLabel === value) {
23
+ return;
24
+ }
25
+ this._ariaLabel = value;
26
+ this._removeHostAttribute("aria-label");
27
+ this.requestUpdate();
28
+ }
29
+ get ariaLabelledBy() {
30
+ return this._ariaLabelledBy;
31
+ }
32
+ set ariaLabelledBy(value) {
33
+ if (this._ariaLabelledBy === value) {
34
+ return;
35
+ }
36
+ this._ariaLabelledBy = value;
37
+ this._removeHostAttribute("aria-labelledby");
38
+ this.requestUpdate();
39
+ }
40
+ get ariaDescribedBy() {
41
+ return this._ariaDescribedBy;
42
+ }
43
+ set ariaDescribedBy(value) {
44
+ if (this._ariaDescribedBy === value) {
45
+ return;
46
+ }
47
+ this._ariaDescribedBy = value;
48
+ this._removeHostAttribute("aria-describedby");
49
+ this.requestUpdate();
50
+ }
51
+ get autocapitalize() {
52
+ return this._autocapitalize;
53
+ }
54
+ set autocapitalize(value) {
55
+ const normalizedValue = value ?? "";
56
+ if (this._autocapitalize === normalizedValue) {
57
+ return;
58
+ }
59
+ this._autocapitalize = normalizedValue;
60
+ this._removeHostAttribute("autocapitalize");
61
+ this.requestUpdate();
62
+ }
63
+ get spellcheck() {
64
+ return this._spellcheck ?? super.spellcheck;
65
+ }
66
+ set spellcheck(value) {
67
+ if (this._spellcheck === value) {
68
+ return;
69
+ }
70
+ this._spellcheck = value ?? null;
71
+ this._removeHostAttribute("spellcheck");
72
+ this.requestUpdate();
73
+ }
74
+ get title() {
75
+ return this._title;
76
+ }
77
+ set title(value) {
78
+ const normalizedValue = value ?? "";
79
+ if (this._title === normalizedValue) {
80
+ return;
81
+ }
82
+ this._title = normalizedValue;
83
+ this._removeHostAttribute("title");
84
+ this.requestUpdate();
13
85
  }
14
86
  get id() {
15
- return this._id ?? "";
87
+ return this._id;
16
88
  }
17
89
  set id(value) {
18
- if ((this._id ?? "") === value) {
90
+ const normalizedValue = value ?? "";
91
+ if (this._id === normalizedValue) {
19
92
  return;
20
93
  }
21
- this._id = value;
22
- const host = this;
23
- if (HTMLElement.prototype.hasAttribute.call(host, "id")) {
24
- HTMLElement.prototype.removeAttribute.call(host, "id");
25
- }
94
+ this._id = normalizedValue;
95
+ this._removeHostAttribute("id");
26
96
  this.requestUpdate();
27
97
  }
28
98
  // Spectre components intentionally render in light DOM so the global
@@ -32,36 +102,121 @@ var SpectreBaseElement = class extends LitElement {
32
102
  }
33
103
  connectedCallback() {
34
104
  super.connectedCallback();
35
- const hostId = super.getAttribute("id");
36
- if (hostId !== null) {
37
- this.id = hostId;
38
- }
105
+ const proxiedAttributes = [
106
+ "id",
107
+ "title",
108
+ "autocapitalize",
109
+ "spellcheck",
110
+ "aria-label",
111
+ "aria-labelledby",
112
+ "aria-describedby"
113
+ ];
114
+ proxiedAttributes.forEach((attr) => {
115
+ const value = super.getAttribute(attr);
116
+ if (value !== null) {
117
+ this.setAttribute(attr, value);
118
+ }
119
+ });
39
120
  }
40
121
  getAttribute(qualifiedName) {
41
- if (qualifiedName === "id") {
42
- return this.id || null;
122
+ switch (qualifiedName) {
123
+ case "id":
124
+ return this.id || null;
125
+ case "title":
126
+ return this.title || null;
127
+ case "autocapitalize":
128
+ return this.autocapitalize || null;
129
+ case "spellcheck":
130
+ return this._spellcheck !== null ? String(this._spellcheck) : null;
131
+ case "aria-label":
132
+ return this.ariaLabel;
133
+ case "aria-labelledby":
134
+ return this.ariaLabelledBy;
135
+ case "aria-describedby":
136
+ return this.ariaDescribedBy;
137
+ default:
138
+ return super.getAttribute(qualifiedName);
43
139
  }
44
- return super.getAttribute(qualifiedName);
45
140
  }
46
141
  hasAttribute(qualifiedName) {
47
- if (qualifiedName === "id") {
48
- return this.id !== "";
142
+ switch (qualifiedName) {
143
+ case "id":
144
+ return this.id !== "";
145
+ case "title":
146
+ return this.title !== "";
147
+ case "autocapitalize":
148
+ return this.autocapitalize !== "";
149
+ case "spellcheck":
150
+ return this._spellcheck !== null;
151
+ case "aria-label":
152
+ return this.ariaLabel !== null;
153
+ case "aria-labelledby":
154
+ return this.ariaLabelledBy !== null;
155
+ case "aria-describedby":
156
+ return this.ariaDescribedBy !== null;
157
+ default:
158
+ return super.hasAttribute(qualifiedName);
49
159
  }
50
- return super.hasAttribute(qualifiedName);
51
160
  }
52
161
  setAttribute(qualifiedName, value) {
53
- if (qualifiedName === "id") {
54
- this.id = value;
55
- return;
162
+ switch (qualifiedName) {
163
+ case "id":
164
+ this.id = value;
165
+ break;
166
+ case "title":
167
+ this.title = value;
168
+ break;
169
+ case "autocapitalize":
170
+ this.autocapitalize = value;
171
+ break;
172
+ case "spellcheck":
173
+ this.spellcheck = value !== "false";
174
+ break;
175
+ case "aria-label":
176
+ this.ariaLabel = value;
177
+ break;
178
+ case "aria-labelledby":
179
+ this.ariaLabelledBy = value;
180
+ break;
181
+ case "aria-describedby":
182
+ this.ariaDescribedBy = value;
183
+ break;
184
+ default:
185
+ super.setAttribute(qualifiedName, value);
56
186
  }
57
- super.setAttribute(qualifiedName, value);
58
187
  }
59
188
  removeAttribute(qualifiedName) {
60
- if (qualifiedName === "id") {
61
- this.id = "";
62
- return;
189
+ switch (qualifiedName) {
190
+ case "id":
191
+ this.id = "";
192
+ break;
193
+ case "title":
194
+ this.title = "";
195
+ break;
196
+ case "autocapitalize":
197
+ this.autocapitalize = "";
198
+ break;
199
+ case "spellcheck":
200
+ this.spellcheck = null;
201
+ break;
202
+ case "aria-label":
203
+ this.ariaLabel = null;
204
+ break;
205
+ case "aria-labelledby":
206
+ this.ariaLabelledBy = null;
207
+ break;
208
+ case "aria-describedby":
209
+ this.ariaDescribedBy = null;
210
+ break;
211
+ default:
212
+ super.removeAttribute(qualifiedName);
213
+ }
214
+ }
215
+ _removeHostAttribute(name) {
216
+ const host = this;
217
+ if (HTMLElement.prototype.hasAttribute.call(host, name)) {
218
+ HTMLElement.prototype.removeAttribute.call(host, name);
63
219
  }
64
- super.removeAttribute(qualifiedName);
65
220
  }
66
221
  get forwardedAriaLabel() {
67
222
  const value = this.ariaLabel?.trim();
@@ -76,11 +231,7 @@ var SpectreBaseElement = class extends LitElement {
76
231
  return value ? value : void 0;
77
232
  }
78
233
  };
79
- SpectreBaseElement.properties = {
80
- ariaLabel: { attribute: "aria-label", type: String },
81
- ariaLabelledBy: { attribute: "aria-labelledby", type: String },
82
- ariaDescribedBy: { attribute: "aria-describedby", type: String }
83
- };
234
+ SpectreBaseElement.properties = {};
84
235
  var spectreInputSizes = ["sm", "md", "lg"];
85
236
  function isInputSize(value) {
86
237
  return spectreInputSizes.includes(value);
@@ -102,6 +253,12 @@ var spectreInputTypes = [
102
253
  function isInputType(value) {
103
254
  return spectreInputTypes.includes(value);
104
255
  }
256
+ function normalizeInt(value, fallback, min = 0) {
257
+ if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
258
+ return fallback;
259
+ }
260
+ return value;
261
+ }
105
262
  var SpectreInputElement = class extends SpectreBaseElement {
106
263
  constructor() {
107
264
  super(...arguments);
@@ -115,41 +272,60 @@ var SpectreInputElement = class extends SpectreBaseElement {
115
272
  this.required = false;
116
273
  this.size = "md";
117
274
  this.success = false;
118
- this.title = "";
119
275
  this.type = "text";
120
276
  this.value = "";
121
277
  }
278
+ get autocapitalize() {
279
+ return super.autocapitalize;
280
+ }
281
+ set autocapitalize(value) {
282
+ super.autocapitalize = value;
283
+ }
284
+ get id() {
285
+ return super.id;
286
+ }
287
+ set id(value) {
288
+ super.id = value;
289
+ }
290
+ get spellcheck() {
291
+ return super.spellcheck;
292
+ }
293
+ set spellcheck(value) {
294
+ super.spellcheck = value;
295
+ }
296
+ get title() {
297
+ return super.title;
298
+ }
299
+ set title(value) {
300
+ super.title = value;
301
+ }
122
302
  willUpdate(changedProperties) {
123
- if (changedProperties.has("size") && !isInputSize(this.size)) {
303
+ if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
124
304
  this.size = "md";
125
305
  }
126
- if (changedProperties.has("type") && !isInputType(this.type)) {
306
+ if (changedProperties.has("type") && (this.type == null || !isInputType(this.type))) {
127
307
  this.type = "text";
128
308
  }
129
309
  if (changedProperties.has("value") && this.value == null) {
130
310
  this.value = "";
131
311
  }
132
312
  if (changedProperties.has("maxlength")) {
133
- if (this.maxlength == null || !Number.isInteger(this.maxlength) || this.maxlength < 0) {
134
- this.maxlength = void 0;
135
- }
313
+ this.maxlength = normalizeInt(this.maxlength, void 0);
136
314
  }
137
315
  if (changedProperties.has("minlength")) {
138
- if (this.minlength == null || !Number.isInteger(this.minlength) || this.minlength < 0) {
139
- this.minlength = void 0;
140
- }
316
+ this.minlength = normalizeInt(this.minlength, void 0);
141
317
  }
142
318
  }
143
319
  get inputClasses() {
144
320
  return getInputClasses({
145
- fullWidth: this.fullWidth,
146
- pill: this.pill,
321
+ fullWidth: this.fullWidth ?? false,
322
+ pill: this.pill ?? false,
147
323
  size: this.size,
148
324
  state: this.isDisabled ? this.disabled ? "disabled" : "loading" : this.invalid ? "error" : this.success ? "success" : "default"
149
325
  });
150
326
  }
151
327
  get isDisabled() {
152
- return this.disabled || this.loading;
328
+ return (this.disabled ?? false) || (this.loading ?? false);
153
329
  }
154
330
  get nativeInput() {
155
331
  return this.querySelector("[data-sp-input-native]");
@@ -169,61 +345,70 @@ var SpectreInputElement = class extends SpectreBaseElement {
169
345
  this.nativeInput?.blur();
170
346
  }
171
347
  render() {
172
- return html`
173
- <input
174
- aria-busy=${this.loading ? "true" : "false"}
175
- aria-describedby=${ifDefined(this.forwardedAriaDescribedBy)}
176
- aria-invalid=${ifDefined(this.invalid ? "true" : void 0)}
177
- aria-label=${ifDefined(this.forwardedAriaLabel)}
178
- aria-labelledby=${ifDefined(this.forwardedAriaLabelledBy)}
179
- autocomplete=${ifDefined(this.autocomplete)}
180
- ?autofocus=${this.autofocus}
181
- class=${this.inputClasses}
182
- data-sp-input-native
183
- ?disabled=${this.isDisabled}
184
- form=${ifDefined(this.form)}
185
- ?readonly=${this.readonly}
186
- ?required=${this.required}
187
- id=${ifDefined(this.id || void 0)}
188
- inputmode=${ifDefined(this.inputmode)}
189
- max=${ifDefined(this.max)}
190
- maxlength=${ifDefined(this.maxlength)}
191
- min=${ifDefined(this.min)}
192
- minlength=${ifDefined(this.minlength)}
193
- name=${ifDefined(this.name)}
194
- placeholder=${ifDefined(this.placeholder)}
195
- step=${ifDefined(this.step)}
196
- title=${ifDefined(this.title || void 0)}
197
- type=${this.type}
198
- .value=${live(this.value)}
199
- @change=${this.handleChange}
200
- @input=${this.handleInput}
201
- />
202
- `;
348
+ return html`<input
349
+ aria-busy="${this.loading ? "true" : "false"}"
350
+ aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
351
+ aria-invalid="${ifDefined(this.invalid ? "true" : void 0)}"
352
+ aria-label="${ifDefined(this.forwardedAriaLabel)}"
353
+ aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
354
+ autocapitalize="${ifDefined(this.autocapitalize || void 0)}"
355
+ autocomplete="${ifDefined(this.autocomplete || void 0)}"
356
+ ?autofocus="${this.autofocus}"
357
+ class="${this.inputClasses}"
358
+ data-sp-input-native
359
+ ?disabled="${this.isDisabled}"
360
+ enterkeyhint="${ifDefined(this.enterkeyhint || void 0)}"
361
+ form="${ifDefined(this.form || void 0)}"
362
+ ?readonly="${this.readonly}"
363
+ ?required="${this.required}"
364
+ id="${ifDefined(this.id || void 0)}"
365
+ inputmode="${ifDefined(this.inputmode || void 0)}"
366
+ list="${ifDefined(this.list || void 0)}"
367
+ max="${ifDefined(this.max || void 0)}"
368
+ maxlength="${ifDefined(this.maxlength)}"
369
+ min="${ifDefined(this.min || void 0)}"
370
+ minlength="${ifDefined(this.minlength)}"
371
+ name="${ifDefined(this.name || void 0)}"
372
+ pattern="${ifDefined(this.pattern || void 0)}"
373
+ placeholder="${ifDefined(this.placeholder || void 0)}"
374
+ spellcheck="${ifDefined(
375
+ this.spellcheck === void 0 ? void 0 : String(this.spellcheck)
376
+ )}"
377
+ step="${ifDefined(this.step || void 0)}"
378
+ title="${ifDefined(this.title || void 0)}"
379
+ type="${this.type}"
380
+ .value="${live(this.value)}"
381
+ @change="${this.handleChange}"
382
+ @input="${this.handleInput}"
383
+ />`;
203
384
  }
204
385
  };
205
386
  SpectreInputElement.properties = {
387
+ autocapitalize: { type: String, reflect: true },
206
388
  autocomplete: { type: String, reflect: true },
207
389
  autofocus: { type: Boolean, reflect: true },
208
390
  disabled: { type: Boolean, reflect: true },
391
+ enterkeyhint: { type: String, reflect: true },
209
392
  form: { type: String },
210
393
  fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
211
394
  inputmode: { type: String, reflect: true },
212
395
  invalid: { type: Boolean, reflect: true },
396
+ list: { type: String, reflect: true },
213
397
  loading: { type: Boolean, reflect: true },
214
398
  max: { type: String, reflect: true },
215
399
  maxlength: { type: Number, reflect: true },
216
400
  min: { type: String, reflect: true },
217
401
  minlength: { type: Number, reflect: true },
218
402
  name: { type: String, reflect: true },
403
+ pattern: { type: String, reflect: true },
219
404
  pill: { type: Boolean, reflect: true },
220
405
  placeholder: { type: String, reflect: true },
221
406
  readonly: { type: Boolean, reflect: true },
222
407
  required: { type: Boolean, reflect: true },
223
408
  size: { type: String, reflect: true },
409
+ spellcheck: { type: Boolean, reflect: true },
224
410
  step: { type: String, reflect: true },
225
411
  success: { type: Boolean, reflect: true },
226
- title: { type: String, reflect: true },
227
412
  type: { type: String, reflect: true },
228
413
  value: { type: String }
229
414
  };
package/dist/input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/base.ts","../src/utils/form.ts","../src/components/input/sp-input.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,kBAAA,GAAN,cAAiC,UAAA,CAAW;AAAA,EAA5C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAOL,IAAA,IAAA,CAAA,SAAA,GAA2B,IAAA;AAC3B,IAAA,IAAA,CAAA,cAAA,GAAgC,IAAA;AAChC,IAAA,IAAA,CAAA,eAAA,GAAiC,IAAA;AAAA,EAAA;AAAA,EAIjC,IAAa,EAAA,GAAa;AACxB,IAAA,OAAO,KAAK,GAAA,IAAO,EAAA;AAAA,EACrB;AAAA,EAEA,IAAa,GAAG,KAAA,EAAe;AAC7B,IAAA,IAAA,CAAK,IAAA,CAAK,GAAA,IAAO,EAAA,MAAQ,KAAA,EAAO;AAC9B,MAAA;AAAA,IACF;AAEA,IAAA,IAAA,CAA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,CAAO,SAAS,mBAAmB,CAAA;AAClD,EAAA,OAAO,mBAAA;AACT","file":"input.js","sourcesContent":["import { LitElement, type PropertyDeclarations } from 'lit';\n\nexport class SpectreBaseElement extends LitElement {\n static properties: PropertyDeclarations = {\n ariaLabel: { attribute: 'aria-label', type: String },\n ariaLabelledBy: { attribute: 'aria-labelledby', type: String },\n ariaDescribedBy: { attribute: 'aria-describedby', type: String },\n };\n\n ariaLabel: string | null = null;\n ariaLabelledBy: string | null = null;\n ariaDescribedBy: string | null = null;\n\n private _id?: string;\n\n override get id(): string {\n return this._id ?? '';\n }\n\n override set id(value: string) {\n if ((this._id ?? '') === value) {\n return;\n }\n\n this._id = value;\n\n const host = this as unknown as HTMLElement;\n if (HTMLElement.prototype.hasAttribute.call(host, 'id')) {\n HTMLElement.prototype.removeAttribute.call(host, 'id');\n }\n\n this.requestUpdate();\n }\n\n // Spectre components intentionally render in light DOM so the global\n // `@phcdevworks/spectre-ui` styling contract can apply directly.\n createRenderRoot(): this {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n const hostId = super.getAttribute('id');\n if (hostId !== null) {\n this.id = hostId;\n }\n }\n\n override getAttribute(qualifiedName: string): string | null {\n if (qualifiedName === 'id') {\n return this.id || null;\n }\n\n return super.getAttribute(qualifiedName);\n }\n\n override hasAttribute(qualifiedName: string): boolean {\n if (qualifiedName === 'id') {\n return this.id !== '';\n }\n\n return super.hasAttribute(qualifiedName);\n }\n\n override setAttribute(qualifiedName: string, value: string): void {\n if (qualifiedName === 'id') {\n this.id = value;\n return;\n }\n\n super.setAttribute(qualifiedName, value);\n }\n\n override removeAttribute(qualifiedName: string): void {\n if (qualifiedName === 'id') {\n this.id = '';\n return;\n }\n\n super.removeAttribute(qualifiedName);\n }\n\n protected get forwardedAriaLabel(): string | undefined {\n const value = this.ariaLabel?.trim();\n return value ? value : undefined;\n }\n\n protected get forwardedAriaLabelledBy(): string | undefined {\n const value = this.ariaLabelledBy?.trim();\n return value ? value : undefined;\n }\n\n protected get forwardedAriaDescribedBy(): string | undefined {\n const value = this.ariaDescribedBy?.trim();\n return value ? value : undefined;\n }\n}\n","import { type InputSize } from '@phcdevworks/spectre-ui';\n\nexport const spectreInputSizes = ['sm', 'md', 'lg'] as const;\nexport type SpectreInputSize = (typeof spectreInputSizes)[number];\n\nexport function isInputSize(value: string): value is InputSize {\n return (spectreInputSizes as readonly string[]).includes(value);\n}\n\nexport const spectreInputTypes = [\n 'text',\n 'email',\n 'password',\n 'search',\n 'tel',\n 'url',\n 'number',\n 'date',\n 'datetime-local',\n 'month',\n 'time',\n 'week',\n] as const;\n\nexport type SpectreInputType = (typeof spectreInputTypes)[number];\n\nexport function isInputType(value: string): value is SpectreInputType {\n return (spectreInputTypes as readonly string[]).includes(value);\n}\n","import { html } from 'lit';\nimport { live } from 'lit/directives/live.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { SpectreBaseElement } from '../../utils/base';\nimport {\n spectreInputSizes,\n isInputSize,\n type SpectreInputSize,\n spectreInputTypes,\n isInputType,\n type SpectreInputType,\n} from '../../utils/form';\n\nimport { getInputClasses } from '@phcdevworks/spectre-ui';\n\nexport {\n spectreInputSizes,\n isInputSize,\n type SpectreInputSize,\n spectreInputTypes,\n isInputType,\n type SpectreInputType,\n};\n\nexport interface SpectreInputProps {\n ariaLabel?: string | null;\n ariaLabelledBy?: string | null;\n ariaDescribedBy?: string | null;\n autocomplete?: string;\n autofocus?: boolean;\n disabled?: boolean;\n form?: string;\n fullWidth?: boolean;\n inputmode?: string;\n invalid?: boolean;\n loading?: boolean;\n max?: string;\n maxlength?: number | undefined;\n min?: string;\n minlength?: number | undefined;\n name?: string | undefined;\n pill?: boolean;\n placeholder?: string | undefined;\n readonly?: boolean;\n required?: boolean;\n size?: SpectreInputSize;\n step?: string;\n success?: boolean;\n title?: string;\n type?: SpectreInputType;\n value?: string;\n}\n\nexport class SpectreInputElement extends SpectreBaseElement implements SpectreInputProps {\n static properties = {\n autocomplete: { type: String, reflect: true },\n autofocus: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n form: { type: String },\n fullWidth: { attribute: 'full-width', type: Boolean, reflect: true },\n inputmode: { type: String, reflect: true },\n invalid: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n max: { type: String, reflect: true },\n maxlength: { type: Number, reflect: true },\n min: { type: String, reflect: true },\n minlength: { type: Number, reflect: true },\n name: { type: String, reflect: true },\n pill: { type: Boolean, reflect: true },\n placeholder: { type: String, reflect: true },\n readonly: { type: Boolean, reflect: true },\n required: { type: Boolean, reflect: true },\n size: { type: String, reflect: true },\n step: { type: String, reflect: true },\n success: { type: Boolean, reflect: true },\n title: { type: String, reflect: true },\n type: { type: String, reflect: true },\n value: { type: String },\n };\n\n autocomplete?: string;\n autofocus = false;\n disabled = false;\n form?: string;\n fullWidth = false;\n inputmode?: string;\n invalid = false;\n loading = false;\n max?: string;\n maxlength?: number | undefined;\n min?: string;\n minlength?: number | undefined;\n name?: string;\n pill = false;\n placeholder?: string;\n readonly = false;\n required = false;\n size: SpectreInputSize = 'md';\n step?: string;\n success = false;\n override title = '';\n type: SpectreInputType = 'text';\n value = '';\n\n protected override willUpdate(changedProperties: Map<PropertyKey, unknown>): void {\n if (changedProperties.has('size') && !isInputSize(this.size)) {\n this.size = 'md';\n }\n\n if (changedProperties.has('type') && !isInputType(this.type)) {\n this.type = 'text';\n }\n\n if (changedProperties.has('value') && this.value == null) {\n this.value = '';\n }\n\n if (changedProperties.has('maxlength')) {\n if (\n this.maxlength == null ||\n !Number.isInteger(this.maxlength) ||\n this.maxlength < 0\n ) {\n this.maxlength = undefined;\n }\n }\n\n if (changedProperties.has('minlength')) {\n if (\n this.minlength == null ||\n !Number.isInteger(this.minlength) ||\n this.minlength < 0\n ) {\n this.minlength = undefined;\n }\n }\n }\n\n private get inputClasses(): string {\n return getInputClasses({\n fullWidth: this.fullWidth,\n pill: this.pill,\n size: this.size,\n state: this.isDisabled\n ? this.disabled\n ? 'disabled'\n : 'loading'\n : this.invalid\n ? 'error'\n : this.success\n ? 'success'\n : 'default',\n });\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.loading;\n }\n\n private get nativeInput(): HTMLInputElement | null {\n return this.querySelector('[data-sp-input-native]');\n }\n\n private handleInput(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.value = input.value;\n }\n\n private handleChange(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.value = input.value;\n }\n\n override focus(options?: FocusOptions): void {\n this.nativeInput?.focus(options);\n }\n\n override blur(): void {\n this.nativeInput?.blur();\n }\n\n override render() {\n return html`\n <input\n aria-busy=${this.loading ? 'true' : 'false'}\n aria-describedby=${ifDefined(this.forwardedAriaDescribedBy)}\n aria-invalid=${ifDefined(this.invalid ? 'true' : undefined)}\n aria-label=${ifDefined(this.forwardedAriaLabel)}\n aria-labelledby=${ifDefined(this.forwardedAriaLabelledBy)}\n autocomplete=${ifDefined(this.autocomplete)}\n ?autofocus=${this.autofocus}\n class=${this.inputClasses}\n data-sp-input-native\n ?disabled=${this.isDisabled}\n form=${ifDefined(this.form)}\n ?readonly=${this.readonly}\n ?required=${this.required}\n id=${ifDefined(this.id || undefined)}\n inputmode=${ifDefined(this.inputmode)}\n max=${ifDefined(this.max)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n minlength=${ifDefined(this.minlength)}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n step=${ifDefined(this.step)}\n title=${ifDefined(this.title || undefined)}\n type=${this.type}\n .value=${live(this.value)}\n @change=${this.handleChange}\n @input=${this.handleInput}\n />\n `;\n }\n}\n\nexport function defineSpectreInput(tagName = 'sp-input'): typeof SpectreInputElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreInputElement;\n }\n\n customElements.define(tagName, SpectreInputElement);\n return SpectreInputElement;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/base.ts","../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C,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACpC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA;AACjB,CAAA;AAwKK,SAAS,kBAAA,CAAmB,UAAU,UAAA,EAAwC;AACnF,EAAA,MAAM,eAAA,GAAkB,cAAA,CAAe,GAAA,CAAI,OAAO,CAAA;AAElD,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,OAAO,eAAA;AAAA,EACT;AAEA,EAAA,cAAA,CAAe,MAAA,CAAO,SAAS,mBAAmB,CAAA;AAClD,EAAA,OAAO,mBAAA;AACT","file":"input.js","sourcesContent":["import { LitElement, type PropertyDeclarations } from 'lit';\n\nexport class SpectreBaseElement extends LitElement {\n static properties: PropertyDeclarations = {};\n\n private _ariaLabel: string | null = null;\n private _ariaLabelledBy: string | null = null;\n private _ariaDescribedBy: string | null = null;\n private _autocapitalize = '';\n private _spellcheck: boolean | null = null;\n private _title = '';\n private _id = '';\n\n get ariaLabel(): string | null {\n return this._ariaLabel;\n }\n\n set ariaLabel(value: string | null) {\n if (this._ariaLabel === value) {\n return;\n }\n this._ariaLabel = value;\n this._removeHostAttribute('aria-label');\n this.requestUpdate();\n }\n\n get ariaLabelledBy(): string | null {\n return this._ariaLabelledBy;\n }\n\n set ariaLabelledBy(value: string | null) {\n if (this._ariaLabelledBy === value) {\n return;\n }\n this._ariaLabelledBy = value;\n this._removeHostAttribute('aria-labelledby');\n this.requestUpdate();\n }\n\n get ariaDescribedBy(): string | null {\n return this._ariaDescribedBy;\n }\n\n set ariaDescribedBy(value: string | null) {\n if (this._ariaDescribedBy === value) {\n return;\n }\n this._ariaDescribedBy = value;\n this._removeHostAttribute('aria-describedby');\n this.requestUpdate();\n }\n\n override get autocapitalize(): string {\n return this._autocapitalize;\n }\n\n override set autocapitalize(value: string | undefined | null) {\n const normalizedValue = value ?? '';\n if (this._autocapitalize === normalizedValue) {\n return;\n }\n this._autocapitalize = normalizedValue;\n this._removeHostAttribute('autocapitalize');\n this.requestUpdate();\n }\n\n override get spellcheck(): boolean {\n return this._spellcheck ?? super.spellcheck;\n }\n\n override set spellcheck(value: boolean | undefined | null) {\n if (this._spellcheck === value) {\n return;\n }\n this._spellcheck = value ?? null;\n this._removeHostAttribute('spellcheck');\n this.requestUpdate();\n }\n\n override get title(): string {\n return this._title;\n }\n\n override set title(value: string | undefined | null) {\n const normalizedValue = value ?? '';\n if (this._title === normalizedValue) {\n return;\n }\n this._title = normalizedValue;\n this._removeHostAttribute('title');\n this.requestUpdate();\n }\n\n override get id(): string {\n return this._id;\n }\n\n override set id(value: string | undefined | null) {\n const normalizedValue = value ?? '';\n if (this._id === normalizedValue) {\n return;\n }\n this._id = normalizedValue;\n this._removeHostAttribute('id');\n this.requestUpdate();\n }\n\n // Spectre components intentionally render in light DOM so the global\n // `@phcdevworks/spectre-ui` styling contract can apply directly.\n createRenderRoot(): this {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n const proxiedAttributes = [\n 'id',\n 'title',\n 'autocapitalize',\n 'spellcheck',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n ];\n\n proxiedAttributes.forEach((attr) => {\n const value = super.getAttribute(attr);\n if (value !== null) {\n this.setAttribute(attr, value);\n }\n });\n }\n\n override getAttribute(qualifiedName: string): string | null {\n switch (qualifiedName) {\n case 'id':\n return this.id || null;\n case 'title':\n return this.title || null;\n case 'autocapitalize':\n return this.autocapitalize || null;\n case 'spellcheck':\n return this._spellcheck !== null ? String(this._spellcheck) : null;\n case 'aria-label':\n return this.ariaLabel;\n case 'aria-labelledby':\n return this.ariaLabelledBy;\n case 'aria-describedby':\n return this.ariaDescribedBy;\n default:\n return super.getAttribute(qualifiedName);\n }\n }\n\n override hasAttribute(qualifiedName: string): boolean {\n switch (qualifiedName) {\n case 'id':\n return this.id !== '';\n case 'title':\n return this.title !== '';\n case 'autocapitalize':\n return this.autocapitalize !== '';\n case 'spellcheck':\n return this._spellcheck !== null;\n case 'aria-label':\n return this.ariaLabel !== null;\n case 'aria-labelledby':\n return this.ariaLabelledBy !== null;\n case 'aria-describedby':\n return this.ariaDescribedBy !== null;\n default:\n return super.hasAttribute(qualifiedName);\n }\n }\n\n override setAttribute(qualifiedName: string, value: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = value;\n break;\n case 'title':\n this.title = value;\n break;\n case 'autocapitalize':\n this.autocapitalize = value;\n break;\n case 'spellcheck':\n this.spellcheck = value !== 'false';\n break;\n case 'aria-label':\n this.ariaLabel = value;\n break;\n case 'aria-labelledby':\n this.ariaLabelledBy = value;\n break;\n case 'aria-describedby':\n this.ariaDescribedBy = value;\n break;\n default:\n super.setAttribute(qualifiedName, value);\n }\n }\n\n override removeAttribute(qualifiedName: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = '';\n break;\n case 'title':\n this.title = '';\n break;\n case 'autocapitalize':\n this.autocapitalize = '';\n break;\n case 'spellcheck':\n this.spellcheck = null;\n break;\n case 'aria-label':\n this.ariaLabel = null;\n break;\n case 'aria-labelledby':\n this.ariaLabelledBy = null;\n break;\n case 'aria-describedby':\n this.ariaDescribedBy = null;\n break;\n default:\n super.removeAttribute(qualifiedName);\n }\n }\n\n private _removeHostAttribute(name: string): void {\n const host = this as unknown as HTMLElement;\n if (HTMLElement.prototype.hasAttribute.call(host, name)) {\n // Use the native removeAttribute to avoid our own overridden version\n // which would reset the internal state.\n HTMLElement.prototype.removeAttribute.call(host, name);\n }\n }\n\n protected get forwardedAriaLabel(): string | undefined {\n const value = this.ariaLabel?.trim();\n return value ? value : undefined;\n }\n\n protected get forwardedAriaLabelledBy(): string | undefined {\n const value = this.ariaLabelledBy?.trim();\n return value ? value : undefined;\n }\n\n protected get forwardedAriaDescribedBy(): string | undefined {\n const value = this.ariaDescribedBy?.trim();\n return value ? value : undefined;\n }\n}\n","import {\n type ButtonSize,\n type ButtonVariant,\n type InputSize,\n} from '@phcdevworks/spectre-ui';\n\nexport const spectreInputSizes = ['sm', 'md', 'lg'] as const;\nexport type SpectreInputSize = (typeof spectreInputSizes)[number];\n\nexport function isInputSize(value: unknown): value is InputSize | ButtonSize {\n return (spectreInputSizes as readonly string[]).includes(value as string);\n}\n\nexport const spectreButtonVariants = [\n 'primary',\n 'secondary',\n 'ghost',\n 'danger',\n 'success',\n 'cta',\n 'accent',\n] as const;\n\nexport type SpectreButtonVariant = (typeof spectreButtonVariants)[number];\n\nexport function isButtonVariant(value: unknown): value is ButtonVariant {\n return (spectreButtonVariants as readonly string[]).includes(value as string);\n}\n\nexport const spectreButtonTypes = ['button', 'submit', 'reset'] as const;\n\nexport type SpectreButtonType = (typeof spectreButtonTypes)[number];\n\nexport function isButtonType(value: unknown): value is SpectreButtonType {\n return (spectreButtonTypes as readonly string[]).includes(value as string);\n}\n\nexport const spectreInputTypes = [\n 'text',\n 'email',\n 'password',\n 'search',\n 'tel',\n 'url',\n 'number',\n 'date',\n 'datetime-local',\n 'month',\n 'time',\n 'week',\n] as const;\n\nexport type SpectreInputType = (typeof spectreInputTypes)[number];\n\nexport function isInputType(value: unknown): value is SpectreInputType {\n return (spectreInputTypes as readonly string[]).includes(value as string);\n}\n\nexport function normalizeInt(\n value: unknown,\n fallback: number | undefined,\n min = 0,\n): number | undefined {\n if (\n value == null ||\n typeof value !== 'number' ||\n !Number.isInteger(value) ||\n value < min\n ) {\n return fallback;\n }\n return value;\n}\n","import { html } from 'lit';\nimport { live } from 'lit/directives/live.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { SpectreBaseElement } from '../../utils/base';\nimport {\n spectreInputSizes,\n isInputSize,\n type SpectreInputSize,\n spectreInputTypes,\n isInputType,\n type SpectreInputType,\n normalizeInt,\n} from '../../utils/form';\n\nimport { getInputClasses } from '@phcdevworks/spectre-ui';\n\nexport {\n spectreInputSizes,\n type SpectreInputSize,\n spectreInputTypes,\n type SpectreInputType,\n};\n\nexport interface SpectreInputProps {\n ariaLabel?: string | null;\n ariaLabelledBy?: string | null;\n ariaDescribedBy?: string | null;\n autocapitalize?: string | undefined;\n autocomplete?: string | undefined;\n autofocus?: boolean | undefined;\n disabled?: boolean | undefined;\n enterkeyhint?: string | undefined;\n form?: string | undefined;\n fullWidth?: boolean | undefined;\n id?: string | null | undefined;\n inputmode?: string | undefined;\n invalid?: boolean | undefined;\n list?: string | undefined;\n loading?: boolean | undefined;\n max?: string | undefined;\n maxlength?: number | undefined;\n min?: string | undefined;\n minlength?: number | undefined;\n name?: string | undefined;\n pattern?: string | undefined;\n pill?: boolean | undefined;\n placeholder?: string | undefined;\n readonly?: boolean | undefined;\n required?: boolean | undefined;\n size?: SpectreInputSize | undefined;\n spellcheck?: boolean | undefined;\n step?: string | undefined;\n success?: boolean | undefined;\n title?: string | null | undefined;\n type?: SpectreInputType | undefined;\n value?: string | undefined;\n}\n\nexport class SpectreInputElement extends SpectreBaseElement implements SpectreInputProps {\n static properties = {\n autocapitalize: { type: String, reflect: true },\n autocomplete: { type: String, reflect: true },\n autofocus: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n enterkeyhint: { type: String, reflect: true },\n form: { type: String },\n fullWidth: { attribute: 'full-width', type: Boolean, reflect: true },\n inputmode: { type: String, reflect: true },\n invalid: { type: Boolean, reflect: true },\n list: { type: String, reflect: true },\n loading: { type: Boolean, reflect: true },\n max: { type: String, reflect: true },\n maxlength: { type: Number, reflect: true },\n min: { type: String, reflect: true },\n minlength: { type: Number, reflect: true },\n name: { type: String, reflect: true },\n pattern: { type: String, reflect: true },\n pill: { type: Boolean, reflect: true },\n placeholder: { type: String, reflect: true },\n readonly: { type: Boolean, reflect: true },\n required: { type: Boolean, reflect: true },\n size: { type: String, reflect: true },\n spellcheck: { type: Boolean, reflect: true },\n step: { type: String, reflect: true },\n success: { type: Boolean, reflect: true },\n type: { type: String, reflect: true },\n value: { type: String },\n };\n\n override get autocapitalize(): string {\n return super.autocapitalize;\n }\n\n override set autocapitalize(value: string | null | undefined) {\n super.autocapitalize = value;\n }\n\n autocomplete: string | undefined;\n autofocus = false;\n disabled = false;\n enterkeyhint: string | undefined;\n form: string | undefined;\n fullWidth = false;\n\n override get id(): string {\n return super.id;\n }\n\n override set id(value: string | null | undefined) {\n super.id = value;\n }\n\n inputmode: string | undefined;\n invalid = false;\n list: string | undefined;\n loading = false;\n max: string | undefined;\n maxlength: number | undefined;\n min: string | undefined;\n minlength: number | undefined;\n name: string | undefined;\n pattern: string | undefined;\n pill = false;\n placeholder: string | undefined;\n readonly = false;\n required = false;\n size: SpectreInputSize | undefined = 'md';\n\n override get spellcheck(): boolean {\n return super.spellcheck;\n }\n\n override set spellcheck(value: boolean | null | undefined) {\n super.spellcheck = value;\n }\n\n step: string | undefined;\n success = false;\n\n override get title(): string {\n return super.title;\n }\n\n override set title(value: string | null | undefined) {\n super.title = value;\n }\n\n type: SpectreInputType | undefined = 'text';\n value: string | undefined = '';\n\n protected override willUpdate(changedProperties: Map<PropertyKey, unknown>): void {\n if (changedProperties.has('size') && (this.size == null || !isInputSize(this.size))) {\n this.size = 'md';\n }\n\n if (changedProperties.has('type') && (this.type == null || !isInputType(this.type))) {\n this.type = 'text';\n }\n\n if (changedProperties.has('value') && this.value == null) {\n this.value = '';\n }\n\n if (changedProperties.has('maxlength')) {\n this.maxlength = normalizeInt(this.maxlength, undefined);\n }\n\n if (changedProperties.has('minlength')) {\n this.minlength = normalizeInt(this.minlength, undefined);\n }\n }\n\n private get inputClasses(): string {\n return getInputClasses({\n fullWidth: this.fullWidth ?? false,\n pill: this.pill ?? false,\n size: this.size as SpectreInputSize,\n state: this.isDisabled\n ? this.disabled\n ? 'disabled'\n : 'loading'\n : this.invalid\n ? 'error'\n : this.success\n ? 'success'\n : 'default',\n });\n }\n\n private get isDisabled(): boolean {\n return (this.disabled ?? false) || (this.loading ?? false);\n }\n\n private get nativeInput(): HTMLInputElement | null {\n return this.querySelector('[data-sp-input-native]');\n }\n\n private handleInput(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.value = input.value;\n }\n\n private handleChange(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.value = input.value;\n }\n\n override focus(options?: FocusOptions): void {\n this.nativeInput?.focus(options);\n }\n\n override blur(): void {\n this.nativeInput?.blur();\n }\n\n override render() {\n return html`<input\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n aria-describedby=\"${ifDefined(this.forwardedAriaDescribedBy)}\"\n aria-invalid=\"${ifDefined(this.invalid ? 'true' : undefined)}\"\n aria-label=\"${ifDefined(this.forwardedAriaLabel)}\"\n aria-labelledby=\"${ifDefined(this.forwardedAriaLabelledBy)}\"\n autocapitalize=\"${ifDefined(this.autocapitalize || undefined)}\"\n autocomplete=\"${ifDefined(this.autocomplete || undefined)}\"\n ?autofocus=\"${this.autofocus}\"\n class=\"${this.inputClasses}\"\n data-sp-input-native\n ?disabled=\"${this.isDisabled}\"\n enterkeyhint=\"${ifDefined(this.enterkeyhint || undefined)}\"\n form=\"${ifDefined(this.form || undefined)}\"\n ?readonly=\"${this.readonly}\"\n ?required=\"${this.required}\"\n id=\"${ifDefined(this.id || undefined)}\"\n inputmode=\"${ifDefined(this.inputmode || undefined)}\"\n list=\"${ifDefined(this.list || undefined)}\"\n max=\"${ifDefined(this.max || undefined)}\"\n maxlength=\"${ifDefined(this.maxlength)}\"\n min=\"${ifDefined(this.min || undefined)}\"\n minlength=\"${ifDefined(this.minlength)}\"\n name=\"${ifDefined(this.name || undefined)}\"\n pattern=\"${ifDefined(this.pattern || undefined)}\"\n placeholder=\"${ifDefined(this.placeholder || undefined)}\"\n spellcheck=\"${ifDefined(\n this.spellcheck === undefined ? undefined : String(this.spellcheck),\n )}\"\n step=\"${ifDefined(this.step || undefined)}\"\n title=\"${ifDefined(this.title || undefined)}\"\n type=\"${this.type}\"\n .value=\"${live(this.value)}\"\n @change=\"${this.handleChange}\"\n @input=\"${this.handleInput}\"\n />`;\n }\n}\n\nexport function defineSpectreInput(tagName = 'sp-input'): typeof SpectreInputElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreInputElement;\n }\n\n customElements.define(tagName, SpectreInputElement);\n return SpectreInputElement;\n}\n"]}