@phcdevworks/spectre-components 0.0.1 → 1.1.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 (62) hide show
  1. package/README.md +113 -40
  2. package/dist/base-2rD8EmdC.d.cts +32 -0
  3. package/dist/base-2rD8EmdC.d.ts +32 -0
  4. package/dist/button.cjs +295 -170
  5. package/dist/button.cjs.map +1 -1
  6. package/dist/button.d.cts +30 -61
  7. package/dist/button.d.ts +30 -61
  8. package/dist/button.js +296 -171
  9. package/dist/button.js.map +1 -1
  10. package/dist/checkbox.cjs +286 -71
  11. package/dist/checkbox.cjs.map +1 -1
  12. package/dist/checkbox.d.cts +38 -43
  13. package/dist/checkbox.d.ts +38 -43
  14. package/dist/checkbox.js +287 -72
  15. package/dist/checkbox.js.map +1 -1
  16. package/dist/fieldset.cjs +233 -88
  17. package/dist/fieldset.cjs.map +1 -1
  18. package/dist/fieldset.d.cts +23 -40
  19. package/dist/fieldset.d.ts +23 -40
  20. package/dist/fieldset.js +233 -88
  21. package/dist/fieldset.js.map +1 -1
  22. package/dist/form-iI7vV-3W.d.cts +6 -0
  23. package/dist/form-iI7vV-3W.d.ts +6 -0
  24. package/dist/index.cjs +564 -1029
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +5 -2
  27. package/dist/index.d.ts +5 -2
  28. package/dist/index.js +566 -1030
  29. package/dist/index.js.map +1 -1
  30. package/dist/input.cjs +232 -119
  31. package/dist/input.cjs.map +1 -1
  32. package/dist/input.d.cts +52 -68
  33. package/dist/input.d.ts +52 -68
  34. package/dist/input.js +232 -119
  35. package/dist/input.js.map +1 -1
  36. package/dist/label.cjs +232 -73
  37. package/dist/label.cjs.map +1 -1
  38. package/dist/label.d.cts +13 -22
  39. package/dist/label.d.ts +13 -22
  40. package/dist/label.js +232 -73
  41. package/dist/label.js.map +1 -1
  42. package/dist/projectable-BzDQ4xp_.d.cts +17 -0
  43. package/dist/projectable-s3SgvjGX.d.ts +17 -0
  44. package/dist/radio.cjs +286 -71
  45. package/dist/radio.cjs.map +1 -1
  46. package/dist/radio.d.cts +38 -43
  47. package/dist/radio.d.ts +38 -43
  48. package/dist/radio.js +287 -72
  49. package/dist/radio.js.map +1 -1
  50. package/dist/select.cjs +292 -163
  51. package/dist/select.cjs.map +1 -1
  52. package/dist/select.d.cts +35 -58
  53. package/dist/select.d.ts +35 -58
  54. package/dist/select.js +293 -163
  55. package/dist/select.js.map +1 -1
  56. package/dist/textarea.cjs +191 -290
  57. package/dist/textarea.cjs.map +1 -1
  58. package/dist/textarea.d.cts +41 -58
  59. package/dist/textarea.d.ts +41 -58
  60. package/dist/textarea.js +191 -290
  61. package/dist/textarea.js.map +1 -1
  62. package/package.json +13 -12
package/dist/checkbox.cjs CHANGED
@@ -1,82 +1,177 @@
1
1
  'use strict';
2
2
 
3
3
  var lit = require('lit');
4
+ var live_js = require('lit/directives/live.js');
4
5
  var ifDefined_js = require('lit/directives/if-defined.js');
5
6
 
6
7
  // src/components/checkbox/sp-checkbox.ts
7
- var SpectreCheckboxElement = class extends lit.LitElement {
8
+ var SpectreBaseElement = class extends lit.LitElement {
8
9
  constructor() {
9
10
  super(...arguments);
10
- this.ariaLabel = null;
11
- this.ariaLabelledBy = null;
12
- this.ariaDescribedBy = null;
13
- this.autofocus = false;
14
- this.checked = false;
15
- this.disabled = false;
16
- this.invalid = false;
17
- this.label = "";
18
- this.required = false;
19
- this.title = "";
20
- this.value = "on";
11
+ this._ariaLabel = null;
12
+ this._ariaLabelledBy = null;
13
+ this._ariaDescribedBy = null;
14
+ this._title = "";
15
+ this._id = "";
16
+ }
17
+ get ariaLabel() {
18
+ return this._ariaLabel;
19
+ }
20
+ set ariaLabel(value) {
21
+ if (this._ariaLabel === value) {
22
+ return;
23
+ }
24
+ this._ariaLabel = value;
25
+ this._removeHostAttribute("aria-label");
26
+ this.requestUpdate();
27
+ }
28
+ get ariaLabelledBy() {
29
+ return this._ariaLabelledBy;
30
+ }
31
+ set ariaLabelledBy(value) {
32
+ if (this._ariaLabelledBy === value) {
33
+ return;
34
+ }
35
+ this._ariaLabelledBy = value;
36
+ this._removeHostAttribute("aria-labelledby");
37
+ this.requestUpdate();
38
+ }
39
+ get ariaDescribedBy() {
40
+ return this._ariaDescribedBy;
41
+ }
42
+ set ariaDescribedBy(value) {
43
+ if (this._ariaDescribedBy === value) {
44
+ return;
45
+ }
46
+ this._ariaDescribedBy = value;
47
+ this._removeHostAttribute("aria-describedby");
48
+ this.requestUpdate();
49
+ }
50
+ get title() {
51
+ return this._title;
52
+ }
53
+ set title(value) {
54
+ const normalizedValue = value ?? "";
55
+ if (this._title === normalizedValue) {
56
+ return;
57
+ }
58
+ this._title = normalizedValue;
59
+ this._removeHostAttribute("title");
60
+ this.requestUpdate();
21
61
  }
22
62
  get id() {
23
- return this._id ?? "";
63
+ return this._id;
24
64
  }
25
65
  set id(value) {
26
- if ((this._id ?? "") === value) {
66
+ const normalizedValue = value ?? "";
67
+ if (this._id === normalizedValue) {
27
68
  return;
28
69
  }
29
- this._id = value;
30
- const host = this;
31
- if (HTMLElement.prototype.hasAttribute.call(host, "id")) {
32
- HTMLElement.prototype.removeAttribute.call(host, "id");
33
- }
70
+ this._id = normalizedValue;
71
+ this._removeHostAttribute("id");
34
72
  this.requestUpdate();
35
73
  }
74
+ // Spectre components intentionally render in light DOM so the global
75
+ // `@phcdevworks/spectre-ui` styling contract can apply directly.
36
76
  createRenderRoot() {
37
77
  return this;
38
78
  }
39
79
  connectedCallback() {
40
80
  super.connectedCallback();
41
- const hostId = super.getAttribute("id");
42
- if (hostId !== null) {
43
- this.id = hostId;
44
- }
81
+ const proxiedAttributes = [
82
+ "id",
83
+ "title",
84
+ "aria-label",
85
+ "aria-labelledby",
86
+ "aria-describedby"
87
+ ];
88
+ proxiedAttributes.forEach((attr) => {
89
+ const value = super.getAttribute(attr);
90
+ if (value !== null) {
91
+ this.setAttribute(attr, value);
92
+ }
93
+ });
45
94
  }
46
95
  getAttribute(qualifiedName) {
47
- if (qualifiedName === "id") {
48
- return this.id || null;
96
+ switch (qualifiedName) {
97
+ case "id":
98
+ return this.id || null;
99
+ case "title":
100
+ return this.title || null;
101
+ case "aria-label":
102
+ return this.ariaLabel;
103
+ case "aria-labelledby":
104
+ return this.ariaLabelledBy;
105
+ case "aria-describedby":
106
+ return this.ariaDescribedBy;
107
+ default:
108
+ return super.getAttribute(qualifiedName);
49
109
  }
50
- return super.getAttribute(qualifiedName);
51
110
  }
52
111
  hasAttribute(qualifiedName) {
53
- if (qualifiedName === "id") {
54
- return this.id !== "";
112
+ switch (qualifiedName) {
113
+ case "id":
114
+ return this.id !== "";
115
+ case "title":
116
+ return this.title !== "";
117
+ case "aria-label":
118
+ return this.ariaLabel !== null;
119
+ case "aria-labelledby":
120
+ return this.ariaLabelledBy !== null;
121
+ case "aria-describedby":
122
+ return this.ariaDescribedBy !== null;
123
+ default:
124
+ return super.hasAttribute(qualifiedName);
55
125
  }
56
- return super.hasAttribute(qualifiedName);
57
126
  }
58
127
  setAttribute(qualifiedName, value) {
59
- if (qualifiedName === "id") {
60
- this.id = value;
61
- return;
128
+ switch (qualifiedName) {
129
+ case "id":
130
+ this.id = value;
131
+ break;
132
+ case "title":
133
+ this.title = value;
134
+ break;
135
+ case "aria-label":
136
+ this.ariaLabel = value;
137
+ break;
138
+ case "aria-labelledby":
139
+ this.ariaLabelledBy = value;
140
+ break;
141
+ case "aria-describedby":
142
+ this.ariaDescribedBy = value;
143
+ break;
144
+ default:
145
+ super.setAttribute(qualifiedName, value);
62
146
  }
63
- super.setAttribute(qualifiedName, value);
64
147
  }
65
148
  removeAttribute(qualifiedName) {
66
- if (qualifiedName === "id") {
67
- this.id = "";
68
- return;
149
+ switch (qualifiedName) {
150
+ case "id":
151
+ this.id = "";
152
+ break;
153
+ case "title":
154
+ this.title = "";
155
+ break;
156
+ case "aria-label":
157
+ this.ariaLabel = null;
158
+ break;
159
+ case "aria-labelledby":
160
+ this.ariaLabelledBy = null;
161
+ break;
162
+ case "aria-describedby":
163
+ this.ariaDescribedBy = null;
164
+ break;
165
+ default:
166
+ super.removeAttribute(qualifiedName);
69
167
  }
70
- super.removeAttribute(qualifiedName);
71
168
  }
72
- willUpdate(changedProperties) {
73
- if (changedProperties.has("value") && this.value == null) {
74
- this.value = "on";
169
+ _removeHostAttribute(name) {
170
+ const host = this;
171
+ if (HTMLElement.prototype.hasAttribute.call(host, name)) {
172
+ HTMLElement.prototype.removeAttribute.call(host, name);
75
173
  }
76
174
  }
77
- get nativeInput() {
78
- return this.querySelector("[data-sp-checkbox-native]");
79
- }
80
175
  get forwardedAriaLabel() {
81
176
  const value = this.ariaLabel?.trim();
82
177
  return value ? value : void 0;
@@ -89,6 +184,125 @@ var SpectreCheckboxElement = class extends lit.LitElement {
89
184
  const value = this.ariaDescribedBy?.trim();
90
185
  return value ? value : void 0;
91
186
  }
187
+ };
188
+ SpectreBaseElement.properties = {};
189
+
190
+ // src/utils/dom.ts
191
+ function hasMeaningfulContent(nodes) {
192
+ return nodes.some((node) => {
193
+ if (node.nodeType === Node.ELEMENT_NODE) {
194
+ return true;
195
+ }
196
+ if (node.nodeType === Node.TEXT_NODE) {
197
+ return (node.textContent?.trim().length ?? 0) > 0;
198
+ }
199
+ return false;
200
+ });
201
+ }
202
+
203
+ // src/utils/projectable.ts
204
+ var SpectreProjectableElement = class extends SpectreBaseElement {
205
+ constructor() {
206
+ super(...arguments);
207
+ this.projectedContent = [];
208
+ }
209
+ get hasProjectedContent() {
210
+ return hasMeaningfulContent(this.projectedContent);
211
+ }
212
+ connectedCallback() {
213
+ super.connectedCallback();
214
+ this.syncProjectedContent();
215
+ this.startContentObserver();
216
+ }
217
+ disconnectedCallback() {
218
+ this.stopContentObserver();
219
+ super.disconnectedCallback();
220
+ }
221
+ update(changedProperties) {
222
+ this.stopContentObserver();
223
+ super.update(changedProperties);
224
+ this.startContentObserver();
225
+ }
226
+ syncProjectedContent() {
227
+ const nextProjectedContent = [];
228
+ const sourceNodes = [
229
+ ...this.childNodes,
230
+ ...this.getContentContainer()?.childNodes ?? []
231
+ ];
232
+ sourceNodes.forEach((node) => {
233
+ if (!this.isInternalNode(node) && !nextProjectedContent.includes(node)) {
234
+ nextProjectedContent.push(node);
235
+ }
236
+ });
237
+ const hasChanged = nextProjectedContent.length !== this.projectedContent.length || nextProjectedContent.some((node, index) => node !== this.projectedContent[index]);
238
+ if (hasChanged) {
239
+ this.projectedContent = nextProjectedContent;
240
+ }
241
+ return hasChanged;
242
+ }
243
+ startContentObserver() {
244
+ if (this.contentObserver) {
245
+ return;
246
+ }
247
+ this.contentObserver = new MutationObserver((mutations) => {
248
+ const isInternalMovement = mutations.every(
249
+ (mutation) => [...mutation.removedNodes].every(
250
+ (node) => this.isInternalNode(node) || this.contains(node)
251
+ ) && [...mutation.addedNodes].every((node) => this.isInternalNode(node))
252
+ );
253
+ if (isInternalMovement) {
254
+ return;
255
+ }
256
+ if (this.syncProjectedContent()) {
257
+ this.requestUpdate();
258
+ }
259
+ });
260
+ this.contentObserver.observe(this, { childList: true });
261
+ }
262
+ stopContentObserver() {
263
+ this.contentObserver?.disconnect();
264
+ this.contentObserver = void 0;
265
+ }
266
+ };
267
+
268
+ // src/components/checkbox/sp-checkbox.ts
269
+ var SpectreCheckboxElement = class extends SpectreProjectableElement {
270
+ constructor() {
271
+ super(...arguments);
272
+ this.autofocus = false;
273
+ this.checked = false;
274
+ this.disabled = false;
275
+ this.invalid = false;
276
+ this.loading = false;
277
+ this.required = false;
278
+ this.success = false;
279
+ this.value = "on";
280
+ }
281
+ getContentContainer() {
282
+ return this.querySelector("[data-sp-checkbox-label]");
283
+ }
284
+ isInternalNode(node) {
285
+ if (node.nodeType !== Node.ELEMENT_NODE) {
286
+ return false;
287
+ }
288
+ const el = node;
289
+ return el.hasAttribute("data-sp-checkbox-label") || el.hasAttribute("data-sp-checkbox-native") || el.hasAttribute("data-sp-checkbox-label-fallback") || el.hasAttribute("data-sp-checkbox-indicator");
290
+ }
291
+ willUpdate(changedProperties) {
292
+ if (changedProperties.has("value") && this.value == null) {
293
+ this.value = "on";
294
+ }
295
+ }
296
+ get nativeInput() {
297
+ return this.querySelector("[data-sp-checkbox-native]");
298
+ }
299
+ get isDisabled() {
300
+ return this.disabled || this.loading;
301
+ }
302
+ get visibleLabelFallback() {
303
+ const trimmedLabel = this.label?.trim();
304
+ return trimmedLabel ? trimmedLabel : void 0;
305
+ }
92
306
  handleInput(event) {
93
307
  const input = event.currentTarget;
94
308
  this.checked = input.checked;
@@ -104,43 +318,44 @@ var SpectreCheckboxElement = class extends lit.LitElement {
104
318
  this.nativeInput?.blur();
105
319
  }
106
320
  render() {
107
- return lit.html`
108
- <label>
109
- <input
110
- aria-describedby=${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}
111
- aria-invalid=${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}
112
- aria-label=${ifDefined_js.ifDefined(this.forwardedAriaLabel)}
113
- aria-labelledby=${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}
114
- ?autofocus=${this.autofocus}
115
- data-sp-checkbox-native
116
- ?checked=${this.checked}
117
- ?disabled=${this.disabled}
118
- id=${ifDefined_js.ifDefined(this.id || void 0)}
119
- name=${ifDefined_js.ifDefined(this.name)}
120
- ?required=${this.required}
121
- title=${ifDefined_js.ifDefined(this.title || void 0)}
122
- type='checkbox'
123
- value=${ifDefined_js.ifDefined(this.value || void 0)}
124
- @change=${this.handleChange}
125
- @input=${this.handleInput}
126
- />
127
- <span class='sp-label'>${this.label}</span>
128
- </label>
129
- `;
321
+ const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span class="sp-label" data-sp-checkbox-label-fallback>${this.visibleLabelFallback}</span>` : lit.nothing;
322
+ return lit.html`<label data-sp-checkbox-label>
323
+ <input
324
+ aria-busy="${this.loading ? "true" : "false"}"
325
+ aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
326
+ aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
327
+ aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
328
+ aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
329
+ ?autofocus="${this.autofocus}"
330
+ data-sp-checkbox-native
331
+ .checked="${live_js.live(this.checked)}"
332
+ ?disabled="${this.isDisabled}"
333
+ form="${ifDefined_js.ifDefined(this.form || void 0)}"
334
+ id="${ifDefined_js.ifDefined(this.id || void 0)}"
335
+ name="${ifDefined_js.ifDefined(this.name || void 0)}"
336
+ ?required="${this.required}"
337
+ title="${ifDefined_js.ifDefined(this.title || void 0)}"
338
+ type="checkbox"
339
+ value="${ifDefined_js.ifDefined(this.value)}"
340
+ @change="${this.handleChange}"
341
+ @input="${this.handleInput}"
342
+ />
343
+ <span class="sp-checkbox-indicator" data-sp-checkbox-indicator></span>
344
+ ${labelContent}
345
+ </label>`;
130
346
  }
131
347
  };
132
348
  SpectreCheckboxElement.properties = {
133
- ariaLabel: { attribute: "aria-label", type: String },
134
- ariaLabelledBy: { attribute: "aria-labelledby", type: String },
135
- ariaDescribedBy: { attribute: "aria-describedby", type: String },
136
349
  autofocus: { type: Boolean, reflect: true },
137
350
  checked: { type: Boolean, reflect: true },
138
351
  disabled: { type: Boolean, reflect: true },
352
+ form: { type: String },
139
353
  invalid: { type: Boolean, reflect: true },
354
+ loading: { type: Boolean, reflect: true },
140
355
  label: { type: String, reflect: true },
141
- name: { type: String },
356
+ name: { type: String, reflect: true },
142
357
  required: { type: Boolean, reflect: true },
143
- title: { type: String, reflect: true },
358
+ success: { type: Boolean, reflect: true },
144
359
  value: { type: String }
145
360
  };
146
361
  function defineSpectreCheckbox(tagName = "sp-checkbox") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/checkbox/sp-checkbox.ts"],"names":["LitElement","html","ifDefined"],"mappings":";;;;;;AAeO,IAAM,sBAAA,GAAN,cAAqCA,cAAA,CAA2C;AAAA,EAAhF,WA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AA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACrC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA;AACjB,CAAA;AAwJK,SAAS,qBAAA,CAAsB,UAAU,aAAA,EAA8C;AAC5F,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,sBAAsB,CAAA;AACrD,EAAA,OAAO,sBAAA;AACT","file":"checkbox.cjs","sourcesContent":["import { LitElement, html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport interface SpectreCheckboxProps {\n autofocus?: boolean;\n checked?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n label?: string;\n name?: string;\n required?: boolean;\n title?: string;\n value?: string;\n}\n\nexport class SpectreCheckboxElement extends LitElement implements SpectreCheckboxProps {\n static properties = {\n ariaLabel: { attribute: 'aria-label', type: String },\n ariaLabelledBy: { attribute: 'aria-labelledby', type: String },\n ariaDescribedBy: { attribute: 'aria-describedby', type: String },\n autofocus: { type: Boolean, reflect: true },\n checked: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n invalid: { type: Boolean, reflect: true },\n label: { type: String, reflect: true },\n name: { type: String },\n required: { type: Boolean, reflect: true },\n title: { type: String, reflect: true },\n value: { type: String },\n };\n\n ariaLabel: string | null = null;\n ariaLabelledBy: string | null = null;\n ariaDescribedBy: string | null = null;\n autofocus = false;\n checked = false;\n disabled = false;\n invalid = false;\n label = '';\n name?: string;\n required = false;\n override title = '';\n value = 'on';\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 createRenderRoot(): this {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const hostId = super.getAttribute('id');\n\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 override willUpdate(changedProperties: Map<PropertyKey, unknown>): void {\n if (changedProperties.has('value') && this.value == null) {\n this.value = 'on';\n }\n }\n\n private get nativeInput(): HTMLInputElement | null {\n return this.querySelector('[data-sp-checkbox-native]');\n }\n\n private get forwardedAriaLabel(): string | undefined {\n const value = this.ariaLabel?.trim();\n return value ? value : undefined;\n }\n\n private get forwardedAriaLabelledBy(): string | undefined {\n const value = this.ariaLabelledBy?.trim();\n return value ? value : undefined;\n }\n\n private get forwardedAriaDescribedBy(): string | undefined {\n const value = this.ariaDescribedBy?.trim();\n return value ? value : undefined;\n }\n\n private handleInput(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.checked = input.checked;\n }\n\n private handleChange(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.checked = input.checked;\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 <label>\n <input\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 ?autofocus=${this.autofocus}\n data-sp-checkbox-native\n ?checked=${this.checked}\n ?disabled=${this.disabled}\n id=${ifDefined(this.id || undefined)}\n name=${ifDefined(this.name)}\n ?required=${this.required}\n title=${ifDefined(this.title || undefined)}\n type='checkbox'\n value=${ifDefined(this.value || undefined)}\n @change=${this.handleChange}\n @input=${this.handleInput}\n />\n <span class='sp-label'>${this.label}</span>\n </label>\n `;\n }\n}\n\nexport function defineSpectreCheckbox(tagName = 'sp-checkbox'): typeof SpectreCheckboxElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreCheckboxElement;\n }\n\n customElements.define(tagName, SpectreCheckboxElement);\n return SpectreCheckboxElement;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/base.ts","../src/utils/dom.ts","../src/utils/projectable.ts","../src/components/checkbox/sp-checkbox.ts"],"names":["LitElement","html","nothing","ifDefined","live"],"mappings":";;;;;;;AAEO,IAAM,kBAAA,GAAN,cAAiCA,cAAA,CAAW;AAAA,EAA5C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAGL,IAAA,IAAA,CAAQ,UAAA,GAA4B,IAAA;AACpC,IAAA,IAAA,CAAQ,eAAA,GAAiC,IAAA;AACzC,IAAA,IAAA,CAAQ,gBAAA,GAAkC,IAAA;AAC1C,IAAA,IAAA,CAAQ,MAAA,GAAS,EAAA;AACjB,IAAA,IAAA,CAAQ,GAAA,GAAM,EAAA;AAAA,EAAA;AAAA,EAEd,IAAI,SAAA,GAA2B;AAC7B,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACd;AAAA,EAEA,IAAI,UAAU,KAAA,EAAsB;AAClC,IAAA,IAAI,IAAA,CAAK,eAAe,KAAA,EAAO;AAC7B,MAAA;AAAA,IAC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rB,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACrC,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACpC,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA;AACjB,CAAA;AAuGK,SAAS,qBAAA,CAAsB,UAAU,aAAA,EAA8C;AAC5F,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,sBAAsB,CAAA;AACrD,EAAA,OAAO,sBAAA;AACT","file":"checkbox.cjs","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 _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 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 '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 '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 '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 '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 '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 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","export function hasMeaningfulContent(nodes: readonly Node[]): boolean {\n return nodes.some((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n return true;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent?.trim().length ?? 0) > 0;\n }\n\n return false;\n });\n}\n","import { SpectreBaseElement } from './base';\nimport { hasMeaningfulContent } from './dom';\n\nexport abstract class SpectreProjectableElement extends SpectreBaseElement {\n protected projectedContent: Node[] = [];\n private contentObserver?: MutationObserver | undefined;\n\n // Return the native container whose existing children are also treated as\n // projected content sources (e.g. the rendered <button>, <select>, <label>).\n protected abstract getContentContainer(): Element | null;\n\n // Return true if the node was rendered by this component and should not be\n // treated as external projected content.\n protected abstract isInternalNode(node: Node): boolean;\n\n protected get hasProjectedContent(): boolean {\n return hasMeaningfulContent(this.projectedContent);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.syncProjectedContent();\n this.startContentObserver();\n }\n\n override disconnectedCallback(): void {\n this.stopContentObserver();\n super.disconnectedCallback();\n }\n\n protected override update(changedProperties: Map<PropertyKey, unknown>): void {\n this.stopContentObserver();\n super.update(changedProperties);\n this.startContentObserver();\n }\n\n protected syncProjectedContent(): boolean {\n const nextProjectedContent: Node[] = [];\n const sourceNodes = [\n ...this.childNodes,\n ...(this.getContentContainer()?.childNodes ?? []),\n ];\n\n sourceNodes.forEach((node) => {\n if (!this.isInternalNode(node) && !nextProjectedContent.includes(node)) {\n nextProjectedContent.push(node);\n }\n });\n\n const hasChanged =\n nextProjectedContent.length !== this.projectedContent.length ||\n nextProjectedContent.some((node, index) => node !== this.projectedContent[index]);\n\n if (hasChanged) {\n this.projectedContent = nextProjectedContent;\n }\n\n return hasChanged;\n }\n\n private startContentObserver(): void {\n if (this.contentObserver) {\n return;\n }\n\n this.contentObserver = new MutationObserver((mutations) => {\n const isInternalMovement = mutations.every((mutation) =>\n [...mutation.removedNodes].every(\n (node) => this.isInternalNode(node) || this.contains(node),\n ) &&\n [...mutation.addedNodes].every((node) => this.isInternalNode(node)),\n );\n\n if (isInternalMovement) {\n return;\n }\n\n if (this.syncProjectedContent()) {\n this.requestUpdate();\n }\n });\n\n this.contentObserver.observe(this, { childList: true });\n }\n\n private stopContentObserver(): void {\n this.contentObserver?.disconnect();\n this.contentObserver = undefined;\n }\n}\n","import { html, nothing } from 'lit';\nimport { live } from 'lit/directives/live.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { SpectreProjectableElement } from '../../utils/projectable';\n\nexport interface SpectreCheckboxProps {\n ariaLabel: string | null;\n ariaLabelledBy: string | null;\n ariaDescribedBy: string | null;\n autofocus?: boolean | undefined;\n checked?: boolean | undefined;\n disabled?: boolean | undefined;\n form?: string | undefined;\n invalid?: boolean | undefined;\n loading?: boolean | undefined;\n label?: string | undefined;\n name?: string | undefined;\n required?: boolean | undefined;\n success?: boolean | undefined;\n title?: string | undefined;\n value?: string | undefined;\n}\n\nexport class SpectreCheckboxElement extends SpectreProjectableElement implements SpectreCheckboxProps {\n static properties = {\n autofocus: { type: Boolean, reflect: true },\n checked: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n form: { type: String },\n invalid: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n label: { type: String, reflect: true },\n name: { type: String, reflect: true },\n required: { type: Boolean, reflect: true },\n success: { type: Boolean, reflect: true },\n value: { type: String },\n };\n\n autofocus = false;\n checked = false;\n disabled = false;\n form: string | undefined;\n invalid = false;\n loading = false;\n label: string | undefined;\n name: string | undefined;\n required = false;\n success = false;\n value = 'on';\n\n protected override getContentContainer(): Element | null {\n return this.querySelector('[data-sp-checkbox-label]');\n }\n\n protected override isInternalNode(node: Node): boolean {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return false;\n }\n\n const el = node as Element;\n return (\n el.hasAttribute('data-sp-checkbox-label') ||\n el.hasAttribute('data-sp-checkbox-native') ||\n el.hasAttribute('data-sp-checkbox-label-fallback') ||\n el.hasAttribute('data-sp-checkbox-indicator')\n );\n }\n\n protected override willUpdate(changedProperties: Map<PropertyKey, unknown>): void {\n if (changedProperties.has('value') && this.value == null) {\n this.value = 'on';\n }\n }\n\n private get nativeInput(): HTMLInputElement | null {\n return this.querySelector('[data-sp-checkbox-native]');\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.loading;\n }\n\n private get visibleLabelFallback(): string | undefined {\n const trimmedLabel = this.label?.trim();\n return trimmedLabel ? trimmedLabel : undefined;\n }\n\n private handleInput(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.checked = input.checked;\n }\n\n private handleChange(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n this.checked = input.checked;\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 const labelContent = this.hasProjectedContent\n ? this.projectedContent\n : this.visibleLabelFallback\n ? html`<span class=\"sp-label\" data-sp-checkbox-label-fallback>${this.visibleLabelFallback}</span>`\n : nothing;\n\n return html`<label data-sp-checkbox-label>\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 ?autofocus=\"${this.autofocus}\"\n data-sp-checkbox-native\n .checked=\"${live(this.checked)}\"\n ?disabled=\"${this.isDisabled}\"\n form=\"${ifDefined(this.form || undefined)}\"\n id=\"${ifDefined(this.id || undefined)}\"\n name=\"${ifDefined(this.name || undefined)}\"\n ?required=\"${this.required}\"\n title=\"${ifDefined(this.title || undefined)}\"\n type=\"checkbox\"\n value=\"${ifDefined(this.value)}\"\n @change=\"${this.handleChange}\"\n @input=\"${this.handleInput}\"\n />\n <span class=\"sp-checkbox-indicator\" data-sp-checkbox-indicator></span>\n ${labelContent}\n </label>`;\n }\n}\n\nexport function defineSpectreCheckbox(tagName = 'sp-checkbox'): typeof SpectreCheckboxElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreCheckboxElement;\n }\n\n customElements.define(tagName, SpectreCheckboxElement);\n return SpectreCheckboxElement;\n}\n"]}
@@ -1,31 +1,27 @@
1
1
  import * as lit_html from 'lit-html';
2
- import { LitElement } from 'lit';
2
+ import { S as SpectreProjectableElement } from './projectable-BzDQ4xp_.cjs';
3
+ import './base-2rD8EmdC.cjs';
4
+ import 'lit';
3
5
 
4
6
  interface SpectreCheckboxProps {
5
- autofocus?: boolean;
6
- checked?: boolean;
7
- disabled?: boolean;
8
- invalid?: boolean;
9
- label?: string;
10
- name?: string;
11
- required?: boolean;
12
- title?: string;
13
- value?: string;
7
+ ariaLabel: string | null;
8
+ ariaLabelledBy: string | null;
9
+ ariaDescribedBy: string | null;
10
+ autofocus?: boolean | undefined;
11
+ checked?: boolean | undefined;
12
+ disabled?: boolean | undefined;
13
+ form?: string | undefined;
14
+ invalid?: boolean | undefined;
15
+ loading?: boolean | undefined;
16
+ label?: string | undefined;
17
+ name?: string | undefined;
18
+ required?: boolean | undefined;
19
+ success?: boolean | undefined;
20
+ title?: string | undefined;
21
+ value?: string | undefined;
14
22
  }
15
- declare class SpectreCheckboxElement extends LitElement implements SpectreCheckboxProps {
23
+ declare class SpectreCheckboxElement extends SpectreProjectableElement implements SpectreCheckboxProps {
16
24
  static properties: {
17
- ariaLabel: {
18
- attribute: string;
19
- type: StringConstructor;
20
- };
21
- ariaLabelledBy: {
22
- attribute: string;
23
- type: StringConstructor;
24
- };
25
- ariaDescribedBy: {
26
- attribute: string;
27
- type: StringConstructor;
28
- };
29
25
  autofocus: {
30
26
  type: BooleanConstructor;
31
27
  reflect: boolean;
@@ -38,55 +34,54 @@ declare class SpectreCheckboxElement extends LitElement implements SpectreCheckb
38
34
  type: BooleanConstructor;
39
35
  reflect: boolean;
40
36
  };
37
+ form: {
38
+ type: StringConstructor;
39
+ };
41
40
  invalid: {
42
41
  type: BooleanConstructor;
43
42
  reflect: boolean;
44
43
  };
44
+ loading: {
45
+ type: BooleanConstructor;
46
+ reflect: boolean;
47
+ };
45
48
  label: {
46
49
  type: StringConstructor;
47
50
  reflect: boolean;
48
51
  };
49
52
  name: {
50
53
  type: StringConstructor;
54
+ reflect: boolean;
51
55
  };
52
56
  required: {
53
57
  type: BooleanConstructor;
54
58
  reflect: boolean;
55
59
  };
56
- title: {
57
- type: StringConstructor;
60
+ success: {
61
+ type: BooleanConstructor;
58
62
  reflect: boolean;
59
63
  };
60
64
  value: {
61
65
  type: StringConstructor;
62
66
  };
63
67
  };
64
- ariaLabel: string | null;
65
- ariaLabelledBy: string | null;
66
- ariaDescribedBy: string | null;
67
68
  autofocus: boolean;
68
69
  checked: boolean;
69
70
  disabled: boolean;
71
+ form: string | undefined;
70
72
  invalid: boolean;
71
- label: string;
72
- name?: string;
73
+ loading: boolean;
74
+ label: string | undefined;
75
+ name: string | undefined;
73
76
  required: boolean;
74
- title: string;
77
+ success: boolean;
75
78
  value: string;
76
- private _id?;
77
- get id(): string;
78
- set id(value: string);
79
- createRenderRoot(): this;
80
- connectedCallback(): void;
81
- getAttribute(qualifiedName: string): string | null;
82
- hasAttribute(qualifiedName: string): boolean;
83
- setAttribute(qualifiedName: string, value: string): void;
84
- removeAttribute(qualifiedName: string): void;
79
+ protected getContentContainer(): Element | null;
80
+ protected isInternalNode(node: Node): boolean;
85
81
  protected willUpdate(changedProperties: Map<PropertyKey, unknown>): void;
86
82
  private get nativeInput();
87
- private get forwardedAriaLabel();
88
- private get forwardedAriaLabelledBy();
89
- private get forwardedAriaDescribedBy();
83
+ private get isDisabled();
84
+ private get visibleLabelFallback();
90
85
  private handleInput;
91
86
  private handleChange;
92
87
  focus(options?: FocusOptions): void;