@six-group/ui-library 0.0.0-insider.388e2a7 → 0.0.0-insider.46b7c93

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 (214) hide show
  1. package/README.md +9 -0
  2. package/dist/cjs/{form-control-d369af14.js → form-control-9769b310.js} +10 -7
  3. package/dist/cjs/form-control-9769b310.js.map +1 -0
  4. package/dist/cjs/index-900437fc.js +214 -1
  5. package/dist/cjs/index-900437fc.js.map +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/six-checkbox.cjs.entry.js +6 -3
  8. package/dist/cjs/six-checkbox.cjs.entry.js.map +1 -1
  9. package/dist/cjs/six-datepicker.cjs.entry.js +2 -7
  10. package/dist/cjs/six-datepicker.cjs.entry.js.map +1 -1
  11. package/dist/cjs/six-dropdown_2.cjs.entry.js +1 -1
  12. package/dist/cjs/six-dropdown_2.cjs.entry.js.map +1 -1
  13. package/dist/cjs/six-error.cjs.entry.js +21 -0
  14. package/dist/cjs/six-error.cjs.entry.js.map +1 -0
  15. package/dist/cjs/six-group-label.cjs.entry.js +2 -2
  16. package/dist/cjs/six-group-label.cjs.entry.js.map +1 -1
  17. package/dist/cjs/six-input.cjs.entry.js +6 -3
  18. package/dist/cjs/six-input.cjs.entry.js.map +1 -1
  19. package/dist/cjs/six-range.cjs.entry.js +6 -3
  20. package/dist/cjs/six-range.cjs.entry.js.map +1 -1
  21. package/dist/cjs/six-select.cjs.entry.js +6 -3
  22. package/dist/cjs/six-select.cjs.entry.js.map +1 -1
  23. package/dist/cjs/six-sidebar.cjs.entry.js +1 -1
  24. package/dist/cjs/six-sidebar.cjs.entry.js.map +1 -1
  25. package/dist/cjs/six-switch.cjs.entry.js +22 -4
  26. package/dist/cjs/six-switch.cjs.entry.js.map +1 -1
  27. package/dist/cjs/six-textarea.cjs.entry.js +6 -3
  28. package/dist/cjs/six-textarea.cjs.entry.js.map +1 -1
  29. package/dist/cjs/six-timepicker.cjs.entry.js +4 -9
  30. package/dist/cjs/six-timepicker.cjs.entry.js.map +1 -1
  31. package/dist/cjs/ui-library.cjs.js +2 -2
  32. package/dist/cjs/ui-library.cjs.js.map +1 -1
  33. package/dist/collection/collection-manifest.json +2 -1
  34. package/dist/collection/components/six-checkbox/six-checkbox.css +1 -1
  35. package/dist/collection/components/six-checkbox/six-checkbox.js +25 -4
  36. package/dist/collection/components/six-checkbox/six-checkbox.js.map +1 -1
  37. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js +6 -2
  38. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js.map +1 -1
  39. package/dist/collection/components/six-datepicker/six-datepicker.js +22 -11
  40. package/dist/collection/components/six-datepicker/six-datepicker.js.map +1 -1
  41. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js +1 -1
  42. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js.map +1 -1
  43. package/dist/collection/components/six-dropdown/six-dropdown.css +2 -1
  44. package/dist/collection/components/six-error/six-error.css +5 -0
  45. package/dist/collection/components/six-error/six-error.js +25 -0
  46. package/dist/collection/components/six-error/six-error.js.map +1 -0
  47. package/dist/collection/components/six-group-label/six-group-label.css +1 -1
  48. package/dist/collection/components/six-group-label/test/six-group-label.spec.js +3 -1
  49. package/dist/collection/components/six-group-label/test/six-group-label.spec.js.map +1 -1
  50. package/dist/collection/components/six-input/six-input.css +1 -1
  51. package/dist/collection/components/six-input/six-input.js +27 -4
  52. package/dist/collection/components/six-input/six-input.js.map +1 -1
  53. package/dist/collection/components/six-input/test/six-input.spec.js +3 -1
  54. package/dist/collection/components/six-input/test/six-input.spec.js.map +1 -1
  55. package/dist/collection/components/six-range/six-range.css +1 -1
  56. package/dist/collection/components/six-range/six-range.js +24 -3
  57. package/dist/collection/components/six-range/six-range.js.map +1 -1
  58. package/dist/collection/components/six-range/test/six-range.spec.js +3 -1
  59. package/dist/collection/components/six-range/test/six-range.spec.js.map +1 -1
  60. package/dist/collection/components/six-select/six-select.css +1 -1
  61. package/dist/collection/components/six-select/six-select.js +24 -3
  62. package/dist/collection/components/six-select/six-select.js.map +1 -1
  63. package/dist/collection/components/six-select/test/six-select.spec.js +6 -2
  64. package/dist/collection/components/six-select/test/six-select.spec.js.map +1 -1
  65. package/dist/collection/components/six-sidebar/six-sidebar.css +1 -0
  66. package/dist/collection/components/six-switch/six-switch.css +1 -1
  67. package/dist/collection/components/six-switch/six-switch.js +45 -4
  68. package/dist/collection/components/six-switch/six-switch.js.map +1 -1
  69. package/dist/collection/components/six-switch/test/six-switch.spec.js +6 -2
  70. package/dist/collection/components/six-switch/test/six-switch.spec.js.map +1 -1
  71. package/dist/collection/components/six-textarea/six-textarea.css +1 -1
  72. package/dist/collection/components/six-textarea/six-textarea.js +25 -4
  73. package/dist/collection/components/six-textarea/six-textarea.js.map +1 -1
  74. package/dist/collection/components/six-textarea/test/six-textarea.spec.js +3 -1
  75. package/dist/collection/components/six-textarea/test/six-textarea.spec.js.map +1 -1
  76. package/dist/collection/components/six-timepicker/six-timepicker.js +24 -12
  77. package/dist/collection/components/six-timepicker/six-timepicker.js.map +1 -1
  78. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js +15 -15
  79. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js.map +1 -1
  80. package/dist/collection/functional-components/form-control/form-control.js +8 -6
  81. package/dist/collection/functional-components/form-control/form-control.js.map +1 -1
  82. package/dist/components/form-control.js +9 -6
  83. package/dist/components/form-control.js.map +1 -1
  84. package/dist/components/index.js +2 -0
  85. package/dist/components/index.js.map +1 -1
  86. package/dist/components/six-checkbox.js +14 -3
  87. package/dist/components/six-checkbox.js.map +1 -1
  88. package/dist/components/six-datepicker.js +10 -8
  89. package/dist/components/six-datepicker.js.map +1 -1
  90. package/dist/components/six-dropdown2.js +8 -2
  91. package/dist/components/six-dropdown2.js.map +1 -1
  92. package/dist/components/six-error.d.ts +11 -0
  93. package/dist/components/six-error.js +8 -0
  94. package/dist/components/six-error.js.map +1 -0
  95. package/dist/components/six-error2.js +32 -0
  96. package/dist/components/six-error2.js.map +1 -0
  97. package/dist/components/six-group-label.js +8 -2
  98. package/dist/components/six-group-label.js.map +1 -1
  99. package/dist/components/six-header.js +8 -2
  100. package/dist/components/six-header.js.map +1 -1
  101. package/dist/components/six-input2.js +14 -3
  102. package/dist/components/six-input2.js.map +1 -1
  103. package/dist/components/six-range.js +14 -3
  104. package/dist/components/six-range.js.map +1 -1
  105. package/dist/components/six-search-field.js +7 -1
  106. package/dist/components/six-search-field.js.map +1 -1
  107. package/dist/components/six-select.js +15 -4
  108. package/dist/components/six-select.js.map +1 -1
  109. package/dist/components/six-sidebar.js +1 -1
  110. package/dist/components/six-sidebar.js.map +1 -1
  111. package/dist/components/six-switch.js +30 -4
  112. package/dist/components/six-switch.js.map +1 -1
  113. package/dist/components/six-textarea.js +14 -3
  114. package/dist/components/six-textarea.js.map +1 -1
  115. package/dist/components/six-timepicker2.js +12 -10
  116. package/dist/components/six-timepicker2.js.map +1 -1
  117. package/dist/components.json +413 -49
  118. package/dist/esm/{form-control-32cb533f.js → form-control-b0febe88.js} +10 -7
  119. package/dist/esm/form-control-b0febe88.js.map +1 -0
  120. package/dist/esm/index-8a74f992.js +214 -1
  121. package/dist/esm/index-8a74f992.js.map +1 -1
  122. package/dist/esm/loader.js +1 -1
  123. package/dist/esm/six-checkbox.entry.js +6 -3
  124. package/dist/esm/six-checkbox.entry.js.map +1 -1
  125. package/dist/esm/six-datepicker.entry.js +2 -7
  126. package/dist/esm/six-datepicker.entry.js.map +1 -1
  127. package/dist/esm/six-dropdown_2.entry.js +1 -1
  128. package/dist/esm/six-dropdown_2.entry.js.map +1 -1
  129. package/dist/esm/six-error.entry.js +17 -0
  130. package/dist/esm/six-error.entry.js.map +1 -0
  131. package/dist/esm/six-group-label.entry.js +2 -2
  132. package/dist/esm/six-group-label.entry.js.map +1 -1
  133. package/dist/esm/six-input.entry.js +6 -3
  134. package/dist/esm/six-input.entry.js.map +1 -1
  135. package/dist/esm/six-range.entry.js +6 -3
  136. package/dist/esm/six-range.entry.js.map +1 -1
  137. package/dist/esm/six-select.entry.js +6 -3
  138. package/dist/esm/six-select.entry.js.map +1 -1
  139. package/dist/esm/six-sidebar.entry.js +1 -1
  140. package/dist/esm/six-sidebar.entry.js.map +1 -1
  141. package/dist/esm/six-switch.entry.js +22 -4
  142. package/dist/esm/six-switch.entry.js.map +1 -1
  143. package/dist/esm/six-textarea.entry.js +6 -3
  144. package/dist/esm/six-textarea.entry.js.map +1 -1
  145. package/dist/esm/six-timepicker.entry.js +4 -9
  146. package/dist/esm/six-timepicker.entry.js.map +1 -1
  147. package/dist/esm/ui-library.js +2 -2
  148. package/dist/esm/ui-library.js.map +1 -1
  149. package/dist/types/components/six-checkbox/six-checkbox.d.ts +4 -1
  150. package/dist/types/components/six-datepicker/six-datepicker.d.ts +4 -2
  151. package/dist/types/components/six-error/six-error.d.ts +9 -0
  152. package/dist/types/components/six-input/six-input.d.ts +7 -2
  153. package/dist/types/components/six-range/six-range.d.ts +4 -1
  154. package/dist/types/components/six-select/six-select.d.ts +4 -1
  155. package/dist/types/components/six-switch/six-switch.d.ts +8 -1
  156. package/dist/types/components/six-textarea/six-textarea.d.ts +4 -1
  157. package/dist/types/components/six-timepicker/six-timepicker.d.ts +5 -2
  158. package/dist/types/components.d.ts +109 -16
  159. package/dist/types/functional-components/form-control/form-control.d.ts +6 -2
  160. package/dist/ui-library/{p-ed381ad9.entry.js → p-14c1ec31.entry.js} +2 -2
  161. package/dist/ui-library/p-14c1ec31.entry.js.map +1 -0
  162. package/dist/ui-library/p-25bb1752.entry.js +2 -0
  163. package/dist/ui-library/p-25bb1752.entry.js.map +1 -0
  164. package/dist/ui-library/p-2a141e10.entry.js +2 -0
  165. package/dist/ui-library/p-2a141e10.entry.js.map +1 -0
  166. package/dist/ui-library/p-4435ff73.entry.js +2 -0
  167. package/dist/ui-library/p-4435ff73.entry.js.map +1 -0
  168. package/dist/ui-library/p-538f3c50.entry.js +2 -0
  169. package/dist/ui-library/p-538f3c50.entry.js.map +1 -0
  170. package/dist/ui-library/p-6153045b.js.map +1 -1
  171. package/dist/ui-library/p-a457fee8.entry.js +2 -0
  172. package/dist/ui-library/p-a457fee8.entry.js.map +1 -0
  173. package/dist/ui-library/p-ab91c2a9.entry.js +2 -0
  174. package/dist/ui-library/p-ab91c2a9.entry.js.map +1 -0
  175. package/dist/ui-library/p-b57afbe4.entry.js +2 -0
  176. package/dist/ui-library/p-b57afbe4.entry.js.map +1 -0
  177. package/dist/ui-library/p-b6f47c9d.entry.js +2 -0
  178. package/dist/ui-library/p-b6f47c9d.entry.js.map +1 -0
  179. package/dist/ui-library/p-db34a6cc.entry.js +2 -0
  180. package/dist/ui-library/p-db34a6cc.entry.js.map +1 -0
  181. package/dist/ui-library/p-db936ad7.entry.js +2 -0
  182. package/dist/ui-library/{p-d367f4f9.entry.js.map → p-db936ad7.entry.js.map} +1 -1
  183. package/dist/ui-library/p-e5020f0d.js +2 -0
  184. package/dist/ui-library/p-e5020f0d.js.map +1 -0
  185. package/dist/ui-library/p-e775dcb4.entry.js +2 -0
  186. package/dist/ui-library/p-e775dcb4.entry.js.map +1 -0
  187. package/dist/ui-library/ui-library.esm.js +1 -1
  188. package/dist/ui-library/ui-library.esm.js.map +1 -1
  189. package/package.json +3 -3
  190. package/dist/cjs/form-control-d369af14.js.map +0 -1
  191. package/dist/esm/form-control-32cb533f.js.map +0 -1
  192. package/dist/ui-library/p-02981b91.entry.js +0 -2
  193. package/dist/ui-library/p-02981b91.entry.js.map +0 -1
  194. package/dist/ui-library/p-314b2096.entry.js +0 -2
  195. package/dist/ui-library/p-314b2096.entry.js.map +0 -1
  196. package/dist/ui-library/p-330a4988.entry.js +0 -2
  197. package/dist/ui-library/p-330a4988.entry.js.map +0 -1
  198. package/dist/ui-library/p-3d9de119.entry.js +0 -2
  199. package/dist/ui-library/p-3d9de119.entry.js.map +0 -1
  200. package/dist/ui-library/p-4abed9df.entry.js +0 -2
  201. package/dist/ui-library/p-4abed9df.entry.js.map +0 -1
  202. package/dist/ui-library/p-5d6b7353.entry.js +0 -2
  203. package/dist/ui-library/p-5d6b7353.entry.js.map +0 -1
  204. package/dist/ui-library/p-9f0b43f9.entry.js +0 -2
  205. package/dist/ui-library/p-9f0b43f9.entry.js.map +0 -1
  206. package/dist/ui-library/p-bf87464b.entry.js +0 -2
  207. package/dist/ui-library/p-bf87464b.entry.js.map +0 -1
  208. package/dist/ui-library/p-d367f4f9.entry.js +0 -2
  209. package/dist/ui-library/p-d42c2025.js +0 -2
  210. package/dist/ui-library/p-d42c2025.js.map +0 -1
  211. package/dist/ui-library/p-ed381ad9.entry.js.map +0 -1
  212. package/dist/ui-library/p-ff90ffd1.entry.js +0 -2
  213. package/dist/ui-library/p-ff90ffd1.entry.js.map +0 -1
  214. package/readme.md +0 -156
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { EventListeners } from "../../utils/event-listeners";
3
3
  import FormControl from "../../functional-components/form-control/form-control";
4
+ import { hasSlot } from "../../utils/slot";
4
5
  let id = 0;
5
6
  /**
6
7
  * @since 1.0
@@ -9,6 +10,7 @@ let id = 0;
9
10
  * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
10
11
  *
11
12
  * @slot - The switch's label.
13
+ * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.
12
14
  *
13
15
  * @part base - The component's base wrapper.
14
16
  * @part control - The switch control.
@@ -21,6 +23,9 @@ export class SixSwitch {
21
23
  this.labelId = `switch-label-${id}`;
22
24
  this.errorTextId = `input-error-text-${id}`;
23
25
  this.eventListeners = new EventListeners();
26
+ this.handleSlotChange = () => {
27
+ this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
28
+ };
24
29
  this.handleClick = () => {
25
30
  if (this.inputElement != null) {
26
31
  this.checked = this.inputElement.checked;
@@ -54,6 +59,7 @@ export class SixSwitch {
54
59
  (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus();
55
60
  };
56
61
  this.hasFocus = false;
62
+ this.hasErrorTextSlot = false;
57
63
  this.name = '';
58
64
  this.value = 'on';
59
65
  this.disabled = false;
@@ -61,8 +67,12 @@ export class SixSwitch {
61
67
  this.checked = false;
62
68
  this.label = '';
63
69
  this.errorText = '';
70
+ this.errorTextCount = undefined;
64
71
  this.invalid = false;
65
72
  }
73
+ componentWillLoad() {
74
+ this.handleSlotChange();
75
+ }
66
76
  handleCheckedChange() {
67
77
  if (this.inputElement != null) {
68
78
  this.inputElement.checked = this.checked;
@@ -70,13 +80,20 @@ export class SixSwitch {
70
80
  }
71
81
  }
72
82
  connectedCallback() {
83
+ var _a;
84
+ (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener('slotchange', this.handleSlotChange);
73
85
  this.eventListeners.forward('six-switch-change', 'change', this.host);
74
86
  this.eventListeners.forward('six-switch-blur', 'blur', this.host);
75
87
  this.eventListeners.forward('six-switch-focus', 'focus', this.host);
76
88
  }
77
89
  disconnectedCallback() {
90
+ var _a;
91
+ (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener('slotchange', this.handleSlotChange);
78
92
  this.eventListeners.removeAll();
79
93
  }
94
+ handleLabelChange() {
95
+ this.handleSlotChange();
96
+ }
80
97
  /** Sets focus on the switch. */
81
98
  async setFocus(options) {
82
99
  var _a;
@@ -88,7 +105,7 @@ export class SixSwitch {
88
105
  (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.blur();
89
106
  }
90
107
  render() {
91
- return (h(FormControl, { inputId: this.switchId, label: this.label, labelId: this.labelId, hasLabelSlot: false, errorTextId: this.errorTextId, errorText: this.errorText, size: "medium", disabled: this.disabled, required: this.required, displayError: this.invalid }, h("label", { part: "base", htmlFor: this.switchId, class: {
108
+ return (h(FormControl, { inputId: this.switchId, label: this.label, labelId: this.labelId, hasLabelSlot: false, errorTextId: this.errorTextId, errorText: this.errorText, errorTextCount: this.errorTextCount, hasErrorTextSlot: this.hasErrorTextSlot, size: "medium", disabled: this.disabled, required: this.required, displayError: this.invalid }, h("label", { part: "base", htmlFor: this.switchId, class: {
92
109
  switch: true,
93
110
  'switch--checked': this.checked,
94
111
  'switch--disabled': this.disabled,
@@ -221,8 +238,8 @@ export class SixSwitch {
221
238
  "type": "string",
222
239
  "mutable": false,
223
240
  "complexType": {
224
- "original": "string",
225
- "resolved": "string",
241
+ "original": "string | string[]",
242
+ "resolved": "string | string[]",
226
243
  "references": {}
227
244
  },
228
245
  "required": false,
@@ -235,6 +252,23 @@ export class SixSwitch {
235
252
  "reflect": false,
236
253
  "defaultValue": "''"
237
254
  },
255
+ "errorTextCount": {
256
+ "type": "number",
257
+ "mutable": false,
258
+ "complexType": {
259
+ "original": "number",
260
+ "resolved": "number | undefined",
261
+ "references": {}
262
+ },
263
+ "required": false,
264
+ "optional": true,
265
+ "docs": {
266
+ "tags": [],
267
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
268
+ },
269
+ "attribute": "error-text-count",
270
+ "reflect": false
271
+ },
238
272
  "invalid": {
239
273
  "type": "boolean",
240
274
  "mutable": false,
@@ -257,7 +291,8 @@ export class SixSwitch {
257
291
  }
258
292
  static get states() {
259
293
  return {
260
- "hasFocus": {}
294
+ "hasFocus": {},
295
+ "hasErrorTextSlot": {}
261
296
  };
262
297
  }
263
298
  static get events() {
@@ -364,6 +399,12 @@ export class SixSwitch {
364
399
  return [{
365
400
  "propName": "checked",
366
401
  "methodName": "handleCheckedChange"
402
+ }, {
403
+ "propName": "errorText",
404
+ "methodName": "handleLabelChange"
405
+ }, {
406
+ "propName": "label",
407
+ "methodName": "handleLabelChange"
367
408
  }];
368
409
  }
369
410
  }
@@ -1 +1 @@
1
- {"version":3,"file":"six-switch.js","sourceRoot":"","sources":["../../../src/components/six-switch/six-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,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IAAI,EAAC,QAAQ,kBACC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,qBAC5B,IAAI,CAAC,OAAO,EAC7B,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,GAC7B,CACG;QAEP,YAAM,IAAI,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,eAAe;UACxD,eAAQ,CACH,CACD,CACI,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\nimport FormControl from '../../functional-components/form-control/form-control';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot - The switch's label.\n *\n * @part base - The component's base wrapper.\n * @part control - The switch control.\n * @part thumb - The switch position indicator.\n * @part label - The switch label.\n */\n\n@Component({\n tag: 'six-switch',\n styleUrl: 'six-switch.scss',\n shadow: true,\n})\nexport class SixSwitch {\n private switchId = `switch-${++id}`;\n private labelId = `switch-label-${id}`;\n private errorTextId = `input-error-text-${id}`;\n\n private inputElement?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixSwitchElement;\n\n @State() hasFocus = false;\n\n /** The switch's name attribute. */\n @Prop() name = '';\n\n /** The switch's value attribute. */\n @Prop() value = 'on';\n\n /** Set to true to disable the switch. */\n @Prop() disabled = false;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** Set to true to draw the switch in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText = '';\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n @Watch('checked')\n handleCheckedChange() {\n if (this.inputElement != null) {\n this.inputElement.checked = this.checked;\n this.checked = this.inputElement.checked;\n }\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-switch-blur' }) sixBlur!: EventEmitter<boolean>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-switch-change' }) sixChange!: EventEmitter<boolean>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-switch-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.eventListeners.forward('six-switch-change', 'change', this.host);\n this.eventListeners.forward('six-switch-blur', 'blur', this.host);\n this.eventListeners.forward('six-switch-focus', 'focus', this.host);\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the switch. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.focus(options);\n }\n\n /** Removes focus from the switch. */\n @Method()\n async removeFocus() {\n this.inputElement?.blur();\n }\n\n private handleClick = () => {\n if (this.inputElement != null) {\n this.checked = this.inputElement.checked;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit(this.checked);\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n this.checked = false;\n this.sixChange.emit(this.checked);\n }\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n this.checked = true;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.inputElement?.focus();\n };\n\n render() {\n return (\n <FormControl\n inputId={this.switchId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={false}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n size=\"medium\"\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <label\n part=\"base\"\n htmlFor={this.switchId}\n class={{\n switch: true,\n 'switch--checked': this.checked,\n 'switch--disabled': this.disabled,\n 'switch--focused': this.hasFocus,\n }}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"switch__control\">\n <span part=\"thumb\" class=\"switch__thumb\" />\n\n <input\n ref={(el) => (this.inputElement = el)}\n id={this.switchId}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n role=\"switch\"\n aria-checked={this.checked ? 'true' : 'false'}\n aria-labelledby={this.labelId}\n onClick={this.handleClick}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"switch__label\">\n <slot />\n </span>\n </label>\n </FormControl>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-switch.js","sourceRoot":"","sources":["../../../src/components/six-switch/six-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,WAAW,MAAM,uDAAu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;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\nimport FormControl from '../../functional-components/form-control/form-control';\nimport { hasSlot } from '../../utils/slot';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot - The switch's label.\n * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.\n *\n * @part base - The component's base wrapper.\n * @part control - The switch control.\n * @part thumb - The switch position indicator.\n * @part label - The switch label.\n */\n\n@Component({\n tag: 'six-switch',\n styleUrl: 'six-switch.scss',\n shadow: true,\n})\nexport class SixSwitch {\n private switchId = `switch-${++id}`;\n private labelId = `switch-label-${id}`;\n private errorTextId = `input-error-text-${id}`;\n\n private inputElement?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixSwitchElement;\n\n @State() hasFocus = false;\n @State() hasErrorTextSlot = false;\n\n /** The switch's name attribute. */\n @Prop() name = '';\n\n /** The switch's value attribute. */\n @Prop() value = 'on';\n\n /** Set to true to disable the switch. */\n @Prop() disabled = false;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** Set to true to draw the switch in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText: string | string[] = '';\n\n /** The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1 */\n @Prop() errorTextCount?: number;\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n @Watch('checked')\n handleCheckedChange() {\n if (this.inputElement != null) {\n this.inputElement.checked = this.checked;\n this.checked = this.inputElement.checked;\n }\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-switch-blur' }) sixBlur!: EventEmitter<boolean>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-switch-change' }) sixChange!: EventEmitter<boolean>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-switch-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.forward('six-switch-change', 'change', this.host);\n this.eventListeners.forward('six-switch-blur', 'blur', this.host);\n this.eventListeners.forward('six-switch-focus', 'focus', this.host);\n }\n\n disconnectedCallback() {\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n @Watch('errorText')\n @Watch('label')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n private handleSlotChange = () => {\n this.hasErrorTextSlot = hasSlot(this.host, 'error-text');\n };\n\n /** Sets focus on the switch. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.focus(options);\n }\n\n /** Removes focus from the switch. */\n @Method()\n async removeFocus() {\n this.inputElement?.blur();\n }\n\n private handleClick = () => {\n if (this.inputElement != null) {\n this.checked = this.inputElement.checked;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit(this.checked);\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n this.checked = false;\n this.sixChange.emit(this.checked);\n }\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n this.checked = true;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.inputElement?.focus();\n };\n\n render() {\n return (\n <FormControl\n inputId={this.switchId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={false}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n errorTextCount={this.errorTextCount}\n hasErrorTextSlot={this.hasErrorTextSlot}\n size=\"medium\"\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <label\n part=\"base\"\n htmlFor={this.switchId}\n class={{\n switch: true,\n 'switch--checked': this.checked,\n 'switch--disabled': this.disabled,\n 'switch--focused': this.hasFocus,\n }}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"switch__control\">\n <span part=\"thumb\" class=\"switch__thumb\" />\n\n <input\n ref={(el) => (this.inputElement = el)}\n id={this.switchId}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n role=\"switch\"\n aria-checked={this.checked ? 'true' : 'false'}\n aria-labelledby={this.labelId}\n onClick={this.handleClick}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"switch__label\">\n <slot />\n </span>\n </label>\n </FormControl>\n );\n }\n}\n"]}
@@ -24,7 +24,9 @@ describe('six-switch', () => {
24
24
  </span>
25
25
  </label>
26
26
  </div>
27
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text"></div>
27
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text">
28
+ <slot name="error-text"></slot>
29
+ </div>
28
30
  <div aria-hidden="true" class="form-control__help-text" part="help-text">
29
31
  <slot name="help-text"></slot>
30
32
  </div>
@@ -56,7 +58,9 @@ describe('six-switch', () => {
56
58
  </span>
57
59
  </label>
58
60
  </div>
59
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-2" part="error-text"></div>
61
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-2" part="error-text">
62
+ <slot name="error-text"></slot>
63
+ </div>
60
64
  <div aria-hidden="true" class="form-control__help-text" part="help-text">
61
65
  <slot name="help-text"></slot>
62
66
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"six-switch.spec.js","sourceRoot":"","sources":["../../../../src/components/six-switch/test/six-switch.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,2BAA2B;KAClC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;KAyB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,mCAAmC;KAC1C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;KAyB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSwitch } from '../six-switch';\n\ndescribe('six-switch', () => {\n it('default', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch>\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-1\" id=\"switch-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch\" htmlfor=\"switch-1\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"false\" aria-labelledby=\"switch-label-1\" id=\"switch-1\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-1\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\"></div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n\n it('checked', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch checked></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch checked=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-2\" id=\"switch-label-2\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch switch--checked\" htmlfor=\"switch-2\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"true\" aria-labelledby=\"switch-label-2\" checked=\"\" id=\"switch-2\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-2\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-2\" part=\"error-text\"></div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"six-switch.spec.js","sourceRoot":"","sources":["../../../../src/components/six-switch/test/six-switch.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,2BAA2B;KAClC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,mCAAmC;KAC1C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSwitch } from '../six-switch';\n\ndescribe('six-switch', () => {\n it('default', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch>\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-1\" id=\"switch-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch\" htmlfor=\"switch-1\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"false\" aria-labelledby=\"switch-label-1\" id=\"switch-1\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-1\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\">\n <slot name=\"error-text\"></slot>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n\n it('checked', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch checked></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch checked=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-2\" id=\"switch-label-2\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch switch--checked\" htmlfor=\"switch-2\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"true\" aria-labelledby=\"switch-label-2\" checked=\"\" id=\"switch-2\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-2\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-2\" part=\"error-text\">\n <slot name=\"error-text\"></slot>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n});\n"]}
@@ -14,6 +14,7 @@
14
14
  }
15
15
  .form-control .form-control__error-text {
16
16
  display: none;
17
+ text-align: left;
17
18
  }
18
19
 
19
20
  .form-control--has-label .form-control__label {
@@ -56,7 +57,6 @@
56
57
 
57
58
  .form-control--has-error-text .form-control__error-text {
58
59
  display: block;
59
- color: var(--six-color-danger-800);
60
60
  margin-top: var(--six-spacing-xxx-small);
61
61
  }
62
62
  .form-control--has-error-text .form-control__error-text ::slotted(*) {
@@ -51,10 +51,12 @@ export class SixTextarea {
51
51
  this.handleSlotChange = () => {
52
52
  this.hasLabelSlot = hasSlot(this.host, 'label');
53
53
  this.hasHelpTextSlot = hasSlot(this.host, 'help-text');
54
+ this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
54
55
  };
55
56
  this.hasFocus = false;
56
57
  this.hasHelpTextSlot = false;
57
58
  this.hasLabelSlot = false;
59
+ this.hasErrorTextSlot = false;
58
60
  this.size = 'medium';
59
61
  this.name = '';
60
62
  this.value = '';
@@ -69,6 +71,7 @@ export class SixTextarea {
69
71
  this.required = false;
70
72
  this.label = '';
71
73
  this.errorText = '';
74
+ this.errorTextCount = undefined;
72
75
  this.invalid = false;
73
76
  this.autocapitalize = 'off';
74
77
  this.autocorrect = 'off';
@@ -164,7 +167,7 @@ export class SixTextarea {
164
167
  return ((_a = this.value) !== null && _a !== void 0 ? _a : '').toString();
165
168
  }
166
169
  render() {
167
- return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, errorTextId: this.errorTextId, errorText: this.errorText, size: this.size, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("div", { part: "base", class: {
170
+ return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, errorTextId: this.errorTextId, errorText: this.errorText, errorTextCount: this.errorTextCount, hasErrorTextSlot: this.hasErrorTextSlot, size: this.size, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("div", { part: "base", class: {
168
171
  textarea: true,
169
172
  // Sizes
170
173
  'textarea--small': this.size === 'small',
@@ -430,8 +433,8 @@ export class SixTextarea {
430
433
  "type": "string",
431
434
  "mutable": false,
432
435
  "complexType": {
433
- "original": "string",
434
- "resolved": "string",
436
+ "original": "string | string[]",
437
+ "resolved": "string | string[]",
435
438
  "references": {}
436
439
  },
437
440
  "required": false,
@@ -444,6 +447,23 @@ export class SixTextarea {
444
447
  "reflect": false,
445
448
  "defaultValue": "''"
446
449
  },
450
+ "errorTextCount": {
451
+ "type": "number",
452
+ "mutable": false,
453
+ "complexType": {
454
+ "original": "number",
455
+ "resolved": "number | undefined",
456
+ "references": {}
457
+ },
458
+ "required": false,
459
+ "optional": true,
460
+ "docs": {
461
+ "tags": [],
462
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
463
+ },
464
+ "attribute": "error-text-count",
465
+ "reflect": false
466
+ },
447
467
  "invalid": {
448
468
  "type": "boolean",
449
469
  "mutable": false,
@@ -575,7 +595,8 @@ export class SixTextarea {
575
595
  return {
576
596
  "hasFocus": {},
577
597
  "hasHelpTextSlot": {},
578
- "hasLabelSlot": {}
598
+ "hasLabelSlot": {},
599
+ "hasErrorTextSlot": {}
579
600
  };
580
601
  }
581
602
  static get events() {
@@ -1 +1 @@
1
- {"version":3,"file":"six-textarea.js","sourceRoot":"","sources":["../../../src/components/six-textarea/six-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,WAAW,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport FormControl from '../../functional-components/form-control/form-control';\nimport { hasSlot } from '../../utils/slot';\nimport { EventListeners } from '../../utils/event-listeners';\nimport { EmptyPayload } from '../../utils/types';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot label - The textarea's label. Alternatively, you can use the label prop.\n * @slot help-text - Help text that describes how to use the input.\n * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.\n *\n * @part base - The component's base wrapper.\n * @part form-control - The form control that wraps the label, textarea, and help text.\n * @part label - The textarea label.\n * @part textarea - The textarea control.\n * @part help-text - The textarea help text.\n */\n@Component({\n tag: 'six-textarea',\n styleUrl: 'six-textarea.scss',\n shadow: true,\n})\nexport class SixTextarea {\n private inputId = `textarea-${++id}`;\n private labelId = `textarea-label-${id}`;\n private helpTextId = `textarea-help-text-${id}`;\n private errorTextId = `input-error-text-${id}`;\n private nativeTextarea?: HTMLTextAreaElement;\n private eventListeners = new EventListeners();\n private resizeObserver = new ResizeObserver(() => this.setTextareaHeight());\n\n @Element() host!: HTMLSixTextareaElement;\n\n @State() hasFocus = false;\n @State() hasHelpTextSlot = false;\n @State() hasLabelSlot = false;\n\n /** The textarea's size. */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** The textarea's name attribute. */\n @Prop({ reflect: true }) name = '';\n\n /** The textarea's value attribute. */\n @Prop({ mutable: true, reflect: true }) value = '';\n\n /** The textarea's help text. Alternatively, you can use the help-text slot. */\n @Prop() helpText = '';\n\n /** The textarea's placeholder text. */\n @Prop() placeholder?: string;\n\n /** The number of rows to display by default. */\n @Prop() rows = 4;\n\n /** Controls how the textarea can be resized. */\n @Prop() resize: 'none' | 'vertical' | 'auto' = 'vertical';\n\n /** Set to true to disable the textarea. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Set to true for a readonly textarea. */\n @Prop({ reflect: true }) readonly = false;\n\n /** The minimum length of input that will be considered valid. */\n @Prop({ reflect: true }) minlength?: number;\n\n /** The maximum length of input that will be considered valid. */\n @Prop({ reflect: true }) maxlength?: number;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText = '';\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n /** The textarea's autocaptialize attribute. */\n @Prop() autocapitalize = 'off';\n\n /** The textarea's autocorrect attribute. */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /** The textarea's autocomplete attribute. */\n @Prop() autocomplete = 'off';\n\n /** The textarea's autofocus attribute. */\n @Prop() autofocus = false;\n\n /** The textarea's spellcheck attribute. */\n @Prop() spellcheck = false;\n\n /** The textarea's inputmode attribute. */\n @Prop() inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n\n /** Emitted when the control's value changes. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control receives input. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-input' }) sixInput!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-textarea-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control loses focus. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n @Watch('helpText')\n @Watch('errorText')\n @Watch('label')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n @Watch('rows')\n handleRowsChange() {\n this.setTextareaHeight();\n }\n\n @Watch('value')\n handleValueChange() {\n this.value = this.getValue();\n if (this.nativeTextarea != null) {\n if (this.nativeTextarea.value !== this.value) {\n this.nativeTextarea.value = this.value;\n }\n }\n }\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.forward('six-textarea-input', 'input', this.host);\n this.eventListeners.forward('six-textarea-change', 'change', this.host);\n this.eventListeners.forward('six-textarea-focus', 'focus', this.host);\n this.eventListeners.forward('six-textarea-blur', 'blur', this.host);\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n componentDidLoad() {\n this.setTextareaHeight();\n if (this.nativeTextarea != null) {\n this.resizeObserver.observe(this.nativeTextarea);\n }\n }\n\n disconnectedCallback() {\n if (this.nativeTextarea != null) {\n this.resizeObserver.unobserve(this.nativeTextarea);\n }\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the textarea. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeTextarea?.focus(options);\n }\n\n /** Removes focus fromt the textarea. */\n @Method()\n async removeFocus() {\n this.nativeTextarea?.blur();\n }\n\n /** Selects all the text in the input. */\n @Method()\n async select() {\n return this.nativeTextarea?.select();\n }\n\n /** Sets the start and end positions of the text selection (0-based). */\n @Method()\n async setSelectionRange(\n selectionStart: number,\n selectionEnd: number,\n selectionDirection: 'forward' | 'backward' | 'none' = 'none'\n ) {\n return this.nativeTextarea?.setSelectionRange(selectionStart, selectionEnd, selectionDirection);\n }\n\n /** Replaces a range of text with a new string. */\n @Method()\n async setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectMode: 'select' | 'start' | 'end' | 'preserve' = 'preserve'\n ) {\n if (this.nativeTextarea == null) return;\n\n this.nativeTextarea.setRangeText(replacement, start, end, selectMode);\n if (this.getValue() !== this.nativeTextarea.value) {\n this.value = this.nativeTextarea.value;\n this.setTextareaHeight();\n this.sixChange.emit();\n this.sixInput.emit();\n }\n }\n\n private handleChange = () => {\n if (this.nativeTextarea != null) {\n this.value = this.nativeTextarea.value;\n this.sixChange.emit();\n }\n };\n\n private handleInput = () => {\n if (this.nativeTextarea != null) {\n this.value = this.nativeTextarea.value;\n this.setTextareaHeight();\n this.sixInput.emit();\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit();\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleSlotChange = () => {\n this.hasLabelSlot = hasSlot(this.host, 'label');\n this.hasHelpTextSlot = hasSlot(this.host, 'help-text');\n };\n\n private setTextareaHeight() {\n if (this.nativeTextarea == null) return;\n\n if (this.resize === 'auto') {\n this.nativeTextarea.style.height = 'auto';\n this.nativeTextarea.style.height = this.nativeTextarea.scrollHeight + 'px';\n } else {\n (this.nativeTextarea.style.height as string | undefined) = undefined;\n }\n }\n\n private getValue(): string {\n return (this.value ?? '').toString();\n }\n\n render() {\n return (\n <FormControl\n inputId={this.inputId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={this.hasLabelSlot}\n helpTextId={this.helpTextId}\n helpText={this.helpText}\n hasHelpTextSlot={this.hasHelpTextSlot}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n size={this.size}\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <div\n part=\"base\"\n class={{\n textarea: true,\n\n // Sizes\n 'textarea--small': this.size === 'small',\n 'textarea--medium': this.size === 'medium',\n 'textarea--large': this.size === 'large',\n\n // States\n 'textarea--disabled': this.disabled,\n 'textarea--focused': this.hasFocus,\n 'textarea--empty': this.getValue().length === 0,\n 'textarea--invalid': this.invalid,\n\n // Modifiers\n 'textarea--resize-none': this.resize === 'none',\n 'textarea--resize-vertical': this.resize === 'vertical',\n 'textarea--resize-auto': this.resize === 'auto',\n }}\n >\n <textarea\n part=\"textarea\"\n ref={(el) => (this.nativeTextarea = el)}\n id={this.inputId}\n class=\"textarea__control\"\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n readOnly={this.readonly}\n rows={this.rows}\n minLength={this.minlength}\n maxLength={this.maxlength}\n value={this.getValue()}\n autoCapitalize={this.autocapitalize}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n spellcheck={this.spellcheck}\n required={this.required}\n inputMode={this.inputmode}\n aria-labelledby={this.labelId}\n onChange={this.handleChange}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n </div>\n </FormControl>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-textarea.js","sourceRoot":"","sources":["../../../src/components/six-textarea/six-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,WAAW,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,OAAO,WAAW;;IACd,YAAO,GAAG,YAAY,EAAE,EAAE,EAAE,CAAC;IAC7B,YAAO,GAAG,kBAAkB,EAAE,EAAE,CAAC;IACjC,eAAU,GAAG,sBAAsB,EAAE,EAAE,CAAC;IACxC,gBAAW,GAAG,oBAAoB,EAAE,EAAE,CAAC;IAEvC,mBAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,mBAAc,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuLpE,iBAAY,GAAG,GAAG,EAAE;MAC1B,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,EAAE;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,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QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,SAAS,qBACR,IAAI,CAAC,OAAO,EAC7B,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,GACvB,CACE,CACM,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport FormControl from '../../functional-components/form-control/form-control';\nimport { hasSlot } from '../../utils/slot';\nimport { EventListeners } from '../../utils/event-listeners';\nimport { EmptyPayload } from '../../utils/types';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot label - The textarea's label. Alternatively, you can use the label prop.\n * @slot help-text - Help text that describes how to use the input.\n * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.\n *\n * @part base - The component's base wrapper.\n * @part form-control - The form control that wraps the label, textarea, and help text.\n * @part label - The textarea label.\n * @part textarea - The textarea control.\n * @part help-text - The textarea help text.\n */\n@Component({\n tag: 'six-textarea',\n styleUrl: 'six-textarea.scss',\n shadow: true,\n})\nexport class SixTextarea {\n private inputId = `textarea-${++id}`;\n private labelId = `textarea-label-${id}`;\n private helpTextId = `textarea-help-text-${id}`;\n private errorTextId = `input-error-text-${id}`;\n private nativeTextarea?: HTMLTextAreaElement;\n private eventListeners = new EventListeners();\n private resizeObserver = new ResizeObserver(() => this.setTextareaHeight());\n\n @Element() host!: HTMLSixTextareaElement;\n\n @State() hasFocus = false;\n @State() hasHelpTextSlot = false;\n @State() hasLabelSlot = false;\n @State() hasErrorTextSlot = false;\n\n /** The textarea's size. */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** The textarea's name attribute. */\n @Prop({ reflect: true }) name = '';\n\n /** The textarea's value attribute. */\n @Prop({ mutable: true, reflect: true }) value = '';\n\n /** The textarea's help text. Alternatively, you can use the help-text slot. */\n @Prop() helpText = '';\n\n /** The textarea's placeholder text. */\n @Prop() placeholder?: string;\n\n /** The number of rows to display by default. */\n @Prop() rows = 4;\n\n /** Controls how the textarea can be resized. */\n @Prop() resize: 'none' | 'vertical' | 'auto' = 'vertical';\n\n /** Set to true to disable the textarea. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Set to true for a readonly textarea. */\n @Prop({ reflect: true }) readonly = false;\n\n /** The minimum length of input that will be considered valid. */\n @Prop({ reflect: true }) minlength?: number;\n\n /** The maximum length of input that will be considered valid. */\n @Prop({ reflect: true }) maxlength?: number;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText: string | string[] = '';\n\n /** The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1 */\n @Prop() errorTextCount?: number;\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n /** The textarea's autocaptialize attribute. */\n @Prop() autocapitalize = 'off';\n\n /** The textarea's autocorrect attribute. */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /** The textarea's autocomplete attribute. */\n @Prop() autocomplete = 'off';\n\n /** The textarea's autofocus attribute. */\n @Prop() autofocus = false;\n\n /** The textarea's spellcheck attribute. */\n @Prop() spellcheck = false;\n\n /** The textarea's inputmode attribute. */\n @Prop() inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n\n /** Emitted when the control's value changes. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control receives input. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-input' }) sixInput!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-textarea-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control loses focus. Access the new value via event.target.value. */\n @Event({ eventName: 'six-textarea-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n @Watch('helpText')\n @Watch('errorText')\n @Watch('label')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n @Watch('rows')\n handleRowsChange() {\n this.setTextareaHeight();\n }\n\n @Watch('value')\n handleValueChange() {\n this.value = this.getValue();\n if (this.nativeTextarea != null) {\n if (this.nativeTextarea.value !== this.value) {\n this.nativeTextarea.value = this.value;\n }\n }\n }\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.forward('six-textarea-input', 'input', this.host);\n this.eventListeners.forward('six-textarea-change', 'change', this.host);\n this.eventListeners.forward('six-textarea-focus', 'focus', this.host);\n this.eventListeners.forward('six-textarea-blur', 'blur', this.host);\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n componentDidLoad() {\n this.setTextareaHeight();\n if (this.nativeTextarea != null) {\n this.resizeObserver.observe(this.nativeTextarea);\n }\n }\n\n disconnectedCallback() {\n if (this.nativeTextarea != null) {\n this.resizeObserver.unobserve(this.nativeTextarea);\n }\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the textarea. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeTextarea?.focus(options);\n }\n\n /** Removes focus fromt the textarea. */\n @Method()\n async removeFocus() {\n this.nativeTextarea?.blur();\n }\n\n /** Selects all the text in the input. */\n @Method()\n async select() {\n return this.nativeTextarea?.select();\n }\n\n /** Sets the start and end positions of the text selection (0-based). */\n @Method()\n async setSelectionRange(\n selectionStart: number,\n selectionEnd: number,\n selectionDirection: 'forward' | 'backward' | 'none' = 'none'\n ) {\n return this.nativeTextarea?.setSelectionRange(selectionStart, selectionEnd, selectionDirection);\n }\n\n /** Replaces a range of text with a new string. */\n @Method()\n async setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectMode: 'select' | 'start' | 'end' | 'preserve' = 'preserve'\n ) {\n if (this.nativeTextarea == null) return;\n\n this.nativeTextarea.setRangeText(replacement, start, end, selectMode);\n if (this.getValue() !== this.nativeTextarea.value) {\n this.value = this.nativeTextarea.value;\n this.setTextareaHeight();\n this.sixChange.emit();\n this.sixInput.emit();\n }\n }\n\n private handleChange = () => {\n if (this.nativeTextarea != null) {\n this.value = this.nativeTextarea.value;\n this.sixChange.emit();\n }\n };\n\n private handleInput = () => {\n if (this.nativeTextarea != null) {\n this.value = this.nativeTextarea.value;\n this.setTextareaHeight();\n this.sixInput.emit();\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit();\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleSlotChange = () => {\n this.hasLabelSlot = hasSlot(this.host, 'label');\n this.hasHelpTextSlot = hasSlot(this.host, 'help-text');\n this.hasErrorTextSlot = hasSlot(this.host, 'error-text');\n };\n\n private setTextareaHeight() {\n if (this.nativeTextarea == null) return;\n\n if (this.resize === 'auto') {\n this.nativeTextarea.style.height = 'auto';\n this.nativeTextarea.style.height = this.nativeTextarea.scrollHeight + 'px';\n } else {\n (this.nativeTextarea.style.height as string | undefined) = undefined;\n }\n }\n\n private getValue(): string {\n return (this.value ?? '').toString();\n }\n\n render() {\n return (\n <FormControl\n inputId={this.inputId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={this.hasLabelSlot}\n helpTextId={this.helpTextId}\n helpText={this.helpText}\n hasHelpTextSlot={this.hasHelpTextSlot}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n errorTextCount={this.errorTextCount}\n hasErrorTextSlot={this.hasErrorTextSlot}\n size={this.size}\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <div\n part=\"base\"\n class={{\n textarea: true,\n\n // Sizes\n 'textarea--small': this.size === 'small',\n 'textarea--medium': this.size === 'medium',\n 'textarea--large': this.size === 'large',\n\n // States\n 'textarea--disabled': this.disabled,\n 'textarea--focused': this.hasFocus,\n 'textarea--empty': this.getValue().length === 0,\n 'textarea--invalid': this.invalid,\n\n // Modifiers\n 'textarea--resize-none': this.resize === 'none',\n 'textarea--resize-vertical': this.resize === 'vertical',\n 'textarea--resize-auto': this.resize === 'auto',\n }}\n >\n <textarea\n part=\"textarea\"\n ref={(el) => (this.nativeTextarea = el)}\n id={this.inputId}\n class=\"textarea__control\"\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n readOnly={this.readonly}\n rows={this.rows}\n minLength={this.minlength}\n maxLength={this.maxlength}\n value={this.getValue()}\n autoCapitalize={this.autocapitalize}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n spellcheck={this.spellcheck}\n required={this.required}\n inputMode={this.inputmode}\n aria-labelledby={this.labelId}\n onChange={this.handleChange}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n </div>\n </FormControl>\n );\n }\n}\n"]}
@@ -35,7 +35,9 @@ describe('six-textarea', () => {
35
35
  <div class="textarea textarea--empty textarea--medium textarea--resize-vertical" part="base"><textarea aria-labelledby="textarea-label-1" autocapitalize="off" autocorrect="off" class="textarea__control" id="textarea-1" part="textarea" rows="4" value=""></textarea>
36
36
  </div>
37
37
  </div>
38
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text"></div>
38
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text">
39
+ <slot name="error-text"></slot>
40
+ </div>
39
41
  <div aria-hidden="true" class="form-control__help-text" id="textarea-help-text-1" part="help-text">
40
42
  <slot name="help-text"></slot>
41
43
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"six-textarea.spec.js","sourceRoot":"","sources":["../../../../src/components/six-textarea/test/six-textarea.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;EAC5B,IAAI,IAAgC,CAAC;EACrC,IAAI,QAA6B,CAAC;EAElC,UAAU,CAAC,KAAK,IAAI,EAAE;;IACpB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;MAC1D,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;MAClB,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;MACpB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;KACtB,CAAC,CAAC,CAAC;IAEJ,IA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AsC,EAAE,KAAK,IAAI,EAAE;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IACtB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAC9B,MAAM,CAAC,gBAAgB,CAAC;MACtB,MAAM,EAAE,SAAS;MACjB,IAAI,EAAE,oBAAoB;KAC3B,CAAC,CACH,CAAC;IAEF,OAAO;IACP,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC;IACnC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAC9B,MAAM,CAAC,gBAAgB,CAAC;MACtB,MAAM,EAAE,SAAS;MACjB,IAAI,EAAE,oBAAoB;KAC3B,CAAC,CACH,CAAC;EACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage, SpecPage } from '@stencil/core/testing';\nimport { SixTextarea } from '../six-textarea';\n\ninterface TypedSpecPage<T> extends SpecPage {\n root: HTMLElement & T;\n}\n\ndescribe('six-textarea', () => {\n let page: TypedSpecPage<SixTextarea>;\n let textarea: HTMLTextAreaElement;\n\n beforeEach(async () => {\n global.ResizeObserver = jest.fn().mockImplementation(() => ({\n observe: jest.fn(),\n unobserve: jest.fn(),\n disconnect: jest.fn(),\n }));\n\n page = (await newSpecPage({\n components: [SixTextarea],\n html: `<six-textarea></six-textarea>`,\n supportsShadowDom: true,\n })) as TypedSpecPage<SixTextarea>;\n\n const element = page.root.shadowRoot?.querySelector('textarea');\n if (element != null) {\n textarea = element;\n return;\n }\n fail('textarea not found');\n });\n\n it('renders', async () => {\n // then\n expect(page.root).toEqualHtml(`\n <six-textarea size=\"medium\" value=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"textarea-1\" id=\"textarea-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <div class=\"textarea textarea--empty textarea--medium textarea--resize-vertical\" part=\"base\"><textarea aria-labelledby=\"textarea-label-1\" autocapitalize=\"off\" autocorrect=\"off\" class=\"textarea__control\" id=\"textarea-1\" part=\"textarea\" rows=\"4\" value=\"\"></textarea>\n </div>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\"></div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" id=\"textarea-help-text-1\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-textarea>\n `);\n });\n\n it('should properly dispatch blur event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-blur', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('blur'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-blur',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('blur'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-blur',\n })\n );\n });\n\n it('should properly dispatch focus event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-focus', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('focus'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-focus',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('focus'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-focus',\n })\n );\n });\n\n it('should properly dispatch input event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-input', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('input'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-input',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('input'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-input',\n })\n );\n });\n});\n"]}
1
+ {"version":3,"file":"six-textarea.spec.js","sourceRoot":"","sources":["../../../../src/components/six-textarea/test/six-textarea.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;EAC5B,IAAI,IAAgC,CAAC;EACrC,IAAI,QAA6B,CAAC;EAElC,UAAU,CAAC,KAAK,IAAI,EAAE;;IACpB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;MAC1D,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;MAClB,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;MACpB,UAAU,EAAE,IAAI,CAAC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AC;EACJ,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IACtB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAC9B,MAAM,CAAC,gBAAgB,CAAC;MACtB,MAAM,EAAE,SAAS;MACjB,IAAI,EAAE,oBAAoB;KAC3B,CAAC,CACH,CAAC;IAEF,OAAO;IACP,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC;IACnC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,OAAO;IACP,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAC9B,MAAM,CAAC,gBAAgB,CAAC;MACtB,MAAM,EAAE,SAAS;MACjB,IAAI,EAAE,oBAAoB;KAC3B,CAAC,CACH,CAAC;EACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage, SpecPage } from '@stencil/core/testing';\nimport { SixTextarea } from '../six-textarea';\n\ninterface TypedSpecPage<T> extends SpecPage {\n root: HTMLElement & T;\n}\n\ndescribe('six-textarea', () => {\n let page: TypedSpecPage<SixTextarea>;\n let textarea: HTMLTextAreaElement;\n\n beforeEach(async () => {\n global.ResizeObserver = jest.fn().mockImplementation(() => ({\n observe: jest.fn(),\n unobserve: jest.fn(),\n disconnect: jest.fn(),\n }));\n\n page = (await newSpecPage({\n components: [SixTextarea],\n html: `<six-textarea></six-textarea>`,\n supportsShadowDom: true,\n })) as TypedSpecPage<SixTextarea>;\n\n const element = page.root.shadowRoot?.querySelector('textarea');\n if (element != null) {\n textarea = element;\n return;\n }\n fail('textarea not found');\n });\n\n it('renders', async () => {\n // then\n expect(page.root).toEqualHtml(`\n <six-textarea size=\"medium\" value=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"textarea-1\" id=\"textarea-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <div class=\"textarea textarea--empty textarea--medium textarea--resize-vertical\" part=\"base\"><textarea aria-labelledby=\"textarea-label-1\" autocapitalize=\"off\" autocorrect=\"off\" class=\"textarea__control\" id=\"textarea-1\" part=\"textarea\" rows=\"4\" value=\"\"></textarea>\n </div>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\">\n <slot name=\"error-text\"></slot>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" id=\"textarea-help-text-1\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-textarea>\n `);\n });\n\n it('should properly dispatch blur event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-blur', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('blur'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-blur',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('blur'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-blur',\n })\n );\n });\n\n it('should properly dispatch focus event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-focus', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('focus'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-focus',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('focus'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-focus',\n })\n );\n });\n\n it('should properly dispatch input event', async () => {\n const spy = jest.fn();\n page.root.addEventListener('six-textarea-input', spy);\n await page.waitForChanges();\n\n // when\n textarea.dispatchEvent(new Event('input'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-input',\n })\n );\n\n // when\n page.root.value = 'some new value';\n await page.waitForChanges();\n textarea.dispatchEvent(new Event('input'));\n await page.waitForChanges();\n\n // then\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: undefined,\n type: 'six-textarea-input',\n })\n );\n });\n});\n"]}
@@ -10,6 +10,8 @@ const MIN_POPUP_HEIGHT = 145;
10
10
  * @since 2.0.0
11
11
  * @status experimental
12
12
  *
13
+ * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.
14
+ *
13
15
  * @part input - The input field
14
16
  * @part container - The container of whole component
15
17
  * @part popup - The popup of the timepicker component
@@ -67,6 +69,7 @@ export class SixTimepicker {
67
69
  this.required = false;
68
70
  this.placeholder = undefined;
69
71
  this.errorText = '';
72
+ this.errorTextCount = undefined;
70
73
  this.label = '';
71
74
  this.invalid = false;
72
75
  this.name = '';
@@ -95,11 +98,6 @@ export class SixTimepicker {
95
98
  valueChanged() {
96
99
  this.updateValue();
97
100
  }
98
- invalidChanged(invalid) {
99
- if (this.inputElement) {
100
- this.inputElement.invalid = invalid;
101
- }
102
- }
103
101
  /** Sets focus on the datepickers input. */
104
102
  async setFocus(options) {
105
103
  var _a;
@@ -287,10 +285,10 @@ export class SixTimepicker {
287
285
  } }, icon));
288
286
  }
289
287
  render() {
290
- return (h("div", { part: "container", ref: (el) => (this.wrapper = el), class: "timepicker__container" }, h("six-input", { ref: (el) => (this.inputElement = el), part: "input", onClick: () => this.openPopup(), value: this.value, placeholder: this.placeholder, readonly: this.readonly, disabled: this.disabled, size: this.size, name: this.name, label: this.label, required: this.required, "error-text": this.errorText, class: {
288
+ return (h("div", { part: "container", ref: (el) => (this.wrapper = el), class: "timepicker__container" }, h("six-input", { ref: (el) => (this.inputElement = el), part: "input", onClick: () => this.openPopup(), value: this.value, placeholder: this.placeholder, readonly: this.readonly, disabled: this.disabled, errorTextCount: this.errorTextCount, errorText: this.errorText, invalid: this.invalid, size: this.size, name: this.name, label: this.label, required: this.required, class: {
291
289
  'input--empty': this.value === '',
292
290
  'input--hide': this.inline,
293
- } }, this.renderCustomIcon(), this.renderClearable(), hasSlot(this.host, 'label') ? (h("span", { slot: "label" }, h("slot", { name: "label" }))) : null), this.open && (h("div", { ref: (el) => (this.popup = el), part: "popup", class: {
291
+ } }, this.renderCustomIcon(), this.renderClearable(), hasSlot(this.host, 'label') ? (h("span", { slot: "label" }, h("slot", { name: "label" }))) : null, hasSlot(this.host, 'error-text') ? (h("span", { slot: "error-text" }, h("slot", { name: "error-text" }))) : null), this.open && (h("div", { ref: (el) => (this.popup = el), part: "popup", class: {
294
292
  timepicker__popup: true,
295
293
  'timepicker__popup--is-up': this.placement == null ? this.placement === 'top' : this.isPopupContentUp,
296
294
  'timepicker__popup--is-inline': this.inline,
@@ -516,8 +514,8 @@ export class SixTimepicker {
516
514
  "type": "string",
517
515
  "mutable": false,
518
516
  "complexType": {
519
- "original": "string",
520
- "resolved": "string",
517
+ "original": "string | string[]",
518
+ "resolved": "string | string[]",
521
519
  "references": {}
522
520
  },
523
521
  "required": false,
@@ -530,6 +528,23 @@ export class SixTimepicker {
530
528
  "reflect": false,
531
529
  "defaultValue": "''"
532
530
  },
531
+ "errorTextCount": {
532
+ "type": "number",
533
+ "mutable": false,
534
+ "complexType": {
535
+ "original": "number",
536
+ "resolved": "number | undefined",
537
+ "references": {}
538
+ },
539
+ "required": false,
540
+ "optional": true,
541
+ "docs": {
542
+ "tags": [],
543
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
544
+ },
545
+ "attribute": "error-text-count",
546
+ "reflect": false
547
+ },
533
548
  "label": {
534
549
  "type": "string",
535
550
  "mutable": false,
@@ -817,9 +832,6 @@ export class SixTimepicker {
817
832
  return [{
818
833
  "propName": "value",
819
834
  "methodName": "valueChanged"
820
- }, {
821
- "propName": "invalid",
822
- "methodName": "invalidChanged"
823
835
  }];
824
836
  }
825
837
  static get listeners() {