@six-group/ui-library 4.0.0 → 4.0.1

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 (235) hide show
  1. package/dist/cjs/{form-control-d369af14.js → form-control-9769b310.js} +10 -7
  2. package/dist/cjs/form-control-9769b310.js.map +1 -0
  3. package/dist/cjs/index-900437fc.js +8 -4
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/six-checkbox.cjs.entry.js +6 -3
  6. package/dist/cjs/six-checkbox.cjs.entry.js.map +1 -1
  7. package/dist/cjs/six-datepicker.cjs.entry.js +2 -7
  8. package/dist/cjs/six-datepicker.cjs.entry.js.map +1 -1
  9. package/dist/cjs/six-dropdown_2.cjs.entry.js +1 -1
  10. package/dist/cjs/six-dropdown_2.cjs.entry.js.map +1 -1
  11. package/dist/cjs/six-error.cjs.entry.js +21 -0
  12. package/dist/cjs/six-error.cjs.entry.js.map +1 -0
  13. package/dist/cjs/six-group-label.cjs.entry.js +2 -2
  14. package/dist/cjs/six-group-label.cjs.entry.js.map +1 -1
  15. package/dist/cjs/six-input.cjs.entry.js +6 -3
  16. package/dist/cjs/six-input.cjs.entry.js.map +1 -1
  17. package/dist/cjs/six-range.cjs.entry.js +6 -3
  18. package/dist/cjs/six-range.cjs.entry.js.map +1 -1
  19. package/dist/cjs/six-select.cjs.entry.js +6 -3
  20. package/dist/cjs/six-select.cjs.entry.js.map +1 -1
  21. package/dist/cjs/six-sidebar.cjs.entry.js +1 -1
  22. package/dist/cjs/six-sidebar.cjs.entry.js.map +1 -1
  23. package/dist/cjs/six-switch.cjs.entry.js +22 -4
  24. package/dist/cjs/six-switch.cjs.entry.js.map +1 -1
  25. package/dist/cjs/six-tag.cjs.entry.js +23 -1
  26. package/dist/cjs/six-tag.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/six-tooltip.cjs.entry.js +2 -2
  32. package/dist/cjs/six-tooltip.cjs.entry.js.map +1 -1
  33. package/dist/cjs/ui-library.cjs.js +1 -1
  34. package/dist/collection/collection-manifest.json +1 -0
  35. package/dist/collection/components/six-checkbox/six-checkbox.css +1 -1
  36. package/dist/collection/components/six-checkbox/six-checkbox.js +25 -4
  37. package/dist/collection/components/six-checkbox/six-checkbox.js.map +1 -1
  38. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js +6 -2
  39. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js.map +1 -1
  40. package/dist/collection/components/six-datepicker/six-datepicker.js +22 -11
  41. package/dist/collection/components/six-datepicker/six-datepicker.js.map +1 -1
  42. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js +1 -1
  43. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js.map +1 -1
  44. package/dist/collection/components/six-dropdown/six-dropdown.css +2 -1
  45. package/dist/collection/components/six-error/six-error.css +5 -0
  46. package/dist/collection/components/six-error/six-error.js +25 -0
  47. package/dist/collection/components/six-error/six-error.js.map +1 -0
  48. package/dist/collection/components/six-group-label/six-group-label.css +1 -1
  49. package/dist/collection/components/six-group-label/test/six-group-label.spec.js +3 -1
  50. package/dist/collection/components/six-group-label/test/six-group-label.spec.js.map +1 -1
  51. package/dist/collection/components/six-input/six-input.css +1 -1
  52. package/dist/collection/components/six-input/six-input.js +27 -4
  53. package/dist/collection/components/six-input/six-input.js.map +1 -1
  54. package/dist/collection/components/six-input/test/six-input.spec.js +3 -1
  55. package/dist/collection/components/six-input/test/six-input.spec.js.map +1 -1
  56. package/dist/collection/components/six-range/six-range.css +1 -1
  57. package/dist/collection/components/six-range/six-range.js +24 -3
  58. package/dist/collection/components/six-range/six-range.js.map +1 -1
  59. package/dist/collection/components/six-range/test/six-range.spec.js +3 -1
  60. package/dist/collection/components/six-range/test/six-range.spec.js.map +1 -1
  61. package/dist/collection/components/six-select/six-select.css +1 -1
  62. package/dist/collection/components/six-select/six-select.js +24 -3
  63. package/dist/collection/components/six-select/six-select.js.map +1 -1
  64. package/dist/collection/components/six-select/test/six-select.spec.js +6 -2
  65. package/dist/collection/components/six-select/test/six-select.spec.js.map +1 -1
  66. package/dist/collection/components/six-sidebar/six-sidebar.css +1 -0
  67. package/dist/collection/components/six-switch/six-switch.css +1 -1
  68. package/dist/collection/components/six-switch/six-switch.js +45 -4
  69. package/dist/collection/components/six-switch/six-switch.js.map +1 -1
  70. package/dist/collection/components/six-switch/test/six-switch.spec.js +6 -2
  71. package/dist/collection/components/six-switch/test/six-switch.spec.js.map +1 -1
  72. package/dist/collection/components/six-tag/six-tag.js +23 -1
  73. package/dist/collection/components/six-tag/six-tag.js.map +1 -1
  74. package/dist/collection/components/six-tag/test/six-tag.spec.js +12 -0
  75. package/dist/collection/components/six-tag/test/six-tag.spec.js.map +1 -1
  76. package/dist/collection/components/six-textarea/six-textarea.css +1 -1
  77. package/dist/collection/components/six-textarea/six-textarea.js +25 -4
  78. package/dist/collection/components/six-textarea/six-textarea.js.map +1 -1
  79. package/dist/collection/components/six-textarea/test/six-textarea.spec.js +3 -1
  80. package/dist/collection/components/six-textarea/test/six-textarea.spec.js.map +1 -1
  81. package/dist/collection/components/six-timepicker/six-timepicker.js +24 -12
  82. package/dist/collection/components/six-timepicker/six-timepicker.js.map +1 -1
  83. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js +15 -15
  84. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js.map +1 -1
  85. package/dist/collection/components/six-tooltip/six-tooltip.css +1 -1
  86. package/dist/collection/components/six-tooltip/six-tooltip.js +1 -1
  87. package/dist/collection/components/six-tooltip/six-tooltip.js.map +1 -1
  88. package/dist/collection/functional-components/form-control/form-control.js +8 -6
  89. package/dist/collection/functional-components/form-control/form-control.js.map +1 -1
  90. package/dist/components/form-control.js +9 -6
  91. package/dist/components/form-control.js.map +1 -1
  92. package/dist/components/index.js +2 -0
  93. package/dist/components/index.js.map +1 -1
  94. package/dist/components/six-checkbox.js +14 -3
  95. package/dist/components/six-checkbox.js.map +1 -1
  96. package/dist/components/six-datepicker.js +10 -8
  97. package/dist/components/six-datepicker.js.map +1 -1
  98. package/dist/components/six-dropdown2.js +8 -2
  99. package/dist/components/six-dropdown2.js.map +1 -1
  100. package/dist/components/six-error.d.ts +11 -0
  101. package/dist/components/six-error.js +8 -0
  102. package/dist/components/six-error.js.map +1 -0
  103. package/dist/components/six-error2.js +32 -0
  104. package/dist/components/six-error2.js.map +1 -0
  105. package/dist/components/six-group-label.js +8 -2
  106. package/dist/components/six-group-label.js.map +1 -1
  107. package/dist/components/six-header.js +8 -2
  108. package/dist/components/six-header.js.map +1 -1
  109. package/dist/components/six-input2.js +14 -3
  110. package/dist/components/six-input2.js.map +1 -1
  111. package/dist/components/six-range.js +14 -3
  112. package/dist/components/six-range.js.map +1 -1
  113. package/dist/components/six-search-field.js +7 -1
  114. package/dist/components/six-search-field.js.map +1 -1
  115. package/dist/components/six-select.js +33 -16
  116. package/dist/components/six-select.js.map +1 -1
  117. package/dist/components/six-sidebar.js +1 -1
  118. package/dist/components/six-sidebar.js.map +1 -1
  119. package/dist/components/six-switch.js +30 -4
  120. package/dist/components/six-switch.js.map +1 -1
  121. package/dist/components/six-tag2.js +33 -5
  122. package/dist/components/six-tag2.js.map +1 -1
  123. package/dist/components/six-textarea.js +14 -3
  124. package/dist/components/six-textarea.js.map +1 -1
  125. package/dist/components/six-timepicker2.js +12 -10
  126. package/dist/components/six-timepicker2.js.map +1 -1
  127. package/dist/components/six-tooltip2.js +2 -2
  128. package/dist/components/six-tooltip2.js.map +1 -1
  129. package/dist/components.json +419 -48
  130. package/dist/esm/{form-control-32cb533f.js → form-control-b0febe88.js} +10 -7
  131. package/dist/esm/form-control-b0febe88.js.map +1 -0
  132. package/dist/esm/index-8a74f992.js +8 -4
  133. package/dist/esm/loader.js +1 -1
  134. package/dist/esm/six-checkbox.entry.js +6 -3
  135. package/dist/esm/six-checkbox.entry.js.map +1 -1
  136. package/dist/esm/six-datepicker.entry.js +2 -7
  137. package/dist/esm/six-datepicker.entry.js.map +1 -1
  138. package/dist/esm/six-dropdown_2.entry.js +1 -1
  139. package/dist/esm/six-dropdown_2.entry.js.map +1 -1
  140. package/dist/esm/six-error.entry.js +17 -0
  141. package/dist/esm/six-error.entry.js.map +1 -0
  142. package/dist/esm/six-group-label.entry.js +2 -2
  143. package/dist/esm/six-group-label.entry.js.map +1 -1
  144. package/dist/esm/six-input.entry.js +6 -3
  145. package/dist/esm/six-input.entry.js.map +1 -1
  146. package/dist/esm/six-range.entry.js +6 -3
  147. package/dist/esm/six-range.entry.js.map +1 -1
  148. package/dist/esm/six-select.entry.js +6 -3
  149. package/dist/esm/six-select.entry.js.map +1 -1
  150. package/dist/esm/six-sidebar.entry.js +1 -1
  151. package/dist/esm/six-sidebar.entry.js.map +1 -1
  152. package/dist/esm/six-switch.entry.js +22 -4
  153. package/dist/esm/six-switch.entry.js.map +1 -1
  154. package/dist/esm/six-tag.entry.js +23 -1
  155. package/dist/esm/six-tag.entry.js.map +1 -1
  156. package/dist/esm/six-textarea.entry.js +6 -3
  157. package/dist/esm/six-textarea.entry.js.map +1 -1
  158. package/dist/esm/six-timepicker.entry.js +4 -9
  159. package/dist/esm/six-timepicker.entry.js.map +1 -1
  160. package/dist/esm/six-tooltip.entry.js +2 -2
  161. package/dist/esm/six-tooltip.entry.js.map +1 -1
  162. package/dist/esm/ui-library.js +1 -1
  163. package/dist/types/components/six-checkbox/six-checkbox.d.ts +4 -1
  164. package/dist/types/components/six-datepicker/six-datepicker.d.ts +4 -2
  165. package/dist/types/components/six-error/six-error.d.ts +9 -0
  166. package/dist/types/components/six-input/six-input.d.ts +7 -2
  167. package/dist/types/components/six-range/six-range.d.ts +4 -1
  168. package/dist/types/components/six-select/six-select.d.ts +4 -1
  169. package/dist/types/components/six-switch/six-switch.d.ts +8 -1
  170. package/dist/types/components/six-tag/six-tag.d.ts +8 -0
  171. package/dist/types/components/six-textarea/six-textarea.d.ts +4 -1
  172. package/dist/types/components/six-timepicker/six-timepicker.d.ts +5 -2
  173. package/dist/types/components.d.ts +109 -16
  174. package/dist/types/functional-components/form-control/form-control.d.ts +6 -2
  175. package/dist/ui-library/{p-ed381ad9.entry.js → p-14c1ec31.entry.js} +2 -2
  176. package/dist/ui-library/p-14c1ec31.entry.js.map +1 -0
  177. package/dist/ui-library/p-25bb1752.entry.js +2 -0
  178. package/dist/ui-library/p-25bb1752.entry.js.map +1 -0
  179. package/dist/ui-library/p-2a141e10.entry.js +2 -0
  180. package/dist/ui-library/p-2a141e10.entry.js.map +1 -0
  181. package/dist/ui-library/p-4435ff73.entry.js +2 -0
  182. package/dist/ui-library/p-4435ff73.entry.js.map +1 -0
  183. package/dist/ui-library/p-538f3c50.entry.js +2 -0
  184. package/dist/ui-library/p-538f3c50.entry.js.map +1 -0
  185. package/dist/ui-library/p-a457fee8.entry.js +2 -0
  186. package/dist/ui-library/p-a457fee8.entry.js.map +1 -0
  187. package/dist/ui-library/p-ab91c2a9.entry.js +2 -0
  188. package/dist/ui-library/p-ab91c2a9.entry.js.map +1 -0
  189. package/dist/ui-library/p-b57afbe4.entry.js +2 -0
  190. package/dist/ui-library/p-b57afbe4.entry.js.map +1 -0
  191. package/dist/ui-library/p-b6f47c9d.entry.js +2 -0
  192. package/dist/ui-library/p-b6f47c9d.entry.js.map +1 -0
  193. package/dist/ui-library/p-db34a6cc.entry.js +2 -0
  194. package/dist/ui-library/p-db34a6cc.entry.js.map +1 -0
  195. package/dist/ui-library/p-db936ad7.entry.js +2 -0
  196. package/dist/ui-library/{p-d367f4f9.entry.js.map → p-db936ad7.entry.js.map} +1 -1
  197. package/dist/ui-library/p-dc4f41d8.entry.js +2 -0
  198. package/dist/ui-library/p-dc4f41d8.entry.js.map +1 -0
  199. package/dist/ui-library/p-e5020f0d.js +2 -0
  200. package/dist/ui-library/p-e5020f0d.js.map +1 -0
  201. package/dist/ui-library/p-e775dcb4.entry.js +2 -0
  202. package/dist/ui-library/p-e775dcb4.entry.js.map +1 -0
  203. package/dist/ui-library/p-f1dc3a88.entry.js +2 -0
  204. package/dist/ui-library/p-f1dc3a88.entry.js.map +1 -0
  205. package/dist/ui-library/ui-library.esm.js +1 -1
  206. package/dist/ui-library/ui-library.esm.js.map +1 -1
  207. package/package.json +2 -2
  208. package/dist/cjs/form-control-d369af14.js.map +0 -1
  209. package/dist/esm/form-control-32cb533f.js.map +0 -1
  210. package/dist/ui-library/p-02981b91.entry.js +0 -2
  211. package/dist/ui-library/p-02981b91.entry.js.map +0 -1
  212. package/dist/ui-library/p-314b2096.entry.js +0 -2
  213. package/dist/ui-library/p-314b2096.entry.js.map +0 -1
  214. package/dist/ui-library/p-330a4988.entry.js +0 -2
  215. package/dist/ui-library/p-330a4988.entry.js.map +0 -1
  216. package/dist/ui-library/p-3d9de119.entry.js +0 -2
  217. package/dist/ui-library/p-3d9de119.entry.js.map +0 -1
  218. package/dist/ui-library/p-4abed9df.entry.js +0 -2
  219. package/dist/ui-library/p-4abed9df.entry.js.map +0 -1
  220. package/dist/ui-library/p-5d6b7353.entry.js +0 -2
  221. package/dist/ui-library/p-5d6b7353.entry.js.map +0 -1
  222. package/dist/ui-library/p-72254eef.entry.js +0 -2
  223. package/dist/ui-library/p-72254eef.entry.js.map +0 -1
  224. package/dist/ui-library/p-9f0b43f9.entry.js +0 -2
  225. package/dist/ui-library/p-9f0b43f9.entry.js.map +0 -1
  226. package/dist/ui-library/p-b550a258.entry.js +0 -2
  227. package/dist/ui-library/p-b550a258.entry.js.map +0 -1
  228. package/dist/ui-library/p-bf87464b.entry.js +0 -2
  229. package/dist/ui-library/p-bf87464b.entry.js.map +0 -1
  230. package/dist/ui-library/p-d367f4f9.entry.js +0 -2
  231. package/dist/ui-library/p-d42c2025.js +0 -2
  232. package/dist/ui-library/p-d42c2025.js.map +0 -1
  233. package/dist/ui-library/p-ed381ad9.entry.js.map +0 -1
  234. package/dist/ui-library/p-ff90ffd1.entry.js +0 -2
  235. package/dist/ui-library/p-ff90ffd1.entry.js.map +0 -1
@@ -1,18 +1,28 @@
1
1
  import { newSpecPage } from "@stencil/core/testing";
2
2
  import { SixTag } from "../six-tag";
3
3
  describe('six-tag', () => {
4
+ beforeEach(async () => {
5
+ global.ResizeObserver = jest.fn().mockImplementation(() => ({
6
+ observe: jest.fn(),
7
+ unobserve: jest.fn(),
8
+ disconnect: jest.fn(),
9
+ }));
10
+ });
4
11
  it('renders', async () => {
5
12
  const page = await newSpecPage({
6
13
  components: [SixTag],
7
14
  html: `<six-tag size="small">label</six-tag>`,
8
15
  });
9
16
  expect(page.root).toEqualHtml(`
17
+
10
18
  <six-tag size="small" type="primary">
11
19
  <mock:shadow-root>
12
20
  <span class="tag tag--primary tag--small" part="base">
21
+ <six-tooltip>
13
22
  <span class="tag__content" part="content">
14
23
  <slot></slot>
15
24
  </span>
25
+ </six-tooltip>
16
26
  </span>
17
27
  </mock:shadow-root>
18
28
  label
@@ -28,9 +38,11 @@ describe('six-tag', () => {
28
38
  <six-tag clearable="" size="medium" type="primary">
29
39
  <mock:shadow-root>
30
40
  <span class="tag tag--clear tag--medium tag--primary" part="base">
41
+ <six-tooltip>
31
42
  <span class="tag__content" part="content">
32
43
  <slot></slot>
33
44
  </span>
45
+ </six-tooltip>
34
46
  <six-icon-button class="tag__clear" exportparts="base:clear-button" name="clear" size="xSmall"></six-icon-button>
35
47
  </span>
36
48
  </mock:shadow-root>
@@ -1 +1 @@
1
- {"version":3,"file":"six-tag.spec.js","sourceRoot":"","sources":["../../../../src/components/six-tag/test/six-tag.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;EACvB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,MAAM,CAAC;MACpB,IAAI,EAAE,uCAAuC;KAC9C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;KAW7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;IACjC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,MAAM,CAAC;MACpB,IAAI,EAAE,kDAAkD;KACzD,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;KAY7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixTag } from '../six-tag';\n\ndescribe('six-tag', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [SixTag],\n html: `<six-tag size=\"small\">label</six-tag>`,\n });\n expect(page.root).toEqualHtml(`\n <six-tag size=\"small\" type=\"primary\">\n <mock:shadow-root>\n <span class=\"tag tag--primary tag--small\" part=\"base\">\n <span class=\"tag__content\" part=\"content\">\n <slot></slot>\n </span>\n </span>\n </mock:shadow-root>\n label\n </six-tag>\n `);\n });\n\n it('renders clearable', async () => {\n const page = await newSpecPage({\n components: [SixTag],\n html: `<six-tag size=\"medium\" clearable>label</six-tag>`,\n });\n expect(page.root).toEqualHtml(`\n <six-tag clearable=\"\" size=\"medium\" type=\"primary\">\n <mock:shadow-root>\n <span class=\"tag tag--clear tag--medium tag--primary\" part=\"base\">\n <span class=\"tag__content\" part=\"content\">\n <slot></slot>\n </span>\n <six-icon-button class=\"tag__clear\" exportparts=\"base:clear-button\" name=\"clear\" size=\"xSmall\"></six-icon-button>\n </span>\n </mock:shadow-root>\n label\n </six-tag>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"six-tag.spec.js","sourceRoot":"","sources":["../../../../src/components/six-tag/test/six-tag.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;EACvB,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;EACN,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,MAAM,CAAC;MACpB,IAAI,EAAE,uCAAuC;KAC9C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;KAc7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;IACjC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,MAAM,CAAC;MACpB,IAAI,EAAE,kDAAkD;KACzD,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;KAc7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixTag } from '../six-tag';\n\ndescribe('six-tag', () => {\n beforeEach(async () => {\n global.ResizeObserver = jest.fn().mockImplementation(() => ({\n observe: jest.fn(),\n unobserve: jest.fn(),\n disconnect: jest.fn(),\n }));\n });\n\n it('renders', async () => {\n const page = await newSpecPage({\n components: [SixTag],\n html: `<six-tag size=\"small\">label</six-tag>`,\n });\n expect(page.root).toEqualHtml(`\n\n <six-tag size=\"small\" type=\"primary\">\n <mock:shadow-root>\n <span class=\"tag tag--primary tag--small\" part=\"base\">\n <six-tooltip>\n <span class=\"tag__content\" part=\"content\">\n <slot></slot>\n </span>\n </six-tooltip>\n </span>\n </mock:shadow-root>\n label\n </six-tag>\n `);\n });\n\n it('renders clearable', async () => {\n const page = await newSpecPage({\n components: [SixTag],\n html: `<six-tag size=\"medium\" clearable>label</six-tag>`,\n });\n expect(page.root).toEqualHtml(`\n <six-tag clearable=\"\" size=\"medium\" type=\"primary\">\n <mock:shadow-root>\n <span class=\"tag tag--clear tag--medium tag--primary\" part=\"base\">\n <six-tooltip>\n <span class=\"tag__content\" part=\"content\">\n <slot></slot>\n </span>\n </six-tooltip>\n <six-icon-button class=\"tag__clear\" exportparts=\"base:clear-button\" name=\"clear\" size=\"xSmall\"></six-icon-button>\n </span>\n </mock:shadow-root>\n label\n </six-tag>\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;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,I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B,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\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 }\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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 @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,IAAI,GAAG,CAAC,MAAM,WAAW,CAAC;MACxB,UAAU,EAAE,CAAC,WAAW,CAAC;MACzB,IAAI,EAAE,+BAA+B;MACrC,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAA+B,CAAC;IAElC,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,OAAO,IAAI,IAAI,EAAE;MACnB,QAAQ,GAAG,OAAO,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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,EAAE,EAAE;KACtB,CAAC,CAAC,CAAC;IAEJ,IAAI,GAAG,CAAC,MAAM,WAAW,CAAC;MACxB,UAAU,EAAE,CAAC,WAAW,CAAC;MACzB,IAAI,EAAE,+BAA+B;MACrC,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAA+B,CAAC;IAElC,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,OA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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() {
@@ -1 +1 @@
1
- {"version":3,"file":"six-timepicker.js","sourceRoot":"","sources":["../../../src/components/six-timepicker/six-timepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,GAIhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEhH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkBtE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;;;GAQG;AAMH,MAAM,OAAO,aAAa;;IAChB,mBAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IA2RtC,uBAAkB,GAAG,CAAC,KAA8C,EAAE,QAAwB,EAAE,EAAE;MACxG,oGAAoG;MACpG,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;QAC3B,OAAO;OACR;MAED,4BAA4B;MAC5B,6DAA6D;MAC7D,aAAa;MACb,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport { ItemPickerType } from '../six-item-picker/types';\nimport {\n createTimeString,\n getCurrentTime,\n isValidTimeString,\n parseTimeString,\n Time,\n TimeFormat,\n TimeProperties,\n} from '../../utils/time.util';\nimport { debounce, DEFAULT_DEBOUNCE_FAST, DEFAULT_DEBOUNCE_INSANELY_FAST } from '../../utils/execution-control';\nimport { SixItemPickerChangePayload } from '../six-item-picker/six-item-picker';\nimport { EventListeners } from '../../utils/event-listeners';\nimport { hasSlot } from '../../utils/slot';\nimport { EmptyPayload } from '../../utils/types';\nimport { adjustPopupForHoisting, movePopup } from '../../utils/popup';\n\nexport interface SixTimepickerChange {\n value?: Time;\n valueAsString: string;\n changedProperty?: string;\n}\n\ninterface SixTimeUnitPickerParams {\n min?: number;\n max?: number;\n items?: string[];\n type?: ItemPickerType;\n class?: string;\n paddingLength?: number;\n propertyName: TimeProperties;\n}\n\nconst MIN_POPUP_HEIGHT = 145;\n\n/**\n * @since 2.0.0\n * @status experimental\n *\n * @part input - The input field\n * @part container - The container of whole component\n * @part popup - The popup of the timepicker component\n *\n */\n@Component({\n tag: 'six-timepicker',\n styleUrl: 'six-timepicker.scss',\n shadow: true,\n})\nexport class SixTimepicker {\n private eventListeners = new EventListeners();\n private popup?: HTMLElement;\n private wrapper?: HTMLElement;\n private inputElement?: HTMLSixInputElement;\n @Element() host!: HTMLSixTimepickerElement;\n\n /**\n * Define the time format. Valid formats are:\n *\n * HH:mm:ss\n * hh:mm:ss:aa\n * HH:mm:ss:ms\n * hh:mm:ss:ms:aa\n * HH:mm\n * hh:mm:aa\n * HH\n * hh:aa\n * mm\n * ss\n * ms\n *\n * where HH is the 24 hour format\n * and hh is the 12 hour format\n *\n * Please notice that when using the 12-hour-clock (hh)\n * you always need a period indicator (aa). So the time can be parsed as either am or pm\n * */\n @Prop() format: TimeFormat = 'HH:mm:ss';\n\n /**\n * Define the separator to be shown between the time unit pickers.\n * Please be aware that this property will modify the displayed separator only.\n * The separator for a timestring is always expected to be a colon (eg. '13:52:20')\n * */\n @Prop() separator = ':';\n\n /**\n * The value of the timepicker provided as a string. The string mast match the provided format (or default format)\n */\n @Prop({ mutable: true }) value = '';\n\n /** Indicates whether the timepicker dropdown is open on startup. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Indicates whether the timepicker should be shown as an inline (always open) component */\n @Prop({ reflect: true }) inline = false;\n\n /**\n * If `true` the user can only select a time via the timepicker but not directly edit the input field.\n */\n @Prop() readonly = false;\n\n /**\n * If `true` the component is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The enforced placement of the dropdown panel.\n */\n @Prop() placement?: 'top' | 'bottom';\n\n /** Timepicker size. */\n @Prop() size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /**\n * The placeholder defines what text to be shown on the input element\n */\n @Prop() placeholder?: string;\n\n /** The input's error text. Alternatively, you can use the error-text slot. */\n @Prop() errorText = '';\n\n /** The input's label. Alternatively, you can use the label slot. */\n @Prop() label = '';\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 name attribute. */\n @Prop({ reflect: true }) name = '';\n\n /** Set to true to add a clear button when the input is populated. */\n @Prop() clearable = false;\n\n /** Set the position of the icon */\n @Prop() iconPosition: 'left' | 'right' = 'left';\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`.\n */\n @Prop() hoist = false;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger faster switching between timeunits (e.g. hours).\n */\n @Prop() timeout = DEFAULT_DEBOUNCE_FAST;\n\n /**\n * Set the amount of time, in milliseconds, to wait between switching to next timeunit (e.g. next hour) when mouse button is held pressed.\n */\n @Prop() interval = DEFAULT_DEBOUNCE_INSANELY_FAST;\n\n /**\n * The defaultTime defines the default setting for the timepicker when you open the popup. Default time must match the provided format.\n */\n @Prop() defaultTime?: string;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `six-timepicker-change-debounced` event.\n * If you want your change debounce event to not trigger when keeping the nav button pressed before, make sure debounce\n * is a bit bigger than timeout, otherwise keeping the button pressed will trigger the event twice: once you click\n * (and keep pressed) and once you release\n */\n @Prop() debounce = DEFAULT_DEBOUNCE_FAST;\n\n /**\n * Emitted when the timepicker's value changes\n */\n @Event({ eventName: 'six-timepicker-change' }) sixChange!: EventEmitter<SixTimepickerChange>;\n\n /**\n * Emitted when the timepicker's value changes, but debounced\n */\n @Event({ eventName: 'six-timepicker-change-debounced' }) sixChangeDebounced!: EventEmitter<SixTimepickerChange>;\n\n /**\n * Emitted when the clear button is activated.\n */\n @Event({ eventName: 'six-timepicker-clear' }) sixClear!: EventEmitter<EmptyPayload>;\n\n @State() isPopupContentUp = false;\n\n @State() isDropDownContentUp = false;\n\n @Listen('resize', { target: 'window' })\n async resizeHandler() {\n this.calcIsPopupContentUp();\n this.moveOpenHoistedPopup();\n }\n\n @Listen('scroll', { target: 'window' })\n async scrollHandler() {\n this.calcIsPopupContentUp();\n this.moveOpenHoistedPopup();\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.updateValue();\n }\n\n @Watch('invalid')\n protected invalidChanged(invalid: boolean) {\n if (this.inputElement) {\n this.inputElement.invalid = invalid;\n }\n }\n\n /** Sets focus on the datepickers input. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.setFocus(options);\n }\n\n /*\n * Internally the six-timepicker uses a standardized representation of time, so we don't have a mess,\n * when switching between formats\n */\n @State() private popupValue: Time = {};\n\n connectedCallback() {\n this.eventListeners.forward('six-timepicker-change', 'change', this.host);\n }\n\n componentWillLoad() {\n this.updateValue();\n\n if (this.inline) {\n this.open = true;\n }\n\n if (this.open) {\n this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);\n }\n }\n\n componentDidLoad() {\n if (this.inputElement == null) return;\n const inputElement = this.inputElement;\n\n // emit debounced change event\n this.eventListeners.add(\n this.host,\n 'six-timepicker-change',\n debounce((event: Event) => this.sixChangeDebounced.emit((event as CustomEvent).detail), this.debounce)\n );\n\n // update value and popup value based on input-element value\n this.eventListeners.add(\n inputElement,\n 'six-input-input',\n debounce((event: Event) => {\n event.stopPropagation();\n\n // emit empty event if time string is invalid\n if (!isValidTimeString(inputElement.value, this.format)) {\n this.value = inputElement.value;\n this.sixChange.emit({\n value: {},\n valueAsString: '',\n });\n return;\n }\n\n // update value and popup value, and emit the new value\n this.value = inputElement.value;\n this.popupValue = parseTimeString(inputElement.value, this.format);\n this.sixChange.emit({\n value: this.popupValue,\n valueAsString: createTimeString(this.popupValue, this.format),\n });\n }, this.debounce)\n );\n }\n\n componentDidRender() {\n adjustPopupForHoisting(\n this.hoist,\n this.popup,\n this.inputElement,\n this.wrapper,\n MIN_POPUP_HEIGHT,\n (isUp) => (this.isDropDownContentUp = isUp)\n );\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n\n private updateValue() {\n // normalize value\n if (typeof this.value !== 'string' || !isValidTimeString(this.value, this.format)) {\n this.value = '';\n }\n\n // update popup value\n if (this.value === '') {\n if (this.defaultTime == null) {\n this.popupValue = getCurrentTime(this.is24HourClock());\n } else {\n this.popupValue = parseTimeString(this.defaultTime, this.format);\n }\n } else {\n this.popupValue = parseTimeString(this.value, this.format);\n }\n }\n\n private calcIsPopupContentUp() {\n if (this.inputElement == null || this.wrapper == null) {\n return;\n }\n\n const inputBoundingRect = this.inputElement.getBoundingClientRect();\n const wrapperBoundingRect = this.wrapper.getBoundingClientRect();\n const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);\n\n const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;\n this.isPopupContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;\n }\n\n private moveOpenHoistedPopup() {\n movePopup(this.hoist, this.open, this.popup, this.inputElement, this.wrapper, MIN_POPUP_HEIGHT);\n }\n\n private handlePickerChange = (event: CustomEvent<SixItemPickerChangePayload>, property: TimeProperties) => {\n // stop propagation, since the timepicker should not expose the events of the underlying item-picker\n event.stopPropagation();\n if (this.popupValue == null) {\n return;\n }\n\n // update the internal state\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.popupValue[property] = event.detail;\n\n const timeString = createTimeString(this.popupValue, this.format);\n\n // update the input value\n this.value = timeString;\n\n // emit change event\n this.sixChange.emit({\n changedProperty: property,\n value: this.popupValue,\n valueAsString: timeString,\n });\n };\n\n private getSixTimeUnitPicker(params: SixTimeUnitPickerParams) {\n return (\n <six-item-picker\n class={params.class}\n timeout={this.timeout}\n interval={this.interval}\n padded\n min={params.min}\n max={params.max}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n value={this.popupValue[params.propertyName]}\n items={params.items}\n type={params.type || ItemPickerType.NUMBER}\n padding-length={params.paddingLength}\n onSix-item-picker-change={(event) => this.handlePickerChange(event, params.propertyName)}\n ></six-item-picker>\n );\n }\n\n private getHour24Picker() {\n if (!this.is24HourClock()) {\n return;\n }\n return this.getSixTimeUnitPicker({ min: 0, max: 23, propertyName: 'hours' });\n }\n\n private is24HourClock() {\n return this.format.includes('HH');\n }\n\n private getHour12Picker() {\n if (!this.is12HourClock()) {\n return;\n }\n return this.getSixTimeUnitPicker({ min: 0, max: 11, propertyName: 'hours' });\n }\n\n private is12HourClock() {\n return this.format.includes('hh');\n }\n\n private getAmPmPicker() {\n if (!this.is12HourClock()) {\n return;\n }\n const items = ['AM', 'PM'];\n return this.getSixTimeUnitPicker({\n items,\n type: ItemPickerType.CUSTOM,\n propertyName: 'period',\n });\n }\n\n private getMinutePicker() {\n if (!this.format.includes('mm')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: 'minutes' });\n }\n\n private getSecondsPicker() {\n if (!this.format.includes('ss')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: 'seconds' });\n }\n\n private getMillisecondsPicker() {\n if (!this.format.includes('ms')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({\n min: 0,\n max: 999,\n class: 'timepicker__item--wide',\n paddingLength: 3,\n propertyName: 'milliseconds',\n });\n }\n\n private getSeparator() {\n return (\n <div class=\"timepicker__separator\">\n <span>{this.separator}</span>\n </div>\n );\n }\n\n private getContent() {\n const elementsInOrder = [\n this.getHour24Picker(),\n this.getHour12Picker(),\n this.getMinutePicker(),\n this.getSecondsPicker(),\n this.getMillisecondsPicker(),\n ];\n\n const visibleElements = elementsInOrder.filter((el) => el !== undefined);\n\n return visibleElements.map((el, idx) => {\n if (idx === visibleElements.length - 1) {\n return [el];\n }\n\n return [el, this.getSeparator()];\n });\n }\n\n private openPopup() {\n if (!this.open && !this.disabled) {\n this.open = true;\n this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);\n }\n }\n\n private closePopup() {\n if (this.inline) {\n return;\n }\n\n this.open = false;\n this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);\n }\n\n private handleDocumentMouseDown = (event: Event) => {\n // Close when clicking outside the containing element\n const path = event.composedPath() as EventTarget[];\n if (!path.includes(this.host)) {\n this.closePopup();\n return;\n }\n };\n\n private handleClearClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.value = '';\n this.sixClear.emit();\n this.sixChange.emit({\n value: {},\n valueAsString: '',\n });\n };\n\n private renderClearable() {\n return (\n this.clearable && (\n <button\n slot=\"suffix\"\n class={{\n timepicker_clear: true,\n 'timepicker_clear--right': this.iconPosition === 'left',\n 'timepicker_clear--left': this.iconPosition === 'right',\n }}\n type=\"button\"\n onClick={this.handleClearClick}\n tabindex=\"-1\"\n >\n <six-icon size=\"small\">clear</six-icon>\n </button>\n )\n );\n }\n\n private renderCustomIcon() {\n const icon = hasSlot(this.host, 'custom-icon') ? (\n <slot name=\"custom-icon\"></slot>\n ) : (\n <six-icon size={this.size === 'large' ? 'medium' : this.size}>watch_later</six-icon>\n );\n\n return (\n <span\n slot=\"prefix\"\n part=\"icon\"\n class={{\n prefix: true,\n 'prefix--right': this.iconPosition === 'right',\n }}\n >\n {icon}\n </span>\n );\n }\n\n render() {\n return (\n <div part=\"container\" ref={(el) => (this.wrapper = el)} class=\"timepicker__container\">\n <six-input\n ref={(el) => (this.inputElement = el)}\n part=\"input\"\n onClick={() => this.openPopup()}\n value={this.value}\n placeholder={this.placeholder}\n readonly={this.readonly}\n disabled={this.disabled}\n size={this.size}\n name={this.name}\n label={this.label}\n required={this.required}\n error-text={this.errorText}\n class={{\n 'input--empty': this.value === '',\n 'input--hide': this.inline,\n }}\n >\n {this.renderCustomIcon()}\n {this.renderClearable()}\n {hasSlot(this.host, 'label') ? (\n <span slot=\"label\">\n <slot name=\"label\" />\n </span>\n ) : null}\n </six-input>\n {this.open && (\n <div\n ref={(el) => (this.popup = el)}\n part=\"popup\"\n class={{\n timepicker__popup: true,\n 'timepicker__popup--is-up': this.placement == null ? this.placement === 'top' : this.isPopupContentUp,\n 'timepicker__popup--is-inline': this.inline,\n }}\n >\n {...this.getContent()}\n {this.getAmPmPicker()}\n </div>\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-timepicker.js","sourceRoot":"","sources":["../../../src/components/six-timepicker/six-timepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,GAIhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEhH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkBtE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,aAAa;;IAChB,mBAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAuRtC,uBAAkB,GAAG,CAAC,KAA8C,EAAE,QAAwB,EAAE,EAAE;MACxG,oGAAoG;MACpG,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;QAC3B,OAAO;OACR;MAED,4BAA4B;MAC5B,6DAA6D;MAC7D,aAAa;MACb,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;MAEzC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport { ItemPickerType } from '../six-item-picker/types';\nimport {\n createTimeString,\n getCurrentTime,\n isValidTimeString,\n parseTimeString,\n Time,\n TimeFormat,\n TimeProperties,\n} from '../../utils/time.util';\nimport { debounce, DEFAULT_DEBOUNCE_FAST, DEFAULT_DEBOUNCE_INSANELY_FAST } from '../../utils/execution-control';\nimport { SixItemPickerChangePayload } from '../six-item-picker/six-item-picker';\nimport { EventListeners } from '../../utils/event-listeners';\nimport { hasSlot } from '../../utils/slot';\nimport { EmptyPayload } from '../../utils/types';\nimport { adjustPopupForHoisting, movePopup } from '../../utils/popup';\n\nexport interface SixTimepickerChange {\n value?: Time;\n valueAsString: string;\n changedProperty?: string;\n}\n\ninterface SixTimeUnitPickerParams {\n min?: number;\n max?: number;\n items?: string[];\n type?: ItemPickerType;\n class?: string;\n paddingLength?: number;\n propertyName: TimeProperties;\n}\n\nconst MIN_POPUP_HEIGHT = 145;\n\n/**\n * @since 2.0.0\n * @status experimental\n *\n * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.\n *\n * @part input - The input field\n * @part container - The container of whole component\n * @part popup - The popup of the timepicker component\n *\n */\n@Component({\n tag: 'six-timepicker',\n styleUrl: 'six-timepicker.scss',\n shadow: true,\n})\nexport class SixTimepicker {\n private eventListeners = new EventListeners();\n private popup?: HTMLElement;\n private wrapper?: HTMLElement;\n private inputElement?: HTMLSixInputElement;\n\n @Element() host!: HTMLSixTimepickerElement;\n\n /**\n * Define the time format. Valid formats are:\n *\n * HH:mm:ss\n * hh:mm:ss:aa\n * HH:mm:ss:ms\n * hh:mm:ss:ms:aa\n * HH:mm\n * hh:mm:aa\n * HH\n * hh:aa\n * mm\n * ss\n * ms\n *\n * where HH is the 24 hour format\n * and hh is the 12 hour format\n *\n * Please notice that when using the 12-hour-clock (hh)\n * you always need a period indicator (aa). So the time can be parsed as either am or pm\n * */\n @Prop() format: TimeFormat = 'HH:mm:ss';\n\n /**\n * Define the separator to be shown between the time unit pickers.\n * Please be aware that this property will modify the displayed separator only.\n * The separator for a timestring is always expected to be a colon (eg. '13:52:20')\n * */\n @Prop() separator = ':';\n\n /**\n * The value of the timepicker provided as a string. The string mast match the provided format (or default format)\n */\n @Prop({ mutable: true }) value = '';\n\n /** Indicates whether the timepicker dropdown is open on startup. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Indicates whether the timepicker should be shown as an inline (always open) component */\n @Prop({ reflect: true }) inline = false;\n\n /**\n * If `true` the user can only select a time via the timepicker but not directly edit the input field.\n */\n @Prop() readonly = false;\n\n /**\n * If `true` the component is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The enforced placement of the dropdown panel.\n */\n @Prop() placement?: 'top' | 'bottom';\n\n /** Timepicker size. */\n @Prop() size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /**\n * The placeholder defines what text to be shown on the input element\n */\n @Prop() placeholder?: string;\n\n /** The input's error text. Alternatively, you can use the error-text slot. */\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 /** The input's label. Alternatively, you can use the label slot. */\n @Prop() label = '';\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 name attribute. */\n @Prop({ reflect: true }) name = '';\n\n /** Set to true to add a clear button when the input is populated. */\n @Prop() clearable = false;\n\n /** Set the position of the icon */\n @Prop() iconPosition: 'left' | 'right' = 'left';\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`.\n */\n @Prop() hoist = false;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger faster switching between timeunits (e.g. hours).\n */\n @Prop() timeout = DEFAULT_DEBOUNCE_FAST;\n\n /**\n * Set the amount of time, in milliseconds, to wait between switching to next timeunit (e.g. next hour) when mouse button is held pressed.\n */\n @Prop() interval = DEFAULT_DEBOUNCE_INSANELY_FAST;\n\n /**\n * The defaultTime defines the default setting for the timepicker when you open the popup. Default time must match the provided format.\n */\n @Prop() defaultTime?: string;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `six-timepicker-change-debounced` event.\n * If you want your change debounce event to not trigger when keeping the nav button pressed before, make sure debounce\n * is a bit bigger than timeout, otherwise keeping the button pressed will trigger the event twice: once you click\n * (and keep pressed) and once you release\n */\n @Prop() debounce = DEFAULT_DEBOUNCE_FAST;\n\n /**\n * Emitted when the timepicker's value changes\n */\n @Event({ eventName: 'six-timepicker-change' }) sixChange!: EventEmitter<SixTimepickerChange>;\n\n /**\n * Emitted when the timepicker's value changes, but debounced\n */\n @Event({ eventName: 'six-timepicker-change-debounced' }) sixChangeDebounced!: EventEmitter<SixTimepickerChange>;\n\n /**\n * Emitted when the clear button is activated.\n */\n @Event({ eventName: 'six-timepicker-clear' }) sixClear!: EventEmitter<EmptyPayload>;\n\n @State() isPopupContentUp = false;\n\n @State() isDropDownContentUp = false;\n\n @Listen('resize', { target: 'window' })\n async resizeHandler() {\n this.calcIsPopupContentUp();\n this.moveOpenHoistedPopup();\n }\n\n @Listen('scroll', { target: 'window' })\n async scrollHandler() {\n this.calcIsPopupContentUp();\n this.moveOpenHoistedPopup();\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.updateValue();\n }\n\n /** Sets focus on the datepickers input. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.setFocus(options);\n }\n\n /*\n * Internally the six-timepicker uses a standardized representation of time, so we don't have a mess,\n * when switching between formats\n */\n @State() private popupValue: Time = {};\n\n connectedCallback() {\n this.eventListeners.forward('six-timepicker-change', 'change', this.host);\n }\n\n componentWillLoad() {\n this.updateValue();\n\n if (this.inline) {\n this.open = true;\n }\n\n if (this.open) {\n this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);\n }\n }\n\n componentDidLoad() {\n if (this.inputElement == null) return;\n const inputElement = this.inputElement;\n\n // emit debounced change event\n this.eventListeners.add(\n this.host,\n 'six-timepicker-change',\n debounce((event: Event) => this.sixChangeDebounced.emit((event as CustomEvent).detail), this.debounce)\n );\n\n // update value and popup value based on input-element value\n this.eventListeners.add(\n inputElement,\n 'six-input-input',\n debounce((event: Event) => {\n event.stopPropagation();\n\n // emit empty event if time string is invalid\n if (!isValidTimeString(inputElement.value, this.format)) {\n this.value = inputElement.value;\n this.sixChange.emit({\n value: {},\n valueAsString: '',\n });\n return;\n }\n\n // update value and popup value, and emit the new value\n this.value = inputElement.value;\n this.popupValue = parseTimeString(inputElement.value, this.format);\n this.sixChange.emit({\n value: this.popupValue,\n valueAsString: createTimeString(this.popupValue, this.format),\n });\n }, this.debounce)\n );\n }\n\n componentDidRender() {\n adjustPopupForHoisting(\n this.hoist,\n this.popup,\n this.inputElement,\n this.wrapper,\n MIN_POPUP_HEIGHT,\n (isUp) => (this.isDropDownContentUp = isUp)\n );\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n private updateValue() {\n // normalize value\n if (typeof this.value !== 'string' || !isValidTimeString(this.value, this.format)) {\n this.value = '';\n }\n\n // update popup value\n if (this.value === '') {\n if (this.defaultTime == null) {\n this.popupValue = getCurrentTime(this.is24HourClock());\n } else {\n this.popupValue = parseTimeString(this.defaultTime, this.format);\n }\n } else {\n this.popupValue = parseTimeString(this.value, this.format);\n }\n }\n\n private calcIsPopupContentUp() {\n if (this.inputElement == null || this.wrapper == null) {\n return;\n }\n\n const inputBoundingRect = this.inputElement.getBoundingClientRect();\n const wrapperBoundingRect = this.wrapper.getBoundingClientRect();\n const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);\n\n const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;\n this.isPopupContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;\n }\n\n private moveOpenHoistedPopup() {\n movePopup(this.hoist, this.open, this.popup, this.inputElement, this.wrapper, MIN_POPUP_HEIGHT);\n }\n\n private handlePickerChange = (event: CustomEvent<SixItemPickerChangePayload>, property: TimeProperties) => {\n // stop propagation, since the timepicker should not expose the events of the underlying item-picker\n event.stopPropagation();\n if (this.popupValue == null) {\n return;\n }\n\n // update the internal state\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.popupValue[property] = event.detail;\n\n const timeString = createTimeString(this.popupValue, this.format);\n\n // update the input value\n this.value = timeString;\n\n // emit change event\n this.sixChange.emit({\n changedProperty: property,\n value: this.popupValue,\n valueAsString: timeString,\n });\n };\n\n private getSixTimeUnitPicker(params: SixTimeUnitPickerParams) {\n return (\n <six-item-picker\n class={params.class}\n timeout={this.timeout}\n interval={this.interval}\n padded\n min={params.min}\n max={params.max}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n value={this.popupValue[params.propertyName]}\n items={params.items}\n type={params.type || ItemPickerType.NUMBER}\n padding-length={params.paddingLength}\n onSix-item-picker-change={(event) => this.handlePickerChange(event, params.propertyName)}\n ></six-item-picker>\n );\n }\n\n private getHour24Picker() {\n if (!this.is24HourClock()) {\n return;\n }\n return this.getSixTimeUnitPicker({ min: 0, max: 23, propertyName: 'hours' });\n }\n\n private is24HourClock() {\n return this.format.includes('HH');\n }\n\n private getHour12Picker() {\n if (!this.is12HourClock()) {\n return;\n }\n return this.getSixTimeUnitPicker({ min: 0, max: 11, propertyName: 'hours' });\n }\n\n private is12HourClock() {\n return this.format.includes('hh');\n }\n\n private getAmPmPicker() {\n if (!this.is12HourClock()) {\n return;\n }\n const items = ['AM', 'PM'];\n return this.getSixTimeUnitPicker({\n items,\n type: ItemPickerType.CUSTOM,\n propertyName: 'period',\n });\n }\n\n private getMinutePicker() {\n if (!this.format.includes('mm')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: 'minutes' });\n }\n\n private getSecondsPicker() {\n if (!this.format.includes('ss')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: 'seconds' });\n }\n\n private getMillisecondsPicker() {\n if (!this.format.includes('ms')) {\n return;\n }\n\n return this.getSixTimeUnitPicker({\n min: 0,\n max: 999,\n class: 'timepicker__item--wide',\n paddingLength: 3,\n propertyName: 'milliseconds',\n });\n }\n\n private getSeparator() {\n return (\n <div class=\"timepicker__separator\">\n <span>{this.separator}</span>\n </div>\n );\n }\n\n private getContent() {\n const elementsInOrder = [\n this.getHour24Picker(),\n this.getHour12Picker(),\n this.getMinutePicker(),\n this.getSecondsPicker(),\n this.getMillisecondsPicker(),\n ];\n\n const visibleElements = elementsInOrder.filter((el) => el !== undefined);\n\n return visibleElements.map((el, idx) => {\n if (idx === visibleElements.length - 1) {\n return [el];\n }\n\n return [el, this.getSeparator()];\n });\n }\n\n private openPopup() {\n if (!this.open && !this.disabled) {\n this.open = true;\n this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);\n }\n }\n\n private closePopup() {\n if (this.inline) {\n return;\n }\n\n this.open = false;\n this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);\n }\n\n private handleDocumentMouseDown = (event: Event) => {\n // Close when clicking outside the containing element\n const path = event.composedPath() as EventTarget[];\n if (!path.includes(this.host)) {\n this.closePopup();\n return;\n }\n };\n\n private handleClearClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.value = '';\n this.sixClear.emit();\n this.sixChange.emit({\n value: {},\n valueAsString: '',\n });\n };\n\n private renderClearable() {\n return (\n this.clearable && (\n <button\n slot=\"suffix\"\n class={{\n timepicker_clear: true,\n 'timepicker_clear--right': this.iconPosition === 'left',\n 'timepicker_clear--left': this.iconPosition === 'right',\n }}\n type=\"button\"\n onClick={this.handleClearClick}\n tabindex=\"-1\"\n >\n <six-icon size=\"small\">clear</six-icon>\n </button>\n )\n );\n }\n\n private renderCustomIcon() {\n const icon = hasSlot(this.host, 'custom-icon') ? (\n <slot name=\"custom-icon\"></slot>\n ) : (\n <six-icon size={this.size === 'large' ? 'medium' : this.size}>watch_later</six-icon>\n );\n\n return (\n <span\n slot=\"prefix\"\n part=\"icon\"\n class={{\n prefix: true,\n 'prefix--right': this.iconPosition === 'right',\n }}\n >\n {icon}\n </span>\n );\n }\n\n render() {\n return (\n <div part=\"container\" ref={(el) => (this.wrapper = el)} class=\"timepicker__container\">\n <six-input\n ref={(el) => (this.inputElement = el)}\n part=\"input\"\n onClick={() => this.openPopup()}\n value={this.value}\n placeholder={this.placeholder}\n readonly={this.readonly}\n disabled={this.disabled}\n errorTextCount={this.errorTextCount}\n errorText={this.errorText}\n invalid={this.invalid}\n size={this.size}\n name={this.name}\n label={this.label}\n required={this.required}\n class={{\n 'input--empty': this.value === '',\n 'input--hide': this.inline,\n }}\n >\n {this.renderCustomIcon()}\n {this.renderClearable()}\n {hasSlot(this.host, 'label') ? (\n <span slot=\"label\">\n <slot name=\"label\" />\n </span>\n ) : null}\n {hasSlot(this.host, 'error-text') ? (\n <span slot=\"error-text\">\n <slot name=\"error-text\" />\n </span>\n ) : null}\n </six-input>\n {this.open && (\n <div\n ref={(el) => (this.popup = el)}\n part=\"popup\"\n class={{\n timepicker__popup: true,\n 'timepicker__popup--is-up': this.placement == null ? this.placement === 'top' : this.isPopupContentUp,\n 'timepicker__popup--is-inline': this.inline,\n }}\n >\n {...this.getContent()}\n {this.getAmPmPicker()}\n </div>\n )}\n </div>\n );\n }\n}\n"]}