@tartaguti/ui-components 0.0.0-stage → 0.1.0

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 (392) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +192 -2
  4. package/THIRD-PARTY-NOTICES.md +29 -0
  5. package/custom-elements.json +16731 -0
  6. package/dist/accordion/tt-accordion-item.d.ts +32 -0
  7. package/dist/accordion/tt-accordion-item.d.ts.map +1 -0
  8. package/dist/accordion/tt-accordion-item.js +247 -0
  9. package/dist/accordion/tt-accordion-item.js.map +1 -0
  10. package/dist/accordion/tt-accordion.d.ts +28 -0
  11. package/dist/accordion/tt-accordion.d.ts.map +1 -0
  12. package/dist/accordion/tt-accordion.js +148 -0
  13. package/dist/accordion/tt-accordion.js.map +1 -0
  14. package/dist/bento/tt-bento-item.d.ts +35 -0
  15. package/dist/bento/tt-bento-item.d.ts.map +1 -0
  16. package/dist/bento/tt-bento-item.js +201 -0
  17. package/dist/bento/tt-bento-item.js.map +1 -0
  18. package/dist/bento/tt-bento.d.ts +25 -0
  19. package/dist/bento/tt-bento.d.ts.map +1 -0
  20. package/dist/bento/tt-bento.js +314 -0
  21. package/dist/bento/tt-bento.js.map +1 -0
  22. package/dist/floating.d.ts +61 -0
  23. package/dist/floating.d.ts.map +1 -0
  24. package/dist/floating.js +120 -0
  25. package/dist/floating.js.map +1 -0
  26. package/dist/index.d.ts +92 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +96 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/interaction/tt-draggable.d.ts +29 -0
  31. package/dist/interaction/tt-draggable.d.ts.map +1 -0
  32. package/dist/interaction/tt-draggable.js +66 -0
  33. package/dist/interaction/tt-draggable.js.map +1 -0
  34. package/dist/interaction/tt-droppable.d.ts +37 -0
  35. package/dist/interaction/tt-droppable.d.ts.map +1 -0
  36. package/dist/interaction/tt-droppable.js +108 -0
  37. package/dist/interaction/tt-droppable.js.map +1 -0
  38. package/dist/interaction/tt-resizable.d.ts +45 -0
  39. package/dist/interaction/tt-resizable.d.ts.map +1 -0
  40. package/dist/interaction/tt-resizable.js +210 -0
  41. package/dist/interaction/tt-resizable.js.map +1 -0
  42. package/dist/interaction/tt-reveal.d.ts +54 -0
  43. package/dist/interaction/tt-reveal.d.ts.map +1 -0
  44. package/dist/interaction/tt-reveal.js +302 -0
  45. package/dist/interaction/tt-reveal.js.map +1 -0
  46. package/dist/motion.d.ts +8 -0
  47. package/dist/motion.d.ts.map +1 -0
  48. package/dist/motion.js +49 -0
  49. package/dist/motion.js.map +1 -0
  50. package/dist/overlay.d.ts +7 -0
  51. package/dist/overlay.d.ts.map +1 -0
  52. package/dist/overlay.js +121 -0
  53. package/dist/overlay.js.map +1 -0
  54. package/dist/safe-url.d.ts +14 -0
  55. package/dist/safe-url.d.ts.map +1 -0
  56. package/dist/safe-url.js +46 -0
  57. package/dist/safe-url.js.map +1 -0
  58. package/dist/scroll-lock.d.ts +22 -0
  59. package/dist/scroll-lock.d.ts.map +1 -0
  60. package/dist/scroll-lock.js +56 -0
  61. package/dist/scroll-lock.js.map +1 -0
  62. package/dist/sidebar/tt-menu-group.d.ts +69 -0
  63. package/dist/sidebar/tt-menu-group.d.ts.map +1 -0
  64. package/dist/sidebar/tt-menu-group.js +358 -0
  65. package/dist/sidebar/tt-menu-group.js.map +1 -0
  66. package/dist/sidebar/tt-menu-item.d.ts +70 -0
  67. package/dist/sidebar/tt-menu-item.d.ts.map +1 -0
  68. package/dist/sidebar/tt-menu-item.js +502 -0
  69. package/dist/sidebar/tt-menu-item.js.map +1 -0
  70. package/dist/sidebar/tt-sidebar-footer.d.ts +39 -0
  71. package/dist/sidebar/tt-sidebar-footer.d.ts.map +1 -0
  72. package/dist/sidebar/tt-sidebar-footer.js +205 -0
  73. package/dist/sidebar/tt-sidebar-footer.js.map +1 -0
  74. package/dist/sidebar/tt-sidebar-header.d.ts +31 -0
  75. package/dist/sidebar/tt-sidebar-header.d.ts.map +1 -0
  76. package/dist/sidebar/tt-sidebar-header.js +150 -0
  77. package/dist/sidebar/tt-sidebar-header.js.map +1 -0
  78. package/dist/sidebar/tt-sidebar.d.ts +72 -0
  79. package/dist/sidebar/tt-sidebar.d.ts.map +1 -0
  80. package/dist/sidebar/tt-sidebar.js +539 -0
  81. package/dist/sidebar/tt-sidebar.js.map +1 -0
  82. package/dist/sr-only.d.ts +15 -0
  83. package/dist/sr-only.d.ts.map +1 -0
  84. package/dist/sr-only.js +27 -0
  85. package/dist/sr-only.js.map +1 -0
  86. package/dist/tokens.css +1124 -0
  87. package/dist/tt-alert.d.ts +26 -0
  88. package/dist/tt-alert.d.ts.map +1 -0
  89. package/dist/tt-alert.js +165 -0
  90. package/dist/tt-alert.js.map +1 -0
  91. package/dist/tt-aspect-ratio.d.ts +40 -0
  92. package/dist/tt-aspect-ratio.d.ts.map +1 -0
  93. package/dist/tt-aspect-ratio.js +98 -0
  94. package/dist/tt-aspect-ratio.js.map +1 -0
  95. package/dist/tt-auth.d.ts +75 -0
  96. package/dist/tt-auth.d.ts.map +1 -0
  97. package/dist/tt-auth.js +520 -0
  98. package/dist/tt-auth.js.map +1 -0
  99. package/dist/tt-avatar.d.ts +26 -0
  100. package/dist/tt-avatar.d.ts.map +1 -0
  101. package/dist/tt-avatar.js +169 -0
  102. package/dist/tt-avatar.js.map +1 -0
  103. package/dist/tt-badge.d.ts +36 -0
  104. package/dist/tt-badge.d.ts.map +1 -0
  105. package/dist/tt-badge.js +135 -0
  106. package/dist/tt-badge.js.map +1 -0
  107. package/dist/tt-breadcrumbs.d.ts +22 -0
  108. package/dist/tt-breadcrumbs.d.ts.map +1 -0
  109. package/dist/tt-breadcrumbs.js +144 -0
  110. package/dist/tt-breadcrumbs.js.map +1 -0
  111. package/dist/tt-button-group.d.ts +32 -0
  112. package/dist/tt-button-group.d.ts.map +1 -0
  113. package/dist/tt-button-group.js +132 -0
  114. package/dist/tt-button-group.js.map +1 -0
  115. package/dist/tt-button.d.ts +31 -0
  116. package/dist/tt-button.d.ts.map +1 -0
  117. package/dist/tt-button.js +483 -0
  118. package/dist/tt-button.js.map +1 -0
  119. package/dist/tt-card.d.ts +26 -0
  120. package/dist/tt-card.d.ts.map +1 -0
  121. package/dist/tt-card.js +429 -0
  122. package/dist/tt-card.js.map +1 -0
  123. package/dist/tt-chart.d.ts +36 -0
  124. package/dist/tt-chart.d.ts.map +1 -0
  125. package/dist/tt-chart.js +332 -0
  126. package/dist/tt-chart.js.map +1 -0
  127. package/dist/tt-checkbox-group.d.ts +38 -0
  128. package/dist/tt-checkbox-group.d.ts.map +1 -0
  129. package/dist/tt-checkbox-group.js +243 -0
  130. package/dist/tt-checkbox-group.js.map +1 -0
  131. package/dist/tt-checkbox.d.ts +35 -0
  132. package/dist/tt-checkbox.d.ts.map +1 -0
  133. package/dist/tt-checkbox.js +354 -0
  134. package/dist/tt-checkbox.js.map +1 -0
  135. package/dist/tt-code-block.d.ts +37 -0
  136. package/dist/tt-code-block.d.ts.map +1 -0
  137. package/dist/tt-code-block.js +409 -0
  138. package/dist/tt-code-block.js.map +1 -0
  139. package/dist/tt-collapsible.d.ts +71 -0
  140. package/dist/tt-collapsible.d.ts.map +1 -0
  141. package/dist/tt-collapsible.js +206 -0
  142. package/dist/tt-collapsible.js.map +1 -0
  143. package/dist/tt-combobox.d.ts +107 -0
  144. package/dist/tt-combobox.d.ts.map +1 -0
  145. package/dist/tt-combobox.js +816 -0
  146. package/dist/tt-combobox.js.map +1 -0
  147. package/dist/tt-company-card.d.ts +30 -0
  148. package/dist/tt-company-card.d.ts.map +1 -0
  149. package/dist/tt-company-card.js +382 -0
  150. package/dist/tt-company-card.js.map +1 -0
  151. package/dist/tt-comparison-table.d.ts +59 -0
  152. package/dist/tt-comparison-table.d.ts.map +1 -0
  153. package/dist/tt-comparison-table.js +441 -0
  154. package/dist/tt-comparison-table.js.map +1 -0
  155. package/dist/tt-component-doc.d.ts +63 -0
  156. package/dist/tt-component-doc.d.ts.map +1 -0
  157. package/dist/tt-component-doc.js +585 -0
  158. package/dist/tt-component-doc.js.map +1 -0
  159. package/dist/tt-confirm.d.ts +45 -0
  160. package/dist/tt-confirm.d.ts.map +1 -0
  161. package/dist/tt-confirm.js +151 -0
  162. package/dist/tt-confirm.js.map +1 -0
  163. package/dist/tt-contact-list.d.ts +18 -0
  164. package/dist/tt-contact-list.d.ts.map +1 -0
  165. package/dist/tt-contact-list.js +101 -0
  166. package/dist/tt-contact-list.js.map +1 -0
  167. package/dist/tt-copy-button.d.ts +25 -0
  168. package/dist/tt-copy-button.d.ts.map +1 -0
  169. package/dist/tt-copy-button.js +194 -0
  170. package/dist/tt-copy-button.js.map +1 -0
  171. package/dist/tt-data-table.d.ts +69 -0
  172. package/dist/tt-data-table.d.ts.map +1 -0
  173. package/dist/tt-data-table.js +542 -0
  174. package/dist/tt-data-table.js.map +1 -0
  175. package/dist/tt-divider.d.ts +19 -0
  176. package/dist/tt-divider.d.ts.map +1 -0
  177. package/dist/tt-divider.js +104 -0
  178. package/dist/tt-divider.js.map +1 -0
  179. package/dist/tt-drawer.d.ts +38 -0
  180. package/dist/tt-drawer.d.ts.map +1 -0
  181. package/dist/tt-drawer.js +433 -0
  182. package/dist/tt-drawer.js.map +1 -0
  183. package/dist/tt-dropdown-menu.d.ts +57 -0
  184. package/dist/tt-dropdown-menu.d.ts.map +1 -0
  185. package/dist/tt-dropdown-menu.js +631 -0
  186. package/dist/tt-dropdown-menu.js.map +1 -0
  187. package/dist/tt-empty-state.d.ts +13 -0
  188. package/dist/tt-empty-state.d.ts.map +1 -0
  189. package/dist/tt-empty-state.js +94 -0
  190. package/dist/tt-empty-state.js.map +1 -0
  191. package/dist/tt-example.d.ts +33 -0
  192. package/dist/tt-example.d.ts.map +1 -0
  193. package/dist/tt-example.js +250 -0
  194. package/dist/tt-example.js.map +1 -0
  195. package/dist/tt-file-upload.d.ts +85 -0
  196. package/dist/tt-file-upload.d.ts.map +1 -0
  197. package/dist/tt-file-upload.js +662 -0
  198. package/dist/tt-file-upload.js.map +1 -0
  199. package/dist/tt-filter.d.ts +62 -0
  200. package/dist/tt-filter.d.ts.map +1 -0
  201. package/dist/tt-filter.js +393 -0
  202. package/dist/tt-filter.js.map +1 -0
  203. package/dist/tt-form.d.ts +33 -0
  204. package/dist/tt-form.d.ts.map +1 -0
  205. package/dist/tt-form.js +202 -0
  206. package/dist/tt-form.js.map +1 -0
  207. package/dist/tt-grid.d.ts +22 -0
  208. package/dist/tt-grid.d.ts.map +1 -0
  209. package/dist/tt-grid.js +106 -0
  210. package/dist/tt-grid.js.map +1 -0
  211. package/dist/tt-icon.d.ts +20 -0
  212. package/dist/tt-icon.d.ts.map +1 -0
  213. package/dist/tt-icon.js +510 -0
  214. package/dist/tt-icon.js.map +1 -0
  215. package/dist/tt-image.d.ts +59 -0
  216. package/dist/tt-image.d.ts.map +1 -0
  217. package/dist/tt-image.js +314 -0
  218. package/dist/tt-image.js.map +1 -0
  219. package/dist/tt-inbox.d.ts +45 -0
  220. package/dist/tt-inbox.d.ts.map +1 -0
  221. package/dist/tt-inbox.js +275 -0
  222. package/dist/tt-inbox.js.map +1 -0
  223. package/dist/tt-input.d.ts +43 -0
  224. package/dist/tt-input.d.ts.map +1 -0
  225. package/dist/tt-input.js +476 -0
  226. package/dist/tt-input.js.map +1 -0
  227. package/dist/tt-kbd.d.ts +39 -0
  228. package/dist/tt-kbd.d.ts.map +1 -0
  229. package/dist/tt-kbd.js +145 -0
  230. package/dist/tt-kbd.js.map +1 -0
  231. package/dist/tt-key-values.d.ts +17 -0
  232. package/dist/tt-key-values.d.ts.map +1 -0
  233. package/dist/tt-key-values.js +126 -0
  234. package/dist/tt-key-values.js.map +1 -0
  235. package/dist/tt-knowledge-doc.d.ts +24 -0
  236. package/dist/tt-knowledge-doc.d.ts.map +1 -0
  237. package/dist/tt-knowledge-doc.js +120 -0
  238. package/dist/tt-knowledge-doc.js.map +1 -0
  239. package/dist/tt-layout.d.ts +36 -0
  240. package/dist/tt-layout.d.ts.map +1 -0
  241. package/dist/tt-layout.js +318 -0
  242. package/dist/tt-layout.js.map +1 -0
  243. package/dist/tt-modal.d.ts +32 -0
  244. package/dist/tt-modal.d.ts.map +1 -0
  245. package/dist/tt-modal.js +553 -0
  246. package/dist/tt-modal.js.map +1 -0
  247. package/dist/tt-navbar.d.ts +33 -0
  248. package/dist/tt-navbar.d.ts.map +1 -0
  249. package/dist/tt-navbar.js +390 -0
  250. package/dist/tt-navbar.js.map +1 -0
  251. package/dist/tt-page-header.d.ts +28 -0
  252. package/dist/tt-page-header.d.ts.map +1 -0
  253. package/dist/tt-page-header.js +166 -0
  254. package/dist/tt-page-header.js.map +1 -0
  255. package/dist/tt-page.d.ts +14 -0
  256. package/dist/tt-page.d.ts.map +1 -0
  257. package/dist/tt-page.js +163 -0
  258. package/dist/tt-page.js.map +1 -0
  259. package/dist/tt-pagination.d.ts +27 -0
  260. package/dist/tt-pagination.d.ts.map +1 -0
  261. package/dist/tt-pagination.js +194 -0
  262. package/dist/tt-pagination.js.map +1 -0
  263. package/dist/tt-preview.d.ts +11 -0
  264. package/dist/tt-preview.d.ts.map +1 -0
  265. package/dist/tt-preview.js +68 -0
  266. package/dist/tt-preview.js.map +1 -0
  267. package/dist/tt-product.d.ts +40 -0
  268. package/dist/tt-product.d.ts.map +1 -0
  269. package/dist/tt-product.js +590 -0
  270. package/dist/tt-product.js.map +1 -0
  271. package/dist/tt-profile-card.d.ts +23 -0
  272. package/dist/tt-profile-card.d.ts.map +1 -0
  273. package/dist/tt-profile-card.js +199 -0
  274. package/dist/tt-profile-card.js.map +1 -0
  275. package/dist/tt-progress.d.ts +26 -0
  276. package/dist/tt-progress.d.ts.map +1 -0
  277. package/dist/tt-progress.js +156 -0
  278. package/dist/tt-progress.js.map +1 -0
  279. package/dist/tt-quantity.d.ts +36 -0
  280. package/dist/tt-quantity.d.ts.map +1 -0
  281. package/dist/tt-quantity.js +396 -0
  282. package/dist/tt-quantity.js.map +1 -0
  283. package/dist/tt-radio-group.d.ts +50 -0
  284. package/dist/tt-radio-group.d.ts.map +1 -0
  285. package/dist/tt-radio-group.js +372 -0
  286. package/dist/tt-radio-group.js.map +1 -0
  287. package/dist/tt-rating.d.ts +54 -0
  288. package/dist/tt-rating.d.ts.map +1 -0
  289. package/dist/tt-rating.js +312 -0
  290. package/dist/tt-rating.js.map +1 -0
  291. package/dist/tt-search.d.ts +47 -0
  292. package/dist/tt-search.d.ts.map +1 -0
  293. package/dist/tt-search.js +360 -0
  294. package/dist/tt-search.js.map +1 -0
  295. package/dist/tt-section.d.ts +13 -0
  296. package/dist/tt-section.d.ts.map +1 -0
  297. package/dist/tt-section.js +98 -0
  298. package/dist/tt-section.js.map +1 -0
  299. package/dist/tt-select.d.ts +62 -0
  300. package/dist/tt-select.d.ts.map +1 -0
  301. package/dist/tt-select.js +662 -0
  302. package/dist/tt-select.js.map +1 -0
  303. package/dist/tt-skeleton.d.ts +20 -0
  304. package/dist/tt-skeleton.d.ts.map +1 -0
  305. package/dist/tt-skeleton.js +143 -0
  306. package/dist/tt-skeleton.js.map +1 -0
  307. package/dist/tt-slider.d.ts +74 -0
  308. package/dist/tt-slider.d.ts.map +1 -0
  309. package/dist/tt-slider.js +426 -0
  310. package/dist/tt-slider.js.map +1 -0
  311. package/dist/tt-social-links.d.ts +34 -0
  312. package/dist/tt-social-links.d.ts.map +1 -0
  313. package/dist/tt-social-links.js +242 -0
  314. package/dist/tt-social-links.js.map +1 -0
  315. package/dist/tt-sparkline.d.ts +19 -0
  316. package/dist/tt-sparkline.d.ts.map +1 -0
  317. package/dist/tt-sparkline.js +191 -0
  318. package/dist/tt-sparkline.js.map +1 -0
  319. package/dist/tt-spinner.d.ts +19 -0
  320. package/dist/tt-spinner.d.ts.map +1 -0
  321. package/dist/tt-spinner.js +93 -0
  322. package/dist/tt-spinner.js.map +1 -0
  323. package/dist/tt-stack.d.ts +42 -0
  324. package/dist/tt-stack.d.ts.map +1 -0
  325. package/dist/tt-stack.js +158 -0
  326. package/dist/tt-stack.js.map +1 -0
  327. package/dist/tt-stat.d.ts +17 -0
  328. package/dist/tt-stat.d.ts.map +1 -0
  329. package/dist/tt-stat.js +134 -0
  330. package/dist/tt-stat.js.map +1 -0
  331. package/dist/tt-switch.d.ts +39 -0
  332. package/dist/tt-switch.d.ts.map +1 -0
  333. package/dist/tt-switch.js +254 -0
  334. package/dist/tt-switch.js.map +1 -0
  335. package/dist/tt-switcher.d.ts +23 -0
  336. package/dist/tt-switcher.d.ts.map +1 -0
  337. package/dist/tt-switcher.js +203 -0
  338. package/dist/tt-switcher.js.map +1 -0
  339. package/dist/tt-table-cell.d.ts +26 -0
  340. package/dist/tt-table-cell.d.ts.map +1 -0
  341. package/dist/tt-table-cell.js +121 -0
  342. package/dist/tt-table-cell.js.map +1 -0
  343. package/dist/tt-table-row.d.ts +31 -0
  344. package/dist/tt-table-row.d.ts.map +1 -0
  345. package/dist/tt-table-row.js +72 -0
  346. package/dist/tt-table-row.js.map +1 -0
  347. package/dist/tt-table.d.ts +44 -0
  348. package/dist/tt-table.d.ts.map +1 -0
  349. package/dist/tt-table.js +270 -0
  350. package/dist/tt-table.js.map +1 -0
  351. package/dist/tt-tabs.d.ts +31 -0
  352. package/dist/tt-tabs.d.ts.map +1 -0
  353. package/dist/tt-tabs.js +223 -0
  354. package/dist/tt-tabs.js.map +1 -0
  355. package/dist/tt-tag-list.d.ts +19 -0
  356. package/dist/tt-tag-list.d.ts.map +1 -0
  357. package/dist/tt-tag-list.js +136 -0
  358. package/dist/tt-tag-list.js.map +1 -0
  359. package/dist/tt-text.d.ts +52 -0
  360. package/dist/tt-text.d.ts.map +1 -0
  361. package/dist/tt-text.js +337 -0
  362. package/dist/tt-text.js.map +1 -0
  363. package/dist/tt-textarea.d.ts +43 -0
  364. package/dist/tt-textarea.d.ts.map +1 -0
  365. package/dist/tt-textarea.js +356 -0
  366. package/dist/tt-textarea.js.map +1 -0
  367. package/dist/tt-thread.d.ts +62 -0
  368. package/dist/tt-thread.d.ts.map +1 -0
  369. package/dist/tt-thread.js +374 -0
  370. package/dist/tt-thread.js.map +1 -0
  371. package/dist/tt-toast.d.ts +49 -0
  372. package/dist/tt-toast.d.ts.map +1 -0
  373. package/dist/tt-toast.js +440 -0
  374. package/dist/tt-toast.js.map +1 -0
  375. package/dist/tt-toggle-group.d.ts +73 -0
  376. package/dist/tt-toggle-group.d.ts.map +1 -0
  377. package/dist/tt-toggle-group.js +273 -0
  378. package/dist/tt-toggle-group.js.map +1 -0
  379. package/dist/tt-toggle.d.ts +54 -0
  380. package/dist/tt-toggle.d.ts.map +1 -0
  381. package/dist/tt-toggle.js +232 -0
  382. package/dist/tt-toggle.js.map +1 -0
  383. package/dist/tt-toolbar.d.ts +26 -0
  384. package/dist/tt-toolbar.d.ts.map +1 -0
  385. package/dist/tt-toolbar.js +164 -0
  386. package/dist/tt-toolbar.js.map +1 -0
  387. package/dist/tt-tooltip.d.ts +42 -0
  388. package/dist/tt-tooltip.d.ts.map +1 -0
  389. package/dist/tt-tooltip.js +299 -0
  390. package/dist/tt-tooltip.js.map +1 -0
  391. package/package.json +84 -4
  392. package/vscode.html-custom-data.json +2907 -0
@@ -0,0 +1,542 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, css } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
10
+ import "./tt-checkbox.js";
11
+ import "./tt-skeleton.js";
12
+ import "./tt-empty-state.js";
13
+ import "./tt-dropdown-menu.js";
14
+ import "./tt-icon.js";
15
+ import { srOnly } from "./sr-only.js";
16
+ /**
17
+ * Working table: sorting, selection, row actions, sticky header, and
18
+ * loading and empty states.
19
+ *
20
+ * It owns nothing. Sort state and selection come in as properties and
21
+ * changes go out as events, so the page stays the single source of truth
22
+ * and can put either in a URL. Sorting itself is the page's job too: it
23
+ * knows whether the data is an in-memory array or a server query.
24
+ */
25
+ let TTDataTable = class TTDataTable extends LitElement {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.columns = [];
29
+ this.rows = [];
30
+ /*
31
+ The table's name for screen readers, announced on entering it
32
+ ("Team members, table"). Same word and job as tt-table's label. A
33
+ heading above the table names it for sighted readers only.
34
+ */
35
+ this.label = "";
36
+ this.selectable = false;
37
+ this.selected = [];
38
+ // Same menu on every row. Leave empty for no actions column.
39
+ this.rowActions = [];
40
+ this.loading = false;
41
+ this.loadingRows = 5;
42
+ this.emptyHeading = "Nothing here yet";
43
+ this.emptyDescription = "";
44
+ // Rows respond to clicks. Only set this when there is somewhere to go.
45
+ this.clickableRows = false;
46
+ }
47
+ /*
48
+ What a row's selection checkbox is called.
49
+
50
+ "Select row" repeated twenty times tells a screen-reader user which
51
+ control they are on but nothing about what it does. The first column
52
+ is the closest thing to a row's name that a generic table can know,
53
+ so "Select Adriatik" comes out of the data rather than a guess.
54
+ */
55
+ rowLabel(row) {
56
+ const name = this.rowName(row);
57
+ return name ? `Select ${name}` : "Select row";
58
+ }
59
+ /*
60
+ Only plain text names a row. A rich first cell (a template with an
61
+ avatar and two lines) stringified to "[object Object]", which a screen
62
+ reader then read out on every row.
63
+ */
64
+ rowName(row) {
65
+ const first = this.columns[0];
66
+ const value = first ? row[first.key] : undefined;
67
+ return typeof value === "string" || typeof value === "number" ? String(value) : "";
68
+ }
69
+ get hasActions() {
70
+ return this.rowActions.length > 0;
71
+ }
72
+ get columnCount() {
73
+ return (this.columns.length + (this.selectable ? 1 : 0) + (this.hasActions ? 1 : 0));
74
+ }
75
+ /*
76
+ Both answer for the rows ON SCREEN, compared by id, never by count.
77
+
78
+ `selected` can hold ids that are not in `rows`: picked before a filter
79
+ hid them, or on another page. Comparing lengths then lies. Pick three
80
+ rows, filter to three different ones, and the header claimed "all
81
+ selected" while nothing visible was ticked.
82
+ */
83
+ get allSelected() {
84
+ return (this.rows.length > 0 &&
85
+ this.rows.every((row) => this.selected.includes(row.id)));
86
+ }
87
+ get someSelected() {
88
+ return (!this.allSelected &&
89
+ this.rows.some((row) => this.selected.includes(row.id)));
90
+ }
91
+ emitSelection(next) {
92
+ this.dispatchEvent(new CustomEvent("tt-selection-change", {
93
+ detail: { selected: next },
94
+ bubbles: true,
95
+ composed: true,
96
+ }));
97
+ }
98
+ toggleAll(event) {
99
+ // tt-checkbox emits its own composed tt-change. Without this it would
100
+ // reach the page too, arriving after ours with no `selected` in it.
101
+ event.stopPropagation();
102
+ /*
103
+ Select-all applies to what is currently on screen, which is what a
104
+ user means by "all" when a filter is active. It adds or removes ONLY
105
+ those rows: a selection made before the filter, now hidden, is not
106
+ the header checkbox's to throw away.
107
+ */
108
+ const visible = this.rows.map((r) => r.id);
109
+ this.emitSelection(this.allSelected
110
+ ? this.selected.filter((id) => !visible.includes(id))
111
+ : [...this.selected, ...visible.filter((id) => !this.selected.includes(id))]);
112
+ }
113
+ toggleRow(id, event) {
114
+ event.stopPropagation();
115
+ this.emitSelection(this.selected.includes(id)
116
+ ? this.selected.filter((s) => s !== id)
117
+ : [...this.selected, id]);
118
+ }
119
+ /*
120
+ Cycles ascending, descending, then off. The third state matters: once
121
+ sorted there is otherwise no way back to the original order, which is
122
+ usually meaningful (newest first, or whatever the server chose).
123
+ */
124
+ toggleSort(column) {
125
+ if (!column.sortable)
126
+ return;
127
+ let next;
128
+ if (this.sort?.key !== column.key) {
129
+ next = { key: column.key, direction: "asc" };
130
+ }
131
+ else if (this.sort.direction === "asc") {
132
+ next = { key: column.key, direction: "desc" };
133
+ }
134
+ else {
135
+ next = undefined;
136
+ }
137
+ this.dispatchEvent(new CustomEvent("tt-sort", {
138
+ detail: { sort: next },
139
+ bubbles: true,
140
+ composed: true,
141
+ }));
142
+ }
143
+ clickRow(row) {
144
+ if (!this.clickableRows)
145
+ return;
146
+ this.dispatchEvent(new CustomEvent("tt-row-click", {
147
+ detail: { row },
148
+ bubbles: true,
149
+ composed: true,
150
+ }));
151
+ }
152
+ chooseAction(row, event) {
153
+ // The menu's tt-menu-select is generic. Re-emit it as something the page
154
+ // can act on: which action, on which row.
155
+ event.stopPropagation();
156
+ const { value } = event.detail;
157
+ this.dispatchEvent(new CustomEvent("tt-row-action", {
158
+ detail: { action: value, row },
159
+ bubbles: true,
160
+ composed: true,
161
+ }));
162
+ }
163
+ static { this.styles = [
164
+ srOnly,
165
+ css `
166
+ /* The browser's own [hidden] rule loses to any :host display, so a
167
+ hidden element would still show. Important, so it always wins. */
168
+ :host([hidden]) {
169
+ display: none !important;
170
+ }
171
+
172
+ :host {
173
+ display: block;
174
+ font-family: var(--tt-font-sans);
175
+ }
176
+
177
+ .wrap {
178
+ width: 100%;
179
+ overflow-x: auto;
180
+ box-sizing: border-box;
181
+
182
+ background: var(--tt-card);
183
+ border: 1px solid var(--tt-border);
184
+ border-radius: var(--tt-radius-lg);
185
+
186
+ -webkit-overflow-scrolling: touch;
187
+ }
188
+
189
+ table {
190
+ width: 100%;
191
+ border-collapse: collapse;
192
+ font-size: var(--tt-text-sm);
193
+ }
194
+
195
+ /*
196
+ Sticky header: the column labels stay put while the body scrolls,
197
+ so you never lose track of what a column means in a long list.
198
+
199
+ It sticks to .wrap, not to the page. overflow-x: auto turns .wrap
200
+ into a scroll container on BOTH axes, and sticky always pins to the
201
+ nearest one. So it only works once the consumer gives the wrap a
202
+ height (::part(wrap) { max-height }). There is no way to scroll
203
+ sideways inside a box AND stick to the page's scroll; that is CSS,
204
+ not a choice made here.
205
+ */
206
+ thead th {
207
+ position: sticky;
208
+ top: 0;
209
+ z-index: 1;
210
+
211
+ /* The same pair as tt-table, so a colour theme tints every table header. */
212
+ background: var(--tt-table-header);
213
+ color: var(--tt-table-header-foreground);
214
+
215
+ padding: var(--tt-space-3) var(--tt-space-4);
216
+
217
+ font-size: var(--tt-text-xs);
218
+ font-weight: var(--tt-weight-semibold);
219
+ text-align: left;
220
+ text-transform: uppercase;
221
+ letter-spacing: 0.05em;
222
+ white-space: nowrap;
223
+ }
224
+
225
+ th.end,
226
+ td.end {
227
+ text-align: right;
228
+ }
229
+
230
+ td {
231
+ padding: var(--tt-space-3) var(--tt-space-4);
232
+ border-top: 1px solid var(--tt-border);
233
+ color: var(--tt-foreground);
234
+ line-height: var(--tt-leading-snug);
235
+ vertical-align: middle;
236
+ }
237
+
238
+ tbody tr {
239
+ transition: background var(--tt-duration-fast) var(--tt-ease);
240
+ }
241
+
242
+ tbody tr:hover {
243
+ background: var(--tt-accent);
244
+ }
245
+
246
+ tbody tr.clickable {
247
+ cursor: pointer;
248
+ }
249
+
250
+ /* Selected sits after hover so it wins, and gets its own darker
251
+ hover so a selected row still reacts to the pointer. */
252
+ tbody tr.selected {
253
+ background: color-mix(in srgb, var(--tt-primary) 8%, transparent);
254
+ }
255
+
256
+ tbody tr.selected:hover {
257
+ background: color-mix(in srgb, var(--tt-primary) 14%, transparent);
258
+ }
259
+
260
+ tbody tr:focus-visible {
261
+ outline: var(--tt-ring-width) solid var(--tt-ring);
262
+ outline-offset: var(--tt-ring-offset);
263
+ }
264
+
265
+ /* Sort controls are real buttons so the header is keyboard reachable.
266
+ A th with a click handler is not. */
267
+ .sort {
268
+ display: inline-flex;
269
+ align-items: center;
270
+ gap: var(--tt-space-1);
271
+
272
+ padding: 0;
273
+ border: none;
274
+ background: transparent;
275
+ color: inherit;
276
+
277
+ font: inherit;
278
+ font-size: inherit;
279
+ font-weight: inherit;
280
+ letter-spacing: inherit;
281
+ text-transform: inherit;
282
+
283
+ cursor: pointer;
284
+ }
285
+
286
+ .sort:hover {
287
+ color: var(--tt-foreground);
288
+ }
289
+
290
+ .sort:focus-visible {
291
+ outline: var(--tt-ring-width) solid var(--tt-ring);
292
+ outline-offset: var(--tt-ring-offset);
293
+ border-radius: var(--tt-radius-sm);
294
+ }
295
+
296
+ /* Reserve the arrow's space always, so a header does not shift
297
+ sideways the moment you sort by it. The icon is always rendered and
298
+ only faded, so it holds its own width. */
299
+ .arrow {
300
+ display: inline-flex;
301
+ opacity: 0;
302
+ }
303
+
304
+ .sorted {
305
+ color: var(--tt-foreground);
306
+ }
307
+
308
+ .sorted .arrow {
309
+ opacity: 1;
310
+ }
311
+
312
+ /* width:1% on a table cell means "as narrow as the content allows".
313
+ The other columns absorb the leftover space. */
314
+ .select-cell,
315
+ .actions-cell {
316
+ width: 1%;
317
+ white-space: nowrap;
318
+ }
319
+
320
+ .select-cell {
321
+ padding-right: 0;
322
+ }
323
+
324
+ .actions-cell {
325
+ text-align: right;
326
+ }
327
+
328
+ .state {
329
+ padding: var(--tt-space-6);
330
+ }
331
+
332
+ `,
333
+ ]; }
334
+ renderHeader() {
335
+ return html `
336
+ <thead>
337
+ <tr>
338
+ ${this.selectable
339
+ ? html `
340
+ <th class="select-cell">
341
+ <!--
342
+ The checkbox names ITSELF, but its label lives in a
343
+ nested shadow root, and a table header cell is judged
344
+ on its own text. Same pattern as the actions column
345
+ above: the column gets a name, the control gets a name,
346
+ and they are not the same sentence.
347
+ -->
348
+ <span class="sr-only">Select</span>
349
+ <tt-checkbox
350
+ label="Select all rows"
351
+ label-hidden
352
+ .checked=${this.allSelected}
353
+ .indeterminate=${this.someSelected}
354
+ @tt-change=${this.toggleAll}
355
+ ></tt-checkbox>
356
+ </th>
357
+ `
358
+ : ""}
359
+ ${this.columns.map((column) => {
360
+ const isSorted = this.sort?.key === column.key;
361
+ const direction = this.sort?.direction;
362
+ return html `
363
+ <th
364
+ class=${column.align === "end" ? "end" : ""}
365
+ style=${ifDefined(column.width ? `width:${column.width}` : undefined)}
366
+ aria-sort=${ifDefined(!column.sortable
367
+ ? undefined
368
+ : !isSorted
369
+ ? "none"
370
+ : direction === "asc"
371
+ ? "ascending"
372
+ : "descending")}
373
+ >
374
+ ${column.sortable
375
+ ? html `
376
+ <button
377
+ class="sort ${isSorted ? "sorted" : ""}"
378
+ type="button"
379
+ @click=${() => this.toggleSort(column)}
380
+ >
381
+ ${column.label}
382
+ <span class="arrow" aria-hidden="true">
383
+ <tt-icon
384
+ name=${direction === "desc" ? "arrow-down" : "arrow-up"}
385
+ size="12px"
386
+ ></tt-icon>
387
+ </span>
388
+ </button>
389
+ `
390
+ : column.label}
391
+ </th>
392
+ `;
393
+ })}
394
+ ${this.hasActions
395
+ ? html `<th class="actions-cell">
396
+ <span class="sr-only">Actions</span>
397
+ </th>`
398
+ : ""}
399
+ </tr>
400
+ </thead>
401
+ `;
402
+ }
403
+ renderLoading() {
404
+ return html `
405
+ <tbody aria-busy="true">
406
+ ${Array.from({ length: this.loadingRows }, () => html `
407
+ <tr>
408
+ <td colspan=${this.columnCount}>
409
+ <tt-skeleton variant="text"></tt-skeleton>
410
+ </td>
411
+ </tr>
412
+ `)}
413
+ </tbody>
414
+ `;
415
+ }
416
+ renderRow(row) {
417
+ const isSelected = this.selected.includes(row.id);
418
+ return html `
419
+ <tr
420
+ class="${this.clickableRows ? "clickable" : ""} ${isSelected
421
+ ? "selected"
422
+ : ""}"
423
+ tabindex=${ifDefined(this.clickableRows ? 0 : undefined)}
424
+ @click=${() => this.clickRow(row)}
425
+ @keydown=${(e) => {
426
+ /*
427
+ Only a key pressed on the row ITSELF. Keys bubble, so Enter on
428
+ the row's checkbox or its actions menu reaches this handler
429
+ too, and opening the menu would also navigate away. target is
430
+ where the key was pressed; currentTarget is this <tr>.
431
+ */
432
+ if (e.target !== e.currentTarget)
433
+ return;
434
+ if (this.clickableRows && e.key === "Enter")
435
+ this.clickRow(row);
436
+ }}
437
+ >
438
+ ${this.selectable
439
+ ? html `
440
+ <td class="select-cell" @click=${(e) => e.stopPropagation()}>
441
+ <tt-checkbox
442
+ .label=${this.rowLabel(row)}
443
+ label-hidden
444
+ .checked=${isSelected}
445
+ @tt-change=${(e) => this.toggleRow(row.id, e)}
446
+ ></tt-checkbox>
447
+ </td>
448
+ `
449
+ : ""}
450
+ ${this.columns.map((column) => html `
451
+ <td class=${column.align === "end" ? "end" : ""}>
452
+ ${row[column.key] ?? ""}
453
+ </td>
454
+ `)}
455
+ ${this.hasActions
456
+ ? html `
457
+ <td
458
+ class="actions-cell"
459
+ @click=${(e) => e.stopPropagation()}
460
+ >
461
+ <tt-dropdown-menu
462
+ .items=${this.rowActions}
463
+ label=${this.rowName(row) ? `Actions for ${this.rowName(row)}` : "Actions"}
464
+ @tt-menu-select=${(e) => this.chooseAction(row, e)}
465
+ ></tt-dropdown-menu>
466
+ </td>
467
+ `
468
+ : ""}
469
+ </tr>
470
+ `;
471
+ }
472
+ render() {
473
+ return html `
474
+ <div class="wrap" part="wrap">
475
+ <table part="table" aria-label=${ifDefined(this.label || undefined)}>
476
+ ${this.renderHeader()}
477
+ ${this.loading
478
+ ? this.renderLoading()
479
+ : html `
480
+ <tbody>
481
+ ${this.rows.length === 0
482
+ ? html `
483
+ <tr>
484
+ <td class="state" colspan=${this.columnCount}>
485
+ <tt-empty-state
486
+ heading=${this.emptyHeading}
487
+ description=${this.emptyDescription}
488
+ >
489
+ <slot name="empty-actions" slot="actions"></slot>
490
+ </tt-empty-state>
491
+ </td>
492
+ </tr>
493
+ `
494
+ : this.rows.map((row) => this.renderRow(row))}
495
+ </tbody>
496
+ `}
497
+ </table>
498
+ </div>
499
+ `;
500
+ }
501
+ };
502
+ __decorate([
503
+ property({ type: Array })
504
+ ], TTDataTable.prototype, "columns", void 0);
505
+ __decorate([
506
+ property({ type: Array })
507
+ ], TTDataTable.prototype, "rows", void 0);
508
+ __decorate([
509
+ property({ type: String })
510
+ ], TTDataTable.prototype, "label", void 0);
511
+ __decorate([
512
+ property({ type: Object })
513
+ ], TTDataTable.prototype, "sort", void 0);
514
+ __decorate([
515
+ property({ type: Boolean })
516
+ ], TTDataTable.prototype, "selectable", void 0);
517
+ __decorate([
518
+ property({ type: Array })
519
+ ], TTDataTable.prototype, "selected", void 0);
520
+ __decorate([
521
+ property({ type: Array, attribute: "row-actions" })
522
+ ], TTDataTable.prototype, "rowActions", void 0);
523
+ __decorate([
524
+ property({ type: Boolean })
525
+ ], TTDataTable.prototype, "loading", void 0);
526
+ __decorate([
527
+ property({ type: Number, attribute: "loading-rows" })
528
+ ], TTDataTable.prototype, "loadingRows", void 0);
529
+ __decorate([
530
+ property({ type: String, attribute: "empty-heading" })
531
+ ], TTDataTable.prototype, "emptyHeading", void 0);
532
+ __decorate([
533
+ property({ type: String, attribute: "empty-description" })
534
+ ], TTDataTable.prototype, "emptyDescription", void 0);
535
+ __decorate([
536
+ property({ type: Boolean, attribute: "clickable-rows" })
537
+ ], TTDataTable.prototype, "clickableRows", void 0);
538
+ TTDataTable = __decorate([
539
+ customElement("tt-data-table")
540
+ ], TTDataTable);
541
+ export { TTDataTable };
542
+ //# sourceMappingURL=tt-data-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-data-table.js","sourceRoot":"","sources":["../src/tt-data-table.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwBtC;;;;;;;;GAQG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QACsB,YAAO,GAAiB,EAAE,CAAC;QAE3B,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CAAC;yCAAkB;AAEhB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAoB;AAErB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAyB;AAGE;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAA+B;AAEtD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAiB;AAEU;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAAiB;AAEf;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;iDAAmC;AAE9B;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;qDAAuB;AAGxB;IAAzD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;kDAAuB;AAtDrE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAshBvB"}
@@ -0,0 +1,19 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * A separating line, optionally with a label in the middle.
4
+ *
5
+ * Trivial, and worth having: without it every page writes its own
6
+ * border-top with slightly different spacing, and the product drifts.
7
+ */
8
+ export declare class TTDivider extends LitElement {
9
+ label: string;
10
+ vertical: boolean;
11
+ static styles: import("lit").CSSResult;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ }
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ "tt-divider": TTDivider;
17
+ }
18
+ }
19
+ //# sourceMappingURL=tt-divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-divider.d.ts","sourceRoot":"","sources":["../src/tt-divider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;GAKG;AACH,qBACa,SAAU,SAAQ,UAAU;IACX,KAAK,SAAM;IAEK,QAAQ,UAAS;IAE7D,MAAM,CAAC,MAAM,0BAqDX;IAEF,MAAM;CAmBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
@@ -0,0 +1,104 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, css } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ /**
10
+ * A separating line, optionally with a label in the middle.
11
+ *
12
+ * Trivial, and worth having: without it every page writes its own
13
+ * border-top with slightly different spacing, and the product drifts.
14
+ */
15
+ let TTDivider = class TTDivider extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.label = "";
19
+ this.vertical = false;
20
+ }
21
+ static { this.styles = css `
22
+ /* The browser's own [hidden] rule loses to any :host display, so a
23
+ hidden element would still show. Important, so it always wins. */
24
+ :host([hidden]) {
25
+ display: none !important;
26
+ }
27
+
28
+ :host {
29
+ display: block;
30
+ font-family: var(--tt-font-sans);
31
+ }
32
+
33
+ :host([vertical]) {
34
+ display: inline-block;
35
+ height: 100%;
36
+ min-height: 1em;
37
+ }
38
+
39
+ .line {
40
+ border: none;
41
+ border-top: 1px solid var(--tt-border);
42
+ margin: 0;
43
+ }
44
+
45
+ :host([vertical]) .line {
46
+ height: 100%;
47
+ border-top: none;
48
+ border-left: 1px solid var(--tt-border);
49
+ }
50
+
51
+ /* With a label the rule becomes two rules, one either side of the
52
+ text, using flex rather than any background trickery. */
53
+ .labelled {
54
+ display: flex;
55
+ align-items: center;
56
+ gap: var(--tt-space-3);
57
+ }
58
+
59
+ .labelled::before,
60
+ .labelled::after {
61
+ content: "";
62
+ flex: 1;
63
+ border-top: 1px solid var(--tt-border);
64
+ }
65
+
66
+ .text {
67
+ font-size: var(--tt-text-xs);
68
+ font-weight: var(--tt-weight-medium);
69
+ text-transform: uppercase;
70
+ letter-spacing: 0.05em;
71
+ color: var(--tt-muted-foreground);
72
+ white-space: nowrap;
73
+ }
74
+ `; }
75
+ render() {
76
+ if (this.label) {
77
+ return html `
78
+ <!-- aria-label, because a separator's children are presentational:
79
+ the visible text inside is never read, so without this the
80
+ "or" its docs promise would be skipped. -->
81
+ <div
82
+ class="labelled"
83
+ part="divider"
84
+ role="separator"
85
+ aria-label=${this.label}
86
+ >
87
+ <span class="text">${this.label}</span>
88
+ </div>
89
+ `;
90
+ }
91
+ return html `<hr class="line" part="divider" />`;
92
+ }
93
+ };
94
+ __decorate([
95
+ property({ type: String })
96
+ ], TTDivider.prototype, "label", void 0);
97
+ __decorate([
98
+ property({ type: Boolean, reflect: true })
99
+ ], TTDivider.prototype, "vertical", void 0);
100
+ TTDivider = __decorate([
101
+ customElement("tt-divider")
102
+ ], TTDivider);
103
+ export { TTDivider };
104
+ //# sourceMappingURL=tt-divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-divider.js","sourceRoot":"","sources":["../src/tt-divider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;;GAKG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACuB,UAAK,GAAG,EAAE,CAAC;QAEK,aAAQ,GAAG,KAAK,CAAC;IA4E/D,CAAC;aA1EQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDlB,AArDY,CAqDX;IAEF,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAA;;;;;;;;uBAQM,IAAI,CAAC,KAAK;;+BAEF,IAAI,CAAC,KAAK;;OAElC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAA,oCAAoC,CAAC;IAClD,CAAC;;AA7E2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAY;AAEK;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAkB;AAHlD,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA+ErB"}