@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
@@ -15,7 +15,7 @@ describe('six-timepicker', () => {
15
15
  <six-timepicker>
16
16
  <mock:shadow-root>
17
17
  <div class="timepicker__container" part="container">
18
- <six-input class="input--empty" error-text="" label="" part="input" size="medium" value="">
18
+ <six-input class="input--empty" errortext="" label="" part="input" size="medium" value="">
19
19
  <span class="prefix" part="icon" slot="prefix">
20
20
  <six-icon size="medium">
21
21
  watch_later
@@ -37,7 +37,7 @@ describe('six-timepicker', () => {
37
37
  <six-timepicker open="">
38
38
  <mock:shadow-root>
39
39
  <div class="timepicker__container" part="container">
40
- <six-input error-text="" label="" part="input" size="medium" value="20:00:00">
40
+ <six-input errortext="" label="" part="input" size="medium" value="20:00:00">
41
41
  <span class="prefix" part="icon" slot="prefix">
42
42
  <six-icon size="medium">
43
43
  watch_later
@@ -77,7 +77,7 @@ describe('six-timepicker', () => {
77
77
  <six-timepicker open="" value="13:20:59">
78
78
  <mock:shadow-root>
79
79
  <div class="timepicker__container" part="container">
80
- <six-input error-text="" label="" part="input" size="medium" value="13:20:59">
80
+ <six-input errortext="" label="" part="input" size="medium" value="13:20:59">
81
81
  <span class="prefix" part="icon" slot="prefix">
82
82
  <six-icon size="medium">
83
83
  watch_later
@@ -117,7 +117,7 @@ describe('six-timepicker', () => {
117
117
  <six-timepicker inline="" open="" value="13:20:59">
118
118
  <mock:shadow-root>
119
119
  <div class="timepicker__container" part="container">
120
- <six-input class="input--hide" error-text="" label="" part="input" size="medium" value="13:20:59">
120
+ <six-input class="input--hide" errortext="" label="" part="input" size="medium" value="13:20:59">
121
121
  <span class="prefix" part="icon" slot="prefix">
122
122
  <six-icon size="medium">
123
123
  watch_later
@@ -157,7 +157,7 @@ describe('six-timepicker', () => {
157
157
  <six-timepicker default-time="13:20:59" open="">
158
158
  <mock:shadow-root>
159
159
  <div class="timepicker__container" part="container">
160
- <six-input class="input--empty" error-text="" label="" part="input" size="medium" value="">
160
+ <six-input class="input--empty" errortext="" label="" part="input" size="medium" value="">
161
161
  <span class="prefix" part="icon" slot="prefix">
162
162
  <six-icon size="medium">
163
163
  watch_later
@@ -197,7 +197,7 @@ describe('six-timepicker', () => {
197
197
  <six-timepicker open="" separator="-" value="11:59:20">
198
198
  <mock:shadow-root>
199
199
  <div class="timepicker__container" part="container">
200
- <six-input error-text="" label="" part="input" size="medium" value="11:59:20">
200
+ <six-input errortext="" label="" part="input" size="medium" value="11:59:20">
201
201
  <span class="prefix" part="icon" slot="prefix">
202
202
  <six-icon size="medium">
203
203
  watch_later
@@ -237,7 +237,7 @@ describe('six-timepicker', () => {
237
237
  <six-timepicker format="hh:mm:ss:aa" open="" value="03:45:20:PM">
238
238
  <mock:shadow-root>
239
239
  <div class="timepicker__container" part="container">
240
- <six-input error-text="" label="" part="input" size="medium" value="03:45:20:PM">
240
+ <six-input errortext="" label="" part="input" size="medium" value="03:45:20:PM">
241
241
  <span class="prefix" part="icon" slot="prefix">
242
242
  <six-icon size="medium">
243
243
  watch_later
@@ -278,7 +278,7 @@ describe('six-timepicker', () => {
278
278
  <six-timepicker interval="150" open="" timeout="500" value="13:20:59">
279
279
  <mock:shadow-root>
280
280
  <div class="timepicker__container" part="container">
281
- <six-input error-text="" label="" part="input" size="medium" value="13:20:59">
281
+ <six-input errortext="" label="" part="input" size="medium" value="13:20:59">
282
282
  <span class="prefix" part="icon" slot="prefix">
283
283
  <six-icon size="medium">
284
284
  watch_later
@@ -318,7 +318,7 @@ describe('six-timepicker', () => {
318
318
  <six-timepicker placeholder="HH:mm:ss">
319
319
  <mock:shadow-root>
320
320
  <div class="timepicker__container" part="container">
321
- <six-input class="input--empty" error-text="" label="" part="input" placeholder="HH:mm:ss" size="medium" value="">
321
+ <six-input class="input--empty" errortext="" label="" part="input" placeholder="HH:mm:ss" size="medium" value="">
322
322
  <span class="prefix" part="icon" slot="prefix">
323
323
  <six-icon size="medium">
324
324
  watch_later
@@ -343,7 +343,7 @@ describe('six-timepicker', () => {
343
343
  <six-timepicker readonly="" value="02:00:00">
344
344
  <mock:shadow-root>
345
345
  <div class="timepicker__container" part="container">
346
- <six-input error-text="" label="" part="input" readonly="" size="medium" value="02:00:00">
346
+ <six-input errortext="" label="" part="input" readonly="" size="medium" value="02:00:00">
347
347
  <span class="prefix" part="icon" slot="prefix">
348
348
  <six-icon size="medium">
349
349
  watch_later
@@ -368,7 +368,7 @@ describe('six-timepicker', () => {
368
368
  <six-timepicker disabled="" value="02:00:00">
369
369
  <mock:shadow-root>
370
370
  <div class="timepicker__container" part="container">
371
- <six-input disabled="" error-text="" label="" part="input" size="medium" value="02:00:00">
371
+ <six-input disabled="" errortext="" label="" part="input" size="medium" value="02:00:00">
372
372
  <span class="prefix" part="icon" slot="prefix">
373
373
  <six-icon size="medium">
374
374
  watch_later
@@ -393,7 +393,7 @@ describe('six-timepicker', () => {
393
393
  <six-timepicker size="small">
394
394
  <mock:shadow-root>
395
395
  <div class="timepicker__container" part="container">
396
- <six-input class="input--empty" error-text="" label="" part="input" size="small" value="">
396
+ <six-input class="input--empty" errortext="" label="" part="input" size="small" value="">
397
397
  <span class="prefix" part="icon" slot="prefix">
398
398
  <six-icon size="small">
399
399
  watch_later
@@ -414,7 +414,7 @@ describe('six-timepicker', () => {
414
414
  <six-timepicker size="small">
415
415
  <mock:shadow-root>
416
416
  <div class="timepicker__container" part="container">
417
- <six-input class="input--empty" error-text="" label="" part="input" size="medium" value="">
417
+ <six-input class="input--empty" errortext="" label="" part="input" size="medium" value="">
418
418
  <span class="prefix" part="icon" slot="prefix">
419
419
  <six-icon size="medium">
420
420
  watch_later
@@ -435,7 +435,7 @@ describe('six-timepicker', () => {
435
435
  <six-timepicker size="small">
436
436
  <mock:shadow-root>
437
437
  <div class="timepicker__container" part="container">
438
- <six-input class="input--empty" error-text="" label="" part="input" size="large" value="">
438
+ <six-input class="input--empty" errortext="" label="" part="input" size="large" value="">
439
439
  <span class="prefix" part="icon" slot="prefix">
440
440
  <six-icon size="medium">
441
441
  watch_later
@@ -460,7 +460,7 @@ describe('six-timepicker', () => {
460
460
  <six-timepicker clearable="" icon-position="right" open="" value="13:20:59">
461
461
  <mock:shadow-root>
462
462
  <div class="timepicker__container" part="container">
463
- <six-input error-text="" label="" part="input" size="medium" value="13:20:59">
463
+ <six-input errortext="" label="" part="input" size="medium" value="13:20:59">
464
464
  <span class="prefix prefix--right" part="icon" slot="prefix">
465
465
  <six-icon size="medium">
466
466
  watch_later
@@ -1 +1 @@
1
- {"version":3,"file":"six-timepicker.spec.js","sourceRoot":"","sources":["../../../../src/components/six-timepicker/test/six-timepicker.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;EAC9B,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;;IAChD,QAAQ;IACR,MAAM,MAAM,GAAG;MACb,UAAU,EAAE,CAAC,aAAa,CAAC;MAC3B,IAAI,EAAE,mCAAmC;KAC1C,CAAC;IAEF,wBAAwB;IACxB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO;IACP,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;IAc9B,CAAC,CAAC;IAEF,6CAA6C;IAC7C,IAAI,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,UAAU,KAAI,IAAI,EAAE;MACjC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;MAC7B,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,0CAAE,KAAK,EAAE,CAAC;KAC1D;IACD,MAAM,IAAI,CAAC,cAAc,EAAE,CA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icker } from '../six-timepicker';\n\ndescribe('six-timepicker', () => {\n it('should render default timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker></six-timepicker>`,\n };\n\n // when initially loaded\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker>\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n\n // when setting a value and opening the popup\n if (page.root?.shadowRoot != null) {\n page.root.value = '20:00:00';\n page.root.shadowRoot.querySelector('six-input')?.click();\n }\n await page.waitForChanges();\n\n // then expect the correct time to be rendered\n expect(page.root).toEqualHtml(`\n<six-timepicker open=\"\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"20:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"0\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"0\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render open timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render inline timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker inline value=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker inline=\"\" open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--hide\" error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup timepicker__popup--is-inline\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render open timepicker with default time', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open default-time=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker default-time=\"13:20:59\" open=\"\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render timepicker with different separator', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"11:59:20\" separator=\"-\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker open=\"\" separator=\"-\" value=\"11:59:20\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"11:59:20\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"11\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n -\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n -\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render timepicker with different format', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"03:45:20:PM\" format=\"hh:mm:ss:aa\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker format=\"hh:mm:ss:aa\" open=\"\" value=\"03:45:20:PM\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"03:45:20:PM\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"11\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"3\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"45\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <six-item-picker interval=\"35\" padded=\"\" timeout=\"300\" type=\"custom\" value=\"PM\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker with adjusted timeout and interval', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\" timeout=\"500\" interval=\"150\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker interval=\"150\" open=\"\" timeout=\"500\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"150\" max=\"23\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"150\" max=\"59\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"150\" max=\"59\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker with placeholder', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker placeholder=\"HH:mm:ss\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker placeholder=\"HH:mm:ss\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" placeholder=\"HH:mm:ss\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render readonly timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker value=\"02:00:00\" readonly></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker readonly=\"\" value=\"02:00:00\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" readonly=\"\" size=\"medium\" value=\"02:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render disabled timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker value=\"02:00:00\" disabled></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker disabled=\"\" value=\"02:00:00\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input disabled=\"\" error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"02:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker in correct sizes', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker size=\"small\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" size=\"small\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"small\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n\n // when changing size\n if (page.root != null) {\n page.root.size = 'medium';\n }\n await page.waitForChanges();\n\n // then expect medium sized timepicker\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n\n // when changing size\n if (page.root != null) {\n page.root.size = 'large';\n }\n await page.waitForChanges();\n\n // then expect medium sized timepicker\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" error-text=\"\" label=\"\" part=\"input\" size=\"large\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render open timepicker with icon on the right', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\" icon-position=\"right\" clearable></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker clearable=\"\" icon-position=\"right\" open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input error-text=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix prefix--right\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n <button class=\"timepicker_clear timepicker_clear--left\" slot=\"suffix\" tabindex=\"-1\" type=\"button\">\n <six-icon size=\"small\">\n clear\n </six-icon>\n </button>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"six-timepicker.spec.js","sourceRoot":"","sources":["../../../../src/components/six-timepicker/test/six-timepicker.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;EAC9B,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;;IAChD,QAAQ;IACR,MAAM,MAAM,GAAG;MACb,UAAU,EAAE,CAAC,aAAa,CAAC;MAC3B,IAAI,EAAE,mCAAmC;KAC1C,CAAC;IAEF,wBAAwB;IACxB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,C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Q;IACR,MAAM,MAAM,GAAG;MACb,UAAU,EAAE,CAAC,aAAa,CAAC;MAC3B,IAAI,EAAE,yFAAyF;KAChG,CAAC;IAEF,OAAO;IACP,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO;IACP,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkC9B,CAAC,CAAC;EACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixTimepicker } from '../six-timepicker';\n\ndescribe('six-timepicker', () => {\n it('should render default timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker></six-timepicker>`,\n };\n\n // when initially loaded\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker>\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n\n // when setting a value and opening the popup\n if (page.root?.shadowRoot != null) {\n page.root.value = '20:00:00';\n page.root.shadowRoot.querySelector('six-input')?.click();\n }\n await page.waitForChanges();\n\n // then expect the correct time to be rendered\n expect(page.root).toEqualHtml(`\n<six-timepicker open=\"\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"20:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"0\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"0\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render open timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render inline timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker inline value=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker inline=\"\" open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--hide\" errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup timepicker__popup--is-inline\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render open timepicker with default time', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open default-time=\"13:20:59\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker default-time=\"13:20:59\" open=\"\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render timepicker with different separator', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"11:59:20\" separator=\"-\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n <six-timepicker open=\"\" separator=\"-\" value=\"11:59:20\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"11:59:20\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"11\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n -\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n -\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n </six-timepicker>\n `);\n });\n\n it('should render timepicker with different format', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"03:45:20:PM\" format=\"hh:mm:ss:aa\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker format=\"hh:mm:ss:aa\" open=\"\" value=\"03:45:20:PM\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"03:45:20:PM\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"11\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"3\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"45\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <six-item-picker interval=\"35\" padded=\"\" timeout=\"300\" type=\"custom\" value=\"PM\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker with adjusted timeout and interval', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\" timeout=\"500\" interval=\"150\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker interval=\"150\" open=\"\" timeout=\"500\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"150\" max=\"23\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"150\" max=\"59\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"150\" max=\"59\" min=\"0\" padded=\"\" timeout=\"500\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker with placeholder', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker placeholder=\"HH:mm:ss\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker placeholder=\"HH:mm:ss\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" placeholder=\"HH:mm:ss\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render readonly timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker value=\"02:00:00\" readonly></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker readonly=\"\" value=\"02:00:00\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" readonly=\"\" size=\"medium\" value=\"02:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render disabled timepicker', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker value=\"02:00:00\" disabled></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker disabled=\"\" value=\"02:00:00\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input disabled=\"\" errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"02:00:00\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render timepicker in correct sizes', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker size=\"small\"></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" size=\"small\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"small\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n\n // when changing size\n if (page.root != null) {\n page.root.size = 'medium';\n }\n await page.waitForChanges();\n\n // then expect medium sized timepicker\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n\n // when changing size\n if (page.root != null) {\n page.root.size = 'large';\n }\n await page.waitForChanges();\n\n // then expect medium sized timepicker\n expect(page.root).toEqualHtml(`\n<six-timepicker size=\"small\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input class=\"input--empty\" errortext=\"\" label=\"\" part=\"input\" size=\"large\" value=\"\">\n <span class=\"prefix\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n </six-input>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n\n it('should render open timepicker with icon on the right', async () => {\n // given\n const config = {\n components: [SixTimepicker],\n html: `<six-timepicker open value=\"13:20:59\" icon-position=\"right\" clearable></six-timepicker>`,\n };\n\n // when\n const page = await newSpecPage(config);\n\n // then\n expect(page.root).toEqualHtml(`\n<six-timepicker clearable=\"\" icon-position=\"right\" open=\"\" value=\"13:20:59\">\n <mock:shadow-root>\n <div class=\"timepicker__container\" part=\"container\">\n <six-input errortext=\"\" label=\"\" part=\"input\" size=\"medium\" value=\"13:20:59\">\n <span class=\"prefix prefix--right\" part=\"icon\" slot=\"prefix\">\n <six-icon size=\"medium\">\n watch_later\n </six-icon>\n </span>\n <button class=\"timepicker_clear timepicker_clear--left\" slot=\"suffix\" tabindex=\"-1\" type=\"button\">\n <six-icon size=\"small\">\n clear\n </six-icon>\n </button>\n </six-input>\n <div class=\"timepicker__popup\" part=\"popup\">\n <six-item-picker interval=\"35\" max=\"23\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"13\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"20\"></six-item-picker>\n <div class=\"timepicker__separator\">\n <span>\n :\n </span>\n </div>\n <six-item-picker interval=\"35\" max=\"59\" min=\"0\" padded=\"\" timeout=\"300\" type=\"number\" value=\"59\"></six-item-picker>\n </div>\n </div>\n </mock:shadow-root>\n</six-timepicker>\n `);\n });\n});\n"]}
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  .tooltip-positioner {
30
- position: absolute;
30
+ position: fixed;
31
31
  z-index: var(--six-z-index-tooltip);
32
32
  pointer-events: none;
33
33
  }
@@ -73,7 +73,7 @@ export class SixTooltip {
73
73
  if (this.tooltipPositioner == null)
74
74
  return;
75
75
  this.target = this.getTarget();
76
- this.popover = new Popover(this.target, this.tooltipPositioner);
76
+ this.popover = new Popover(this.target, this.tooltipPositioner, { strategy: 'fixed' });
77
77
  this.syncOptions();
78
78
  this.host.addEventListener('blur', this.handleBlur, true);
79
79
  this.host.addEventListener('click', this.handleClick, true);
@@ -1 +1 @@
1
- {"version":3,"file":"six-tooltip.js","sourceRoot":"","sources":["../../../src/components/six-tooltip/six-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,UAAU;;IACb,gBAAW,GAAG,WAAW,EAAE,EAAE,EAAE,CAAC;IAChC,cAAS,GAAG,KAAK,CAAC;IAmJlB,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;OACb;IACH,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;OACvC;IACH,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,C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AC,CAAC,CAAC,MAAM;UAEzC,YAAM,IAAI,EAAC,SAAS,IAAE,IAAI,CAAC,OAAO,CAAQ,CACtC,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from '@stencil/core';\nimport Popover from '../../utils/popover';\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 - The tooltip's target element. Only the first element will be used as the target.\n * @slot content - The tooltip's content. Alternatively, you can use the content prop.\n *\n * @part base - The component's base wrapper.\n */\n\n@Component({\n tag: 'six-tooltip',\n styleUrl: 'six-tooltip.scss',\n shadow: true,\n})\nexport class SixTooltip {\n private componentId = `tooltip-${++id}`;\n private isVisible = false;\n private popover?: Popover;\n private tooltipPositioner?: HTMLElement;\n private target?: HTMLElement;\n private tooltip?: HTMLElement;\n\n @Element() host!: HTMLSixTooltipElement;\n\n /** The tooltip's content. Alternatively, you can use the content slot. */\n @Prop() content = '';\n\n /**\n * The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip\n * inside the viewport.\n */\n @Prop() placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /** Set to true to disable the tooltip, so it won't show when triggered. */\n @Prop() disabled = false;\n\n /** The distance in pixels from which to offset the tooltip away from its target. */\n @Prop() distance = 10;\n\n /** Indicates whether the tooltip is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** The distance in pixels from which to offset the tooltip along its target. */\n @Prop() skidding = 0;\n\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @Prop() trigger = 'hover focus';\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n /** Emitted when the tooltip begins to show. Calling `event.preventDefault()` will prevent it from being shown. */\n @Event({ eventName: 'six-tooltip-show' }) sixShow!: EventEmitter<EmptyPayload>;\n\n /** Emitted after the tooltip has shown and all transitions are complete. */\n @Event({ eventName: 'six-tooltip-after-show' }) sixAfterShow!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the tooltip begins to hide. Calling `event.preventDefault()` will prevent it from being hidden. */\n @Event({ eventName: 'six-tooltip-hide' }) sixHide!: EventEmitter<EmptyPayload>;\n\n /** Emitted after the tooltip has hidden and all transitions are complete. */\n @Event({ eventName: 'six-tooltip-after-hide' }) sixAfterHide!: EventEmitter<EmptyPayload>;\n\n componentDidLoad() {\n if (this.tooltipPositioner == null) return;\n this.target = this.getTarget();\n this.popover = new Popover(this.target, this.tooltipPositioner);\n this.syncOptions();\n\n this.host.addEventListener('blur', this.handleBlur, true);\n this.host.addEventListener('click', this.handleClick, true);\n this.host.addEventListener('focus', this.handleFocus, true);\n\n // Show on init if open\n this.tooltipPositioner.hidden = !this.open;\n if (this.open) {\n this.show();\n }\n }\n\n componentDidUpdate() {\n this.syncOptions();\n }\n\n disconnectedCallback() {\n if (this.popover != null) {\n this.popover.destroy();\n }\n\n this.host.removeEventListener('blur', this.handleBlur, true);\n this.host.removeEventListener('click', this.handleClick, true);\n this.host.removeEventListener('focus', this.handleFocus, true);\n }\n\n /** Shows the tooltip. */\n @Method()\n async show() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (this.isVisible || this.disabled) {\n return;\n }\n\n const sixShow = this.sixShow.emit();\n if (sixShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.isVisible = true;\n this.open = true;\n this.popover?.show();\n }\n\n /** Shows the tooltip. */\n @Method()\n async hide() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (!this.isVisible || this.disabled) {\n return;\n }\n\n const sixHide = this.sixHide.emit();\n if (sixHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.isVisible = false;\n this.open = false;\n this.popover?.hide();\n }\n\n private getTarget() {\n // Get the first child that isn't a <style> or content slot\n const target = [...this.host.children].find(\n (el) => el.tagName.toLowerCase() !== 'style' && el.getAttribute('slot') !== 'content'\n ) as HTMLElement;\n\n if (target == null) {\n throw new Error('Invalid tooltip target: no child element was found.');\n }\n\n return target;\n }\n\n private handleBlur = () => {\n if (this.hasTrigger('focus')) {\n this.hide();\n }\n };\n\n private handleClick = () => {\n if (this.hasTrigger('click')) {\n this.open ? this.hide() : this.show();\n }\n };\n\n private handleFocus = () => {\n if (this.hasTrigger('focus')) {\n this.show();\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n // Pressing escape when the target element has focus should dismiss the tooltip\n if (this.open && event.key === 'Escape') {\n event.stopPropagation();\n this.hide();\n }\n };\n\n private handleMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.show();\n }\n };\n\n private handleMouseOut = () => {\n if (this.hasTrigger('hover')) {\n this.hide();\n }\n };\n\n private handleSlotChange = () => {\n const oldTarget = this.target;\n const newTarget = this.getTarget();\n\n if (newTarget !== oldTarget) {\n if (oldTarget != null) {\n oldTarget.removeAttribute('aria-describedby');\n }\n newTarget.setAttribute('aria-describedby', this.componentId);\n }\n };\n\n private hasTrigger(triggerType: string) {\n const triggers = this.trigger.split(' ');\n return triggers.includes(triggerType);\n }\n\n private syncOptions() {\n if (this.popover == null) return;\n\n this.popover.setOptions({\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.tooltip,\n onAfterHide: () => this.sixAfterHide.emit(),\n onAfterShow: () => this.sixAfterShow.emit(),\n });\n }\n\n render() {\n return (\n <Host onKeyDown={this.handleKeyDown} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>\n <slot onSlotchange={this.handleSlotChange} />\n <div ref={(el) => (this.tooltipPositioner = el)} class=\"tooltip-positioner\">\n <div\n part=\"base\"\n ref={(el) => (this.tooltip = el)}\n id={this.componentId}\n class={{\n tooltip: true,\n 'tooltip--open': this.open,\n }}\n role=\"tooltip\"\n aria-hidden={this.open ? 'false' : 'true'}\n >\n <slot name=\"content\">{this.content}</slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-tooltip.js","sourceRoot":"","sources":["../../../src/components/six-tooltip/six-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,UAAU;;IACb,gBAAW,GAAG,WAAW,EAAE,EAAE,EAAE,CAAC;IAChC,cAAS,GAAG,KAAK,CAAC;IAmJlB,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;OACb;IACH,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC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AAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,EAChC,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,KAAK,EAAE;YACL,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,IAAI,CAAC,IAAI;WAC3B,EACD,IAAI,EAAC,SAAS,iBACD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;UAEzC,YAAM,IAAI,EAAC,SAAS,IAAE,IAAI,CAAC,OAAO,CAAQ,CACtC,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from '@stencil/core';\nimport Popover from '../../utils/popover';\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 - The tooltip's target element. Only the first element will be used as the target.\n * @slot content - The tooltip's content. Alternatively, you can use the content prop.\n *\n * @part base - The component's base wrapper.\n */\n\n@Component({\n tag: 'six-tooltip',\n styleUrl: 'six-tooltip.scss',\n shadow: true,\n})\nexport class SixTooltip {\n private componentId = `tooltip-${++id}`;\n private isVisible = false;\n private popover?: Popover;\n private tooltipPositioner?: HTMLElement;\n private target?: HTMLElement;\n private tooltip?: HTMLElement;\n\n @Element() host!: HTMLSixTooltipElement;\n\n /** The tooltip's content. Alternatively, you can use the content slot. */\n @Prop() content = '';\n\n /**\n * The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip\n * inside the viewport.\n */\n @Prop() placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /** Set to true to disable the tooltip, so it won't show when triggered. */\n @Prop() disabled = false;\n\n /** The distance in pixels from which to offset the tooltip away from its target. */\n @Prop() distance = 10;\n\n /** Indicates whether the tooltip is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** The distance in pixels from which to offset the tooltip along its target. */\n @Prop() skidding = 0;\n\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @Prop() trigger = 'hover focus';\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n /** Emitted when the tooltip begins to show. Calling `event.preventDefault()` will prevent it from being shown. */\n @Event({ eventName: 'six-tooltip-show' }) sixShow!: EventEmitter<EmptyPayload>;\n\n /** Emitted after the tooltip has shown and all transitions are complete. */\n @Event({ eventName: 'six-tooltip-after-show' }) sixAfterShow!: EventEmitter<EmptyPayload>;\n\n /** Emitted when the tooltip begins to hide. Calling `event.preventDefault()` will prevent it from being hidden. */\n @Event({ eventName: 'six-tooltip-hide' }) sixHide!: EventEmitter<EmptyPayload>;\n\n /** Emitted after the tooltip has hidden and all transitions are complete. */\n @Event({ eventName: 'six-tooltip-after-hide' }) sixAfterHide!: EventEmitter<EmptyPayload>;\n\n componentDidLoad() {\n if (this.tooltipPositioner == null) return;\n this.target = this.getTarget();\n this.popover = new Popover(this.target, this.tooltipPositioner, { strategy: 'fixed' });\n this.syncOptions();\n\n this.host.addEventListener('blur', this.handleBlur, true);\n this.host.addEventListener('click', this.handleClick, true);\n this.host.addEventListener('focus', this.handleFocus, true);\n\n // Show on init if open\n this.tooltipPositioner.hidden = !this.open;\n if (this.open) {\n this.show();\n }\n }\n\n componentDidUpdate() {\n this.syncOptions();\n }\n\n disconnectedCallback() {\n if (this.popover != null) {\n this.popover.destroy();\n }\n\n this.host.removeEventListener('blur', this.handleBlur, true);\n this.host.removeEventListener('click', this.handleClick, true);\n this.host.removeEventListener('focus', this.handleFocus, true);\n }\n\n /** Shows the tooltip. */\n @Method()\n async show() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (this.isVisible || this.disabled) {\n return;\n }\n\n const sixShow = this.sixShow.emit();\n if (sixShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.isVisible = true;\n this.open = true;\n this.popover?.show();\n }\n\n /** Shows the tooltip. */\n @Method()\n async hide() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (!this.isVisible || this.disabled) {\n return;\n }\n\n const sixHide = this.sixHide.emit();\n if (sixHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.isVisible = false;\n this.open = false;\n this.popover?.hide();\n }\n\n private getTarget() {\n // Get the first child that isn't a <style> or content slot\n const target = [...this.host.children].find(\n (el) => el.tagName.toLowerCase() !== 'style' && el.getAttribute('slot') !== 'content'\n ) as HTMLElement;\n\n if (target == null) {\n throw new Error('Invalid tooltip target: no child element was found.');\n }\n\n return target;\n }\n\n private handleBlur = () => {\n if (this.hasTrigger('focus')) {\n this.hide();\n }\n };\n\n private handleClick = () => {\n if (this.hasTrigger('click')) {\n this.open ? this.hide() : this.show();\n }\n };\n\n private handleFocus = () => {\n if (this.hasTrigger('focus')) {\n this.show();\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n // Pressing escape when the target element has focus should dismiss the tooltip\n if (this.open && event.key === 'Escape') {\n event.stopPropagation();\n this.hide();\n }\n };\n\n private handleMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.show();\n }\n };\n\n private handleMouseOut = () => {\n if (this.hasTrigger('hover')) {\n this.hide();\n }\n };\n\n private handleSlotChange = () => {\n const oldTarget = this.target;\n const newTarget = this.getTarget();\n\n if (newTarget !== oldTarget) {\n if (oldTarget != null) {\n oldTarget.removeAttribute('aria-describedby');\n }\n newTarget.setAttribute('aria-describedby', this.componentId);\n }\n };\n\n private hasTrigger(triggerType: string) {\n const triggers = this.trigger.split(' ');\n return triggers.includes(triggerType);\n }\n\n private syncOptions() {\n if (this.popover == null) return;\n\n this.popover.setOptions({\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.tooltip,\n onAfterHide: () => this.sixAfterHide.emit(),\n onAfterShow: () => this.sixAfterShow.emit(),\n });\n }\n\n render() {\n return (\n <Host onKeyDown={this.handleKeyDown} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>\n <slot onSlotchange={this.handleSlotChange} />\n <div ref={(el) => (this.tooltipPositioner = el)} class=\"tooltip-positioner\">\n <div\n part=\"base\"\n ref={(el) => (this.tooltip = el)}\n id={this.componentId}\n class={{\n tooltip: true,\n 'tooltip--open': this.open,\n }}\n role=\"tooltip\"\n aria-hidden={this.open ? 'false' : 'true'}\n >\n <slot name=\"content\">{this.content}</slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1,8 +1,10 @@
1
1
  import { h } from "@stencil/core";
2
2
  const FormControl = (props, children) => {
3
- var _a, _b, _c, _d, _e, _f;
3
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4
+ const errorMessages = (Array.isArray(props.errorText) ? props.errorText : [props.errorText]).filter((text) => text != null && text.trim() !== '');
4
5
  const hasLabel = props.label != null && props.label.trim() !== '' ? true : (_a = props.hasLabelSlot) !== null && _a !== void 0 ? _a : false;
5
6
  const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : (_b = props.hasHelpTextSlot) !== null && _b !== void 0 ? _b : false;
7
+ const hasErrorText = (errorMessages.length > 0 || ((_c = props.hasErrorTextSlot) !== null && _c !== void 0 ? _c : false)) && ((_d = props.displayError) !== null && _d !== void 0 ? _d : false);
6
8
  return (h("div", { part: "form-control", class: {
7
9
  'form-control': true,
8
10
  'form-control--small': props.size === 'small',
@@ -10,13 +12,13 @@ const FormControl = (props, children) => {
10
12
  'form-control--large': props.size === 'large',
11
13
  'form-control--has-label': hasLabel,
12
14
  'form-control--has-help-text': hasHelpText,
13
- 'form-control--has-error-text': (_c = props.displayError) !== null && _c !== void 0 ? _c : false,
14
- 'form-control--disabled': (_d = props.disabled) !== null && _d !== void 0 ? _d : false,
15
- 'form-control--invalid': ((_e = props.displayError) !== null && _e !== void 0 ? _e : false) && !props.disabled,
15
+ 'form-control--has-error-text': hasErrorText,
16
+ 'form-control--disabled': (_e = props.disabled) !== null && _e !== void 0 ? _e : false,
17
+ 'form-control--invalid': ((_f = props.displayError) !== null && _f !== void 0 ? _f : false) && !props.disabled,
16
18
  } }, h("label", { part: "label", id: props.labelId, class: {
17
19
  'form-control__label': true,
18
- 'form-control__label__required': (_f = props.required) !== null && _f !== void 0 ? _f : false,
19
- }, htmlFor: props.inputId, "aria-hidden": hasLabel ? 'false' : 'true', onClick: props.onLabelClick }, h("slot", { name: "label" }, props.label)), h("div", { class: "form-control__input" }, children), h("div", { part: "error-text", id: props.errorTextId, class: "form-control__error-text", "aria-hidden": props.displayError ? 'false' : 'true' }, props.errorText), h("div", { part: "help-text", id: props.helpTextId, class: "form-control__help-text", "aria-hidden": hasHelpText ? 'false' : 'true' }, h("slot", { name: "help-text" }, props.helpText))));
20
+ 'form-control__label__required': (_g = props.required) !== null && _g !== void 0 ? _g : false,
21
+ }, htmlFor: props.inputId, "aria-hidden": hasLabel ? 'false' : 'true', onClick: props.onLabelClick }, h("slot", { name: "label" }, props.label)), h("div", { class: "form-control__input" }, children), h("div", { part: "error-text", id: props.errorTextId, class: "form-control__error-text", "aria-hidden": hasErrorText ? 'false' : 'true' }, h("slot", { name: "error-text" }, errorMessages.slice(0, (_h = props.errorTextCount) !== null && _h !== void 0 ? _h : 1).map((text) => (h("six-error", null, text))))), h("div", { part: "help-text", id: props.helpTextId, class: "form-control__help-text", "aria-hidden": hasHelpText ? 'false' : 'true' }, h("slot", { name: "help-text" }, props.helpText))));
20
22
  };
21
23
  export default FormControl;
22
24
  //# sourceMappingURL=form-control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-control.js","sourceRoot":"","sources":["../../../src/functional-components/form-control/form-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAS,MAAM,eAAe,CAAC;AA8CzC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,QAAiB,EAAE,EAAE;;EACjE,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK,CAAC;EACvG,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,eAAe,mCAAI,KAAK,CAAC;EAEnH,OAAO,CACL,WACE,IAAI,EAAC,cAAc,EACnB,KAAK,EAAE;MACL,cAAc,EAAE,IAAI;MACpB,qBAAqB,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO;MAC7C,sBAAsB,EAAE,KAAK,CAAC,IAAI,KAAK,QAAQ;MAC/C,qBAAqB,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO;MAC7C,yBAAyB,EAAE,QAAQ;MACnC,6BAA6B,EAAE,WAAW;MAC1C,8BAA8B,EAAE,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK;MAC3D,wBAAwB,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,KAAK;MACjD,uBAAuB,EAAE,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;KAC1E;IAED,aACE,IAAI,EAAC,OAAO,EACZ,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,KAAK,EAAE;QACL,qBAAqB,EAAE,IAAI;QAC3B,+BAA+B,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,KAAK;OACzD,EACD,OAAO,EAAE,KAAK,CAAC,OAAO,iBACT,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EACxC,OAAO,EAAE,KAAK,CAAC,YAAY;MAE3B,YAAM,IAAI,EAAC,OAAO,IAAE,KAAK,CAAC,KAAK,CAAQ,CACjC;IAER,WAAK,KAAK,EAAC,qBAAqB,IAAE,QAAQ,CAAO;IAEjD,WACE,IAAI,EAAC,YAAY,EACjB,EAAE,EAAE,KAAK,CAAC,WAAW,EACrB,KAAK,EAAC,0BAA0B,iBACnB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,IAEjD,KAAK,CAAC,SAAS,CACZ;IAEN,WACE,IAAI,EAAC,WAAW,EAChB,EAAE,EAAE,KAAK,CAAC,UAAU,EACpB,KAAK,EAAC,yBAAyB,iBAClB,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;MAE3C,YAAM,IAAI,EAAC,WAAW,IAAE,KAAK,CAAC,QAAQ,CAAQ,CAC1C,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { h, VNode } from '@stencil/core';\n\nexport interface FormControlProps {\n /** The input id, used to map the input to the label */\n inputId: string;\n\n /** The size of the form control */\n size: 'small' | 'medium' | 'large';\n\n /** The label id, used to map the label to the input */\n labelId?: string;\n\n /** The label text (if the label slot isn't used) */\n label?: string;\n\n /** Whether a label slot has been provided. */\n hasLabelSlot?: boolean;\n\n /** The help text id, used to map the input to the help text */\n helpTextId?: string;\n\n /** The help text (if the help-text slot isn't used) */\n helpText?: string;\n\n /** Whether a help text slot has been provided. */\n hasHelpTextSlot?: boolean;\n\n /** The error text id, used to map the input to the help text */\n errorTextId?: string;\n\n /** The error text */\n errorText?: string;\n\n /** Set to true to disable the input. */\n disabled?: boolean;\n\n /** Set if the value is required. */\n required?: boolean;\n\n /** Set if the error text is displayed. */\n displayError?: boolean;\n\n /** A function that gets called when the label is clicked. */\n onLabelClick?: (event: MouseEvent) => void;\n}\n\nconst FormControl = (props: FormControlProps, children: VNode[]) => {\n const hasLabel = props.label != null && props.label.trim() !== '' ? true : props.hasLabelSlot ?? false;\n const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : props.hasHelpTextSlot ?? false;\n\n return (\n <div\n part=\"form-control\"\n class={{\n 'form-control': true,\n 'form-control--small': props.size === 'small',\n 'form-control--medium': props.size === 'medium',\n 'form-control--large': props.size === 'large',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'form-control--has-error-text': props.displayError ?? false,\n 'form-control--disabled': props.disabled ?? false,\n 'form-control--invalid': (props.displayError ?? false) && !props.disabled,\n }}\n >\n <label\n part=\"label\"\n id={props.labelId}\n class={{\n 'form-control__label': true,\n 'form-control__label__required': props.required ?? false,\n }}\n htmlFor={props.inputId}\n aria-hidden={hasLabel ? 'false' : 'true'}\n onClick={props.onLabelClick}\n >\n <slot name=\"label\">{props.label}</slot>\n </label>\n\n <div class=\"form-control__input\">{children}</div>\n\n <div\n part=\"error-text\"\n id={props.errorTextId}\n class=\"form-control__error-text\"\n aria-hidden={props.displayError ? 'false' : 'true'}\n >\n {props.errorText}\n </div>\n\n <div\n part=\"help-text\"\n id={props.helpTextId}\n class=\"form-control__help-text\"\n aria-hidden={hasHelpText ? 'false' : 'true'}\n >\n <slot name=\"help-text\">{props.helpText}</slot>\n </div>\n </div>\n );\n};\n\nexport default FormControl;\n"]}
1
+ {"version":3,"file":"form-control.js","sourceRoot":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AE3C,YAAM,IAAI,EAAC,WAAW,IAAE,KAAK,CAAC,QAAQ,CAAQ,CAC1C,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { h, VNode } from '@stencil/core';\n\nexport interface FormControlProps {\n /** The input id, used to map the input to the label */\n inputId: string;\n\n /** The size of the form control */\n size: 'small' | 'medium' | 'large';\n\n /** The label id, used to map the label to the input */\n labelId?: string;\n\n /** The label text (if the label slot isn't used) */\n label?: string;\n\n /** Whether a label slot has been provided. */\n hasLabelSlot?: boolean;\n\n /** The help text id, used to map the input to the help text */\n helpTextId?: string;\n\n /** The help text (if the help-text slot isn't used) */\n helpText?: string;\n\n /** Whether a help text slot has been provided. */\n hasHelpTextSlot?: boolean;\n\n /** Whether an error text slot has been provided. */\n hasErrorTextSlot?: boolean;\n\n /** The error text id, used to map the input to the help text */\n errorTextId?: string;\n\n /** The error text (if the error-text slot isn't used) */\n 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 errorTextCount?: number;\n\n /** Set to true to disable the input. */\n disabled?: boolean;\n\n /** Set if the value is required. */\n required?: boolean;\n\n /** Set if the error text is displayed. */\n displayError?: boolean;\n\n /** A function that gets called when the label is clicked. */\n onLabelClick?: (event: MouseEvent) => void;\n}\n\nconst FormControl = (props: FormControlProps, children: VNode[]) => {\n const errorMessages = (Array.isArray(props.errorText) ? props.errorText : [props.errorText]).filter(\n (text) => text != null && text.trim() !== ''\n );\n\n const hasLabel = props.label != null && props.label.trim() !== '' ? true : props.hasLabelSlot ?? false;\n const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : props.hasHelpTextSlot ?? false;\n const hasErrorText = (errorMessages.length > 0 || (props.hasErrorTextSlot ?? false)) && (props.displayError ?? false);\n\n return (\n <div\n part=\"form-control\"\n class={{\n 'form-control': true,\n 'form-control--small': props.size === 'small',\n 'form-control--medium': props.size === 'medium',\n 'form-control--large': props.size === 'large',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'form-control--has-error-text': hasErrorText,\n 'form-control--disabled': props.disabled ?? false,\n 'form-control--invalid': (props.displayError ?? false) && !props.disabled,\n }}\n >\n <label\n part=\"label\"\n id={props.labelId}\n class={{\n 'form-control__label': true,\n 'form-control__label__required': props.required ?? false,\n }}\n htmlFor={props.inputId}\n aria-hidden={hasLabel ? 'false' : 'true'}\n onClick={props.onLabelClick}\n >\n <slot name=\"label\">{props.label}</slot>\n </label>\n\n <div class=\"form-control__input\">{children}</div>\n\n <div\n part=\"error-text\"\n id={props.errorTextId}\n class=\"form-control__error-text\"\n aria-hidden={hasErrorText ? 'false' : 'true'}\n >\n <slot name=\"error-text\">\n {errorMessages.slice(0, props.errorTextCount ?? 1).map((text) => (\n <six-error>{text}</six-error>\n ))}\n </slot>\n </div>\n\n <div\n part=\"help-text\"\n id={props.helpTextId}\n class=\"form-control__help-text\"\n aria-hidden={hasHelpText ? 'false' : 'true'}\n >\n <slot name=\"help-text\">{props.helpText}</slot>\n </div>\n </div>\n );\n};\n\nexport default FormControl;\n"]}
@@ -1,9 +1,11 @@
1
1
  import { h } from '@stencil/core/internal/client';
2
2
 
3
3
  const FormControl = (props, children) => {
4
- var _a, _b, _c, _d, _e, _f;
4
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5
+ const errorMessages = (Array.isArray(props.errorText) ? props.errorText : [props.errorText]).filter((text) => text != null && text.trim() !== '');
5
6
  const hasLabel = props.label != null && props.label.trim() !== '' ? true : (_a = props.hasLabelSlot) !== null && _a !== void 0 ? _a : false;
6
7
  const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : (_b = props.hasHelpTextSlot) !== null && _b !== void 0 ? _b : false;
8
+ const hasErrorText = (errorMessages.length > 0 || ((_c = props.hasErrorTextSlot) !== null && _c !== void 0 ? _c : false)) && ((_d = props.displayError) !== null && _d !== void 0 ? _d : false);
7
9
  return (h("div", { part: "form-control", class: {
8
10
  'form-control': true,
9
11
  'form-control--small': props.size === 'small',
@@ -11,17 +13,18 @@ const FormControl = (props, children) => {
11
13
  'form-control--large': props.size === 'large',
12
14
  'form-control--has-label': hasLabel,
13
15
  'form-control--has-help-text': hasHelpText,
14
- 'form-control--has-error-text': (_c = props.displayError) !== null && _c !== void 0 ? _c : false,
15
- 'form-control--disabled': (_d = props.disabled) !== null && _d !== void 0 ? _d : false,
16
- 'form-control--invalid': ((_e = props.displayError) !== null && _e !== void 0 ? _e : false) && !props.disabled,
16
+ 'form-control--has-error-text': hasErrorText,
17
+ 'form-control--disabled': (_e = props.disabled) !== null && _e !== void 0 ? _e : false,
18
+ 'form-control--invalid': ((_f = props.displayError) !== null && _f !== void 0 ? _f : false) && !props.disabled,
17
19
  } },
18
20
  h("label", { part: "label", id: props.labelId, class: {
19
21
  'form-control__label': true,
20
- 'form-control__label__required': (_f = props.required) !== null && _f !== void 0 ? _f : false,
22
+ 'form-control__label__required': (_g = props.required) !== null && _g !== void 0 ? _g : false,
21
23
  }, htmlFor: props.inputId, "aria-hidden": hasLabel ? 'false' : 'true', onClick: props.onLabelClick },
22
24
  h("slot", { name: "label" }, props.label)),
23
25
  h("div", { class: "form-control__input" }, children),
24
- h("div", { part: "error-text", id: props.errorTextId, class: "form-control__error-text", "aria-hidden": props.displayError ? 'false' : 'true' }, props.errorText),
26
+ h("div", { part: "error-text", id: props.errorTextId, class: "form-control__error-text", "aria-hidden": hasErrorText ? 'false' : 'true' },
27
+ h("slot", { name: "error-text" }, errorMessages.slice(0, (_h = props.errorTextCount) !== null && _h !== void 0 ? _h : 1).map((text) => (h("six-error", null, text))))),
25
28
  h("div", { part: "help-text", id: props.helpTextId, class: "form-control__help-text", "aria-hidden": hasHelpText ? 'false' : 'true' },
26
29
  h("slot", { name: "help-text" }, props.helpText))));
27
30
  };
@@ -1 +1 @@
1
- {"file":"form-control.js","mappings":";;MA8CM,WAAW,GAAG,CAAC,KAAuB,EAAE,QAAiB;;EAC7D,MAAM,QAAQ,GAAG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D,WACE,IAAI,EAAC,YAAY,EACjB,EAAE,EAAE,KAAK,CAAC,WAAW,EACrB,KAAK,EAAC,0BAA0B,iBACnB,KAAK,CAAC,YAAY,GAAG,OAAO,GAAG,MAAM,IAEjD,KAAK,CAAC,SAAS,CACZ;IAEN,WACE,IAAI,EAAC,WAAW,EAChB,EAAE,EAAE,KAAK,CAAC,UAAU,EACpB,KAAK,EAAC,yBAAyB,iBAClB,WAAW,GAAG,OAAO,GAAG,MAAM;MAE3C,YAAM,IAAI,EAAC,WAAW,IAAE,KAAK,CAAC,QAAQ,CAAQ,CAC1C,CACF,EACN;AACJ;;;;","names":[],"sources":["src/functional-components/form-control/form-control.tsx"],"sourcesContent":["import { h, VNode } from '@stencil/core';\n\nexport interface FormControlProps {\n /** The input id, used to map the input to the label */\n inputId: string;\n\n /** The size of the form control */\n size: 'small' | 'medium' | 'large';\n\n /** The label id, used to map the label to the input */\n labelId?: string;\n\n /** The label text (if the label slot isn't used) */\n label?: string;\n\n /** Whether a label slot has been provided. */\n hasLabelSlot?: boolean;\n\n /** The help text id, used to map the input to the help text */\n helpTextId?: string;\n\n /** The help text (if the help-text slot isn't used) */\n helpText?: string;\n\n /** Whether a help text slot has been provided. */\n hasHelpTextSlot?: boolean;\n\n /** The error text id, used to map the input to the help text */\n errorTextId?: string;\n\n /** The error text */\n errorText?: string;\n\n /** Set to true to disable the input. */\n disabled?: boolean;\n\n /** Set if the value is required. */\n required?: boolean;\n\n /** Set if the error text is displayed. */\n displayError?: boolean;\n\n /** A function that gets called when the label is clicked. */\n onLabelClick?: (event: MouseEvent) => void;\n}\n\nconst FormControl = (props: FormControlProps, children: VNode[]) => {\n const hasLabel = props.label != null && props.label.trim() !== '' ? true : props.hasLabelSlot ?? false;\n const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : props.hasHelpTextSlot ?? false;\n\n return (\n <div\n part=\"form-control\"\n class={{\n 'form-control': true,\n 'form-control--small': props.size === 'small',\n 'form-control--medium': props.size === 'medium',\n 'form-control--large': props.size === 'large',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'form-control--has-error-text': props.displayError ?? false,\n 'form-control--disabled': props.disabled ?? false,\n 'form-control--invalid': (props.displayError ?? false) && !props.disabled,\n }}\n >\n <label\n part=\"label\"\n id={props.labelId}\n class={{\n 'form-control__label': true,\n 'form-control__label__required': props.required ?? false,\n }}\n htmlFor={props.inputId}\n aria-hidden={hasLabel ? 'false' : 'true'}\n onClick={props.onLabelClick}\n >\n <slot name=\"label\">{props.label}</slot>\n </label>\n\n <div class=\"form-control__input\">{children}</div>\n\n <div\n part=\"error-text\"\n id={props.errorTextId}\n class=\"form-control__error-text\"\n aria-hidden={props.displayError ? 'false' : 'true'}\n >\n {props.errorText}\n </div>\n\n <div\n part=\"help-text\"\n id={props.helpTextId}\n class=\"form-control__help-text\"\n aria-hidden={hasHelpText ? 'false' : 'true'}\n >\n <slot name=\"help-text\">{props.helpText}</slot>\n </div>\n </div>\n );\n};\n\nexport default FormControl;\n"],"version":3}
1
+ {"file":"form-control.js","mappings":";;MAoDM,WAAW,GAAG,CAAC,KAAuB,EAAE,QAAiB;;EAC7D,MAAM,aAAa,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,CACjG,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAC7C,CAAC;EAEF,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,GAAG,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK,CAAC;EACvG,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,EA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,OAAO,GAAG,MAAM;MAE5C,YAAM,IAAI,EAAC,YAAY,IACpB,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,MAAA,KAAK,CAAC,cAAc,mCAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAC1D,qBAAY,IAAI,CAAa,CAC9B,CAAC,CACG,CACH;IAEN,WACE,IAAI,EAAC,WAAW,EAChB,EAAE,EAAE,KAAK,CAAC,UAAU,EACpB,KAAK,EAAC,yBAAyB,iBAClB,WAAW,GAAG,OAAO,GAAG,MAAM;MAE3C,YAAM,IAAI,EAAC,WAAW,IAAE,KAAK,CAAC,QAAQ,CAAQ,CAC1C,CACF,EACN;AACJ;;;;","names":[],"sources":["src/functional-components/form-control/form-control.tsx"],"sourcesContent":["import { h, VNode } from '@stencil/core';\n\nexport interface FormControlProps {\n /** The input id, used to map the input to the label */\n inputId: string;\n\n /** The size of the form control */\n size: 'small' | 'medium' | 'large';\n\n /** The label id, used to map the label to the input */\n labelId?: string;\n\n /** The label text (if the label slot isn't used) */\n label?: string;\n\n /** Whether a label slot has been provided. */\n hasLabelSlot?: boolean;\n\n /** The help text id, used to map the input to the help text */\n helpTextId?: string;\n\n /** The help text (if the help-text slot isn't used) */\n helpText?: string;\n\n /** Whether a help text slot has been provided. */\n hasHelpTextSlot?: boolean;\n\n /** Whether an error text slot has been provided. */\n hasErrorTextSlot?: boolean;\n\n /** The error text id, used to map the input to the help text */\n errorTextId?: string;\n\n /** The error text (if the error-text slot isn't used) */\n 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 errorTextCount?: number;\n\n /** Set to true to disable the input. */\n disabled?: boolean;\n\n /** Set if the value is required. */\n required?: boolean;\n\n /** Set if the error text is displayed. */\n displayError?: boolean;\n\n /** A function that gets called when the label is clicked. */\n onLabelClick?: (event: MouseEvent) => void;\n}\n\nconst FormControl = (props: FormControlProps, children: VNode[]) => {\n const errorMessages = (Array.isArray(props.errorText) ? props.errorText : [props.errorText]).filter(\n (text) => text != null && text.trim() !== ''\n );\n\n const hasLabel = props.label != null && props.label.trim() !== '' ? true : props.hasLabelSlot ?? false;\n const hasHelpText = props.helpText != null && props.helpText.trim() !== '' ? true : props.hasHelpTextSlot ?? false;\n const hasErrorText = (errorMessages.length > 0 || (props.hasErrorTextSlot ?? false)) && (props.displayError ?? false);\n\n return (\n <div\n part=\"form-control\"\n class={{\n 'form-control': true,\n 'form-control--small': props.size === 'small',\n 'form-control--medium': props.size === 'medium',\n 'form-control--large': props.size === 'large',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'form-control--has-error-text': hasErrorText,\n 'form-control--disabled': props.disabled ?? false,\n 'form-control--invalid': (props.displayError ?? false) && !props.disabled,\n }}\n >\n <label\n part=\"label\"\n id={props.labelId}\n class={{\n 'form-control__label': true,\n 'form-control__label__required': props.required ?? false,\n }}\n htmlFor={props.inputId}\n aria-hidden={hasLabel ? 'false' : 'true'}\n onClick={props.onLabelClick}\n >\n <slot name=\"label\">{props.label}</slot>\n </label>\n\n <div class=\"form-control__input\">{children}</div>\n\n <div\n part=\"error-text\"\n id={props.errorTextId}\n class=\"form-control__error-text\"\n aria-hidden={hasErrorText ? 'false' : 'true'}\n >\n <slot name=\"error-text\">\n {errorMessages.slice(0, props.errorTextCount ?? 1).map((text) => (\n <six-error>{text}</six-error>\n ))}\n </slot>\n </div>\n\n <div\n part=\"help-text\"\n id={props.helpTextId}\n class=\"form-control__help-text\"\n aria-hidden={hasHelpText ? 'false' : 'true'}\n >\n <slot name=\"help-text\">{props.helpText}</slot>\n </div>\n </div>\n );\n};\n\nexport default FormControl;\n"],"version":3}
@@ -10,6 +10,7 @@ import { SixDetails } from './six-details.js';
10
10
  import { SixDialog } from './six-dialog.js';
11
11
  import { SixDrawer } from './six-drawer.js';
12
12
  import { SixDropdown } from './six-dropdown.js';
13
+ import { SixError } from './six-error.js';
13
14
  import { SixErrorPage } from './six-error-page.js';
14
15
  import { SixFileList } from './six-file-list.js';
15
16
  import { SixFileListItem } from './six-file-list-item.js';
@@ -158,6 +159,7 @@ const defineCustomElements = (opts) => {
158
159
  SixDialog,
159
160
  SixDrawer,
160
161
  SixDropdown,
162
+ SixError,
161
163
  SixErrorPage,
162
164
  SixFileList,
163
165
  SixFileListItem,
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAgBpD;;;SAGgB,eAAe,CAAC,QAAkB,EAAE,KAAsB;EACxE,IAAI;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,QAAQ,KAAK,CAAC,GAAG;MACf,KAAK,UAAU,CAAC;MAChB,KAAK,cAAc,CAAC;MACpB,KAAK,OAAO;QACV,OAAO,OAAO,CAAC;MACjB,KAAK,WAAW,CAAC;MACjB,KAAK,WAAW;QACd,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;MAC3E,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;MACrE,KAAK,KAAK;QACR,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;MACrD,KAAK,KAAK;QACR,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;MACrD,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC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AAG,EAAE,2DAA2D;IAChE,YAAY,EAAE,mCAAmC;IACjD,OAAO,EAAE,2DAA2D;IACpE,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,yCAAyC;GACvD;EACD,EAAE,EAAE;IACF,QAAQ,EAAE,qCAAqC;IAC/C,SAAS,EAAE,yDAAyD;IACpE,SAAS,EAAE,6DAA6D;IACxE,OAAO,EAAE,uEAAuE;IAChF,KAAK,EAAE,iDAAiD;IACxD,GAAG,EAAE,2DAA2D;IAChE,GAAG,EAAE,yDAAyD;IAC9D,YAAY,EAAE,oCAAoC;IAClD,OAAO,EAAE,0DAA0D;IACnE,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,4BAA4B;GAC1C;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/error-messages.ts"],"sourcesContent":["export type Language = 'de' | 'fr' | 'it' | 'en';\n\nconst dateFormat = new Intl.DateTimeFormat('de-CH');\n\nexport type ValidationError =\n | { key: 'required' }\n | { key: 'requiredtrue' }\n | { key: 'email'; requiredPattern: string }\n | { key: 'minlength'; requiredLength: number }\n | { key: 'maxlength'; requiredLength: number }\n | { key: 'pattern'; requiredPattern: string }\n | { key: 'min'; min: number }\n | { key: 'max'; max: number }\n | { key: 'mindate'; mindate: Date; actual: Date }\n | { key: 'maxdate'; maxdate: Date; actual: Date }\n | { key: 'invaliddate'; actual: Date }\n | { key: 'custom'; text: string };\n\n/**\n * Returns an error message for the given language and error.\n */\nexport function getErrorMessage(language: Language, error: ValidationError): string | undefined {\n try {\n const message = translation[language][error.key];\n switch (error.key) {\n case 'required':\n case 'requiredtrue':\n case 'email':\n return message;\n case 'minlength':\n case 'maxlength':\n return message.replace('{requiredLength}', String(error.requiredLength));\n case 'pattern':\n return message.replace('{pattern}', String(error.requiredPattern));\n case 'min':\n return message.replace('{min}', String(error.min));\n case 'max':\n return message.replace('{max}', String(error.max));\n case 'mindate':\n return message.replace('{mindate}', dateFormat.format(error.mindate));\n case 'maxdate':\n return message.replace('{maxdate}', dateFormat.format(error.maxdate));\n case 'invaliddate':\n return message;\n case 'custom':\n return error.text;\n }\n } catch (e) {\n console.warn(`no error message in '${language}' for error:`, error);\n return undefined;\n }\n}\n\nconst translation: Record<Language, Record<string, string>> = {\n en: {\n required: 'Please fill out this field.',\n minlength: 'Please enter at least {requiredLength} characters.',\n maxlength: 'Please enter no more than {requiredLength} characters.',\n pattern: 'Please enter a value that matches the pattern: {pattern}.',\n email: 'Please enter a valid email address.',\n min: 'Please enter a value greater than or equal to {min}.',\n max: 'Please enter a value less than or equal to {max}.',\n requiredtrue: 'Please check this field.',\n mindate: 'Please enter a date on or after {mindate}.',\n maxdate: 'Please enter a date on or before {maxdate}.',\n invaliddate: 'Please enter a valid date.',\n },\n fr: {\n required: \"Veuillez remplir ce champ s'il vous plaît.\",\n minlength: 'Veuillez entrer au moins {requiredLength} caractères.',\n maxlength: 'Veuillez entrer au maximum {requiredLength} caractères.',\n pattern: 'Veuillez entrer une valeur qui correspond au format : {pattern}.',\n email: 'Veuillez entrer une adresse email valide.',\n min: 'Veuillez entrer une valeur supérieure ou égale à {min}.',\n max: 'Veuillez entrer une valeur inférieure ou égale à {max}.',\n requiredtrue: \"Veuillez cocher cette case s'il vous plaît.\",\n mindate: 'Veuillez entrer une date le {mindate} ou après.',\n maxdate: 'Veuillez entrer une date le {maxdate} ou avant.',\n invaliddate: 'Veuillez entrer une date valide.',\n },\n de: {\n required: 'Bitte füllen Sie dieses Feld aus.',\n minlength: 'Bitte geben Sie mindestens {requiredLength} Zeichen ein.',\n maxlength: 'Bitte geben Sie höchstens {requiredLength} Zeichen ein.',\n pattern: 'Bitte geben Sie einen Wert ein, der dem Muster entspricht: {pattern}.',\n email: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.',\n min: 'Bitte geben Sie einen Wert größer oder gleich {min} ein.',\n max: 'Bitte geben Sie einen Wert kleiner oder gleich {max} ein.',\n requiredtrue: 'Bitte aktivieren Sie dieses Feld.',\n mindate: 'Bitte geben Sie ein Datum am oder nach dem {mindate} ein.',\n maxdate: 'Bitte geben Sie ein Datum am oder vor dem {maxdate} ein.',\n invaliddate: 'Bitte geben Sie ein gültiges Datum ein.',\n },\n it: {\n required: 'Si prega di compilare questo campo.',\n minlength: 'Si prega di inserire almeno {requiredLength} caratteri.',\n maxlength: 'Si prega di inserire al massimo {requiredLength} caratteri.',\n pattern: 'Si prega di inserire un valore che corrisponde al formato: {pattern}.',\n email: 'Si prega di inserire un indirizzo email valido.',\n min: 'Si prega di inserire un valore maggiore o uguale a {min}.',\n max: 'Si prega di inserire un valore minore o uguale a {max}.',\n requiredtrue: 'Si prega di spuntare questo campo.',\n mindate: 'Si prega di inserire una data il {mindate} o successiva.',\n maxdate: 'Si prega di inserire una data il {maxdate} o precedente.',\n invaliddate: 'Inserisci una data valida.',\n },\n};\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAgBpD;;;SAGgB,eAAe,CAAC,QAAkB,EAAE,KAAsB;EACxE,IAAI;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,QAAQ,KAAK,CAAC,GAAG;MACf,KAAK,UAAU,CAAC;MAChB,KAAK,cAAc,CAAC;MACpB,KAAK,OAAO;QACV,OAAO,OAAO,CAAC;MACjB,KAAK,WAAW,CAAC;MACjB,KAAK,WAAW;QACd,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;MAC3E,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,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C3E,KAAK,EAAE,2CAA2C;IAClD,GAAG,EAAE,yDAAyD;IAC9D,GAAG,EAAE,yDAAyD;IAC9D,YAAY,EAAE,6CAA6C;IAC3D,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,iDAAiD;IAC1D,WAAW,EAAE,kCAAkC;GAChD;EACD,EAAE,EAAE;IACF,QAAQ,EAAE,mCAAmC;IAC7C,SAAS,EAAE,0DAA0D;IACrE,SAAS,EAAE,yDAAyD;IACpE,OAAO,EAAE,uEAAuE;IAChF,KAAK,EAAE,kDAAkD;IACzD,GAAG,EAAE,0DAA0D;IAC/D,GAAG,EAAE,2DAA2D;IAChE,YAAY,EAAE,mCAAmC;IACjD,OAAO,EAAE,2DAA2D;IACpE,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,yCAAyC;GACvD;EACD,EAAE,EAAE;IACF,QAAQ,EAAE,qCAAqC;IAC/C,SAAS,EAAE,yDAAyD;IACpE,SAAS,EAAE,6DAA6D;IACxE,OAAO,EAAE,uEAAuE;IAChF,KAAK,EAAE,iDAAiD;IACxD,GAAG,EAAE,2DAA2D;IAChE,GAAG,EAAE,yDAAyD;IAC9D,YAAY,EAAE,oCAAoC;IAClD,OAAO,EAAE,0DAA0D;IACnE,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,4BAA4B;GAC1C;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/error-messages.ts"],"sourcesContent":["export type Language = 'de' | 'fr' | 'it' | 'en';\n\nconst dateFormat = new Intl.DateTimeFormat('de-CH');\n\nexport type ValidationError =\n | { key: 'required' }\n | { key: 'requiredtrue' }\n | { key: 'email'; requiredPattern: string }\n | { key: 'minlength'; requiredLength: number }\n | { key: 'maxlength'; requiredLength: number }\n | { key: 'pattern'; requiredPattern: string }\n | { key: 'min'; min: number }\n | { key: 'max'; max: number }\n | { key: 'mindate'; mindate: Date; actual: Date }\n | { key: 'maxdate'; maxdate: Date; actual: Date }\n | { key: 'invaliddate'; actual: Date }\n | { key: 'custom'; text: string };\n\n/**\n * Returns an error message for the given language and error.\n */\nexport function getErrorMessage(language: Language, error: ValidationError): string | undefined {\n try {\n const message = translation[language][error.key];\n switch (error.key) {\n case 'required':\n case 'requiredtrue':\n case 'email':\n return message;\n case 'minlength':\n case 'maxlength':\n return message.replace('{requiredLength}', String(error.requiredLength));\n case 'pattern':\n return message.replace('{pattern}', String(error.requiredPattern));\n case 'min':\n return message.replace('{min}', String(error.min));\n case 'max':\n return message.replace('{max}', String(error.max));\n case 'mindate':\n return message.replace('{mindate}', dateFormat.format(error.mindate));\n case 'maxdate':\n return message.replace('{maxdate}', dateFormat.format(error.maxdate));\n case 'invaliddate':\n return message;\n case 'custom':\n return error.text;\n }\n } catch (e) {\n console.warn(`no error message in '${language}' for error:`, error);\n return undefined;\n }\n}\n\nconst translation: Record<Language, Record<string, string>> = {\n en: {\n required: 'Please fill out this field.',\n minlength: 'Please enter at least {requiredLength} characters.',\n maxlength: 'Please enter no more than {requiredLength} characters.',\n pattern: 'Please enter a value that matches the pattern: {pattern}.',\n email: 'Please enter a valid email address.',\n min: 'Please enter a value greater than or equal to {min}.',\n max: 'Please enter a value less than or equal to {max}.',\n requiredtrue: 'Please check this field.',\n mindate: 'Please enter a date on or after {mindate}.',\n maxdate: 'Please enter a date on or before {maxdate}.',\n invaliddate: 'Please enter a valid date.',\n },\n fr: {\n required: \"Veuillez remplir ce champ s'il vous plaît.\",\n minlength: 'Veuillez entrer au moins {requiredLength} caractères.',\n maxlength: 'Veuillez entrer au maximum {requiredLength} caractères.',\n pattern: 'Veuillez entrer une valeur qui correspond au format : {pattern}.',\n email: 'Veuillez entrer une adresse email valide.',\n min: 'Veuillez entrer une valeur supérieure ou égale à {min}.',\n max: 'Veuillez entrer une valeur inférieure ou égale à {max}.',\n requiredtrue: \"Veuillez cocher cette case s'il vous plaît.\",\n mindate: 'Veuillez entrer une date le {mindate} ou après.',\n maxdate: 'Veuillez entrer une date le {maxdate} ou avant.',\n invaliddate: 'Veuillez entrer une date valide.',\n },\n de: {\n required: 'Bitte füllen Sie dieses Feld aus.',\n minlength: 'Bitte geben Sie mindestens {requiredLength} Zeichen ein.',\n maxlength: 'Bitte geben Sie höchstens {requiredLength} Zeichen ein.',\n pattern: 'Bitte geben Sie einen Wert ein, der dem Muster entspricht: {pattern}.',\n email: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.',\n min: 'Bitte geben Sie einen Wert größer oder gleich {min} ein.',\n max: 'Bitte geben Sie einen Wert kleiner oder gleich {max} ein.',\n requiredtrue: 'Bitte aktivieren Sie dieses Feld.',\n mindate: 'Bitte geben Sie ein Datum am oder nach dem {mindate} ein.',\n maxdate: 'Bitte geben Sie ein Datum am oder vor dem {maxdate} ein.',\n invaliddate: 'Bitte geben Sie ein gültiges Datum ein.',\n },\n it: {\n required: 'Si prega di compilare questo campo.',\n minlength: 'Si prega di inserire almeno {requiredLength} caratteri.',\n maxlength: 'Si prega di inserire al massimo {requiredLength} caratteri.',\n pattern: 'Si prega di inserire un valore che corrisponde al formato: {pattern}.',\n email: 'Si prega di inserire un indirizzo email valido.',\n min: 'Si prega di inserire un valore maggiore o uguale a {min}.',\n max: 'Si prega di inserire un valore minore o uguale a {max}.',\n requiredtrue: 'Si prega di spuntare questo campo.',\n mindate: 'Si prega di inserire una data il {mindate} o successiva.',\n maxdate: 'Si prega di inserire una data il {maxdate} o precedente.',\n invaliddate: 'Inserisci una data valida.',\n },\n};\n"],"version":3}