@six-group/ui-library 0.0.0-insider.db2b416 → 0.0.0-insider.e2aca06

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 (256) 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 +8 -13
  8. package/dist/cjs/six-checkbox.cjs.entry.js.map +1 -1
  9. package/dist/cjs/six-datepicker.cjs.entry.js +5 -8
  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-radio.cjs.entry.js +9 -17
  20. package/dist/cjs/six-radio.cjs.entry.js.map +1 -1
  21. package/dist/cjs/six-range.cjs.entry.js +6 -3
  22. package/dist/cjs/six-range.cjs.entry.js.map +1 -1
  23. package/dist/cjs/six-select.cjs.entry.js +12 -8
  24. package/dist/cjs/six-select.cjs.entry.js.map +1 -1
  25. package/dist/cjs/six-sidebar.cjs.entry.js +1 -1
  26. package/dist/cjs/six-sidebar.cjs.entry.js.map +1 -1
  27. package/dist/cjs/six-switch.cjs.entry.js +25 -5
  28. package/dist/cjs/six-switch.cjs.entry.js.map +1 -1
  29. package/dist/cjs/six-tag.cjs.entry.js +24 -2
  30. package/dist/cjs/six-tag.cjs.entry.js.map +1 -1
  31. package/dist/cjs/six-textarea.cjs.entry.js +6 -3
  32. package/dist/cjs/six-textarea.cjs.entry.js.map +1 -1
  33. package/dist/cjs/six-timepicker.cjs.entry.js +4 -9
  34. package/dist/cjs/six-timepicker.cjs.entry.js.map +1 -1
  35. package/dist/cjs/six-tooltip.cjs.entry.js +2 -2
  36. package/dist/cjs/six-tooltip.cjs.entry.js.map +1 -1
  37. package/dist/cjs/ui-library.cjs.js +2 -2
  38. package/dist/cjs/ui-library.cjs.js.map +1 -1
  39. package/dist/collection/collection-manifest.json +2 -1
  40. package/dist/collection/components/six-checkbox/six-checkbox.css +1 -1
  41. package/dist/collection/components/six-checkbox/six-checkbox.js +27 -31
  42. package/dist/collection/components/six-checkbox/six-checkbox.js.map +1 -1
  43. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js +6 -2
  44. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js.map +1 -1
  45. package/dist/collection/components/six-datepicker/six-datepicker.js +25 -12
  46. package/dist/collection/components/six-datepicker/six-datepicker.js.map +1 -1
  47. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js +1 -1
  48. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js.map +1 -1
  49. package/dist/collection/components/six-dropdown/six-dropdown.css +2 -1
  50. package/dist/collection/components/six-error/six-error.css +5 -0
  51. package/dist/collection/components/six-error/six-error.js +25 -0
  52. package/dist/collection/components/six-error/six-error.js.map +1 -0
  53. package/dist/collection/components/six-group-label/six-group-label.css +1 -1
  54. package/dist/collection/components/six-group-label/test/six-group-label.spec.js +3 -1
  55. package/dist/collection/components/six-group-label/test/six-group-label.spec.js.map +1 -1
  56. package/dist/collection/components/six-input/six-input.css +2 -2
  57. package/dist/collection/components/six-input/six-input.js +27 -4
  58. package/dist/collection/components/six-input/six-input.js.map +1 -1
  59. package/dist/collection/components/six-input/test/six-input.spec.js +3 -1
  60. package/dist/collection/components/six-input/test/six-input.spec.js.map +1 -1
  61. package/dist/collection/components/six-radio/six-radio.js +9 -34
  62. package/dist/collection/components/six-radio/six-radio.js.map +1 -1
  63. package/dist/collection/components/six-range/six-range.css +1 -1
  64. package/dist/collection/components/six-range/six-range.js +24 -3
  65. package/dist/collection/components/six-range/six-range.js.map +1 -1
  66. package/dist/collection/components/six-range/test/six-range.spec.js +3 -1
  67. package/dist/collection/components/six-range/test/six-range.spec.js.map +1 -1
  68. package/dist/collection/components/six-select/six-select.css +7 -10
  69. package/dist/collection/components/six-select/six-select.js +30 -8
  70. package/dist/collection/components/six-select/six-select.js.map +1 -1
  71. package/dist/collection/components/six-select/test/six-select.spec.js +8 -4
  72. package/dist/collection/components/six-select/test/six-select.spec.js.map +1 -1
  73. package/dist/collection/components/six-sidebar/six-sidebar.css +1 -0
  74. package/dist/collection/components/six-switch/six-switch.css +1 -1
  75. package/dist/collection/components/six-switch/six-switch.js +48 -5
  76. package/dist/collection/components/six-switch/six-switch.js.map +1 -1
  77. package/dist/collection/components/six-switch/test/six-switch.spec.js +6 -2
  78. package/dist/collection/components/six-switch/test/six-switch.spec.js.map +1 -1
  79. package/dist/collection/components/six-tag/six-tag.css +6 -0
  80. package/dist/collection/components/six-tag/six-tag.js +23 -1
  81. package/dist/collection/components/six-tag/six-tag.js.map +1 -1
  82. package/dist/collection/components/six-tag/test/six-tag.spec.js +12 -0
  83. package/dist/collection/components/six-tag/test/six-tag.spec.js.map +1 -1
  84. package/dist/collection/components/six-textarea/six-textarea.css +1 -1
  85. package/dist/collection/components/six-textarea/six-textarea.js +25 -4
  86. package/dist/collection/components/six-textarea/six-textarea.js.map +1 -1
  87. package/dist/collection/components/six-textarea/test/six-textarea.spec.js +3 -1
  88. package/dist/collection/components/six-textarea/test/six-textarea.spec.js.map +1 -1
  89. package/dist/collection/components/six-timepicker/six-timepicker.js +24 -12
  90. package/dist/collection/components/six-timepicker/six-timepicker.js.map +1 -1
  91. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js +15 -15
  92. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js.map +1 -1
  93. package/dist/collection/components/six-tooltip/six-tooltip.css +1 -1
  94. package/dist/collection/components/six-tooltip/six-tooltip.js +1 -1
  95. package/dist/collection/components/six-tooltip/six-tooltip.js.map +1 -1
  96. package/dist/collection/functional-components/form-control/form-control.js +8 -6
  97. package/dist/collection/functional-components/form-control/form-control.js.map +1 -1
  98. package/dist/components/form-control.js +9 -6
  99. package/dist/components/form-control.js.map +1 -1
  100. package/dist/components/index.js +2 -0
  101. package/dist/components/index.js.map +1 -1
  102. package/dist/components/six-checkbox.js +17 -15
  103. package/dist/components/six-checkbox.js.map +1 -1
  104. package/dist/components/six-datepicker.js +13 -9
  105. package/dist/components/six-datepicker.js.map +1 -1
  106. package/dist/components/six-dropdown2.js +8 -2
  107. package/dist/components/six-dropdown2.js.map +1 -1
  108. package/dist/components/six-error.d.ts +11 -0
  109. package/dist/components/six-error.js +8 -0
  110. package/dist/components/six-error.js.map +1 -0
  111. package/dist/components/six-error2.js +32 -0
  112. package/dist/components/six-error2.js.map +1 -0
  113. package/dist/components/six-group-label.js +8 -2
  114. package/dist/components/six-group-label.js.map +1 -1
  115. package/dist/components/six-header.js +8 -2
  116. package/dist/components/six-header.js.map +1 -1
  117. package/dist/components/six-input2.js +14 -3
  118. package/dist/components/six-input2.js.map +1 -1
  119. package/dist/components/six-radio.js +10 -19
  120. package/dist/components/six-radio.js.map +1 -1
  121. package/dist/components/six-range.js +14 -3
  122. package/dist/components/six-range.js.map +1 -1
  123. package/dist/components/six-search-field.js +7 -1
  124. package/dist/components/six-search-field.js.map +1 -1
  125. package/dist/components/six-select.js +39 -21
  126. package/dist/components/six-select.js.map +1 -1
  127. package/dist/components/six-sidebar.js +1 -1
  128. package/dist/components/six-sidebar.js.map +1 -1
  129. package/dist/components/six-switch.js +33 -5
  130. package/dist/components/six-switch.js.map +1 -1
  131. package/dist/components/six-tag2.js +34 -6
  132. package/dist/components/six-tag2.js.map +1 -1
  133. package/dist/components/six-textarea.js +14 -3
  134. package/dist/components/six-textarea.js.map +1 -1
  135. package/dist/components/six-timepicker2.js +12 -10
  136. package/dist/components/six-timepicker2.js.map +1 -1
  137. package/dist/components/six-tooltip2.js +2 -2
  138. package/dist/components/six-tooltip2.js.map +1 -1
  139. package/dist/components.json +420 -93
  140. package/dist/esm/{form-control-32cb533f.js → form-control-b0febe88.js} +10 -7
  141. package/dist/esm/form-control-b0febe88.js.map +1 -0
  142. package/dist/esm/index-8a74f992.js +214 -1
  143. package/dist/esm/index-8a74f992.js.map +1 -1
  144. package/dist/esm/loader.js +1 -1
  145. package/dist/esm/six-checkbox.entry.js +8 -13
  146. package/dist/esm/six-checkbox.entry.js.map +1 -1
  147. package/dist/esm/six-datepicker.entry.js +5 -8
  148. package/dist/esm/six-datepicker.entry.js.map +1 -1
  149. package/dist/esm/six-dropdown_2.entry.js +1 -1
  150. package/dist/esm/six-dropdown_2.entry.js.map +1 -1
  151. package/dist/esm/six-error.entry.js +17 -0
  152. package/dist/esm/six-error.entry.js.map +1 -0
  153. package/dist/esm/six-group-label.entry.js +2 -2
  154. package/dist/esm/six-group-label.entry.js.map +1 -1
  155. package/dist/esm/six-input.entry.js +6 -3
  156. package/dist/esm/six-input.entry.js.map +1 -1
  157. package/dist/esm/six-radio.entry.js +9 -17
  158. package/dist/esm/six-radio.entry.js.map +1 -1
  159. package/dist/esm/six-range.entry.js +6 -3
  160. package/dist/esm/six-range.entry.js.map +1 -1
  161. package/dist/esm/six-select.entry.js +12 -8
  162. package/dist/esm/six-select.entry.js.map +1 -1
  163. package/dist/esm/six-sidebar.entry.js +1 -1
  164. package/dist/esm/six-sidebar.entry.js.map +1 -1
  165. package/dist/esm/six-switch.entry.js +25 -5
  166. package/dist/esm/six-switch.entry.js.map +1 -1
  167. package/dist/esm/six-tag.entry.js +24 -2
  168. package/dist/esm/six-tag.entry.js.map +1 -1
  169. package/dist/esm/six-textarea.entry.js +6 -3
  170. package/dist/esm/six-textarea.entry.js.map +1 -1
  171. package/dist/esm/six-timepicker.entry.js +4 -9
  172. package/dist/esm/six-timepicker.entry.js.map +1 -1
  173. package/dist/esm/six-tooltip.entry.js +2 -2
  174. package/dist/esm/six-tooltip.entry.js.map +1 -1
  175. package/dist/esm/ui-library.js +2 -2
  176. package/dist/esm/ui-library.js.map +1 -1
  177. package/dist/types/components/six-checkbox/six-checkbox.d.ts +4 -5
  178. package/dist/types/components/six-datepicker/six-datepicker.d.ts +4 -2
  179. package/dist/types/components/six-error/six-error.d.ts +9 -0
  180. package/dist/types/components/six-input/six-input.d.ts +7 -2
  181. package/dist/types/components/six-radio/six-radio.d.ts +0 -5
  182. package/dist/types/components/six-range/six-range.d.ts +4 -1
  183. package/dist/types/components/six-select/six-select.d.ts +4 -1
  184. package/dist/types/components/six-switch/six-switch.d.ts +8 -1
  185. package/dist/types/components/six-tag/six-tag.d.ts +8 -0
  186. package/dist/types/components/six-textarea/six-textarea.d.ts +4 -1
  187. package/dist/types/components/six-timepicker/six-timepicker.d.ts +5 -2
  188. package/dist/types/components.d.ts +109 -24
  189. package/dist/types/functional-components/form-control/form-control.d.ts +6 -2
  190. package/dist/ui-library/{p-da19c7ce.entry.js → p-14c1ec31.entry.js} +2 -2
  191. package/dist/ui-library/p-14c1ec31.entry.js.map +1 -0
  192. package/dist/ui-library/p-25bb1752.entry.js +2 -0
  193. package/dist/ui-library/p-25bb1752.entry.js.map +1 -0
  194. package/dist/ui-library/p-264d4ea8.entry.js +2 -0
  195. package/dist/ui-library/p-264d4ea8.entry.js.map +1 -0
  196. package/dist/ui-library/p-2a141e10.entry.js +2 -0
  197. package/dist/ui-library/p-2a141e10.entry.js.map +1 -0
  198. package/dist/ui-library/p-4435ff73.entry.js +2 -0
  199. package/dist/ui-library/p-4435ff73.entry.js.map +1 -0
  200. package/dist/ui-library/p-538f3c50.entry.js +2 -0
  201. package/dist/ui-library/p-538f3c50.entry.js.map +1 -0
  202. package/dist/ui-library/p-6153045b.js.map +1 -1
  203. package/dist/ui-library/p-a457fee8.entry.js +2 -0
  204. package/dist/ui-library/p-a457fee8.entry.js.map +1 -0
  205. package/dist/ui-library/p-ab91c2a9.entry.js +2 -0
  206. package/dist/ui-library/p-ab91c2a9.entry.js.map +1 -0
  207. package/dist/ui-library/p-b57afbe4.entry.js +2 -0
  208. package/dist/ui-library/p-b57afbe4.entry.js.map +1 -0
  209. package/dist/ui-library/p-b6f47c9d.entry.js +2 -0
  210. package/dist/ui-library/p-b6f47c9d.entry.js.map +1 -0
  211. package/dist/ui-library/p-db34a6cc.entry.js +2 -0
  212. package/dist/ui-library/p-db34a6cc.entry.js.map +1 -0
  213. package/dist/ui-library/p-db936ad7.entry.js +2 -0
  214. package/dist/ui-library/{p-d367f4f9.entry.js.map → p-db936ad7.entry.js.map} +1 -1
  215. package/dist/ui-library/p-dc4f41d8.entry.js +2 -0
  216. package/dist/ui-library/p-dc4f41d8.entry.js.map +1 -0
  217. package/dist/ui-library/p-e5020f0d.js +2 -0
  218. package/dist/ui-library/p-e5020f0d.js.map +1 -0
  219. package/dist/ui-library/p-e775dcb4.entry.js +2 -0
  220. package/dist/ui-library/p-e775dcb4.entry.js.map +1 -0
  221. package/dist/ui-library/p-f1dc3a88.entry.js +2 -0
  222. package/dist/ui-library/p-f1dc3a88.entry.js.map +1 -0
  223. package/dist/ui-library/ui-library.esm.js +1 -1
  224. package/dist/ui-library/ui-library.esm.js.map +1 -1
  225. package/package.json +3 -3
  226. package/dist/cjs/form-control-d369af14.js.map +0 -1
  227. package/dist/esm/form-control-32cb533f.js.map +0 -1
  228. package/dist/ui-library/p-1730a174.entry.js +0 -2
  229. package/dist/ui-library/p-1730a174.entry.js.map +0 -1
  230. package/dist/ui-library/p-1d0bee53.entry.js +0 -2
  231. package/dist/ui-library/p-1d0bee53.entry.js.map +0 -1
  232. package/dist/ui-library/p-314b2096.entry.js +0 -2
  233. package/dist/ui-library/p-314b2096.entry.js.map +0 -1
  234. package/dist/ui-library/p-330a4988.entry.js +0 -2
  235. package/dist/ui-library/p-330a4988.entry.js.map +0 -1
  236. package/dist/ui-library/p-4abed9df.entry.js +0 -2
  237. package/dist/ui-library/p-4abed9df.entry.js.map +0 -1
  238. package/dist/ui-library/p-5d6b7353.entry.js +0 -2
  239. package/dist/ui-library/p-5d6b7353.entry.js.map +0 -1
  240. package/dist/ui-library/p-6eb24bcb.entry.js +0 -2
  241. package/dist/ui-library/p-6eb24bcb.entry.js.map +0 -1
  242. package/dist/ui-library/p-72254eef.entry.js +0 -2
  243. package/dist/ui-library/p-72254eef.entry.js.map +0 -1
  244. package/dist/ui-library/p-cf49252a.entry.js +0 -2
  245. package/dist/ui-library/p-cf49252a.entry.js.map +0 -1
  246. package/dist/ui-library/p-d367f4f9.entry.js +0 -2
  247. package/dist/ui-library/p-d42c2025.js +0 -2
  248. package/dist/ui-library/p-d42c2025.js.map +0 -1
  249. package/dist/ui-library/p-da19c7ce.entry.js.map +0 -1
  250. package/dist/ui-library/p-e0b13ad3.entry.js +0 -2
  251. package/dist/ui-library/p-e0b13ad3.entry.js.map +0 -1
  252. package/dist/ui-library/p-f1eb03ba.entry.js +0 -2
  253. package/dist/ui-library/p-f1eb03ba.entry.js.map +0 -1
  254. package/dist/ui-library/p-ff90ffd1.entry.js +0 -2
  255. package/dist/ui-library/p-ff90ffd1.entry.js.map +0 -1
  256. package/readme.md +0 -156
@@ -19,11 +19,10 @@ export class SixRadio {
19
19
  this.inputId = `radio-${++id}`;
20
20
  this.labelId = `radio-label-${id}`;
21
21
  this.eventListeners = new EventListeners();
22
- /** default state whether the radio button should be checked or not when resetting */
23
- this.defaultState = false;
24
22
  this.handleClick = () => {
25
23
  if (this.nativeInput != null) {
26
24
  this.checked = this.nativeInput.checked;
25
+ this.sixChange.emit();
27
26
  }
28
27
  };
29
28
  this.handleBlur = () => {
@@ -34,19 +33,20 @@ export class SixRadio {
34
33
  this.hasFocus = true;
35
34
  this.sixFocus.emit();
36
35
  };
37
- this.handleKeyDown = (event) => {
38
- if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
36
+ this.handleKeyDown = (keyboardEvent) => {
37
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(keyboardEvent.key)) {
39
38
  const radios = this.getAllRadios().filter((radio) => !radio.disabled);
40
- const incr = ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;
39
+ const incr = ['ArrowUp', 'ArrowLeft'].includes(keyboardEvent.key) ? -1 : 1;
41
40
  let index = radios.indexOf(this.host) + incr;
42
41
  if (index < 0)
43
42
  index = radios.length - 1;
44
43
  if (index > radios.length - 1)
45
44
  index = 0;
46
- this.getAllRadios().map((radio) => (radio.checked = false));
45
+ this.getAllRadios().forEach((radio) => (radio.checked = false));
47
46
  radios[index].setFocus();
48
47
  radios[index].checked = true;
49
- event.preventDefault();
48
+ radios[index].dispatchEvent(new CustomEvent('six-radio-change', { bubbles: true, cancelable: true }));
49
+ keyboardEvent.preventDefault();
50
50
  }
51
51
  };
52
52
  this.handleMouseDown = (event) => {
@@ -64,11 +64,10 @@ export class SixRadio {
64
64
  }
65
65
  handleCheckedChange() {
66
66
  if (this.checked) {
67
- this.getSiblingRadios().map((radio) => (radio.checked = false));
67
+ this.getSiblingRadios().forEach((radio) => (radio.checked = false));
68
68
  }
69
69
  if (this.nativeInput != null) {
70
70
  this.nativeInput.checked = this.checked;
71
- this.sixChange.emit();
72
71
  }
73
72
  }
74
73
  handleNameChange(name) {
@@ -81,9 +80,6 @@ export class SixRadio {
81
80
  this.eventListeners.forward('six-radio-blur', 'blur', this.host);
82
81
  this.eventListeners.forward('six-radio-focus', 'focus', this.host);
83
82
  }
84
- componentWillLoad() {
85
- this.defaultState = this.checked;
86
- }
87
83
  disconnectedCallback() {
88
84
  this.eventListeners.removeAll();
89
85
  }
@@ -97,12 +93,8 @@ export class SixRadio {
97
93
  var _a;
98
94
  (_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.blur();
99
95
  }
100
- /** Resets the formcontrol */
101
- async reset() {
102
- this.checked = this.defaultState;
103
- }
104
96
  getAllRadios() {
105
- const form = this.host.closest('six-form, form') || document.body;
97
+ const form = this.host.closest('form') || document.body;
106
98
  if (this.name === '')
107
99
  return [];
108
100
  return [...form.querySelectorAll('six-radio')].filter((radio) => radio.name === this.name);
@@ -337,23 +329,6 @@ export class SixRadio {
337
329
  "text": "Removes focus from the radio.",
338
330
  "tags": []
339
331
  }
340
- },
341
- "reset": {
342
- "complexType": {
343
- "signature": "() => Promise<void>",
344
- "parameters": [],
345
- "references": {
346
- "Promise": {
347
- "location": "global",
348
- "id": "global::Promise"
349
- }
350
- },
351
- "return": "Promise<void>"
352
- },
353
- "docs": {
354
- "text": "Resets the formcontrol",
355
- "tags": []
356
- }
357
332
  }
358
333
  };
359
334
  }
@@ -1 +1 @@
1
- {"version":3,"file":"six-radio.js","sourceRoot":"","sources":["../../../src/components/six-radio/six-radio.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;AAE7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,QAAQ;;IACX,YAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC;IAC1B,YAAO,GAAG,eAAe,EAAE,EAAE,CAAC;IAE9B,mBAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAgD9C,qFAAqF;IAC7E,iBAAY,GAAG,KAAK,CAAC;IAgDrB,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;OACzC;IACH,C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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';\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 radio's label.\n *\n * @part base - The component's base wrapper.\n * @part control - The radio control.\n * @part checked-icon - The container the wraps the checked icon.\n * @part label - The radio label.\n */\n\n@Component({\n tag: 'six-radio',\n styleUrl: 'six-radio.scss',\n shadow: true,\n})\nexport class SixRadio {\n private inputId = `radio-${++id}`;\n private labelId = `radio-label-${id}`;\n private nativeInput?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixRadioElement;\n\n @State() hasFocus = false;\n\n /** The radio's name attribute. */\n @Prop() name = '';\n\n /** The radio's value attribute. */\n @Prop({ reflect: true }) value = 'on';\n\n /** Set to true to disable the radio. */\n @Prop() disabled = false;\n\n /** Set to true to draw the radio in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\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.checked) {\n this.getSiblingRadios().map((radio) => (radio.checked = false));\n }\n if (this.nativeInput != null) {\n this.nativeInput.checked = this.checked;\n this.sixChange.emit();\n }\n }\n\n @Watch('name')\n handleNameChange(name: string) {\n if (this.nativeInput != null) {\n this.nativeInput.name = name;\n }\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-radio-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-radio-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-radio-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n /** default state whether the radio button should be checked or not when resetting */\n private defaultState = false;\n\n connectedCallback() {\n this.eventListeners.forward('six-radio-change', 'change', this.host);\n this.eventListeners.forward('six-radio-blur', 'blur', this.host);\n this.eventListeners.forward('six-radio-focus', 'focus', this.host);\n }\n\n componentWillLoad() {\n this.defaultState = this.checked;\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the radio. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeInput?.focus(options);\n }\n\n /** Removes focus from the radio. */\n @Method()\n async removeFocus() {\n this.nativeInput?.blur();\n }\n\n /** Resets the formcontrol */\n @Method()\n async reset() {\n this.checked = this.defaultState;\n }\n\n private getAllRadios() {\n const form = this.host.closest('six-form, form') || document.body;\n\n if (this.name === '') return [];\n\n return [...form.querySelectorAll('six-radio')].filter(\n (radio: HTMLSixRadioElement) => radio.name === this.name\n ) as HTMLSixRadioElement[];\n }\n\n private getSiblingRadios() {\n return this.getAllRadios().filter((radio) => radio !== this.host) as HTMLSixRadioElement[];\n }\n\n private handleClick = () => {\n if (this.nativeInput != null) {\n this.checked = this.nativeInput.checked;\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 handleKeyDown = (event: KeyboardEvent) => {\n if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {\n const radios = this.getAllRadios().filter((radio) => !radio.disabled);\n const incr = ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;\n let index = radios.indexOf(this.host) + incr;\n if (index < 0) index = radios.length - 1;\n if (index > radios.length - 1) index = 0;\n\n this.getAllRadios().map((radio) => (radio.checked = false));\n radios[index].setFocus();\n radios[index].checked = true;\n\n event.preventDefault();\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.nativeInput?.focus();\n };\n\n render() {\n return (\n <label\n part=\"base\"\n class={{\n radio: true,\n 'radio--checked': this.checked,\n 'radio--disabled': this.disabled,\n 'radio--focused': this.hasFocus,\n }}\n htmlFor={this.inputId}\n onKeyDown={this.handleKeyDown}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"radio__control\">\n <span part=\"checked-icon\" class=\"radio__icon\">\n <svg viewBox=\"0 0 16 16\">\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"currentColor\">\n <circle cx=\"8\" cy=\"8\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n </span>\n\n <input\n ref={(el) => (this.nativeInput = el)}\n id={this.inputId}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n role=\"radio\"\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 />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"radio__label\">\n <slot />\n </span>\n </label>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-radio.js","sourceRoot":"","sources":["../../../src/components/six-radio/six-radio.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;AAE7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,QAAQ;;IACX,YAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC;IA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AE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,cAAc;QACvD,eAAQ,CACH,CACD,CACT,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';\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 radio's label.\n *\n * @part base - The component's base wrapper.\n * @part control - The radio control.\n * @part checked-icon - The container the wraps the checked icon.\n * @part label - The radio label.\n */\n\n@Component({\n tag: 'six-radio',\n styleUrl: 'six-radio.scss',\n shadow: true,\n})\nexport class SixRadio {\n private inputId = `radio-${++id}`;\n private labelId = `radio-label-${id}`;\n private nativeInput?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixRadioElement;\n\n @State() hasFocus = false;\n\n /** The radio's name attribute. */\n @Prop() name = '';\n\n /** The radio's value attribute. */\n @Prop({ reflect: true }) value = 'on';\n\n /** Set to true to disable the radio. */\n @Prop() disabled = false;\n\n /** Set to true to draw the radio in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\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.checked) {\n this.getSiblingRadios().forEach((radio) => (radio.checked = false));\n }\n if (this.nativeInput != null) {\n this.nativeInput.checked = this.checked;\n }\n }\n\n @Watch('name')\n handleNameChange(name: string) {\n if (this.nativeInput != null) {\n this.nativeInput.name = name;\n }\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-radio-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-radio-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-radio-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.eventListeners.forward('six-radio-change', 'change', this.host);\n this.eventListeners.forward('six-radio-blur', 'blur', this.host);\n this.eventListeners.forward('six-radio-focus', 'focus', this.host);\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the radio. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeInput?.focus(options);\n }\n\n /** Removes focus from the radio. */\n @Method()\n async removeFocus() {\n this.nativeInput?.blur();\n }\n\n private getAllRadios() {\n const form = this.host.closest('form') || document.body;\n\n if (this.name === '') return [];\n\n return [...form.querySelectorAll('six-radio')].filter(\n (radio: HTMLSixRadioElement) => radio.name === this.name\n ) as HTMLSixRadioElement[];\n }\n\n private getSiblingRadios() {\n return this.getAllRadios().filter((radio) => radio !== this.host) as HTMLSixRadioElement[];\n }\n\n private handleClick = () => {\n if (this.nativeInput != null) {\n this.checked = this.nativeInput.checked;\n this.sixChange.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 handleKeyDown = (keyboardEvent: KeyboardEvent) => {\n if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(keyboardEvent.key)) {\n const radios = this.getAllRadios().filter((radio) => !radio.disabled);\n const incr = ['ArrowUp', 'ArrowLeft'].includes(keyboardEvent.key) ? -1 : 1;\n let index = radios.indexOf(this.host) + incr;\n if (index < 0) index = radios.length - 1;\n if (index > radios.length - 1) index = 0;\n\n this.getAllRadios().forEach((radio) => (radio.checked = false));\n radios[index].setFocus();\n radios[index].checked = true;\n radios[index].dispatchEvent(new CustomEvent('six-radio-change', { bubbles: true, cancelable: true }));\n keyboardEvent.preventDefault();\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.nativeInput?.focus();\n };\n\n render() {\n return (\n <label\n part=\"base\"\n class={{\n radio: true,\n 'radio--checked': this.checked,\n 'radio--disabled': this.disabled,\n 'radio--focused': this.hasFocus,\n }}\n htmlFor={this.inputId}\n onKeyDown={this.handleKeyDown}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"radio__control\">\n <span part=\"checked-icon\" class=\"radio__icon\">\n <svg viewBox=\"0 0 16 16\">\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"currentColor\">\n <circle cx=\"8\" cy=\"8\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n </span>\n\n <input\n ref={(el) => (this.nativeInput = el)}\n id={this.inputId}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n role=\"radio\"\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 />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"radio__label\">\n <slot />\n </span>\n </label>\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(*) {
@@ -53,12 +53,14 @@ export class SixRange {
53
53
  this.handleSlotChange = () => {
54
54
  this.hasHelpTextSlot = hasSlot(this.host, 'help-text');
55
55
  this.hasLabelSlot = hasSlot(this.host, 'label');
56
+ this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
56
57
  };
57
58
  this.handleTouchStart = () => {
58
59
  this.setFocus();
59
60
  };
60
61
  this.hasFocus = false;
61
62
  this.hasHelpTextSlot = false;
63
+ this.hasErrorTextSlot = false;
62
64
  this.hasLabelSlot = false;
63
65
  this.hasTooltip = false;
64
66
  this.name = '';
@@ -68,6 +70,7 @@ export class SixRange {
68
70
  this.disabled = false;
69
71
  this.label = '';
70
72
  this.errorText = '';
73
+ this.errorTextCount = undefined;
71
74
  this.invalid = false;
72
75
  this.min = 0;
73
76
  this.max = 100;
@@ -175,7 +178,7 @@ export class SixRange {
175
178
  }
176
179
  }
177
180
  render() {
178
- return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, size: "medium", errorTextId: this.errorTextId, errorText: this.errorText, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("div", { part: "base", class: {
181
+ return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, size: "medium", errorTextId: this.errorTextId, errorText: this.errorText, hasErrorTextSlot: this.hasErrorTextSlot, errorTextCount: this.errorTextCount, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("div", { part: "base", class: {
179
182
  range: true,
180
183
  // States
181
184
  'range--disabled': this.disabled,
@@ -311,8 +314,8 @@ export class SixRange {
311
314
  "type": "string",
312
315
  "mutable": false,
313
316
  "complexType": {
314
- "original": "string",
315
- "resolved": "string",
317
+ "original": "string | string[]",
318
+ "resolved": "string | string[]",
316
319
  "references": {}
317
320
  },
318
321
  "required": false,
@@ -325,6 +328,23 @@ export class SixRange {
325
328
  "reflect": false,
326
329
  "defaultValue": "''"
327
330
  },
331
+ "errorTextCount": {
332
+ "type": "number",
333
+ "mutable": false,
334
+ "complexType": {
335
+ "original": "number",
336
+ "resolved": "number | undefined",
337
+ "references": {}
338
+ },
339
+ "required": false,
340
+ "optional": true,
341
+ "docs": {
342
+ "tags": [],
343
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
344
+ },
345
+ "attribute": "error-text-count",
346
+ "reflect": false
347
+ },
328
348
  "invalid": {
329
349
  "type": "boolean",
330
350
  "mutable": false,
@@ -437,6 +457,7 @@ export class SixRange {
437
457
  return {
438
458
  "hasFocus": {},
439
459
  "hasHelpTextSlot": {},
460
+ "hasErrorTextSlot": {},
440
461
  "hasLabelSlot": {},
441
462
  "hasTooltip": {}
442
463
  };
@@ -1 +1 @@
1
- {"version":3,"file":"six-range.js","sourceRoot":"","sources":["../../../src/components/six-range/six-range.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;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,QAAQ;;IACX,YAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC;IAC1B,YAAO,GAAG,eAAe,EAAE,EAAE,CAAC;IAC9B,eAAU,GAAG,mBAAmB,EAAE,EAAE,CAAC;IACrC,gBAAW,GAAG,oBAAoB,EAAE,EAAE,CAAC;IACvC,mBAAc,GAAG,IAAI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,EAAC,OAAO,EACZ,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,GACvB;QACD,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAC1B,cAAQ,IAAI,EAAC,SAAS,EAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK,EAAC,gBAAgB,IAC3E,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAC3B,CACV,CACG,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 { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\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 input's label. Alternatively, you can use the label prop.\n * @slot help-text - Help text that describes how to use the input. Alternatively, you can use the help-text prop.\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 input - The native range input.\n * @part tooltip - The range tooltip.\n */\n@Component({\n tag: 'six-range',\n styleUrl: 'six-range.scss',\n shadow: true,\n})\nexport class SixRange {\n private inputId = `input-${++id}`;\n private labelId = `input-label-${id}`;\n private helpTextId = `input-help-text-${id}`;\n private errorTextId = `input-error-text-${id}`;\n private eventListeners = new EventListeners();\n private resizeObserver?: ResizeObserver;\n\n private output?: HTMLElement;\n private nativeInput?: HTMLInputElement;\n\n @Element() host!: HTMLSixRangeElement;\n\n @State() hasFocus = false;\n @State() hasHelpTextSlot = false;\n @State() hasLabelSlot = false;\n @State() hasTooltip = false;\n\n /** The input's name attribute. */\n @Prop() name = '';\n\n /** The input's value attribute. */\n @Prop({ mutable: true }) value = 0;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** The range's help text. Alternatively, you can use the help-text slot. */\n @Prop() helpText = '';\n\n /** Set to true to disable the input. */\n @Prop() disabled = 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 input's min attribute. */\n @Prop() min = 0;\n\n /** The input's max attribute. */\n @Prop() max = 100;\n\n /** The input's step attribute. */\n @Prop() step = 1;\n\n /** The preferred placedment of the tooltip. */\n @Prop() tooltip: 'top' | 'bottom' | 'none' = 'top';\n\n /** A function used to format the tooltip's value. */\n @Prop() tooltipFormatter = (value: number) => value.toString();\n\n /** Emitted when the control's value changes. */\n @Event({ eventName: 'six-range-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-range-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-range-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n @Watch('label')\n @Watch('errorText')\n @Watch('helpText')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n @Watch('value')\n @Watch('min')\n @Watch('max')\n handleValueChange() {\n this.update();\n }\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n }\n\n componentWillLoad() {\n this.update();\n this.handleSlotChange();\n }\n\n componentDidLoad() {\n const nativeInput = this.nativeInput;\n if (nativeInput == null) {\n return;\n }\n this.update();\n this.resizeObserver = new ResizeObserver(() => this.update());\n }\n\n disconnectedCallback() {\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the input. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeInput?.focus(options);\n }\n\n /** Removes focus from the input. */\n @Method()\n async removeFocus() {\n this.nativeInput?.blur();\n }\n\n private handleInput = () => {\n if (this.nativeInput != null) {\n this.update(parseFloat(this.nativeInput.value));\n }\n requestAnimationFrame(() => {\n this.sixChange.emit();\n });\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.hasTooltip = false;\n this.sixBlur.emit();\n if (this.nativeInput != null) {\n this.resizeObserver?.unobserve(this.nativeInput);\n }\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.hasTooltip = true;\n this.sixFocus.emit();\n if (this.nativeInput != null) {\n this.resizeObserver?.observe(this.nativeInput);\n }\n };\n\n private handleSlotChange = () => {\n this.hasHelpTextSlot = hasSlot(this.host, 'help-text');\n this.hasLabelSlot = hasSlot(this.host, 'label');\n };\n\n private handleTouchStart = () => {\n this.setFocus();\n };\n\n private syncTooltip(min: number, max: number, value: number) {\n if (this.tooltip !== 'none' && this.nativeInput != null && this.output != null) {\n const percent = Math.max(0, (value - min) / (max - min));\n const inputWidth = this.nativeInput.offsetWidth;\n const tooltipWidth = this.output.offsetWidth;\n const thumbSize = getComputedStyle(this.nativeInput).getPropertyValue('--thumb-size');\n const x = `calc(${inputWidth * percent}px - calc(calc(${percent} * ${thumbSize}) - calc(${thumbSize} / 2)))`;\n this.output.style.transform = `translateX(${x})`;\n this.output.style.marginLeft = `-${tooltipWidth / 2}px`;\n }\n }\n\n private isFirefox() {\n return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n }\n\n private update(updateValue?: number) {\n if (updateValue != null) {\n this.value = updateValue;\n }\n\n const min = Number(this.min) ?? 0;\n const max = Number(this.max) ?? 0;\n let value;\n const parsedValue = parseFloat(this.value as never);\n if (isNaN(parsedValue)) {\n value = this.getDefaultValue(min, max);\n } else {\n value = parsedValue;\n }\n\n if (this.nativeInput != null) {\n // The value may have constraints, so we set the native control's\n // value and sync it back to ensure it adheres to min, max, and step\n // properly.\n this.nativeInput.value = value.toString();\n this.value = parseFloat(this.nativeInput.value);\n } else {\n this.value = value;\n }\n this.calculateColorRunnableTrack(min, max, this.value);\n this.syncTooltip(min, max, this.value);\n }\n\n /**\n * from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#value\n */\n private getDefaultValue(min: number, max: number): number {\n return max < min ? min : min + (max - min) / 2;\n }\n\n /**\n * For Firefox this functionality is not needed because it is supported by standard CSS.\n */\n private calculateColorRunnableTrack(min: number, max: number, value: number) {\n if (!this.isFirefox() && this.nativeInput != null) {\n const percent = Math.ceil(((value - min) / (max - min)) * 100);\n this.nativeInput.style.background =\n '-webkit-linear-gradient(left, var(--track-color) 0%, var(--track-color) ' +\n percent +\n '%, var(--six-color-web-rock-300) ' +\n percent +\n '%)';\n }\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 size=\"medium\"\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <div\n part=\"base\"\n class={{\n range: true,\n\n // States\n 'range--disabled': this.disabled,\n 'range--focused': this.hasFocus,\n 'range--tooltip-visible': this.hasTooltip,\n 'range--tooltip-top': this.tooltip === 'top',\n 'range--tooltip-bottom': this.tooltip === 'bottom',\n }}\n onTouchStart={this.handleTouchStart}\n >\n <input\n part=\"input\"\n ref={(el) => (this.nativeInput = el)}\n type=\"range\"\n class=\"range__control\"\n name={this.name}\n disabled={this.disabled}\n min={this.min}\n max={this.max}\n step={this.step}\n value={this.value}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n {this.tooltip !== 'none' && (\n <output part=\"tooltip\" ref={(el) => (this.output = el)} class=\"range__tooltip\">\n {this.tooltipFormatter(this.value)}\n </output>\n )}\n </div>\n </FormControl>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-range.js","sourceRoot":"","sources":["../../../src/components/six-range/six-range.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;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,QAAQ;;IACX,YAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC;IAC1B,YAAO,GAAG,eAAe,EAAE,EAAE,CAAC;IAC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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 { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\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 input's label. Alternatively, you can use the label prop.\n * @slot help-text - Help text that describes how to use the input. Alternatively, you can use the help-text prop.\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 input - The native range input.\n * @part tooltip - The range tooltip.\n */\n@Component({\n tag: 'six-range',\n styleUrl: 'six-range.scss',\n shadow: true,\n})\nexport class SixRange {\n private inputId = `input-${++id}`;\n private labelId = `input-label-${id}`;\n private helpTextId = `input-help-text-${id}`;\n private errorTextId = `input-error-text-${id}`;\n private eventListeners = new EventListeners();\n private resizeObserver?: ResizeObserver;\n\n private output?: HTMLElement;\n private nativeInput?: HTMLInputElement;\n\n @Element() host!: HTMLSixRangeElement;\n\n @State() hasFocus = false;\n @State() hasHelpTextSlot = false;\n @State() hasErrorTextSlot = false;\n @State() hasLabelSlot = false;\n @State() hasTooltip = false;\n\n /** The input's name attribute. */\n @Prop() name = '';\n\n /** The input's value attribute. */\n @Prop({ mutable: true }) value = 0;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** The range's help text. Alternatively, you can use the help-text slot. */\n @Prop() helpText = '';\n\n /** Set to true to disable the input. */\n @Prop() disabled = 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 input's min attribute. */\n @Prop() min = 0;\n\n /** The input's max attribute. */\n @Prop() max = 100;\n\n /** The input's step attribute. */\n @Prop() step = 1;\n\n /** The preferred placedment of the tooltip. */\n @Prop() tooltip: 'top' | 'bottom' | 'none' = 'top';\n\n /** A function used to format the tooltip's value. */\n @Prop() tooltipFormatter = (value: number) => value.toString();\n\n /** Emitted when the control's value changes. */\n @Event({ eventName: 'six-range-change' }) sixChange!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-range-blur' }) sixBlur!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-range-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n @Watch('label')\n @Watch('errorText')\n @Watch('helpText')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n @Watch('value')\n @Watch('min')\n @Watch('max')\n handleValueChange() {\n this.update();\n }\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n }\n\n componentWillLoad() {\n this.update();\n this.handleSlotChange();\n }\n\n componentDidLoad() {\n const nativeInput = this.nativeInput;\n if (nativeInput == null) {\n return;\n }\n this.update();\n this.resizeObserver = new ResizeObserver(() => this.update());\n }\n\n disconnectedCallback() {\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the input. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.nativeInput?.focus(options);\n }\n\n /** Removes focus from the input. */\n @Method()\n async removeFocus() {\n this.nativeInput?.blur();\n }\n\n private handleInput = () => {\n if (this.nativeInput != null) {\n this.update(parseFloat(this.nativeInput.value));\n }\n requestAnimationFrame(() => {\n this.sixChange.emit();\n });\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.hasTooltip = false;\n this.sixBlur.emit();\n if (this.nativeInput != null) {\n this.resizeObserver?.unobserve(this.nativeInput);\n }\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.hasTooltip = true;\n this.sixFocus.emit();\n if (this.nativeInput != null) {\n this.resizeObserver?.observe(this.nativeInput);\n }\n };\n\n private handleSlotChange = () => {\n this.hasHelpTextSlot = hasSlot(this.host, 'help-text');\n this.hasLabelSlot = hasSlot(this.host, 'label');\n this.hasErrorTextSlot = hasSlot(this.host, 'error-text');\n };\n\n private handleTouchStart = () => {\n this.setFocus();\n };\n\n private syncTooltip(min: number, max: number, value: number) {\n if (this.tooltip !== 'none' && this.nativeInput != null && this.output != null) {\n const percent = Math.max(0, (value - min) / (max - min));\n const inputWidth = this.nativeInput.offsetWidth;\n const tooltipWidth = this.output.offsetWidth;\n const thumbSize = getComputedStyle(this.nativeInput).getPropertyValue('--thumb-size');\n const x = `calc(${inputWidth * percent}px - calc(calc(${percent} * ${thumbSize}) - calc(${thumbSize} / 2)))`;\n this.output.style.transform = `translateX(${x})`;\n this.output.style.marginLeft = `-${tooltipWidth / 2}px`;\n }\n }\n\n private isFirefox() {\n return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n }\n\n private update(updateValue?: number) {\n if (updateValue != null) {\n this.value = updateValue;\n }\n\n const min = Number(this.min) ?? 0;\n const max = Number(this.max) ?? 0;\n let value;\n const parsedValue = parseFloat(this.value as never);\n if (isNaN(parsedValue)) {\n value = this.getDefaultValue(min, max);\n } else {\n value = parsedValue;\n }\n\n if (this.nativeInput != null) {\n // The value may have constraints, so we set the native control's\n // value and sync it back to ensure it adheres to min, max, and step\n // properly.\n this.nativeInput.value = value.toString();\n this.value = parseFloat(this.nativeInput.value);\n } else {\n this.value = value;\n }\n this.calculateColorRunnableTrack(min, max, this.value);\n this.syncTooltip(min, max, this.value);\n }\n\n /**\n * from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#value\n */\n private getDefaultValue(min: number, max: number): number {\n return max < min ? min : min + (max - min) / 2;\n }\n\n /**\n * For Firefox this functionality is not needed because it is supported by standard CSS.\n */\n private calculateColorRunnableTrack(min: number, max: number, value: number) {\n if (!this.isFirefox() && this.nativeInput != null) {\n const percent = Math.ceil(((value - min) / (max - min)) * 100);\n this.nativeInput.style.background =\n '-webkit-linear-gradient(left, var(--track-color) 0%, var(--track-color) ' +\n percent +\n '%, var(--six-color-web-rock-300) ' +\n percent +\n '%)';\n }\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 size=\"medium\"\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n hasErrorTextSlot={this.hasErrorTextSlot}\n errorTextCount={this.errorTextCount}\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <div\n part=\"base\"\n class={{\n range: true,\n\n // States\n 'range--disabled': this.disabled,\n 'range--focused': this.hasFocus,\n 'range--tooltip-visible': this.hasTooltip,\n 'range--tooltip-top': this.tooltip === 'top',\n 'range--tooltip-bottom': this.tooltip === 'bottom',\n }}\n onTouchStart={this.handleTouchStart}\n >\n <input\n part=\"input\"\n ref={(el) => (this.nativeInput = el)}\n type=\"range\"\n class=\"range__control\"\n name={this.name}\n disabled={this.disabled}\n min={this.min}\n max={this.max}\n step={this.step}\n value={this.value}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n {this.tooltip !== 'none' && (\n <output part=\"tooltip\" ref={(el) => (this.output = el)} class=\"range__tooltip\">\n {this.tooltipFormatter(this.value)}\n </output>\n )}\n </div>\n </FormControl>\n );\n }\n}\n"]}
@@ -19,7 +19,9 @@ describe('six-range', () => {
19
19
  <input class="range__control" max="100" min="0" part="input" step="1" type="range" value="0" style="background: -webkit-linear-gradient(left, var(--track-color) 0%, var(--track-color) 0%, var(--six-color-web-rock-300) 0%);">
20
20
  </div>
21
21
  </div>
22
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text"></div>
22
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text">
23
+ <slot name="error-text"></slot>
24
+ </div>
23
25
  <div aria-hidden="true" class="form-control__help-text" id="input-help-text-1" part="help-text">
24
26
  <slot name="help-text"></slot>
25
27
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"six-range.spec.js","sourceRoot":"","sources":["../../../../src/components/six-range/test/six-range.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;EACzB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAElC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,QAAQ,CAAC;MACtB,IAAI,EAAE,wCAAwC;KAC/C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;KAmB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixRange } from '../six-range';\n\ndescribe('six-range', () => {\n it('renders', async () => {\n global.ResizeObserver = jest.fn();\n\n const page = await newSpecPage({\n components: [SixRange],\n html: `<six-range tooltip=\"none\"></six-range>`,\n });\n expect(page.root).toEqualHtml(`\n <six-range tooltip=\"none\">\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=\"input-1\" id=\"input-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <div class=\"range\" part=\"base\">\n <input class=\"range__control\" max=\"100\" min=\"0\" part=\"input\" step=\"1\" type=\"range\" value=\"0\" style=\"background: -webkit-linear-gradient(left, var(--track-color) 0%, var(--track-color) 0%, var(--six-color-web-rock-300) 0%);\">\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=\"input-help-text-1\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-range>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"six-range.spec.js","sourceRoot":"","sources":["../../../../src/components/six-range/test/six-range.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;EACzB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAElC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,QAAQ,CAAC;MACtB,IAAI,EAAE,wCAAwC;KAC/C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;KAqB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixRange } from '../six-range';\n\ndescribe('six-range', () => {\n it('renders', async () => {\n global.ResizeObserver = jest.fn();\n\n const page = await newSpecPage({\n components: [SixRange],\n html: `<six-range tooltip=\"none\"></six-range>`,\n });\n expect(page.root).toEqualHtml(`\n <six-range tooltip=\"none\">\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=\"input-1\" id=\"input-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <div class=\"range\" part=\"base\">\n <input class=\"range__control\" max=\"100\" min=\"0\" part=\"input\" step=\"1\" type=\"range\" value=\"0\" style=\"background: -webkit-linear-gradient(left, var(--track-color) 0%, var(--track-color) 0%, var(--six-color-web-rock-300) 0%);\">\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=\"input-help-text-1\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-range>\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(*) {
@@ -104,7 +104,6 @@
104
104
  background-color: var(--six-input-background-color);
105
105
  border: solid var(--six-border-width) var(--six-input-border-color);
106
106
  vertical-align: middle;
107
- overflow: hidden;
108
107
  transition: var(--six-transition-fast) color, var(--six-transition-fast) border, var(--six-transition-fast) box-shadow;
109
108
  cursor: pointer;
110
109
  }
@@ -169,13 +168,17 @@
169
168
  -ms-overflow-style: none;
170
169
  overflow-x: auto;
171
170
  overflow-y: hidden;
172
- white-space: nowrap;
171
+ text-overflow: ellipsis;
173
172
  }
174
173
  .select__label::-webkit-scrollbar {
175
174
  width: 0;
176
175
  height: 0;
177
176
  }
178
177
 
178
+ .select__label--single {
179
+ white-space: nowrap;
180
+ }
181
+
179
182
  .select__clear {
180
183
  flex-shrink: 0;
181
184
  flex-grow: 0;
@@ -202,7 +205,7 @@
202
205
  }
203
206
 
204
207
  .select__tags {
205
- display: inline-flex;
208
+ display: flex;
206
209
  align-items: center;
207
210
  flex-wrap: wrap;
208
211
  justify-content: left;
@@ -250,8 +253,6 @@
250
253
  }
251
254
  .select--small .select__tags six-tag {
252
255
  padding-top: 2px;
253
- }
254
- .select--small .select__tags six-tag:not(:last-of-type) {
255
256
  margin-right: var(--six-spacing-xx-small);
256
257
  }
257
258
  .select--small.select--has-tags .select__label {
@@ -281,8 +282,6 @@
281
282
  }
282
283
  .select--medium .select__tags six-tag {
283
284
  padding-top: 3px;
284
- }
285
- .select--medium .select__tags six-tag:not(:last-of-type) {
286
285
  margin-right: var(--six-spacing-xx-small);
287
286
  }
288
287
  .select--medium.select--has-tags .select__label {
@@ -312,8 +311,6 @@
312
311
  }
313
312
  .select--large .select__tags six-tag {
314
313
  padding-top: 4px;
315
- }
316
- .select--large .select__tags six-tag:not(:last-of-type) {
317
314
  margin-right: var(--six-spacing-xx-small);
318
315
  }
319
316
  .select--large.select--has-tags .select__label {
@@ -45,6 +45,7 @@ export class SixSelect {
45
45
  this.handleClearClick = (event) => {
46
46
  event.stopPropagation();
47
47
  this.clearValues();
48
+ this.sixChange.emit({ value: this.value, isSelected: true });
48
49
  };
49
50
  this.handleSelectAll = (event) => {
50
51
  const nonFilteredItems = this.getItems().filter((item) => item.style.display !== 'none');
@@ -61,6 +62,7 @@ export class SixSelect {
61
62
  .forEach((option) => (option.checked = hasDeselectedOptions));
62
63
  const checkedItems = nonFilteredItems.filter((option) => option.checked).map((option) => option.value);
63
64
  this.value = hasDeselectedOptions ? checkedItems : [];
65
+ this.sixChange.emit({ value: this.value, isSelected: true });
64
66
  }
65
67
  };
66
68
  this.handleKeyDown = (event) => {
@@ -123,6 +125,7 @@ export class SixSelect {
123
125
  };
124
126
  this.value = getValue();
125
127
  this.syncItemsFromValue();
128
+ this.sixChange.emit({ value: this.value, isSelected: true });
126
129
  };
127
130
  this.handleMenuShow = (event) => {
128
131
  var _a;
@@ -142,6 +145,7 @@ export class SixSelect {
142
145
  this.handleSlotChange = () => {
143
146
  this.hasHelpTextSlot = hasSlot(this.host, 'help-text');
144
147
  this.hasLabelSlot = hasSlot(this.host, 'label');
148
+ this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
145
149
  this.syncItemsFromValue();
146
150
  };
147
151
  this.handleTagInteraction = (event) => {
@@ -155,11 +159,13 @@ export class SixSelect {
155
159
  });
156
160
  if (clearButton) {
157
161
  event.stopPropagation();
162
+ this.sixChange.emit({ value: this.value, isSelected: true });
158
163
  }
159
164
  };
160
165
  this.hasFocus = false;
161
166
  this.hasHelpTextSlot = false;
162
167
  this.hasLabelSlot = false;
168
+ this.hasErrorTextSlot = false;
163
169
  this.isOpen = false;
164
170
  this.displayLabel = '';
165
171
  this.displayTags = [];
@@ -179,6 +185,7 @@ export class SixSelect {
179
185
  this.clearable = false;
180
186
  this.label = '';
181
187
  this.errorText = '';
188
+ this.errorTextCount = undefined;
182
189
  this.invalid = false;
183
190
  this.line = false;
184
191
  this.filter = false;
@@ -211,9 +218,6 @@ export class SixSelect {
211
218
  this.value = '';
212
219
  }
213
220
  await this.syncItemsFromValue();
214
- if (this.input) {
215
- this.sixChange.emit({ value: this.value, isSelected: true });
216
- }
217
221
  }
218
222
  connectedCallback() {
219
223
  var _a;
@@ -278,7 +282,7 @@ export class SixSelect {
278
282
  return this.getItems().length > 0;
279
283
  }
280
284
  getValueAsArray() {
281
- const values = Array.isArray(this.value) ? this.value : [this.value];
285
+ const values = Array.isArray(this.value) ? this.value : this.value === '' ? [] : [this.value];
282
286
  // enforce that the values are converted to 'string' before the value is compared
283
287
  return values.map(String);
284
288
  }
@@ -354,7 +358,7 @@ export class SixSelect {
354
358
  render() {
355
359
  var _a;
356
360
  const hasSelection = this.hasSelection();
357
- 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, onLabelClick: this.handleLabelClick, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("six-dropdown", { part: "base", ref: (el) => (this.dropdown = el), hoist: this.hoist, closeOnSelect: !this.multiple, containingElement: this.host, disableHideOnEnterAndSpace: this.autocomplete, class: {
361
+ 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, onLabelClick: this.handleLabelClick, disabled: this.disabled, required: this.required, displayError: this.invalid }, h("six-dropdown", { part: "base", ref: (el) => (this.dropdown = el), hoist: this.hoist, closeOnSelect: !this.multiple, containingElement: this.host, disableHideOnEnterAndSpace: this.autocomplete, class: {
358
362
  select: true,
359
363
  'select--open': this.isOpen,
360
364
  'select--empty': ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === 0,
@@ -373,7 +377,7 @@ export class SixSelect {
373
377
  select__box: true,
374
378
  'select__box--line': this.line,
375
379
  'select__box--autocomplete': this.autocomplete,
376
- }, role: "combobox", "aria-labelledby": this.labelId, "aria-describedby": this.helpTextId, "aria-haspopup": "true", "aria-expanded": this.isOpen ? 'true' : 'false', tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onKeyDown: this.handleKeyDown }, h("span", { class: "select__label" }, this.displayTags.length > 0 ? (h("span", { part: "tags", class: "select__tags" }, this.displayTags)) : (this.displayLabel || this.placeholder)), this.clearable && hasSelection && (h("six-icon-button", { exportparts: "base:clear-button", class: "select__clear", name: "clear", size: "small", onClick: this.handleClearClick, tabindex: "-1" })), this.hasMenuItems() && (h("span", { part: "icon", class: "select__icon" }, h("six-icon", { size: "medium" }, "expand_more"))), h("six-input", { ref: (el) => (this.input = el), class: {
380
+ }, role: "combobox", "aria-labelledby": this.labelId, "aria-describedby": this.helpTextId, "aria-haspopup": "true", "aria-expanded": this.isOpen ? 'true' : 'false', tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onKeyDown: this.handleKeyDown }, h("span", { class: { select__label: true, 'select__label--single': !this.displayTags.length } }, this.displayTags.length > 0 ? (h("span", { part: "tags", class: "select__tags" }, this.displayTags)) : (this.displayLabel || this.placeholder)), this.clearable && hasSelection && (h("six-icon-button", { exportparts: "base:clear-button", class: "select__clear", name: "clear", size: "small", onClick: this.handleClearClick, tabindex: "-1" })), this.hasMenuItems() && (h("span", { part: "icon", class: "select__icon" }, h("six-icon", { size: "medium" }, "expand_more"))), h("six-input", { ref: (el) => (this.input = el), class: {
377
381
  select__input: true,
378
382
  'select__hidden-select': !this.autocomplete,
379
383
  }, "aria-hidden": "true", required: this.required, onFocus: this.handleFocus, clearable: this.clearable, placeholder: this.placeholder, pill: this.pill, disabled: this.disabled, size: this.size, tabIndex: -1 })), h("six-menu", { ref: (el) => (this.menu = el), part: "menu", class: {
@@ -672,8 +676,8 @@ export class SixSelect {
672
676
  "type": "string",
673
677
  "mutable": false,
674
678
  "complexType": {
675
- "original": "string",
676
- "resolved": "string",
679
+ "original": "string | string[]",
680
+ "resolved": "string | string[]",
677
681
  "references": {}
678
682
  },
679
683
  "required": false,
@@ -686,6 +690,23 @@ export class SixSelect {
686
690
  "reflect": false,
687
691
  "defaultValue": "''"
688
692
  },
693
+ "errorTextCount": {
694
+ "type": "number",
695
+ "mutable": false,
696
+ "complexType": {
697
+ "original": "number",
698
+ "resolved": "number | undefined",
699
+ "references": {}
700
+ },
701
+ "required": false,
702
+ "optional": true,
703
+ "docs": {
704
+ "tags": [],
705
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
706
+ },
707
+ "attribute": "error-text-count",
708
+ "reflect": false
709
+ },
689
710
  "invalid": {
690
711
  "type": "boolean",
691
712
  "mutable": false,
@@ -841,6 +862,7 @@ export class SixSelect {
841
862
  "hasFocus": {},
842
863
  "hasHelpTextSlot": {},
843
864
  "hasLabelSlot": {},
865
+ "hasErrorTextSlot": {},
844
866
  "isOpen": {},
845
867
  "displayLabel": {},
846
868
  "displayTags": {}