@tartaguti/ui-components 0.0.0-stage → 0.2.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 +13 -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 +16899 -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 +96 -0
  172. package/dist/tt-data-table.d.ts.map +1 -0
  173. package/dist/tt-data-table.js +812 -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 +2911 -0
@@ -0,0 +1,520 @@
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, nothing } from "lit";
8
+ import { property, state, customElement } from "lit/decorators.js";
9
+ import "./tt-card.js";
10
+ import "./tt-form.js";
11
+ import "./tt-input.js";
12
+ import "./tt-checkbox.js";
13
+ import "./tt-button.js";
14
+ import "./tt-alert.js";
15
+ import "./tt-divider.js";
16
+ import "./tt-icon.js";
17
+ /*
18
+ What each mode calls itself, in one table rather than spread across four
19
+ render methods. A consumer can still override any of it with the
20
+ heading and submitLabel properties; these are only the defaults, and a
21
+ default that has to be right in four places is a default that will
22
+ eventually disagree with itself in one of them.
23
+ */
24
+ const COPY = {
25
+ signIn: {
26
+ heading: "Sign in",
27
+ submit: "Sign in",
28
+ description: "",
29
+ },
30
+ signUp: {
31
+ heading: "Create an account",
32
+ submit: "Create account",
33
+ description: "",
34
+ },
35
+ forgotPsw: {
36
+ heading: "Reset your password",
37
+ submit: "Send reset link",
38
+ description: "We will email you a link to choose a new password.",
39
+ },
40
+ resetPsw: {
41
+ heading: "Choose a new password",
42
+ submit: "Save password",
43
+ description: "",
44
+ },
45
+ };
46
+ /**
47
+ * The four screens every application needs, as one component.
48
+ *
49
+ * One element with a `mode` rather than four elements, the same choice
50
+ * tt-product and tt-profile-card make with `orientation`. All four share
51
+ * a card, a heading, an error region and a footer; only the fields and
52
+ * the event differ. Four components would repeat that shell four times
53
+ * and let it drift.
54
+ *
55
+ * IT NEVER TALKS TO A SERVER AND NEVER DECIDES ANYTHING. It reports what
56
+ * was typed and what was asked for. Whether the credentials are valid,
57
+ * whether the account exists, and what happens next all belong to
58
+ * whoever is using it. That is what keeps it usable against any backend.
59
+ *
60
+ * The events, for the custom-elements manifest. Its analyzer reads event
61
+ * names from string literals at the dispatch site, and these are chosen at
62
+ * run time, so without the tags the manifest listed a bogus event instead.
63
+ * @fires tt-sign-in - { email, password, remember } from the sign-in form.
64
+ * @fires tt-sign-up - { name, email, password, accepted } from the sign-up form.
65
+ * @fires tt-forgot - { email } from the forgot-password form.
66
+ * @fires tt-reset - { password } from the reset form.
67
+ * @fires tt-mode - { mode }, when a footer link asks for another screen.
68
+ */
69
+ let TTAuth = class TTAuth extends LitElement {
70
+ constructor() {
71
+ super(...arguments);
72
+ this.mode = "signIn";
73
+ // Left empty to take the per-mode default from COPY above.
74
+ this.heading = "";
75
+ this.description = "";
76
+ this.submitLabel = "";
77
+ this.emailLabel = "Email";
78
+ this.passwordLabel = "Password";
79
+ this.nameLabel = "Full name";
80
+ // Prefilled after a failed attempt, so nothing has to be retyped.
81
+ this.email = "";
82
+ this.name = "";
83
+ this.rememberMe = false;
84
+ this.loading = false;
85
+ /*
86
+ forgotPsw only: swap the form for a confirmation.
87
+
88
+ Deliberately a boolean and not an outcome. The message must be the
89
+ same whether or not the address is registered, or anyone can use this
90
+ form to discover which emails have accounts. See renderSent.
91
+ */
92
+ this.sent = false;
93
+ // A failure from the server, above the form. Field problems go on the
94
+ // field, which is where the person is looking.
95
+ this.error = "";
96
+ /*
97
+ The mismatch message, held here rather than passed in.
98
+
99
+ It is the one error this component is allowed to decide, because it is
100
+ the one that needs no server: the two boxes either match or they do
101
+ not. Everything else arrives through `error`.
102
+ */
103
+ this.confirmError = "";
104
+ }
105
+ get copy() {
106
+ return COPY[this.mode];
107
+ }
108
+ get resolvedHeading() {
109
+ return this.heading || this.copy.heading;
110
+ }
111
+ get resolvedSubmit() {
112
+ return this.submitLabel || this.copy.submit;
113
+ }
114
+ get resolvedDescription() {
115
+ return this.description || this.copy.description;
116
+ }
117
+ /*
118
+ One submit handler, branching on mode.
119
+
120
+ The event NAME and its payload both follow the mode. A single event
121
+ carrying { email, password, remember } would be wrong for three of
122
+ the four screens: sign-up drops the name and the terms box, and
123
+ forgot-password reports a password field that does not exist.
124
+ */
125
+ handleSubmit(event) {
126
+ const data = event.detail.formData;
127
+ const read = (key) => String(data.get(key) ?? "");
128
+ this.confirmError = "";
129
+ if (this.mode === "signIn") {
130
+ this.emit("tt-sign-in", {
131
+ email: read("email"),
132
+ password: read("password"),
133
+ remember: data.get("remember") !== null,
134
+ });
135
+ return;
136
+ }
137
+ if (this.mode === "forgotPsw") {
138
+ this.emit("tt-forgot", { email: read("email") });
139
+ return;
140
+ }
141
+ /*
142
+ The two modes that set a password both confirm it.
143
+
144
+ Checked on SUBMIT, never on input: comparing as someone types tells
145
+ them they are wrong before they have finished being right, and the
146
+ message flickers on every keystroke.
147
+ */
148
+ const password = read("password");
149
+ if (password !== read("confirm")) {
150
+ this.confirmError = "The two passwords do not match.";
151
+ return;
152
+ }
153
+ if (this.mode === "signUp") {
154
+ this.emit("tt-sign-up", {
155
+ name: read("name"),
156
+ email: read("email"),
157
+ password,
158
+ accepted: data.get("accepted") !== null,
159
+ });
160
+ return;
161
+ }
162
+ this.emit("tt-reset", { password });
163
+ }
164
+ emit(type, detail) {
165
+ this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));
166
+ }
167
+ /*
168
+ The footer links announce rather than navigate.
169
+
170
+ This component has no idea whether the app routes with a hash, real
171
+ paths, or by swapping a property. Same rule as every other composite
172
+ here: report the intent, let the owner act on it.
173
+ */
174
+ goTo(mode) {
175
+ this.emit("tt-mode", { mode });
176
+ }
177
+ // ---- pieces shared by every mode ----
178
+ renderEmail(autocomplete) {
179
+ return html `
180
+ <tt-input
181
+ name="email"
182
+ type="email"
183
+ full-width
184
+ required
185
+ autocomplete=${autocomplete}
186
+ label=${this.emailLabel}
187
+ placeholder="you@company.com"
188
+ .value=${this.email}
189
+ ?disabled=${this.loading}
190
+ ></tt-input>
191
+ `;
192
+ }
193
+ renderPassword(label, isNew) {
194
+ return html `
195
+ <tt-input
196
+ name="password"
197
+ type="password"
198
+ full-width
199
+ required
200
+ autocomplete=${isNew ? "new-password" : "current-password"}
201
+ label=${label}
202
+ ?disabled=${this.loading}
203
+ ></tt-input>
204
+ `;
205
+ }
206
+ /* The mismatch lands on this field, not above the form, because this is
207
+ the field that has to change. */
208
+ renderConfirm() {
209
+ return html `
210
+ <tt-input
211
+ name="confirm"
212
+ type="password"
213
+ full-width
214
+ required
215
+ autocomplete="new-password"
216
+ label="Confirm password"
217
+ error=${this.confirmError}
218
+ ?disabled=${this.loading}
219
+ ></tt-input>
220
+ `;
221
+ }
222
+ renderSubmit() {
223
+ return html `
224
+ <tt-button
225
+ type="submit"
226
+ full-width
227
+ ?loading=${this.loading}
228
+ >
229
+ ${this.resolvedSubmit}
230
+ </tt-button>
231
+ `;
232
+ }
233
+ link(label, mode) {
234
+ return html `
235
+ <button type="button" class="link" @click=${() => this.goTo(mode)}>
236
+ ${label}
237
+ </button>
238
+ `;
239
+ }
240
+ /*
241
+ The card, written once.
242
+
243
+ Every mode used to carry its own copy of this, which is the
244
+ duplication a `mode` property exists to remove: four shells drift, and
245
+ a fix to the error region has to be made four times.
246
+ */
247
+ renderShell(body, footer) {
248
+ return html `
249
+ <tt-card part="card" variant="elevated">
250
+ <div class="head">
251
+ <h1 part="heading">${this.resolvedHeading}</h1>
252
+
253
+ ${this.resolvedDescription
254
+ ? html `<p class="description">${this.resolvedDescription}</p>`
255
+ : nothing}
256
+ </div>
257
+
258
+ ${this.error
259
+ ? html `<tt-alert class="error" variant="danger">${this.error}</tt-alert>`
260
+ : nothing}
261
+ ${body}
262
+
263
+ <div class="footer" part="footer">
264
+ <slot name="footer">${footer}</slot>
265
+ </div>
266
+ </tt-card>
267
+ `;
268
+ }
269
+ // ---- the four screens ----
270
+ renderSignIn() {
271
+ return this.renderShell(html `
272
+ <tt-form @tt-form-submit=${this.handleSubmit}>
273
+ ${this.renderEmail("username")}
274
+ ${this.renderPassword(this.passwordLabel, false)}
275
+
276
+ <div class="row">
277
+ <tt-checkbox
278
+ name="remember"
279
+ label="Remember me"
280
+ ?checked=${this.rememberMe}
281
+ ?disabled=${this.loading}
282
+ ></tt-checkbox>
283
+
284
+ <slot name="secondary">
285
+ ${this.link("Forgot password?", "forgotPsw")}
286
+ </slot>
287
+ </div>
288
+
289
+ ${this.renderSubmit()}
290
+ </tt-form>
291
+ `, html `No account? ${this.link("Create one", "signUp")}`);
292
+ }
293
+ renderSignUp() {
294
+ return this.renderShell(html `
295
+ <tt-form @tt-form-submit=${this.handleSubmit}>
296
+ <tt-input
297
+ name="name"
298
+ full-width
299
+ required
300
+ autocomplete="name"
301
+ label=${this.nameLabel}
302
+ placeholder="Ana Marku"
303
+ .value=${this.name}
304
+ ?disabled=${this.loading}
305
+ ></tt-input>
306
+
307
+ ${this.renderEmail("email")}
308
+ ${this.renderPassword("Password", true)} ${this.renderConfirm()}
309
+
310
+ <tt-checkbox
311
+ name="accepted"
312
+ required
313
+ label="I accept the terms and the privacy policy"
314
+ ?disabled=${this.loading}
315
+ ></tt-checkbox>
316
+
317
+ ${this.renderSubmit()}
318
+ </tt-form>
319
+ `, html `Already have an account? ${this.link("Sign in", "signIn")}`);
320
+ }
321
+ /*
322
+ The same message whether or not the address is registered.
323
+
324
+ Telling someone "no account with that email" turns this form into a
325
+ way of testing which addresses have accounts, one request at a time.
326
+ The wording is deliberately conditional.
327
+ */
328
+ renderSent() {
329
+ return html `
330
+ <tt-alert variant="success" heading="Check your email">
331
+ If an account exists for that address, a reset link is on its way.
332
+ </tt-alert>
333
+ `;
334
+ }
335
+ renderForgot() {
336
+ return this.renderShell(this.sent
337
+ ? this.renderSent()
338
+ : html `
339
+ <tt-form @tt-form-submit=${this.handleSubmit}>
340
+ ${this.renderEmail("username")} ${this.renderSubmit()}
341
+ </tt-form>
342
+ `, html `Remembered it? ${this.link("Sign in", "signIn")}`);
343
+ }
344
+ renderReset() {
345
+ return this.renderShell(html `
346
+ <tt-form @tt-form-submit=${this.handleSubmit}>
347
+ ${this.renderPassword("New password", true)} ${this.renderConfirm()}
348
+ ${this.renderSubmit()}
349
+ </tt-form>
350
+ `, html `${this.link("Back to sign in", "signIn")}`);
351
+ }
352
+ static { this.styles = css `
353
+ /* The browser's own [hidden] rule loses to any :host display, so a
354
+ hidden element would still show. Important, so it always wins. */
355
+ :host([hidden]) {
356
+ display: none !important;
357
+ }
358
+
359
+ :host {
360
+ display: block;
361
+ width: 100%;
362
+ max-width: 380px;
363
+
364
+ font-family: var(--tt-font-sans);
365
+ -webkit-font-smoothing: antialiased;
366
+ }
367
+
368
+ .head {
369
+ display: flex;
370
+ flex-direction: column;
371
+ gap: var(--tt-space-1);
372
+ margin-bottom: var(--tt-space-5);
373
+ text-align: center;
374
+ }
375
+
376
+ h1 {
377
+ margin: 0;
378
+ font-size: var(--tt-text-xl);
379
+ font-weight: var(--tt-weight-bold);
380
+ letter-spacing: -0.01em;
381
+ color: var(--tt-foreground);
382
+ }
383
+
384
+ .description {
385
+ margin: 0;
386
+ font-size: var(--tt-text-sm);
387
+ line-height: var(--tt-leading-normal);
388
+ color: var(--tt-muted-foreground);
389
+ }
390
+
391
+ /* role="alert" makes a screen reader announce this the moment it
392
+ appears, which is the whole point of a failed sign-in message. */
393
+ /* A tt-alert, not a box of its own. This was a second, hand-drawn
394
+ danger banner (different tint, no accent edge) beside the one the
395
+ library already has; tt-alert danger is also role="alert". */
396
+ .error {
397
+ display: block;
398
+ margin-bottom: var(--tt-space-4);
399
+ }
400
+
401
+ .row {
402
+ display: flex;
403
+ align-items: center;
404
+ justify-content: space-between;
405
+ gap: var(--tt-space-3);
406
+ flex-wrap: wrap;
407
+ }
408
+
409
+ /* Pushed to the bottom of the card, separated from the fields. */
410
+ .footer {
411
+ margin-top: var(--tt-space-5);
412
+ padding-top: var(--tt-space-4);
413
+ border-top: 1px solid var(--tt-border);
414
+
415
+ font-size: var(--tt-text-sm);
416
+ color: var(--tt-muted-foreground);
417
+ text-align: center;
418
+ }
419
+
420
+ /*
421
+ A button, not an anchor, and that is deliberate.
422
+
423
+ These switch a screen inside this component; they do not go to a
424
+ URL, and this component does not know whether the app even has one
425
+ for them. An <a> with no href is not focusable and is announced as
426
+ nothing, so a real button carries the interaction and CSS makes it
427
+ read as a link.
428
+ */
429
+ .link {
430
+ padding: 0;
431
+ border: none;
432
+ background: none;
433
+
434
+ font: inherit;
435
+ color: var(--tt-foreground);
436
+ font-weight: var(--tt-weight-medium);
437
+
438
+ cursor: pointer;
439
+ text-decoration: none;
440
+ }
441
+
442
+ .link:hover {
443
+ text-decoration: underline;
444
+ }
445
+
446
+ .link:focus-visible {
447
+ outline: var(--tt-ring-width) solid var(--tt-ring);
448
+ outline-offset: var(--tt-ring-offset);
449
+ border-radius: var(--tt-radius-sm);
450
+ }
451
+
452
+ ::slotted(a) {
453
+ color: var(--tt-foreground);
454
+ text-decoration: none;
455
+ }
456
+
457
+ ::slotted(a:hover) {
458
+ text-decoration: underline;
459
+ }
460
+ `; }
461
+ render() {
462
+ switch (this.mode) {
463
+ case "signUp":
464
+ return this.renderSignUp();
465
+ case "forgotPsw":
466
+ return this.renderForgot();
467
+ case "resetPsw":
468
+ return this.renderReset();
469
+ default:
470
+ return this.renderSignIn();
471
+ }
472
+ }
473
+ };
474
+ __decorate([
475
+ property({ type: String })
476
+ ], TTAuth.prototype, "mode", void 0);
477
+ __decorate([
478
+ property({ type: String })
479
+ ], TTAuth.prototype, "heading", void 0);
480
+ __decorate([
481
+ property({ type: String })
482
+ ], TTAuth.prototype, "description", void 0);
483
+ __decorate([
484
+ property({ type: String, attribute: "submit-label" })
485
+ ], TTAuth.prototype, "submitLabel", void 0);
486
+ __decorate([
487
+ property({ type: String, attribute: "email-label" })
488
+ ], TTAuth.prototype, "emailLabel", void 0);
489
+ __decorate([
490
+ property({ type: String, attribute: "password-label" })
491
+ ], TTAuth.prototype, "passwordLabel", void 0);
492
+ __decorate([
493
+ property({ type: String, attribute: "name-label" })
494
+ ], TTAuth.prototype, "nameLabel", void 0);
495
+ __decorate([
496
+ property({ type: String })
497
+ ], TTAuth.prototype, "email", void 0);
498
+ __decorate([
499
+ property({ type: String })
500
+ ], TTAuth.prototype, "name", void 0);
501
+ __decorate([
502
+ property({ type: Boolean, attribute: "remember-me" })
503
+ ], TTAuth.prototype, "rememberMe", void 0);
504
+ __decorate([
505
+ property({ type: Boolean })
506
+ ], TTAuth.prototype, "loading", void 0);
507
+ __decorate([
508
+ property({ type: Boolean })
509
+ ], TTAuth.prototype, "sent", void 0);
510
+ __decorate([
511
+ property({ type: String })
512
+ ], TTAuth.prototype, "error", void 0);
513
+ __decorate([
514
+ state()
515
+ ], TTAuth.prototype, "confirmError", void 0);
516
+ TTAuth = __decorate([
517
+ customElement("tt-auth")
518
+ ], TTAuth);
519
+ export { TTAuth };
520
+ //# sourceMappingURL=tt-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-auth.js","sourceRoot":"","sources":["../src/tt-auth.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AAItB;;;;;;EAME;AACF,MAAM,IAAI,GAGN;IACF,MAAM,EAAE;QACN,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,mBAAmB;QAC5B,MAAM,EAAE,gBAAgB;QACxB,WAAW,EAAE,EAAE;KAChB;IACD,SAAS,EAAE;QACT,OAAO,EAAE,qBAAqB;QAC9B,MAAM,EAAE,iBAAiB;QACzB,WAAW,EAAE,oDAAoD;KAClE;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,uBAAuB;QAChC,MAAM,EAAE,eAAe;QACvB,WAAW,EAAE,EAAE;KAChB;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QACuB,SAAI,GAAa,QAAQ,CAAC;QAEtD,2DAA2D;QAC/B,YAAO,GAAG,EAAE,CAAC;QACb,gBAAW,GAAG,EAAE,CAAC;QACU,gBAAW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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;0CAAsB;AAClB;IAAxD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;6CAA4B;AAC/B;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;yCAAyB;AAGjD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCAAW;AAEiB;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;0CAAoB;AAE7C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAiB;AAShB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCAAc;AAId;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAAY;AAStB;IAAhB,KAAK,EAAE;4CAA2B;AAxCxB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAuclB"}
@@ -0,0 +1,26 @@
1
+ import { LitElement } from "lit";
2
+ export type AvatarSize = "small" | "medium" | "large";
3
+ /**
4
+ * Image with an initials fallback. The fallback is the entire point:
5
+ * logos and profile photos fail to load constantly, and a broken image
6
+ * icon is the difference between a product that looks maintained and one
7
+ * that does not.
8
+ */
9
+ export declare class TTAvatar extends LitElement {
10
+ src: string;
11
+ name: string;
12
+ size: AvatarSize;
13
+ square: boolean;
14
+ private failed;
15
+ updated(changed: Map<string, unknown>): void;
16
+ private get initials();
17
+ private get tone();
18
+ static styles: import("lit").CSSResult;
19
+ render(): import("lit-html").TemplateResult<1>;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ "tt-avatar": TTAvatar;
24
+ }
25
+ }
26
+ //# sourceMappingURL=tt-avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-avatar.d.ts","sourceRoot":"","sources":["../src/tt-avatar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;;;GAKG;AACH,qBACa,QAAS,SAAQ,UAAU;IACV,GAAG,SAAM;IAGT,IAAI,SAAM;IAEK,IAAI,EAAE,UAAU,CAAY;IAE3B,MAAM,UAAS;IAElD,OAAO,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrC,OAAO,KAAK,QAAQ,GAQnB;IAOD,OAAO,KAAK,IAAI,GAMf;IAED,MAAM,CAAC,MAAM,0BAgEX;IAEF,MAAM;CA8BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}