@phcdevworks/spectre-components 1.0.0 → 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 (60) hide show
  1. package/README.md +113 -40
  2. package/dist/{base-DQtCQ-dP.d.cts → base-2rD8EmdC.d.cts} +15 -5
  3. package/dist/{base-DQtCQ-dP.d.ts → base-2rD8EmdC.d.ts} +15 -5
  4. package/dist/button.cjs +158 -58
  5. package/dist/button.cjs.map +1 -1
  6. package/dist/button.d.cts +22 -28
  7. package/dist/button.d.ts +22 -28
  8. package/dist/button.js +158 -58
  9. package/dist/button.js.map +1 -1
  10. package/dist/checkbox.cjs +164 -64
  11. package/dist/checkbox.cjs.map +1 -1
  12. package/dist/checkbox.d.cts +18 -23
  13. package/dist/checkbox.d.ts +18 -23
  14. package/dist/checkbox.js +164 -64
  15. package/dist/checkbox.js.map +1 -1
  16. package/dist/fieldset.cjs +154 -55
  17. package/dist/fieldset.cjs.map +1 -1
  18. package/dist/fieldset.d.cts +13 -18
  19. package/dist/fieldset.d.ts +13 -18
  20. package/dist/fieldset.js +154 -55
  21. package/dist/fieldset.js.map +1 -1
  22. package/dist/index.cjs +324 -261
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +324 -261
  27. package/dist/index.js.map +1 -1
  28. package/dist/input.cjs +174 -72
  29. package/dist/input.cjs.map +1 -1
  30. package/dist/input.d.cts +33 -38
  31. package/dist/input.d.ts +33 -38
  32. package/dist/input.js +174 -72
  33. package/dist/input.js.map +1 -1
  34. package/dist/label.cjs +152 -56
  35. package/dist/label.cjs.map +1 -1
  36. package/dist/label.d.cts +8 -13
  37. package/dist/label.d.ts +8 -13
  38. package/dist/label.js +152 -56
  39. package/dist/label.js.map +1 -1
  40. package/dist/{projectable-DcnBRiko.d.cts → projectable-BzDQ4xp_.d.cts} +1 -1
  41. package/dist/{projectable-SzbPvXfM.d.ts → projectable-s3SgvjGX.d.ts} +1 -1
  42. package/dist/radio.cjs +164 -64
  43. package/dist/radio.cjs.map +1 -1
  44. package/dist/radio.d.cts +18 -23
  45. package/dist/radio.d.ts +18 -23
  46. package/dist/radio.js +164 -64
  47. package/dist/radio.js.map +1 -1
  48. package/dist/select.cjs +161 -61
  49. package/dist/select.cjs.map +1 -1
  50. package/dist/select.d.cts +22 -27
  51. package/dist/select.d.ts +22 -27
  52. package/dist/select.js +161 -61
  53. package/dist/select.js.map +1 -1
  54. package/dist/textarea.cjs +172 -72
  55. package/dist/textarea.cjs.map +1 -1
  56. package/dist/textarea.d.cts +27 -32
  57. package/dist/textarea.d.ts +27 -32
  58. package/dist/textarea.js +172 -72
  59. package/dist/textarea.js.map +1 -1
  60. package/package.json +9 -8
package/dist/textarea.js CHANGED
@@ -7,22 +7,67 @@ 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._title = "";
14
+ this._id = "";
15
+ }
16
+ get ariaLabel() {
17
+ return this._ariaLabel;
18
+ }
19
+ set ariaLabel(value) {
20
+ if (this._ariaLabel === value) {
21
+ return;
22
+ }
23
+ this._ariaLabel = value;
24
+ this._removeHostAttribute("aria-label");
25
+ this.requestUpdate();
26
+ }
27
+ get ariaLabelledBy() {
28
+ return this._ariaLabelledBy;
29
+ }
30
+ set ariaLabelledBy(value) {
31
+ if (this._ariaLabelledBy === value) {
32
+ return;
33
+ }
34
+ this._ariaLabelledBy = value;
35
+ this._removeHostAttribute("aria-labelledby");
36
+ this.requestUpdate();
37
+ }
38
+ get ariaDescribedBy() {
39
+ return this._ariaDescribedBy;
40
+ }
41
+ set ariaDescribedBy(value) {
42
+ if (this._ariaDescribedBy === value) {
43
+ return;
44
+ }
45
+ this._ariaDescribedBy = value;
46
+ this._removeHostAttribute("aria-describedby");
47
+ this.requestUpdate();
48
+ }
49
+ get title() {
50
+ return this._title;
51
+ }
52
+ set title(value) {
53
+ const normalizedValue = value ?? "";
54
+ if (this._title === normalizedValue) {
55
+ return;
56
+ }
57
+ this._title = normalizedValue;
58
+ this._removeHostAttribute("title");
59
+ this.requestUpdate();
13
60
  }
14
61
  get id() {
15
- return this._id ?? "";
62
+ return this._id;
16
63
  }
17
64
  set id(value) {
18
- if ((this._id ?? "") === value) {
65
+ const normalizedValue = value ?? "";
66
+ if (this._id === normalizedValue) {
19
67
  return;
20
68
  }
21
- this._id = value;
22
- const host = this;
23
- if (HTMLElement.prototype.hasAttribute.call(host, "id")) {
24
- HTMLElement.prototype.removeAttribute.call(host, "id");
25
- }
69
+ this._id = normalizedValue;
70
+ this._removeHostAttribute("id");
26
71
  this.requestUpdate();
27
72
  }
28
73
  // Spectre components intentionally render in light DOM so the global
@@ -32,36 +77,99 @@ var SpectreBaseElement = class extends LitElement {
32
77
  }
33
78
  connectedCallback() {
34
79
  super.connectedCallback();
35
- const hostId = super.getAttribute("id");
36
- if (hostId !== null) {
37
- this.id = hostId;
38
- }
80
+ const proxiedAttributes = [
81
+ "id",
82
+ "title",
83
+ "aria-label",
84
+ "aria-labelledby",
85
+ "aria-describedby"
86
+ ];
87
+ proxiedAttributes.forEach((attr) => {
88
+ const value = super.getAttribute(attr);
89
+ if (value !== null) {
90
+ this.setAttribute(attr, value);
91
+ }
92
+ });
39
93
  }
40
94
  getAttribute(qualifiedName) {
41
- if (qualifiedName === "id") {
42
- return this.id || null;
95
+ switch (qualifiedName) {
96
+ case "id":
97
+ return this.id || null;
98
+ case "title":
99
+ return this.title || null;
100
+ case "aria-label":
101
+ return this.ariaLabel;
102
+ case "aria-labelledby":
103
+ return this.ariaLabelledBy;
104
+ case "aria-describedby":
105
+ return this.ariaDescribedBy;
106
+ default:
107
+ return super.getAttribute(qualifiedName);
43
108
  }
44
- return super.getAttribute(qualifiedName);
45
109
  }
46
110
  hasAttribute(qualifiedName) {
47
- if (qualifiedName === "id") {
48
- return this.id !== "";
111
+ switch (qualifiedName) {
112
+ case "id":
113
+ return this.id !== "";
114
+ case "title":
115
+ return this.title !== "";
116
+ case "aria-label":
117
+ return this.ariaLabel !== null;
118
+ case "aria-labelledby":
119
+ return this.ariaLabelledBy !== null;
120
+ case "aria-describedby":
121
+ return this.ariaDescribedBy !== null;
122
+ default:
123
+ return super.hasAttribute(qualifiedName);
49
124
  }
50
- return super.hasAttribute(qualifiedName);
51
125
  }
52
126
  setAttribute(qualifiedName, value) {
53
- if (qualifiedName === "id") {
54
- this.id = value;
55
- return;
127
+ switch (qualifiedName) {
128
+ case "id":
129
+ this.id = value;
130
+ break;
131
+ case "title":
132
+ this.title = value;
133
+ break;
134
+ case "aria-label":
135
+ this.ariaLabel = value;
136
+ break;
137
+ case "aria-labelledby":
138
+ this.ariaLabelledBy = value;
139
+ break;
140
+ case "aria-describedby":
141
+ this.ariaDescribedBy = value;
142
+ break;
143
+ default:
144
+ super.setAttribute(qualifiedName, value);
56
145
  }
57
- super.setAttribute(qualifiedName, value);
58
146
  }
59
147
  removeAttribute(qualifiedName) {
60
- if (qualifiedName === "id") {
61
- this.id = "";
62
- return;
148
+ switch (qualifiedName) {
149
+ case "id":
150
+ this.id = "";
151
+ break;
152
+ case "title":
153
+ this.title = "";
154
+ break;
155
+ case "aria-label":
156
+ this.ariaLabel = null;
157
+ break;
158
+ case "aria-labelledby":
159
+ this.ariaLabelledBy = null;
160
+ break;
161
+ case "aria-describedby":
162
+ this.ariaDescribedBy = null;
163
+ break;
164
+ default:
165
+ super.removeAttribute(qualifiedName);
166
+ }
167
+ }
168
+ _removeHostAttribute(name) {
169
+ const host = this;
170
+ if (HTMLElement.prototype.hasAttribute.call(host, name)) {
171
+ HTMLElement.prototype.removeAttribute.call(host, name);
63
172
  }
64
- super.removeAttribute(qualifiedName);
65
173
  }
66
174
  get forwardedAriaLabel() {
67
175
  const value = this.ariaLabel?.trim();
@@ -76,15 +184,17 @@ var SpectreBaseElement = class extends LitElement {
76
184
  return value ? value : void 0;
77
185
  }
78
186
  };
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
- };
187
+ SpectreBaseElement.properties = {};
84
188
  var spectreInputSizes = ["sm", "md", "lg"];
85
189
  function isInputSize(value) {
86
190
  return spectreInputSizes.includes(value);
87
191
  }
192
+ function normalizeInt(value, fallback, min = 0) {
193
+ if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
194
+ return fallback;
195
+ }
196
+ return value;
197
+ }
88
198
  var DEFAULT_ROWS = 2;
89
199
  var SpectreTextareaElement = class extends SpectreBaseElement {
90
200
  constructor() {
@@ -100,7 +210,6 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
100
210
  this.rows = DEFAULT_ROWS;
101
211
  this.size = "md";
102
212
  this.success = false;
103
- this.title = "";
104
213
  this.value = "";
105
214
  }
106
215
  willUpdate(changedProperties) {
@@ -108,22 +217,16 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
108
217
  this.size = "md";
109
218
  }
110
219
  if (changedProperties.has("rows")) {
111
- if (this.rows == null || !Number.isInteger(this.rows) || this.rows < 1) {
112
- this.rows = DEFAULT_ROWS;
113
- }
220
+ this.rows = normalizeInt(this.rows, DEFAULT_ROWS, 1);
114
221
  }
115
222
  if (changedProperties.has("value") && this.value == null) {
116
223
  this.value = "";
117
224
  }
118
225
  if (changedProperties.has("maxlength")) {
119
- if (this.maxlength == null || !Number.isInteger(this.maxlength) || this.maxlength < 0) {
120
- this.maxlength = void 0;
121
- }
226
+ this.maxlength = normalizeInt(this.maxlength, void 0);
122
227
  }
123
228
  if (changedProperties.has("minlength")) {
124
- if (this.minlength == null || !Number.isInteger(this.minlength) || this.minlength < 0) {
125
- this.minlength = void 0;
126
- }
229
+ this.minlength = normalizeInt(this.minlength, void 0);
127
230
  }
128
231
  }
129
232
  get textareaClasses() {
@@ -155,34 +258,32 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
155
258
  this.nativeTextarea?.blur();
156
259
  }
157
260
  render() {
158
- return html`
159
- <textarea
160
- aria-busy=${this.loading ? "true" : "false"}
161
- aria-describedby=${ifDefined(this.forwardedAriaDescribedBy)}
162
- aria-invalid=${ifDefined(this.invalid ? "true" : void 0)}
163
- aria-label=${ifDefined(this.forwardedAriaLabel)}
164
- aria-labelledby=${ifDefined(this.forwardedAriaLabelledBy)}
165
- autocomplete=${ifDefined(this.autocomplete)}
166
- ?autofocus=${this.autofocus}
167
- class=${this.textareaClasses}
168
- data-sp-textarea-native
169
- ?disabled=${this.isDisabled}
170
- form=${ifDefined(this.form)}
171
- inputmode=${ifDefined(this.inputmode)}
172
- ?readonly=${this.readonly}
173
- ?required=${this.required}
174
- id=${ifDefined(this.id || void 0)}
175
- maxlength=${ifDefined(this.maxlength)}
176
- minlength=${ifDefined(this.minlength)}
177
- name=${ifDefined(this.name)}
178
- placeholder=${ifDefined(this.placeholder)}
179
- rows=${this.rows}
180
- title=${ifDefined(this.title || void 0)}
181
- .value=${live(this.value)}
182
- @change=${this.handleChange}
183
- @input=${this.handleInput}
184
- ></textarea>
185
- `;
261
+ return html`<textarea
262
+ aria-busy="${this.loading ? "true" : "false"}"
263
+ aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
264
+ aria-invalid="${ifDefined(this.invalid ? "true" : void 0)}"
265
+ aria-label="${ifDefined(this.forwardedAriaLabel)}"
266
+ aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
267
+ autocomplete="${ifDefined(this.autocomplete || void 0)}"
268
+ ?autofocus="${this.autofocus}"
269
+ class="${this.textareaClasses}"
270
+ data-sp-textarea-native
271
+ ?disabled="${this.isDisabled}"
272
+ form="${ifDefined(this.form || void 0)}"
273
+ inputmode="${ifDefined(this.inputmode || void 0)}"
274
+ ?readonly="${this.readonly}"
275
+ ?required="${this.required}"
276
+ id="${ifDefined(this.id || void 0)}"
277
+ maxlength="${ifDefined(this.maxlength)}"
278
+ minlength="${ifDefined(this.minlength)}"
279
+ name="${ifDefined(this.name || void 0)}"
280
+ placeholder="${ifDefined(this.placeholder || void 0)}"
281
+ rows="${this.rows}"
282
+ title="${ifDefined(this.title || void 0)}"
283
+ .value="${live(this.value)}"
284
+ @change="${this.handleChange}"
285
+ @input="${this.handleInput}"
286
+ ></textarea>`;
186
287
  }
187
288
  };
188
289
  SpectreTextareaElement.properties = {
@@ -204,7 +305,6 @@ SpectreTextareaElement.properties = {
204
305
  rows: { type: Number },
205
306
  size: { type: String, reflect: true },
206
307
  success: { type: Boolean, reflect: true },
207
- title: { type: String, reflect: true },
208
308
  value: { type: String }
209
309
  };
210
310
  function defineSpectreTextarea(tagName = "sp-textarea") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/base.ts","../src/utils/form.ts","../src/components/textarea/sp-textarea.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,CAAK,GAAA,GAAM,KAAA;AAEX,IAAA,MAAM,IAAA,GAAO,IAAA;A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A,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EACrB,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACpC,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACrC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA;AACjB,CAAA;AA4IK,SAAS,qBAAA,CACd,UAAU,aAAA,EACqB;AAC/B,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":"textarea.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 { isInputSize, type SpectreInputSize } from '../../utils/form';\n\nimport { getInputClasses } from '@phcdevworks/spectre-ui';\n\nexport interface SpectreTextareaProps {\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 maxlength?: number | undefined;\n minlength?: number | undefined;\n name?: string | undefined;\n pill?: boolean;\n placeholder?: string | undefined;\n readonly?: boolean;\n required?: boolean;\n rows?: number;\n size?: SpectreInputSize;\n success?: boolean;\n title?: string;\n value?: string;\n}\n\nconst DEFAULT_ROWS = 2;\n\nexport class SpectreTextareaElement\n extends SpectreBaseElement\n implements SpectreTextareaProps {\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 maxlength: { type: Number, 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 rows: { type: Number },\n size: { type: String, reflect: true },\n success: { type: Boolean, reflect: true },\n title: { 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 maxlength?: number | undefined;\n minlength?: number | undefined;\n name?: string;\n pill = false;\n placeholder?: string;\n readonly = false;\n required = false;\n rows = DEFAULT_ROWS;\n size: SpectreInputSize = 'md';\n success = false;\n override title = '';\n value = '';\n\n protected override willUpdate(\n changedProperties: Map<PropertyKey, unknown>,\n ): void {\n if (changedProperties.has('size') && !isInputSize(this.size)) {\n this.size = 'md';\n }\n\n if (changedProperties.has('rows')) {\n if (\n this.rows == null ||\n !Number.isInteger(this.rows) ||\n this.rows < 1\n ) {\n this.rows = DEFAULT_ROWS;\n }\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 textareaClasses(): 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 nativeTextarea(): HTMLTextAreaElement | null {\n return this.querySelector('[data-sp-textarea-native]');\n }\n\n private handleInput(event: Event): void {\n const textarea = event.currentTarget as HTMLTextAreaElement;\n this.value = textarea.value;\n }\n\n private handleChange(event: Event): void {\n const textarea = event.currentTarget as HTMLTextAreaElement;\n this.value = textarea.value;\n }\n\n override focus(options?: FocusOptions): void {\n this.nativeTextarea?.focus(options);\n }\n\n override blur(): void {\n this.nativeTextarea?.blur();\n }\n\n override render() {\n return html`\n <textarea\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.textareaClasses}\n data-sp-textarea-native\n ?disabled=${this.isDisabled}\n form=${ifDefined(this.form)}\n inputmode=${ifDefined(this.inputmode)}\n ?readonly=${this.readonly}\n ?required=${this.required}\n id=${ifDefined(this.id || undefined)}\n maxlength=${ifDefined(this.maxlength)}\n minlength=${ifDefined(this.minlength)}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n rows=${this.rows}\n title=${ifDefined(this.title || undefined)}\n .value=${live(this.value)}\n @change=${this.handleChange}\n @input=${this.handleInput}\n ></textarea>\n `;\n }\n}\n\nexport function defineSpectreTextarea(\n tagName = 'sp-textarea',\n): typeof SpectreTextareaElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreTextareaElement;\n }\n\n customElements.define(tagName, SpectreTextareaElement);\n return SpectreTextareaElement;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/base.ts","../src/utils/form.ts","../src/components/textarea/sp-textarea.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,kBAAA,GAAN,cAAiC,UAAA,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,IACF;AACA,IAAA,IAAA,CAAK,UAAA,GAAa,KAAA;AAClB,IAAA,IAAA,CAAK,qBAAqB,YAAY,CAAA;AACtC,IAAA,IAAA,CAAK,aAAA,EAAc;AAAA,EACrB;AAAA,EAEA,IAAI,cAAA,GAAgC;AAClC,IAAA,OAAO,IAAA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A,EACrC,WAAA,EAAa,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EAC3C,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EACrB,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACpC,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,KAAA,EAAO,EAAE,IAAA,EAAM,MAAA;AACjB,CAAA;AAuHK,SAAS,qBAAA,CACd,UAAU,aAAA,EACqB;AAC/B,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":"textarea.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 _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","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: unknown): value is InputSize {\n return (spectreInputSizes 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 isInputSize,\n type SpectreInputSize,\n normalizeInt,\n} from '../../utils/form';\n\nimport { getInputClasses } from '@phcdevworks/spectre-ui';\n\nexport interface SpectreTextareaProps {\n ariaLabel: string | null;\n ariaLabelledBy: string | null;\n ariaDescribedBy: string | null;\n autocomplete?: string | undefined;\n autofocus?: boolean | undefined;\n disabled?: boolean | undefined;\n form?: string | undefined;\n fullWidth?: boolean | undefined;\n inputmode?: string | undefined;\n invalid?: boolean | undefined;\n loading?: boolean | undefined;\n maxlength?: number | undefined;\n minlength?: number | undefined;\n name?: string | undefined;\n pill?: boolean | undefined;\n placeholder?: string | undefined;\n readonly?: boolean | undefined;\n required?: boolean | undefined;\n rows?: number | undefined;\n size?: SpectreInputSize | undefined;\n success?: boolean | undefined;\n title?: string | undefined;\n value?: string | undefined;\n}\n\nconst DEFAULT_ROWS = 2;\n\nexport class SpectreTextareaElement\n extends SpectreBaseElement\n implements SpectreTextareaProps {\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 maxlength: { type: Number, 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 rows: { type: Number },\n size: { type: String, reflect: true },\n success: { type: Boolean, reflect: true },\n value: { type: String },\n };\n\n autocomplete: string | undefined;\n autofocus = false;\n disabled = false;\n form: string | undefined;\n fullWidth = false;\n inputmode: string | undefined;\n invalid = false;\n loading = false;\n maxlength: number | undefined;\n minlength: number | undefined;\n name: string | undefined;\n pill = false;\n placeholder: string | undefined;\n readonly = false;\n required = false;\n rows = DEFAULT_ROWS;\n size: SpectreInputSize = 'md';\n success = false;\n value = '';\n\n protected override willUpdate(\n changedProperties: Map<PropertyKey, unknown>,\n ): void {\n if (changedProperties.has('size') && !isInputSize(this.size)) {\n this.size = 'md';\n }\n\n if (changedProperties.has('rows')) {\n this.rows = normalizeInt(this.rows, DEFAULT_ROWS, 1) as number;\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 textareaClasses(): 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 nativeTextarea(): HTMLTextAreaElement | null {\n return this.querySelector('[data-sp-textarea-native]');\n }\n\n private handleInput(event: Event): void {\n const textarea = event.currentTarget as HTMLTextAreaElement;\n this.value = textarea.value;\n }\n\n private handleChange(event: Event): void {\n const textarea = event.currentTarget as HTMLTextAreaElement;\n this.value = textarea.value;\n }\n\n override focus(options?: FocusOptions): void {\n this.nativeTextarea?.focus(options);\n }\n\n override blur(): void {\n this.nativeTextarea?.blur();\n }\n\n override render() {\n return html`<textarea\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 || undefined)}\"\n ?autofocus=\"${this.autofocus}\"\n class=\"${this.textareaClasses}\"\n data-sp-textarea-native\n ?disabled=\"${this.isDisabled}\"\n form=\"${ifDefined(this.form || undefined)}\"\n inputmode=\"${ifDefined(this.inputmode || undefined)}\"\n ?readonly=\"${this.readonly}\"\n ?required=\"${this.required}\"\n id=\"${ifDefined(this.id || undefined)}\"\n maxlength=\"${ifDefined(this.maxlength)}\"\n minlength=\"${ifDefined(this.minlength)}\"\n name=\"${ifDefined(this.name || undefined)}\"\n placeholder=\"${ifDefined(this.placeholder || undefined)}\"\n rows=\"${this.rows}\"\n title=\"${ifDefined(this.title || undefined)}\"\n .value=\"${live(this.value)}\"\n @change=\"${this.handleChange}\"\n @input=\"${this.handleInput}\"\n ></textarea>`;\n }\n}\n\nexport function defineSpectreTextarea(\n tagName = 'sp-textarea',\n): typeof SpectreTextareaElement {\n const existingElement = customElements.get(tagName);\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreTextareaElement;\n }\n\n customElements.define(tagName, SpectreTextareaElement);\n return SpectreTextareaElement;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phcdevworks/spectre-components",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "@phcdevworks/spectre-components is the Lit-based component layer of the Spectre system for reusable, accessible, framework-agnostic web components.",
5
5
  "keywords": [
6
6
  "phcdevworks",
@@ -103,22 +103,23 @@
103
103
  "typescript": "^5.9 || ^6.0"
104
104
  },
105
105
  "dependencies": {
106
- "@phcdevworks/spectre-tokens": "^2.4.0",
107
- "@phcdevworks/spectre-ui": "^1.4.0",
106
+ "@phcdevworks/spectre-tokens": "^2.5.0",
107
+ "@phcdevworks/spectre-ui": "^1.5.0",
108
108
  "lit": "^3.3.2"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@eslint/js": "^10.0.1",
112
112
  "@types/node": "^25.6.0",
113
- "@typescript-eslint/eslint-plugin": "^8.59.0",
114
- "@typescript-eslint/parser": "^8.59.0",
115
- "eslint": "^10.2.1",
116
- "globals": "^17.5.0",
113
+ "@typescript-eslint/eslint-plugin": "^8.59.2",
114
+ "@typescript-eslint/parser": "^8.59.2",
115
+ "eslint": "^10.3.0",
116
+ "globals": "^17.6.0",
117
117
  "happy-dom": "^20.9.0",
118
+ "jiti": "^2.6.1",
118
119
  "prettier": "^3.8.3",
119
120
  "tsup": "^8.5.1",
120
121
  "typescript": "^6.0.3",
121
- "typescript-eslint": "^8.59.0",
122
+ "typescript-eslint": "^8.59.2",
122
123
  "vitest": "^4.1.5"
123
124
  }
124
125
  }