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

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 (358) hide show
  1. package/README.md +9 -0
  2. package/dist/cjs/{form-control-d369af14.js → form-control-9769b310.js} +10 -7
  3. package/dist/cjs/form-control-9769b310.js.map +1 -0
  4. package/dist/cjs/index-900437fc.js +214 -1
  5. package/dist/cjs/index-900437fc.js.map +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{scroll-03678de1.js → scroll-2c4200dc.js} +1 -2
  8. package/dist/cjs/scroll-2c4200dc.js.map +1 -0
  9. package/dist/cjs/six-button.cjs.entry.js +3 -3
  10. package/dist/cjs/six-button.cjs.entry.js.map +1 -1
  11. package/dist/cjs/six-checkbox.cjs.entry.js +8 -13
  12. package/dist/cjs/six-checkbox.cjs.entry.js.map +1 -1
  13. package/dist/cjs/six-datepicker.cjs.entry.js +5 -8
  14. package/dist/cjs/six-datepicker.cjs.entry.js.map +1 -1
  15. package/dist/cjs/six-details.cjs.entry.js +1 -1
  16. package/dist/cjs/six-details.cjs.entry.js.map +1 -1
  17. package/dist/cjs/six-dialog.cjs.entry.js +1 -1
  18. package/dist/cjs/six-drawer.cjs.entry.js +2 -2
  19. package/dist/cjs/six-drawer.cjs.entry.js.map +1 -1
  20. package/dist/cjs/six-dropdown_2.cjs.entry.js +1 -1
  21. package/dist/cjs/six-dropdown_2.cjs.entry.js.map +1 -1
  22. package/dist/cjs/six-error.cjs.entry.js +21 -0
  23. package/dist/cjs/six-error.cjs.entry.js.map +1 -0
  24. package/dist/cjs/six-group-label.cjs.entry.js +2 -2
  25. package/dist/cjs/six-group-label.cjs.entry.js.map +1 -1
  26. package/dist/cjs/six-icon-button.cjs.entry.js +1 -1
  27. package/dist/cjs/six-icon-button.cjs.entry.js.map +1 -1
  28. package/dist/cjs/six-input.cjs.entry.js +6 -3
  29. package/dist/cjs/six-input.cjs.entry.js.map +1 -1
  30. package/dist/cjs/six-radio.cjs.entry.js +9 -17
  31. package/dist/cjs/six-radio.cjs.entry.js.map +1 -1
  32. package/dist/cjs/six-range.cjs.entry.js +6 -3
  33. package/dist/cjs/six-range.cjs.entry.js.map +1 -1
  34. package/dist/cjs/six-select.cjs.entry.js +12 -8
  35. package/dist/cjs/six-select.cjs.entry.js.map +1 -1
  36. package/dist/cjs/six-sidebar-item-group.cjs.entry.js +2 -1
  37. package/dist/cjs/six-sidebar-item-group.cjs.entry.js.map +1 -1
  38. package/dist/cjs/six-sidebar.cjs.entry.js +1 -1
  39. package/dist/cjs/six-switch.cjs.entry.js +25 -5
  40. package/dist/cjs/six-switch.cjs.entry.js.map +1 -1
  41. package/dist/cjs/six-tab-group.cjs.entry.js +45 -50
  42. package/dist/cjs/six-tab-group.cjs.entry.js.map +1 -1
  43. package/dist/cjs/six-tab.cjs.entry.js +19 -3
  44. package/dist/cjs/six-tab.cjs.entry.js.map +1 -1
  45. package/dist/cjs/six-tag.cjs.entry.js +24 -2
  46. package/dist/cjs/six-tag.cjs.entry.js.map +1 -1
  47. package/dist/cjs/six-textarea.cjs.entry.js +6 -3
  48. package/dist/cjs/six-textarea.cjs.entry.js.map +1 -1
  49. package/dist/cjs/six-timepicker.cjs.entry.js +4 -9
  50. package/dist/cjs/six-timepicker.cjs.entry.js.map +1 -1
  51. package/dist/cjs/six-tooltip.cjs.entry.js +2 -2
  52. package/dist/cjs/six-tooltip.cjs.entry.js.map +1 -1
  53. package/dist/cjs/ui-library.cjs.js +2 -2
  54. package/dist/cjs/ui-library.cjs.js.map +1 -1
  55. package/dist/collection/collection-manifest.json +2 -1
  56. package/dist/collection/components/six-button/six-button.css +5 -30
  57. package/dist/collection/components/six-button/six-button.js +2 -2
  58. package/dist/collection/components/six-button/six-button.js.map +1 -1
  59. package/dist/collection/components/six-checkbox/six-checkbox.css +1 -1
  60. package/dist/collection/components/six-checkbox/six-checkbox.js +27 -31
  61. package/dist/collection/components/six-checkbox/six-checkbox.js.map +1 -1
  62. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js +6 -2
  63. package/dist/collection/components/six-checkbox/test/six-checkbox.spec.js.map +1 -1
  64. package/dist/collection/components/six-datepicker/six-datepicker.js +25 -12
  65. package/dist/collection/components/six-datepicker/six-datepicker.js.map +1 -1
  66. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js +1 -1
  67. package/dist/collection/components/six-datepicker/test/six-datepicker.spec.js.map +1 -1
  68. package/dist/collection/components/six-details/six-details.css +3 -1
  69. package/dist/collection/components/six-drawer/six-drawer.js +1 -1
  70. package/dist/collection/components/six-drawer/six-drawer.js.map +1 -1
  71. package/dist/collection/components/six-drawer/test/six-drawer.spec.js +1 -1
  72. package/dist/collection/components/six-drawer/test/six-drawer.spec.js.map +1 -1
  73. package/dist/collection/components/six-dropdown/six-dropdown.css +2 -1
  74. package/dist/collection/components/six-error/six-error.css +5 -0
  75. package/dist/collection/components/six-error/six-error.js +25 -0
  76. package/dist/collection/components/six-error/six-error.js.map +1 -0
  77. package/dist/collection/components/six-group-label/six-group-label.css +1 -1
  78. package/dist/collection/components/six-group-label/test/six-group-label.spec.js +3 -1
  79. package/dist/collection/components/six-group-label/test/six-group-label.spec.js.map +1 -1
  80. package/dist/collection/components/six-icon-button/six-icon-button.css +4 -4
  81. package/dist/collection/components/six-input/six-input.css +2 -2
  82. package/dist/collection/components/six-input/six-input.js +27 -4
  83. package/dist/collection/components/six-input/six-input.js.map +1 -1
  84. package/dist/collection/components/six-input/test/six-input.spec.js +3 -1
  85. package/dist/collection/components/six-input/test/six-input.spec.js.map +1 -1
  86. package/dist/collection/components/six-radio/six-radio.js +9 -34
  87. package/dist/collection/components/six-radio/six-radio.js.map +1 -1
  88. package/dist/collection/components/six-range/six-range.css +1 -1
  89. package/dist/collection/components/six-range/six-range.js +24 -3
  90. package/dist/collection/components/six-range/six-range.js.map +1 -1
  91. package/dist/collection/components/six-range/test/six-range.spec.js +3 -1
  92. package/dist/collection/components/six-range/test/six-range.spec.js.map +1 -1
  93. package/dist/collection/components/six-select/six-select.css +7 -10
  94. package/dist/collection/components/six-select/six-select.js +30 -8
  95. package/dist/collection/components/six-select/six-select.js.map +1 -1
  96. package/dist/collection/components/six-select/test/six-select.spec.js +8 -4
  97. package/dist/collection/components/six-select/test/six-select.spec.js.map +1 -1
  98. package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.css +4 -0
  99. package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js +1 -0
  100. package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js.map +1 -1
  101. package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js +2 -2
  102. package/dist/collection/components/six-sidebar-item-group/test/six-sidebar-item-group.spec.js.map +1 -1
  103. package/dist/collection/components/six-switch/six-switch.css +1 -1
  104. package/dist/collection/components/six-switch/six-switch.js +48 -5
  105. package/dist/collection/components/six-switch/six-switch.js.map +1 -1
  106. package/dist/collection/components/six-switch/test/six-switch.spec.js +6 -2
  107. package/dist/collection/components/six-switch/test/six-switch.spec.js.map +1 -1
  108. package/dist/collection/components/six-tab/six-tab.css +54 -5
  109. package/dist/collection/components/six-tab/six-tab.js +18 -2
  110. package/dist/collection/components/six-tab/six-tab.js.map +1 -1
  111. package/dist/collection/components/six-tab-group/six-tab-group.css +0 -31
  112. package/dist/collection/components/six-tab-group/six-tab-group.js +10 -51
  113. package/dist/collection/components/six-tab-group/six-tab-group.js.map +1 -1
  114. package/dist/collection/components/six-tag/six-tag.css +6 -0
  115. package/dist/collection/components/six-tag/six-tag.js +23 -1
  116. package/dist/collection/components/six-tag/six-tag.js.map +1 -1
  117. package/dist/collection/components/six-tag/test/six-tag.spec.js +12 -0
  118. package/dist/collection/components/six-tag/test/six-tag.spec.js.map +1 -1
  119. package/dist/collection/components/six-textarea/six-textarea.css +1 -1
  120. package/dist/collection/components/six-textarea/six-textarea.js +25 -4
  121. package/dist/collection/components/six-textarea/six-textarea.js.map +1 -1
  122. package/dist/collection/components/six-textarea/test/six-textarea.spec.js +3 -1
  123. package/dist/collection/components/six-textarea/test/six-textarea.spec.js.map +1 -1
  124. package/dist/collection/components/six-timepicker/six-timepicker.js +24 -12
  125. package/dist/collection/components/six-timepicker/six-timepicker.js.map +1 -1
  126. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js +15 -15
  127. package/dist/collection/components/six-timepicker/test/six-timepicker.spec.js.map +1 -1
  128. package/dist/collection/components/six-tooltip/six-tooltip.css +1 -1
  129. package/dist/collection/components/six-tooltip/six-tooltip.js +1 -1
  130. package/dist/collection/components/six-tooltip/six-tooltip.js.map +1 -1
  131. package/dist/collection/functional-components/form-control/form-control.js +8 -6
  132. package/dist/collection/functional-components/form-control/form-control.js.map +1 -1
  133. package/dist/collection/utils/animation.js +34 -0
  134. package/dist/collection/utils/animation.js.map +1 -0
  135. package/dist/components/form-control.js +9 -6
  136. package/dist/components/form-control.js.map +1 -1
  137. package/dist/components/index.js +2 -0
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/components/scroll.js +1 -1
  140. package/dist/components/six-button.js +3 -3
  141. package/dist/components/six-button.js.map +1 -1
  142. package/dist/components/six-checkbox.js +17 -15
  143. package/dist/components/six-checkbox.js.map +1 -1
  144. package/dist/components/six-datepicker.js +13 -9
  145. package/dist/components/six-datepicker.js.map +1 -1
  146. package/dist/components/six-details2.js +1 -1
  147. package/dist/components/six-details2.js.map +1 -1
  148. package/dist/components/six-drawer.js +1 -1
  149. package/dist/components/six-drawer.js.map +1 -1
  150. package/dist/components/six-dropdown2.js +8 -2
  151. package/dist/components/six-dropdown2.js.map +1 -1
  152. package/dist/components/six-error.d.ts +11 -0
  153. package/dist/components/six-error.js +8 -0
  154. package/dist/components/six-error.js.map +1 -0
  155. package/dist/components/six-error2.js +32 -0
  156. package/dist/components/six-error2.js.map +1 -0
  157. package/dist/components/six-group-label.js +8 -2
  158. package/dist/components/six-group-label.js.map +1 -1
  159. package/dist/components/six-header.js +8 -2
  160. package/dist/components/six-header.js.map +1 -1
  161. package/dist/components/six-icon-button2.js +1 -1
  162. package/dist/components/six-icon-button2.js.map +1 -1
  163. package/dist/components/six-input2.js +14 -3
  164. package/dist/components/six-input2.js.map +1 -1
  165. package/dist/components/six-radio.js +10 -19
  166. package/dist/components/six-radio.js.map +1 -1
  167. package/dist/components/six-range.js +14 -3
  168. package/dist/components/six-range.js.map +1 -1
  169. package/dist/components/six-search-field.js +7 -1
  170. package/dist/components/six-search-field.js.map +1 -1
  171. package/dist/components/six-select.js +39 -21
  172. package/dist/components/six-select.js.map +1 -1
  173. package/dist/components/six-sidebar-item-group.js +2 -1
  174. package/dist/components/six-sidebar-item-group.js.map +1 -1
  175. package/dist/components/six-switch.js +33 -5
  176. package/dist/components/six-switch.js.map +1 -1
  177. package/dist/components/six-tab-group.js +45 -50
  178. package/dist/components/six-tab-group.js.map +1 -1
  179. package/dist/components/six-tab.js +19 -3
  180. package/dist/components/six-tab.js.map +1 -1
  181. package/dist/components/six-tag2.js +34 -6
  182. package/dist/components/six-tag2.js.map +1 -1
  183. package/dist/components/six-textarea.js +14 -3
  184. package/dist/components/six-textarea.js.map +1 -1
  185. package/dist/components/six-timepicker2.js +12 -10
  186. package/dist/components/six-timepicker2.js.map +1 -1
  187. package/dist/components/six-tooltip2.js +2 -2
  188. package/dist/components/six-tooltip2.js.map +1 -1
  189. package/dist/components.json +426 -100
  190. package/dist/esm/{form-control-32cb533f.js → form-control-b0febe88.js} +10 -7
  191. package/dist/esm/form-control-b0febe88.js.map +1 -0
  192. package/dist/esm/index-8a74f992.js +214 -1
  193. package/dist/esm/index-8a74f992.js.map +1 -1
  194. package/dist/esm/loader.js +1 -1
  195. package/dist/esm/{scroll-3fb087a2.js → scroll-774762d6.js} +2 -2
  196. package/dist/esm/{scroll-3fb087a2.js.map → scroll-774762d6.js.map} +1 -1
  197. package/dist/esm/six-button.entry.js +3 -3
  198. package/dist/esm/six-button.entry.js.map +1 -1
  199. package/dist/esm/six-checkbox.entry.js +8 -13
  200. package/dist/esm/six-checkbox.entry.js.map +1 -1
  201. package/dist/esm/six-datepicker.entry.js +5 -8
  202. package/dist/esm/six-datepicker.entry.js.map +1 -1
  203. package/dist/esm/six-details.entry.js +1 -1
  204. package/dist/esm/six-details.entry.js.map +1 -1
  205. package/dist/esm/six-dialog.entry.js +1 -1
  206. package/dist/esm/six-drawer.entry.js +2 -2
  207. package/dist/esm/six-drawer.entry.js.map +1 -1
  208. package/dist/esm/six-dropdown_2.entry.js +1 -1
  209. package/dist/esm/six-dropdown_2.entry.js.map +1 -1
  210. package/dist/esm/six-error.entry.js +17 -0
  211. package/dist/esm/six-error.entry.js.map +1 -0
  212. package/dist/esm/six-group-label.entry.js +2 -2
  213. package/dist/esm/six-group-label.entry.js.map +1 -1
  214. package/dist/esm/six-icon-button.entry.js +1 -1
  215. package/dist/esm/six-icon-button.entry.js.map +1 -1
  216. package/dist/esm/six-input.entry.js +6 -3
  217. package/dist/esm/six-input.entry.js.map +1 -1
  218. package/dist/esm/six-radio.entry.js +9 -17
  219. package/dist/esm/six-radio.entry.js.map +1 -1
  220. package/dist/esm/six-range.entry.js +6 -3
  221. package/dist/esm/six-range.entry.js.map +1 -1
  222. package/dist/esm/six-select.entry.js +12 -8
  223. package/dist/esm/six-select.entry.js.map +1 -1
  224. package/dist/esm/six-sidebar-item-group.entry.js +2 -1
  225. package/dist/esm/six-sidebar-item-group.entry.js.map +1 -1
  226. package/dist/esm/six-sidebar.entry.js +1 -1
  227. package/dist/esm/six-switch.entry.js +25 -5
  228. package/dist/esm/six-switch.entry.js.map +1 -1
  229. package/dist/esm/six-tab-group.entry.js +45 -50
  230. package/dist/esm/six-tab-group.entry.js.map +1 -1
  231. package/dist/esm/six-tab.entry.js +19 -3
  232. package/dist/esm/six-tab.entry.js.map +1 -1
  233. package/dist/esm/six-tag.entry.js +24 -2
  234. package/dist/esm/six-tag.entry.js.map +1 -1
  235. package/dist/esm/six-textarea.entry.js +6 -3
  236. package/dist/esm/six-textarea.entry.js.map +1 -1
  237. package/dist/esm/six-timepicker.entry.js +4 -9
  238. package/dist/esm/six-timepicker.entry.js.map +1 -1
  239. package/dist/esm/six-tooltip.entry.js +2 -2
  240. package/dist/esm/six-tooltip.entry.js.map +1 -1
  241. package/dist/esm/ui-library.js +2 -2
  242. package/dist/esm/ui-library.js.map +1 -1
  243. package/dist/types/components/six-checkbox/six-checkbox.d.ts +4 -5
  244. package/dist/types/components/six-datepicker/six-datepicker.d.ts +4 -2
  245. package/dist/types/components/six-error/six-error.d.ts +9 -0
  246. package/dist/types/components/six-input/six-input.d.ts +7 -2
  247. package/dist/types/components/six-radio/six-radio.d.ts +0 -5
  248. package/dist/types/components/six-range/six-range.d.ts +4 -1
  249. package/dist/types/components/six-select/six-select.d.ts +4 -1
  250. package/dist/types/components/six-switch/six-switch.d.ts +8 -1
  251. package/dist/types/components/six-tab-group/six-tab-group.d.ts +0 -3
  252. package/dist/types/components/six-tag/six-tag.d.ts +8 -0
  253. package/dist/types/components/six-textarea/six-textarea.d.ts +4 -1
  254. package/dist/types/components/six-timepicker/six-timepicker.d.ts +5 -2
  255. package/dist/types/components.d.ts +109 -24
  256. package/dist/types/functional-components/form-control/form-control.d.ts +6 -2
  257. package/dist/types/utils/animation.d.ts +12 -0
  258. package/dist/ui-library/{p-1f18768a.js → p-052aa8d3.js} +2 -2
  259. package/dist/ui-library/{p-da19c7ce.entry.js → p-14c1ec31.entry.js} +2 -2
  260. package/dist/ui-library/p-14c1ec31.entry.js.map +1 -0
  261. package/dist/ui-library/p-22c9b8c3.entry.js +2 -0
  262. package/dist/ui-library/p-22c9b8c3.entry.js.map +1 -0
  263. package/dist/ui-library/p-25bb1752.entry.js +2 -0
  264. package/dist/ui-library/p-25bb1752.entry.js.map +1 -0
  265. package/dist/ui-library/p-264d4ea8.entry.js +2 -0
  266. package/dist/ui-library/p-264d4ea8.entry.js.map +1 -0
  267. package/dist/ui-library/p-3f1a5ecb.entry.js +2 -0
  268. package/dist/ui-library/p-3f1a5ecb.entry.js.map +1 -0
  269. package/dist/ui-library/p-4435ff73.entry.js +2 -0
  270. package/dist/ui-library/p-4435ff73.entry.js.map +1 -0
  271. package/dist/ui-library/p-538f3c50.entry.js +2 -0
  272. package/dist/ui-library/p-538f3c50.entry.js.map +1 -0
  273. package/dist/ui-library/{p-330a4988.entry.js → p-5800663b.entry.js} +2 -2
  274. package/dist/ui-library/p-5ba3a0fe.entry.js +2 -0
  275. package/dist/ui-library/p-5ba3a0fe.entry.js.map +1 -0
  276. package/dist/ui-library/{p-99e24daf.entry.js → p-5ef2bdb3.entry.js} +2 -2
  277. package/dist/ui-library/{p-99e24daf.entry.js.map → p-5ef2bdb3.entry.js.map} +1 -1
  278. package/dist/ui-library/p-6153045b.js.map +1 -1
  279. package/dist/ui-library/p-658d9f79.entry.js +2 -0
  280. package/dist/ui-library/p-658d9f79.entry.js.map +1 -0
  281. package/dist/ui-library/p-66fe54b3.entry.js +2 -0
  282. package/dist/ui-library/p-66fe54b3.entry.js.map +1 -0
  283. package/dist/ui-library/p-a457fee8.entry.js +2 -0
  284. package/dist/ui-library/p-a457fee8.entry.js.map +1 -0
  285. package/dist/ui-library/p-ab91c2a9.entry.js +2 -0
  286. package/dist/ui-library/p-ab91c2a9.entry.js.map +1 -0
  287. package/dist/ui-library/p-b57afbe4.entry.js +2 -0
  288. package/dist/ui-library/p-b57afbe4.entry.js.map +1 -0
  289. package/dist/ui-library/p-b6f47c9d.entry.js +2 -0
  290. package/dist/ui-library/p-b6f47c9d.entry.js.map +1 -0
  291. package/dist/ui-library/p-cba69e9d.entry.js +2 -0
  292. package/dist/ui-library/p-cba69e9d.entry.js.map +1 -0
  293. package/dist/ui-library/{p-19ed7a4c.entry.js → p-d1bda563.entry.js} +2 -2
  294. package/dist/ui-library/p-db34a6cc.entry.js +2 -0
  295. package/dist/ui-library/p-db34a6cc.entry.js.map +1 -0
  296. package/dist/ui-library/p-db936ad7.entry.js +2 -0
  297. package/dist/ui-library/{p-d367f4f9.entry.js.map → p-db936ad7.entry.js.map} +1 -1
  298. package/dist/ui-library/p-dc4f41d8.entry.js +2 -0
  299. package/dist/ui-library/p-dc4f41d8.entry.js.map +1 -0
  300. package/dist/ui-library/p-e5020f0d.js +2 -0
  301. package/dist/ui-library/p-e5020f0d.js.map +1 -0
  302. package/dist/ui-library/p-e775dcb4.entry.js +2 -0
  303. package/dist/ui-library/p-e775dcb4.entry.js.map +1 -0
  304. package/dist/ui-library/p-f1dc3a88.entry.js +2 -0
  305. package/dist/ui-library/p-f1dc3a88.entry.js.map +1 -0
  306. package/dist/ui-library/ui-library.css +2 -2
  307. package/dist/ui-library/ui-library.esm.js +1 -1
  308. package/dist/ui-library/ui-library.esm.js.map +1 -1
  309. package/package.json +6 -3
  310. package/dist/cjs/form-control-d369af14.js.map +0 -1
  311. package/dist/cjs/scroll-03678de1.js.map +0 -1
  312. package/dist/collection/components/six-tab/test/six-tab.spec.js +0 -20
  313. package/dist/collection/components/six-tab/test/six-tab.spec.js.map +0 -1
  314. package/dist/collection/components/six-tab-group/test/six-tab-group.spec.js +0 -45
  315. package/dist/collection/components/six-tab-group/test/six-tab-group.spec.js.map +0 -1
  316. package/dist/esm/form-control-32cb533f.js.map +0 -1
  317. package/dist/ui-library/p-1256cc0a.entry.js +0 -2
  318. package/dist/ui-library/p-1256cc0a.entry.js.map +0 -1
  319. package/dist/ui-library/p-1730a174.entry.js +0 -2
  320. package/dist/ui-library/p-1730a174.entry.js.map +0 -1
  321. package/dist/ui-library/p-1d0bee53.entry.js +0 -2
  322. package/dist/ui-library/p-1d0bee53.entry.js.map +0 -1
  323. package/dist/ui-library/p-21b3b321.entry.js +0 -2
  324. package/dist/ui-library/p-21b3b321.entry.js.map +0 -1
  325. package/dist/ui-library/p-29ac3d7d.entry.js +0 -2
  326. package/dist/ui-library/p-29ac3d7d.entry.js.map +0 -1
  327. package/dist/ui-library/p-314b2096.entry.js +0 -2
  328. package/dist/ui-library/p-314b2096.entry.js.map +0 -1
  329. package/dist/ui-library/p-4705a51e.entry.js +0 -2
  330. package/dist/ui-library/p-4705a51e.entry.js.map +0 -1
  331. package/dist/ui-library/p-4abed9df.entry.js +0 -2
  332. package/dist/ui-library/p-4abed9df.entry.js.map +0 -1
  333. package/dist/ui-library/p-5d6b7353.entry.js +0 -2
  334. package/dist/ui-library/p-5d6b7353.entry.js.map +0 -1
  335. package/dist/ui-library/p-6eb24bcb.entry.js +0 -2
  336. package/dist/ui-library/p-6eb24bcb.entry.js.map +0 -1
  337. package/dist/ui-library/p-72254eef.entry.js +0 -2
  338. package/dist/ui-library/p-72254eef.entry.js.map +0 -1
  339. package/dist/ui-library/p-83864cfe.entry.js +0 -2
  340. package/dist/ui-library/p-83864cfe.entry.js.map +0 -1
  341. package/dist/ui-library/p-cf49252a.entry.js +0 -2
  342. package/dist/ui-library/p-cf49252a.entry.js.map +0 -1
  343. package/dist/ui-library/p-d367f4f9.entry.js +0 -2
  344. package/dist/ui-library/p-d42c2025.js +0 -2
  345. package/dist/ui-library/p-d42c2025.js.map +0 -1
  346. package/dist/ui-library/p-da19c7ce.entry.js.map +0 -1
  347. package/dist/ui-library/p-e0b13ad3.entry.js +0 -2
  348. package/dist/ui-library/p-e0b13ad3.entry.js.map +0 -1
  349. package/dist/ui-library/p-ee8342e1.entry.js +0 -2
  350. package/dist/ui-library/p-ee8342e1.entry.js.map +0 -1
  351. package/dist/ui-library/p-f1eb03ba.entry.js +0 -2
  352. package/dist/ui-library/p-f1eb03ba.entry.js.map +0 -1
  353. package/dist/ui-library/p-ff90ffd1.entry.js +0 -2
  354. package/dist/ui-library/p-ff90ffd1.entry.js.map +0 -1
  355. package/readme.md +0 -156
  356. /package/dist/ui-library/{p-1f18768a.js.map → p-052aa8d3.js.map} +0 -0
  357. /package/dist/ui-library/{p-330a4988.entry.js.map → p-5800663b.entry.js.map} +0 -0
  358. /package/dist/ui-library/{p-19ed7a4c.entry.js.map → p-d1bda563.entry.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { EventListeners } from "../../utils/event-listeners";
3
3
  import FormControl from "../../functional-components/form-control/form-control";
4
+ import { hasSlot } from "../../utils/slot";
4
5
  let id = 0;
5
6
  /**
6
7
  * @since 1.0
@@ -9,6 +10,7 @@ let id = 0;
9
10
  * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
10
11
  *
11
12
  * @slot - The switch's label.
13
+ * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.
12
14
  *
13
15
  * @part base - The component's base wrapper.
14
16
  * @part control - The switch control.
@@ -21,9 +23,13 @@ export class SixSwitch {
21
23
  this.labelId = `switch-label-${id}`;
22
24
  this.errorTextId = `input-error-text-${id}`;
23
25
  this.eventListeners = new EventListeners();
26
+ this.handleSlotChange = () => {
27
+ this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
28
+ };
24
29
  this.handleClick = () => {
25
30
  if (this.inputElement != null) {
26
31
  this.checked = this.inputElement.checked;
32
+ this.sixChange.emit(this.checked);
27
33
  }
28
34
  };
29
35
  this.handleBlur = () => {
@@ -38,10 +44,12 @@ export class SixSwitch {
38
44
  if (event.key === 'ArrowLeft') {
39
45
  event.preventDefault();
40
46
  this.checked = false;
47
+ this.sixChange.emit(this.checked);
41
48
  }
42
49
  if (event.key === 'ArrowRight') {
43
50
  event.preventDefault();
44
51
  this.checked = true;
52
+ this.sixChange.emit(this.checked);
45
53
  }
46
54
  };
47
55
  this.handleMouseDown = (event) => {
@@ -51,6 +59,7 @@ export class SixSwitch {
51
59
  (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus();
52
60
  };
53
61
  this.hasFocus = false;
62
+ this.hasErrorTextSlot = false;
54
63
  this.name = '';
55
64
  this.value = 'on';
56
65
  this.disabled = false;
@@ -58,23 +67,33 @@ export class SixSwitch {
58
67
  this.checked = false;
59
68
  this.label = '';
60
69
  this.errorText = '';
70
+ this.errorTextCount = undefined;
61
71
  this.invalid = false;
62
72
  }
73
+ componentWillLoad() {
74
+ this.handleSlotChange();
75
+ }
63
76
  handleCheckedChange() {
64
77
  if (this.inputElement != null) {
65
78
  this.inputElement.checked = this.checked;
66
79
  this.checked = this.inputElement.checked;
67
80
  }
68
- this.sixChange.emit(this.checked);
69
81
  }
70
82
  connectedCallback() {
83
+ var _a;
84
+ (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener('slotchange', this.handleSlotChange);
71
85
  this.eventListeners.forward('six-switch-change', 'change', this.host);
72
86
  this.eventListeners.forward('six-switch-blur', 'blur', this.host);
73
87
  this.eventListeners.forward('six-switch-focus', 'focus', this.host);
74
88
  }
75
89
  disconnectedCallback() {
90
+ var _a;
91
+ (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener('slotchange', this.handleSlotChange);
76
92
  this.eventListeners.removeAll();
77
93
  }
94
+ handleLabelChange() {
95
+ this.handleSlotChange();
96
+ }
78
97
  /** Sets focus on the switch. */
79
98
  async setFocus(options) {
80
99
  var _a;
@@ -86,7 +105,7 @@ export class SixSwitch {
86
105
  (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.blur();
87
106
  }
88
107
  render() {
89
- return (h(FormControl, { inputId: this.switchId, label: this.label, labelId: this.labelId, hasLabelSlot: false, errorTextId: this.errorTextId, errorText: this.errorText, size: "medium", disabled: this.disabled, required: this.required, displayError: this.invalid }, h("label", { part: "base", htmlFor: this.switchId, class: {
108
+ return (h(FormControl, { inputId: this.switchId, label: this.label, labelId: this.labelId, hasLabelSlot: false, errorTextId: this.errorTextId, errorText: this.errorText, errorTextCount: this.errorTextCount, hasErrorTextSlot: this.hasErrorTextSlot, size: "medium", disabled: this.disabled, required: this.required, displayError: this.invalid }, h("label", { part: "base", htmlFor: this.switchId, class: {
90
109
  switch: true,
91
110
  'switch--checked': this.checked,
92
111
  'switch--disabled': this.disabled,
@@ -219,8 +238,8 @@ export class SixSwitch {
219
238
  "type": "string",
220
239
  "mutable": false,
221
240
  "complexType": {
222
- "original": "string",
223
- "resolved": "string",
241
+ "original": "string | string[]",
242
+ "resolved": "string | string[]",
224
243
  "references": {}
225
244
  },
226
245
  "required": false,
@@ -233,6 +252,23 @@ export class SixSwitch {
233
252
  "reflect": false,
234
253
  "defaultValue": "''"
235
254
  },
255
+ "errorTextCount": {
256
+ "type": "number",
257
+ "mutable": false,
258
+ "complexType": {
259
+ "original": "number",
260
+ "resolved": "number | undefined",
261
+ "references": {}
262
+ },
263
+ "required": false,
264
+ "optional": true,
265
+ "docs": {
266
+ "tags": [],
267
+ "text": "The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1"
268
+ },
269
+ "attribute": "error-text-count",
270
+ "reflect": false
271
+ },
236
272
  "invalid": {
237
273
  "type": "boolean",
238
274
  "mutable": false,
@@ -255,7 +291,8 @@ export class SixSwitch {
255
291
  }
256
292
  static get states() {
257
293
  return {
258
- "hasFocus": {}
294
+ "hasFocus": {},
295
+ "hasErrorTextSlot": {}
259
296
  };
260
297
  }
261
298
  static get events() {
@@ -362,6 +399,12 @@ export class SixSwitch {
362
399
  return [{
363
400
  "propName": "checked",
364
401
  "methodName": "handleCheckedChange"
402
+ }, {
403
+ "propName": "errorText",
404
+ "methodName": "handleLabelChange"
405
+ }, {
406
+ "propName": "label",
407
+ "methodName": "handleLabelChange"
365
408
  }];
366
409
  }
367
410
  }
@@ -1 +1 @@
1
- {"version":3,"file":"six-switch.js","sourceRoot":"","sources":["../../../src/components/six-switch/six-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,WAAW,MAAM,uDAAuD,CAAC;AAEhF,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;GAYG;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AO,EAAE,KAAK,EAAC,eAAe;UACxD,eAAQ,CACH,CACD,CACI,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\nimport FormControl from '../../functional-components/form-control/form-control';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot - The switch's label.\n *\n * @part base - The component's base wrapper.\n * @part control - The switch control.\n * @part thumb - The switch position indicator.\n * @part label - The switch label.\n */\n\n@Component({\n tag: 'six-switch',\n styleUrl: 'six-switch.scss',\n shadow: true,\n})\nexport class SixSwitch {\n private switchId = `switch-${++id}`;\n private labelId = `switch-label-${id}`;\n private errorTextId = `input-error-text-${id}`;\n\n private inputElement?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixSwitchElement;\n\n @State() hasFocus = false;\n\n /** The switch's name attribute. */\n @Prop() name = '';\n\n /** The switch's value attribute. */\n @Prop() value = 'on';\n\n /** Set to true to disable the switch. */\n @Prop() disabled = false;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** Set to true to draw the switch in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText = '';\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n @Watch('checked')\n handleCheckedChange() {\n if (this.inputElement != null) {\n this.inputElement.checked = this.checked;\n this.checked = this.inputElement.checked;\n }\n this.sixChange.emit(this.checked);\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-switch-blur' }) sixBlur!: EventEmitter<boolean>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-switch-change' }) sixChange!: EventEmitter<boolean>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-switch-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.eventListeners.forward('six-switch-change', 'change', this.host);\n this.eventListeners.forward('six-switch-blur', 'blur', this.host);\n this.eventListeners.forward('six-switch-focus', 'focus', this.host);\n }\n\n disconnectedCallback() {\n this.eventListeners.removeAll();\n }\n\n /** Sets focus on the switch. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.focus(options);\n }\n\n /** Removes focus from the switch. */\n @Method()\n async removeFocus() {\n this.inputElement?.blur();\n }\n\n private handleClick = () => {\n if (this.inputElement != null) {\n this.checked = this.inputElement.checked;\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit(this.checked);\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n this.checked = false;\n }\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n this.checked = true;\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.inputElement?.focus();\n };\n\n render() {\n return (\n <FormControl\n inputId={this.switchId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={false}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n size=\"medium\"\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <label\n part=\"base\"\n htmlFor={this.switchId}\n class={{\n switch: true,\n 'switch--checked': this.checked,\n 'switch--disabled': this.disabled,\n 'switch--focused': this.hasFocus,\n }}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"switch__control\">\n <span part=\"thumb\" class=\"switch__thumb\" />\n\n <input\n ref={(el) => (this.inputElement = el)}\n id={this.switchId}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n role=\"switch\"\n aria-checked={this.checked ? 'true' : 'false'}\n aria-labelledby={this.labelId}\n onClick={this.handleClick}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"switch__label\">\n <slot />\n </span>\n </label>\n </FormControl>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-switch.js","sourceRoot":"","sources":["../../../src/components/six-switch/six-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,WAAW,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;;;;GAaG;AAOH,MAAM,OAAO,SAAS;;IACZ,aAAQ,GAAG,UAAU,EAAE,EAAE,EAAE,CAAC;IAC5B,YAAO,GAAG,gBAAgB,EAAE,EAAE,CAAC;IAC/B,gBAAW,GAAG,oBAAoB,EAAE,EAAE,CAAC;IAGvC,mBAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAyEtC,qBAAgB,GAAG,GAAG,EAAE;MAC9B,IA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CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,QAAQ,kBACC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,qBAC5B,IAAI,CAAC,OAAO,EAC7B,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,GAC7B,CACG;QAEP,YAAM,IAAI,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,eAAe;UACxD,eAAQ,CACH,CACD,CACI,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { EmptyPayload } from '../../utils/types';\nimport { EventListeners } from '../../utils/event-listeners';\nimport FormControl from '../../functional-components/form-control/form-control';\nimport { hasSlot } from '../../utils/slot';\n\nlet id = 0;\n\n/**\n * @since 1.0\n * @status stable\n *\n * Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.\n *\n * @slot - The switch's label.\n * @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.\n *\n * @part base - The component's base wrapper.\n * @part control - The switch control.\n * @part thumb - The switch position indicator.\n * @part label - The switch label.\n */\n\n@Component({\n tag: 'six-switch',\n styleUrl: 'six-switch.scss',\n shadow: true,\n})\nexport class SixSwitch {\n private switchId = `switch-${++id}`;\n private labelId = `switch-label-${id}`;\n private errorTextId = `input-error-text-${id}`;\n\n private inputElement?: HTMLInputElement;\n private eventListeners = new EventListeners();\n\n @Element() host!: HTMLSixSwitchElement;\n\n @State() hasFocus = false;\n @State() hasErrorTextSlot = false;\n\n /** The switch's name attribute. */\n @Prop() name = '';\n\n /** The switch's value attribute. */\n @Prop() value = 'on';\n\n /** Set to true to disable the switch. */\n @Prop() disabled = false;\n\n /** Set to true to show an asterisk beneath the label. */\n @Prop() required = false;\n\n /** Set to true to draw the switch in a checked state. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /** The label text. */\n @Prop() label = '';\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText: string | string[] = '';\n\n /** The number of error texts to be shown (if the error-text slot isn't used). Defaults to 1 */\n @Prop() errorTextCount?: number;\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n @Watch('checked')\n handleCheckedChange() {\n if (this.inputElement != null) {\n this.inputElement.checked = this.checked;\n this.checked = this.inputElement.checked;\n }\n }\n\n /** Emitted when the control loses focus. */\n @Event({ eventName: 'six-switch-blur' }) sixBlur!: EventEmitter<boolean>;\n\n /** Emitted when the control's checked state changes. */\n @Event({ eventName: 'six-switch-change' }) sixChange!: EventEmitter<boolean>;\n\n /** Emitted when the control gains focus. */\n @Event({ eventName: 'six-switch-focus' }) sixFocus!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.forward('six-switch-change', 'change', this.host);\n this.eventListeners.forward('six-switch-blur', 'blur', this.host);\n this.eventListeners.forward('six-switch-focus', 'focus', this.host);\n }\n\n disconnectedCallback() {\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n this.eventListeners.removeAll();\n }\n\n @Watch('errorText')\n @Watch('label')\n handleLabelChange() {\n this.handleSlotChange();\n }\n\n private handleSlotChange = () => {\n this.hasErrorTextSlot = hasSlot(this.host, 'error-text');\n };\n\n /** Sets focus on the switch. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.inputElement?.focus(options);\n }\n\n /** Removes focus from the switch. */\n @Method()\n async removeFocus() {\n this.inputElement?.blur();\n }\n\n private handleClick = () => {\n if (this.inputElement != null) {\n this.checked = this.inputElement.checked;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleBlur = () => {\n this.hasFocus = false;\n this.sixBlur.emit(this.checked);\n };\n\n private handleFocus = () => {\n this.hasFocus = true;\n this.sixFocus.emit();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n this.checked = false;\n this.sixChange.emit(this.checked);\n }\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n this.checked = true;\n this.sixChange.emit(this.checked);\n }\n };\n\n private handleMouseDown = (event: MouseEvent) => {\n // Prevent clicks on the label from briefly blurring the input\n event.preventDefault();\n this.inputElement?.focus();\n };\n\n render() {\n return (\n <FormControl\n inputId={this.switchId}\n label={this.label}\n labelId={this.labelId}\n hasLabelSlot={false}\n errorTextId={this.errorTextId}\n errorText={this.errorText}\n errorTextCount={this.errorTextCount}\n hasErrorTextSlot={this.hasErrorTextSlot}\n size=\"medium\"\n disabled={this.disabled}\n required={this.required}\n displayError={this.invalid}\n >\n <label\n part=\"base\"\n htmlFor={this.switchId}\n class={{\n switch: true,\n 'switch--checked': this.checked,\n 'switch--disabled': this.disabled,\n 'switch--focused': this.hasFocus,\n }}\n onMouseDown={this.handleMouseDown}\n >\n <span part=\"control\" class=\"switch__control\">\n <span part=\"thumb\" class=\"switch__thumb\" />\n\n <input\n ref={(el) => (this.inputElement = el)}\n id={this.switchId}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n role=\"switch\"\n aria-checked={this.checked ? 'true' : 'false'}\n aria-labelledby={this.labelId}\n onClick={this.handleClick}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n />\n </span>\n\n <span part=\"label\" id={this.labelId} class=\"switch__label\">\n <slot />\n </span>\n </label>\n </FormControl>\n );\n }\n}\n"]}
@@ -24,7 +24,9 @@ describe('six-switch', () => {
24
24
  </span>
25
25
  </label>
26
26
  </div>
27
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text"></div>
27
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-1" part="error-text">
28
+ <slot name="error-text"></slot>
29
+ </div>
28
30
  <div aria-hidden="true" class="form-control__help-text" part="help-text">
29
31
  <slot name="help-text"></slot>
30
32
  </div>
@@ -56,7 +58,9 @@ describe('six-switch', () => {
56
58
  </span>
57
59
  </label>
58
60
  </div>
59
- <div aria-hidden="true" class="form-control__error-text" id="input-error-text-2" part="error-text"></div>
61
+ <div aria-hidden="true" class="form-control__error-text" id="input-error-text-2" part="error-text">
62
+ <slot name="error-text"></slot>
63
+ </div>
60
64
  <div aria-hidden="true" class="form-control__help-text" part="help-text">
61
65
  <slot name="help-text"></slot>
62
66
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"six-switch.spec.js","sourceRoot":"","sources":["../../../../src/components/six-switch/test/six-switch.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,2BAA2B;KAClC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;KAyB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,mCAAmC;KAC1C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;KAyB7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSwitch } from '../six-switch';\n\ndescribe('six-switch', () => {\n it('default', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch>\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-1\" id=\"switch-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch\" htmlfor=\"switch-1\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"false\" aria-labelledby=\"switch-label-1\" id=\"switch-1\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-1\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\"></div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n\n it('checked', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch checked></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch checked=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-2\" id=\"switch-label-2\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch switch--checked\" htmlfor=\"switch-2\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"true\" aria-labelledby=\"switch-label-2\" checked=\"\" id=\"switch-2\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-2\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-2\" part=\"error-text\"></div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"six-switch.spec.js","sourceRoot":"","sources":["../../../../src/components/six-switch/test/six-switch.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,2BAA2B;KAClC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;MACvB,IAAI,EAAE,mCAAmC;KAC1C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { SixSwitch } from '../six-switch';\n\ndescribe('six-switch', () => {\n it('default', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch>\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-1\" id=\"switch-label-1\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch\" htmlfor=\"switch-1\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"false\" aria-labelledby=\"switch-label-1\" id=\"switch-1\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-1\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-1\" part=\"error-text\">\n <slot name=\"error-text\"></slot>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n\n it('checked', async () => {\n const page = await newSpecPage({\n components: [SixSwitch],\n html: `<six-switch checked></six-switch>`,\n });\n expect(page.root).toEqualHtml(`\n <six-switch checked=\"\">\n <mock:shadow-root>\n <div class=\"form-control form-control--medium\" part=\"form-control\">\n <label aria-hidden=\"true\" class=\"form-control__label\" htmlfor=\"switch-2\" id=\"switch-label-2\" part=\"label\">\n <slot name=\"label\"></slot>\n </label>\n <div class=\"form-control__input\">\n <label class=\"switch switch--checked\" htmlfor=\"switch-2\" part=\"base\">\n <span class=\"switch__control\" part=\"control\">\n <span class=\"switch__thumb\" part=\"thumb\"></span>\n <input aria-checked=\"true\" aria-labelledby=\"switch-label-2\" checked=\"\" id=\"switch-2\" role=\"switch\" type=\"checkbox\" value=\"on\">\n </span>\n <span class=\"switch__label\" id=\"switch-label-2\" part=\"label\">\n <slot></slot>\n </span>\n </label>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__error-text\" id=\"input-error-text-2\" part=\"error-text\">\n <slot name=\"error-text\"></slot>\n </div>\n <div aria-hidden=\"true\" class=\"form-control__help-text\" part=\"help-text\">\n <slot name=\"help-text\"></slot>\n </div>\n </div>\n </mock:shadow-root>\n </six-switch>\n `);\n });\n});\n"]}
@@ -7,7 +7,7 @@
7
7
  }
8
8
 
9
9
  :host {
10
- display: inline-block;
10
+ display: flex;
11
11
  }
12
12
 
13
13
  .tab {
@@ -16,19 +16,19 @@
16
16
  font-family: var(--six-font-family);
17
17
  font-size: var(--six-font-size-small);
18
18
  font-weight: var(--six-font-weight-semibold);
19
- border-radius: 4px;
20
19
  color: var(--six-tab-color);
21
20
  padding: var(--six-spacing-medium) var(--six-spacing-large);
22
21
  white-space: nowrap;
23
22
  user-select: none;
24
23
  cursor: pointer;
25
- transition: var(--six-transition-fast) box-shadow, var(--six-transition-fast) color;
24
+ width: 100%;
26
25
  }
27
26
  .tab:focus {
28
27
  outline: none;
29
28
  }
30
- .tab:focus:not(.tab--disabled) {
31
- color: var(--six-tab-color-active);
29
+ .tab:focus-visible {
30
+ outline: var(--six-focus-ring);
31
+ outline-offset: calc(-1 * var(--six-focus-ring-width) - var(--six-focus-ring-offset));
32
32
  }
33
33
  .tab.tab--active:not(.tab--disabled) {
34
34
  color: var(--six-tab-color-active);
@@ -51,4 +51,53 @@
51
51
  }
52
52
  .tab__close-button::part(base) {
53
53
  padding: var(--six-spacing-xxx-small);
54
+ }
55
+
56
+ .tab__indicator {
57
+ position: absolute;
58
+ }
59
+ .tab__indicator.tab__indicator--active {
60
+ background-color: var(--six-tab-border-color-active);
61
+ }
62
+
63
+ .tab--top {
64
+ margin-bottom: var(--six-spacing-xxx-small);
65
+ }
66
+
67
+ .tab__indicator--top {
68
+ width: 100%;
69
+ bottom: 0;
70
+ height: var(--six-tab-border-width);
71
+ }
72
+
73
+ .tab--bottom {
74
+ margin-top: var(--six-spacing-xxx-small);
75
+ }
76
+
77
+ .tab__indicator--bottom {
78
+ width: 100%;
79
+ top: 0;
80
+ height: var(--six-tab-border-width);
81
+ }
82
+
83
+ .tab--left {
84
+ margin-right: var(--six-spacing-xxx-small);
85
+ }
86
+
87
+ .tab__indicator--left {
88
+ height: 100%;
89
+ right: 0;
90
+ top: 0;
91
+ width: var(--six-tab-border-width);
92
+ }
93
+
94
+ .tab--right {
95
+ margin-left: var(--six-spacing-xxx-small);
96
+ }
97
+
98
+ .tab__indicator--right {
99
+ height: 100%;
100
+ left: 0;
101
+ top: 0;
102
+ width: var(--six-tab-border-width);
54
103
  }
@@ -36,15 +36,31 @@ export class SixTab {
36
36
  this.sixClose.emit();
37
37
  }
38
38
  render() {
39
+ var _a;
40
+ const tabGroup = this.host.closest('six-tab-group');
41
+ const placement = (_a = tabGroup === null || tabGroup === void 0 ? void 0 : tabGroup.placement) !== null && _a !== void 0 ? _a : 'top';
39
42
  return (
40
- // If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels
43
+ // If the user didn't provide an ID, we'll set one, so we can link tabs and tab panels with aria labels
41
44
  h(Host, { id: this.host.id || this.componentId }, h("div", { part: "base", ref: (el) => (this.tab = el), class: {
42
45
  tab: true,
46
+ // Placements
47
+ 'tab--top': placement === 'top',
48
+ 'tab--bottom': placement === 'bottom',
49
+ 'tab--left': placement === 'left',
50
+ 'tab--right': placement === 'right',
43
51
  // States
44
52
  'tab--active': this.active,
45
53
  'tab--closable': this.closable,
46
54
  'tab--disabled': this.disabled,
47
- }, role: "tab", "aria-disabled": this.disabled ? 'true' : 'false', "aria-selected": this.active ? 'true' : 'false', tabindex: this.disabled || !this.active ? '-1' : '0' }, h("slot", null), this.closable && (h("six-icon-button", { name: "close", size: "xSmall", exportparts: "base:close-button", class: "tab__close-button", onClick: this.handleCloseClick, tabIndex: -1, "aria-hidden": "true" })))));
55
+ }, role: "tab", "aria-disabled": this.disabled ? 'true' : 'false', "aria-selected": this.active ? 'true' : 'false', tabindex: this.disabled || !this.active ? '-1' : '0' }, h("slot", null), this.closable && (h("six-icon-button", { name: "close", size: "xSmall", exportparts: "base:close-button", class: "tab__close-button", onClick: this.handleCloseClick, tabIndex: -1, "aria-hidden": "true" }))), h("div", { class: {
56
+ tab__indicator: true,
57
+ 'tab__indicator--active': this.active,
58
+ // Placements
59
+ 'tab__indicator--top': placement === 'top',
60
+ 'tab__indicator--bottom': placement === 'bottom',
61
+ 'tab__indicator--left': placement === 'left',
62
+ 'tab__indicator--right': placement === 'right',
63
+ } })));
48
64
  }
49
65
  static get is() { return "six-tab"; }
50
66
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"six-tab.js","sourceRoot":"","sources":["../../../src/components/six-tab/six-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,MAAM;;IACT,gBAAW,GAA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AAQ;QACP,IAAI,CAAC,QAAQ,IAAI,CAChB,uBACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,WAAW,EAAC,mBAAmB,EAC/B,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,QAAQ,EAAE,CAAC,CAAC,iBACA,MAAM,GAClB,CACH,CACG,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\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 tab's label.\n *\n * @part base - The component's base wrapper.\n * @part close-button - The close button, which is the icon button's base wrapper.\n */\n\n@Component({\n tag: 'six-tab',\n styleUrl: 'six-tab.scss',\n shadow: true,\n})\nexport class SixTab {\n private componentId = `tab-${++id}`;\n private tab?: HTMLElement;\n\n @Element() host!: HTMLSixTabElement;\n\n /** The name of the tab panel the tab will control. The panel must be located in the same tab group. */\n @Prop({ reflect: true }) panel = '';\n\n /** Set to true to draw the tab in an active state. */\n @Prop({ reflect: true }) active = false;\n\n /** When true, the tab will be rendered with a close icon. */\n @Prop() closable = false;\n\n /** Set to true to draw the tab in a disabled state. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Emitted when the tab is closable and the close button is activated. */\n @Event({ eventName: 'six-tab-close' }) sixClose!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.handleCloseClick = this.handleCloseClick.bind(this);\n }\n\n /** Sets focus to the tab. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.tab?.focus(options);\n }\n\n /** Removes focus from the tab. */\n @Method()\n async removeFocus() {\n this.tab?.blur();\n }\n\n private handleCloseClick() {\n this.sixClose.emit();\n }\n\n render() {\n return (\n // If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels\n <Host id={this.host.id || this.componentId}>\n <div\n part=\"base\"\n ref={(el) => (this.tab = el)}\n class={{\n tab: true,\n\n // States\n 'tab--active': this.active,\n 'tab--closable': this.closable,\n 'tab--disabled': this.disabled,\n }}\n role=\"tab\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-selected={this.active ? 'true' : 'false'}\n tabindex={this.disabled || !this.active ? '-1' : '0'}\n >\n <slot />\n {this.closable && (\n <six-icon-button\n name=\"close\"\n size=\"xSmall\"\n exportparts=\"base:close-button\"\n class=\"tab__close-button\"\n onClick={this.handleCloseClick}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"six-tab.js","sourceRoot":"","sources":["../../../src/components/six-tab/six-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,MAAM;;IACT,gBAAW,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC;iBAMH,EAAE;kBAGD,KAAK;oBAGpB,KAAK;oBAGY,KAAK;;EAKzC,iBAAiB;IACf,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC3D,CAAC;EAED,6BAA6B;EAE7B,KAAK,CAAC,QAAQ,CAAC,OAAsB;;IACnC,MAAA,IAAI,CAAC,GAAG,0CAAE,KAAK,CAAC,OAAO,CAAC,CAAC;EAC3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AEpD,eAAQ;QACP,IAAI,CAAC,QAAQ,IAAI,CAChB,uBACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,WAAW,EAAC,mBAAmB,EAC/B,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,QAAQ,EAAE,CAAC,CAAC,iBACA,MAAM,GAClB,CACH,CACG;MACN,WACE,KAAK,EAAE;UACL,cAAc,EAAE,IAAI;UACpB,wBAAwB,EAAE,IAAI,CAAC,MAAM;UAErC,aAAa;UACb,qBAAqB,EAAE,SAAS,KAAK,KAAK;UAC1C,wBAAwB,EAAE,SAAS,KAAK,QAAQ;UAChD,sBAAsB,EAAE,SAAS,KAAK,MAAM;UAC5C,uBAAuB,EAAE,SAAS,KAAK,OAAO;SAC/C,GACI,CACF,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\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 tab's label.\n *\n * @part base - The component's base wrapper.\n * @part close-button - The close button, which is the icon button's base wrapper.\n */\n\n@Component({\n tag: 'six-tab',\n styleUrl: 'six-tab.scss',\n shadow: true,\n})\nexport class SixTab {\n private componentId = `tab-${++id}`;\n private tab?: HTMLElement;\n\n @Element() host!: HTMLSixTabElement;\n\n /** The name of the tab panel the tab will control. The panel must be located in the same tab group. */\n @Prop({ reflect: true }) panel = '';\n\n /** Set to true to draw the tab in an active state. */\n @Prop({ reflect: true }) active = false;\n\n /** When true, the tab will be rendered with a close icon. */\n @Prop() closable = false;\n\n /** Set to true to draw the tab in a disabled state. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Emitted when the tab is closable and the close button is activated. */\n @Event({ eventName: 'six-tab-close' }) sixClose!: EventEmitter<EmptyPayload>;\n\n connectedCallback() {\n this.handleCloseClick = this.handleCloseClick.bind(this);\n }\n\n /** Sets focus to the tab. */\n @Method()\n async setFocus(options?: FocusOptions) {\n this.tab?.focus(options);\n }\n\n /** Removes focus from the tab. */\n @Method()\n async removeFocus() {\n this.tab?.blur();\n }\n\n private handleCloseClick() {\n this.sixClose.emit();\n }\n\n render() {\n const tabGroup: HTMLSixTabGroupElement | null = this.host.closest('six-tab-group');\n const placement = tabGroup?.placement ?? 'top';\n return (\n // If the user didn't provide an ID, we'll set one, so we can link tabs and tab panels with aria labels\n <Host id={this.host.id || this.componentId}>\n <div\n part=\"base\"\n ref={(el) => (this.tab = el)}\n class={{\n tab: true,\n\n // Placements\n 'tab--top': placement === 'top',\n 'tab--bottom': placement === 'bottom',\n 'tab--left': placement === 'left',\n 'tab--right': placement === 'right',\n\n // States\n 'tab--active': this.active,\n 'tab--closable': this.closable,\n 'tab--disabled': this.disabled,\n }}\n role=\"tab\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-selected={this.active ? 'true' : 'false'}\n tabindex={this.disabled || !this.active ? '-1' : '0'}\n >\n <slot />\n {this.closable && (\n <six-icon-button\n name=\"close\"\n size=\"xSmall\"\n exportparts=\"base:close-button\"\n class=\"tab__close-button\"\n onClick={this.handleCloseClick}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n )}\n </div>\n <div\n class={{\n tab__indicator: true,\n 'tab__indicator--active': this.active,\n\n // Placements\n 'tab__indicator--top': placement === 'top',\n 'tab__indicator--bottom': placement === 'bottom',\n 'tab__indicator--left': placement === 'left',\n 'tab__indicator--right': placement === 'right',\n }}\n ></div>\n </Host>\n );\n }\n}\n"]}
@@ -6,11 +6,7 @@
6
6
  box-sizing: inherit;
7
7
  }
8
8
 
9
- /**
10
- * @prop --tabs-border-color: The color of the border that separates tabs.
11
- */
12
9
  :host {
13
- --tabs-border-color: var(--six-tab-border-color);
14
10
  display: block;
15
11
  }
16
12
 
@@ -23,13 +19,6 @@
23
19
  display: flex;
24
20
  position: relative;
25
21
  }
26
- .tab-group .tab-group__active-tab-indicator {
27
- position: absolute;
28
- transition: var(--six-transition-fast) transform ease, var(--six-transition-fast) width ease;
29
- }
30
- .tab-group:not(.focus-visible) ::slotted(six-tab) {
31
- --focus-ring: none;
32
- }
33
22
 
34
23
  .tab-group--has-scroll-controls .tab-group__nav-container {
35
24
  position: relative;
@@ -74,11 +63,6 @@
74
63
  flex: 1 1 auto;
75
64
  position: relative;
76
65
  flex-direction: row;
77
- border-bottom: solid var(--six-tab-border-width) var(--tabs-border-color);
78
- }
79
- .tab-group--top .tab-group__active-tab-indicator {
80
- bottom: -2px;
81
- border-bottom: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
82
66
  }
83
67
  .tab-group--top .tab-group__body {
84
68
  order: 2;
@@ -104,11 +88,6 @@
104
88
  flex: 1 1 auto;
105
89
  position: relative;
106
90
  flex-direction: row;
107
- border-top: solid var(--six-tab-border-width) var(--tabs-border-color);
108
- }
109
- .tab-group--bottom .tab-group__active-tab-indicator {
110
- top: -2px;
111
- border-top: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
112
91
  }
113
92
  .tab-group--bottom .tab-group__body {
114
93
  order: 1;
@@ -123,11 +102,6 @@
123
102
  .tab-group--left .tab-group__tabs {
124
103
  flex: 0 0 auto;
125
104
  flex-direction: column;
126
- border-right: solid var(--six-tab-border-width) var(--tabs-border-color);
127
- }
128
- .tab-group--left .tab-group__active-tab-indicator {
129
- right: -2px;
130
- border-right: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
131
105
  }
132
106
  .tab-group--left .tab-group__body {
133
107
  flex: 1 1 auto;
@@ -143,11 +117,6 @@
143
117
  .tab-group--right .tab-group__tabs {
144
118
  flex: 0 0 auto;
145
119
  flex-direction: column;
146
- border-left: solid var(--six-tab-border-width) var(--tabs-border-color);
147
- }
148
- .tab-group--right .tab-group__active-tab-indicator {
149
- left: -2px;
150
- border-left: solid var(--six-tab-border-width-active) var(--six-tab-border-color-active);
151
120
  }
152
121
  .tab-group--right .tab-group__body {
153
122
  flex: 1 1 auto;
@@ -1,7 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
- import { getOffset } from "../../utils/offset";
3
2
  import { scrollIntoView } from "../../utils/scroll";
4
- import { focusVisible } from "../../utils/focus-visible";
3
+ import { flipAnimate } from "../../utils/animation";
5
4
  /**
6
5
  * @since 1.0
7
6
  * @status stable
@@ -42,13 +41,6 @@ export class SixTabGroup {
42
41
  if (tabGroup !== this.host) {
43
42
  return false;
44
43
  }
45
- // Activate a tab
46
- if (['Enter', ' '].includes(event.key)) {
47
- if (tab != null) {
48
- this.setActiveTab(tab);
49
- event.preventDefault();
50
- }
51
- }
52
44
  // Move focus left or right
53
45
  if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {
54
46
  const activeEl = document.activeElement;
@@ -68,6 +60,7 @@ export class SixTabGroup {
68
60
  index = Math.min(tabs.length - 1, index + 1);
69
61
  }
70
62
  tabs[index].setFocus({ preventScroll: true });
63
+ this.setActiveTab(tabs[index]);
71
64
  if (['top', 'bottom'].includes(this.placement)) {
72
65
  scrollIntoView(tabs[index], this.nav, 'horizontal');
73
66
  }
@@ -91,44 +84,10 @@ export class SixTabGroup {
91
84
  behavior: 'smooth',
92
85
  });
93
86
  };
94
- this.syncActiveTabIndicator = () => {
95
- if (this.activeTabIndicator == null || this.nav == null)
96
- return;
97
- const tab = this.getActiveTab();
98
- if (tab != null) {
99
- this.activeTabIndicator.style.display = 'block';
100
- }
101
- else {
102
- this.activeTabIndicator.style.display = 'none';
103
- return;
104
- }
105
- const width = tab.clientWidth;
106
- const height = tab.clientHeight;
107
- const offset = getOffset(tab, this.nav);
108
- const offsetTop = offset.top + this.nav.scrollTop;
109
- const offsetLeft = offset.left + this.nav.scrollLeft;
110
- switch (this.placement) {
111
- case 'top':
112
- case 'bottom':
113
- this.activeTabIndicator.style.width = `${width}px`;
114
- this.activeTabIndicator.style.height = '';
115
- this.activeTabIndicator.style.transform = `translateX(${offsetLeft}px)`;
116
- break;
117
- case 'left':
118
- case 'right':
119
- this.activeTabIndicator.style.width = '';
120
- this.activeTabIndicator.style.height = `${height}px`;
121
- this.activeTabIndicator.style.transform = `translateY(${offsetTop}px)`;
122
- break;
123
- }
124
- };
125
87
  this.hasScrollControls = false;
126
88
  this.placement = 'top';
127
89
  this.noScrollControls = false;
128
90
  }
129
- handlePlacementChange() {
130
- this.syncActiveTabIndicator();
131
- }
132
91
  handleNoScrollControlsChange() {
133
92
  this.updateScrollControls();
134
93
  }
@@ -144,7 +103,6 @@ export class SixTabGroup {
144
103
  }
145
104
  });
146
105
  observer.observe(this.host);
147
- focusVisible.observe(this.tabGroup);
148
106
  this.resizeObserver = new ResizeObserver(() => this.updateScrollControls());
149
107
  this.resizeObserver.observe(this.nav);
150
108
  requestAnimationFrame(() => this.updateScrollControls());
@@ -164,7 +122,6 @@ export class SixTabGroup {
164
122
  return;
165
123
  }
166
124
  this.mutationObserver.disconnect();
167
- focusVisible.unobserve(this.tabGroup);
168
125
  this.resizeObserver.unobserve(this.nav);
169
126
  }
170
127
  /** Shows the specified tab panel. */
@@ -204,15 +161,20 @@ export class SixTabGroup {
204
161
  : ['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth;
205
162
  }
206
163
  setActiveTab(tab, emitEvents = true) {
164
+ var _a, _b, _c;
207
165
  if (this.nav == null)
208
166
  return;
209
- if (tab != null && tab !== this.activeTab && !tab.disabled) {
167
+ const newIndicator = (_a = tab === null || tab === void 0 ? void 0 : tab.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.tab__indicator');
168
+ const oldIndicator = (_c = (_b = this.getActiveTab()) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.tab__indicator');
169
+ if (oldIndicator != null && newIndicator != null) {
170
+ flipAnimate(newIndicator, oldIndicator);
171
+ }
172
+ if (tab !== this.activeTab && !tab.disabled) {
210
173
  const previousTab = this.activeTab;
211
174
  this.activeTab = tab;
212
175
  // Sync tabs and panels
213
176
  this.getAllTabs().map((el) => (el.active = el === this.activeTab));
214
177
  this.getAllPanels().map((el) => { var _a; return (el.active = el.name === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)); });
215
- this.syncActiveTabIndicator();
216
178
  if (['top', 'bottom'].includes(this.placement)) {
217
179
  scrollIntoView(this.activeTab, this.nav, 'horizontal');
218
180
  }
@@ -247,7 +209,7 @@ export class SixTabGroup {
247
209
  'tab-group--left': this.placement === 'left',
248
210
  'tab-group--right': this.placement === 'right',
249
211
  'tab-group--has-scroll-controls': this.hasScrollControls,
250
- }, onClick: this.handleClick, onKeyDown: this.handleKeyDown }, h("div", { class: "tab-group__nav-container" }, this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--left", exportparts: "base:scroll-button", name: "chevron_left", onClick: this.handleScrollLeft })), h("div", { ref: (el) => (this.nav = el), key: "nav", part: "nav", class: "tab-group__nav" }, h("div", { ref: (el) => (this.tabs = el), part: "tabs", class: "tab-group__tabs", role: "tablist" }, h("div", { ref: (el) => (this.activeTabIndicator = el), part: "active-tab-indicator", class: "tab-group__active-tab-indicator" }), h("slot", { name: "nav", onSlotchange: this.syncActiveTabIndicator }))), this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--right", exportparts: "base:scroll-button", name: "chevron_right", onClick: this.handleScrollRight }))), h("div", { ref: (el) => (this.body = el), part: "body", class: "tab-group__body" }, h("slot", { onSlotchange: this.syncActiveTabIndicator }))));
212
+ }, onClick: this.handleClick, onKeyDown: this.handleKeyDown }, h("div", { class: "tab-group__nav-container" }, this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--left", exportparts: "base:scroll-button", name: "chevron_left", onClick: this.handleScrollLeft })), h("div", { ref: (el) => (this.nav = el), key: "nav", part: "nav", class: "tab-group__nav" }, h("div", { ref: (el) => (this.tabs = el), part: "tabs", class: "tab-group__tabs", role: "tablist" }, h("slot", { name: "nav" }))), this.hasScrollControls && (h("six-icon-button", { class: "tab-group__scroll-button tab-group__scroll-button--right", exportparts: "base:scroll-button", name: "chevron_right", onClick: this.handleScrollRight }))), h("div", { ref: (el) => (this.body = el), part: "body", class: "tab-group__body" }, h("slot", null))));
251
213
  }
252
214
  static get is() { return "six-tab-group"; }
253
215
  static get encapsulation() { return "shadow"; }
@@ -378,9 +340,6 @@ export class SixTabGroup {
378
340
  static get elementRef() { return "host"; }
379
341
  static get watchers() {
380
342
  return [{
381
- "propName": "placement",
382
- "methodName": "handlePlacementChange"
383
- }, {
384
343
  "propName": "noScrollControls",
385
344
  "methodName": "handleNoScrollControlsChange"
386
345
  }];