@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,273 @@
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 { property, customElement, queryAssignedElements, } from "lit/decorators.js";
9
+ import "./tt-toggle.js";
10
+ /**
11
+ * A row of tt-toggle that agree with each other.
12
+ *
13
+ * ---------------------------------------------------------------------
14
+ * `values` IS ALWAYS AN ARRAY, EVEN IN SINGLE MODE.
15
+ *
16
+ * The obvious API is `value: string` for single and `values: string[]`
17
+ * for multiple, which is what most libraries do. It is rejected here.
18
+ *
19
+ * A property whose TYPE depends on another property is a property you
20
+ * have to think about at every call site, and it makes the change event
21
+ * carry two shapes as well. Every consumer then needs a branch, and half
22
+ * of them will forget it.
23
+ *
24
+ * One shape instead: a single-select group holds an array of zero or one
25
+ * entries. `values[0] ?? null` is the whole cost, paid once by whoever
26
+ * actually wants a scalar, and `tt-change` always carries the complete
27
+ * new array. Same contract as tt-checkbox-group.
28
+ *
29
+ * ---------------------------------------------------------------------
30
+ * WHO OWNS THE SELECTION.
31
+ *
32
+ * Both. `values` comes in, and `tt-change` goes out with the whole new
33
+ * set. The group also keeps that new set itself (Oct 2026). It used to
34
+ * store nothing and wait for the page to echo `values` back, which
35
+ * meant a group with no listener (a pasted snippet, a generated
36
+ * component) started every click from the old set: `multiple` acted
37
+ * like single, and `allow-empty` cleared instead of selecting. A page
38
+ * that sets `values` still wins, the same as with a native input.
39
+ *
40
+ * But it does WRITE to its children, immediately, in its own handler,
41
+ * rather than waiting for the page to echo `values` back. That is the
42
+ * one thing worth understanding here.
43
+ *
44
+ * A tt-toggle flips itself when clicked. In single mode that leaves two
45
+ * pressed toggles for as long as it takes the page to respond, and if
46
+ * the page ignores the event it leaves them pressed forever. So the
47
+ * group corrects its children on the spot: the click is the child's, the
48
+ * ANSWER is the group's.
49
+ *
50
+ * That makes it work whether or not the page echoes the value back, and
51
+ * `updated()` re-applies the same result when it does, which is
52
+ * idempotent (applying it twice is the same as applying it once).
53
+ */
54
+ let TTToggleGroup = class TTToggleGroup extends LitElement {
55
+ constructor() {
56
+ super(...arguments);
57
+ /*
58
+ Off: picking one un-picks the others. A view switcher.
59
+ On: any number at once. Bold AND italic.
60
+
61
+ A boolean, as on tt-accordion (Oct 2026). It was only the enum below,
62
+ so the word a developer learned from the accordion did nothing here.
63
+ */
64
+ this.multiple = false;
65
+ /** The older spelling of `multiple`; type="multiple" still works. */
66
+ this.type = "single";
67
+ this.values = [];
68
+ this.disabled = false;
69
+ /*
70
+ Names the group for a screen reader. Without it the toggles are
71
+ announced one after another with nothing saying what they belong to,
72
+ which for a row of three unlabelled icons is close to useless.
73
+ */
74
+ this.label = "";
75
+ /*
76
+ Joined is the default: inner corners flatten and neighbouring
77
+ borders collapse onto a shared edge, because that IS the shape people
78
+ mean by a toggle group. detached spaces them out, for a row of
79
+ independent tools that happen to sit together. Named for the
80
+ non-default state because a boolean attribute can only switch
81
+ something on; the old attached defaulted to true and could never be
82
+ turned off from HTML.
83
+ */
84
+ this.detached = false;
85
+ /*
86
+ In single mode, whether clicking the pressed item clears the
87
+ selection. Off by default: a view switcher with nothing selected
88
+ shows nothing, which is never what anyone wanted.
89
+ */
90
+ this.allowEmpty = false;
91
+ /** Writes a selection onto every child. Safe to call repeatedly. */
92
+ /*
93
+ The toggles THIS group disabled, so it can give back exactly those.
94
+
95
+ A disabled group disables everything in it. It used to only ever add:
96
+ disable the group, enable it again, and every toggle stayed dead.
97
+ Re-enabling ALL of them would be wrong the other way, switching on a
98
+ toggle the consumer disabled on purpose. Remembering which ones the
99
+ group touched is right both ways.
100
+ */
101
+ this.disabledByGroup = new WeakSet();
102
+ }
103
+ handleChange(event) {
104
+ // Only listen to the toggles, never to something a consumer slotted
105
+ // in that happens to emit the same event name.
106
+ const toggle = event.target;
107
+ if (!toggle || toggle.tagName !== "TT-TOGGLE")
108
+ return;
109
+ /*
110
+ Stopped, and this matters. The child's tt-change and the group's
111
+ tt-change have DIFFERENT detail shapes, and both bubble. A page
112
+ listening on the group would otherwise receive two events per
113
+ click, one of them describing a single toggle and one describing
114
+ the whole set, and would have to tell them apart by inspecting the
115
+ detail. Stopping the child's leaves exactly one truth.
116
+ */
117
+ event.stopPropagation();
118
+ if (this.disabled)
119
+ return;
120
+ const clicked = toggle.value;
121
+ const wasSelected = this.values.includes(clicked);
122
+ let next;
123
+ if (!this.multiple && this.type !== "multiple") {
124
+ next = wasSelected && this.allowEmpty ? [] : [clicked];
125
+ }
126
+ else {
127
+ next = wasSelected
128
+ ? this.values.filter((v) => v !== clicked)
129
+ : [...this.values, clicked];
130
+ }
131
+ // Correct the children first, then announce. See the class comment:
132
+ // the click is the child's, the answer is the group's.
133
+ this.applyTo(next);
134
+ this.values = next;
135
+ this.dispatchEvent(new CustomEvent("tt-change", {
136
+ detail: { values: next },
137
+ bubbles: true,
138
+ composed: true,
139
+ }));
140
+ }
141
+ applyTo(values) {
142
+ for (const toggle of this.toggles ?? []) {
143
+ toggle.pressed = values.includes(toggle.value);
144
+ if (this.disabled && !toggle.disabled) {
145
+ toggle.disabled = true;
146
+ this.disabledByGroup.add(toggle);
147
+ }
148
+ else if (!this.disabled && this.disabledByGroup.has(toggle)) {
149
+ toggle.disabled = false;
150
+ this.disabledByGroup.delete(toggle);
151
+ }
152
+ }
153
+ }
154
+ updated(changed) {
155
+ if (changed.has("values") || changed.has("disabled")) {
156
+ this.applyTo(this.values);
157
+ }
158
+ }
159
+ // Children that arrive later still need the current selection, and
160
+ // this fires on the first render too, which is what sets the initial
161
+ // pressed state.
162
+ handleSlotChange() {
163
+ this.applyTo(this.values);
164
+ }
165
+ static { this.styles = 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: inline-flex;
174
+
175
+ font-family: var(--tt-font-sans);
176
+ -webkit-font-smoothing: antialiased;
177
+ }
178
+
179
+ .group {
180
+ display: inline-flex;
181
+ align-items: center;
182
+ gap: var(--tt-space-2);
183
+
184
+ flex-wrap: wrap;
185
+ }
186
+
187
+ /*
188
+ Attached mode. The gap goes, the shared edge is collapsed with a
189
+ negative margin so two 1px borders do not stack into a 2px line,
190
+ and only the outer corners keep their radius.
191
+
192
+ z-index on hover and focus so the active item's border is drawn
193
+ over its neighbour's rather than under it. Without it, the ring on
194
+ a middle item is clipped on both sides and looks broken.
195
+ */
196
+ .group.attached {
197
+ gap: 0;
198
+ flex-wrap: nowrap;
199
+ }
200
+
201
+ .attached ::slotted(tt-toggle:not(:first-child)) {
202
+ margin-left: -1px;
203
+ }
204
+
205
+ /* Square everything, then give the two ends back their outer
206
+ corners. Setting a custom property on the slotted host, because
207
+ the radius itself lives inside that element shadow root and
208
+ ::slotted() cannot reach across that boundary. */
209
+ .attached ::slotted(tt-toggle) {
210
+ --tt-toggle-radius: 0;
211
+ }
212
+
213
+ .attached ::slotted(tt-toggle:first-child) {
214
+ --tt-toggle-radius: var(--tt-radius) 0 0 var(--tt-radius);
215
+ }
216
+
217
+ .attached ::slotted(tt-toggle:last-child) {
218
+ --tt-toggle-radius: 0 var(--tt-radius) var(--tt-radius) 0;
219
+ }
220
+
221
+ .attached ::slotted(tt-toggle:only-child) {
222
+ --tt-toggle-radius: var(--tt-radius);
223
+ }
224
+
225
+ .attached ::slotted(tt-toggle:hover),
226
+ .attached ::slotted(tt-toggle:focus-within),
227
+ .attached ::slotted(tt-toggle[pressed]) {
228
+ z-index: 1;
229
+ }
230
+ `; }
231
+ render() {
232
+ return html `
233
+ <div
234
+ class="group ${this.detached ? "" : "attached"}"
235
+ part="group"
236
+ role="group"
237
+ aria-label=${this.label || "Options"}
238
+ @tt-change=${this.handleChange}
239
+ >
240
+ <slot @slotchange=${this.handleSlotChange}></slot>
241
+ </div>
242
+ `;
243
+ }
244
+ };
245
+ __decorate([
246
+ property({ type: Boolean, reflect: true })
247
+ ], TTToggleGroup.prototype, "multiple", void 0);
248
+ __decorate([
249
+ property({ type: String, reflect: true })
250
+ ], TTToggleGroup.prototype, "type", void 0);
251
+ __decorate([
252
+ property({ type: Array })
253
+ ], TTToggleGroup.prototype, "values", void 0);
254
+ __decorate([
255
+ property({ type: Boolean, reflect: true })
256
+ ], TTToggleGroup.prototype, "disabled", void 0);
257
+ __decorate([
258
+ property({ type: String })
259
+ ], TTToggleGroup.prototype, "label", void 0);
260
+ __decorate([
261
+ property({ type: Boolean })
262
+ ], TTToggleGroup.prototype, "detached", void 0);
263
+ __decorate([
264
+ queryAssignedElements({ selector: "tt-toggle" })
265
+ ], TTToggleGroup.prototype, "toggles", void 0);
266
+ __decorate([
267
+ property({ type: Boolean, attribute: "allow-empty" })
268
+ ], TTToggleGroup.prototype, "allowEmpty", void 0);
269
+ TTToggleGroup = __decorate([
270
+ customElement("tt-toggle-group")
271
+ ], TTToggleGroup);
272
+ export { TTToggleGroup };
273
+ //# sourceMappingURL=tt-toggle-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-toggle-group.js","sourceRoot":"","sources":["../src/tt-toggle-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,QAAQ,EACR,aAAa,EACb,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,gBAAgB,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACL;;;;;;UAME;QAC0C,aAAQ,GAAG,KAAK,CAAC;QAE7D,qEAAqE;QAC1B,SAAI,GAAoB,QAAQ,CAAC;QAEjD,WAAM,GAAa,EAAE,CAAC;QAEL,aAAQ,GAAG,KAAK,CAAC;QAE7D;;;;UAIE;QAC0B,UAAK,GAAG,EAAE,CAAC;QAEvC;;;;;;;;UAQE;QAC2B,aAAQ,GAAG,KAAK,CAAC;QAK9C;;;;UAIE;QACqD,eAAU,GAAG,KAAK,CAAC;QA+C1E,oEAAoE;QACpE;;;;;;;;UAQE;QACM,oBAAe,GAAG,IAAI,OAAO,EAAY,CAAC;IA6GpD,CAAC;IApKS,YAAY,CAAC,KAAY;QAC/B,oEAAoE;QACpE,+CAA+C;QAC/C,MAAM,MAAM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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkB;AAGlB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAkC;AAEjD;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAuB;AAEL;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkB;AAOjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAY;AAWV;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAkB;AAGtC;IADP,qBAAqB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;8CACpB;AAO0B;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;iDAAoB;AA3C/D,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAiNzB"}
@@ -0,0 +1,54 @@
1
+ import { LitElement } from "lit";
2
+ export type ToggleSize = "small" | "medium" | "large";
3
+ /**
4
+ * A button that stays down.
5
+ *
6
+ * Bold, italic, underline. Grid view or list view. A filter that is on.
7
+ * Anything whose state is visible in the control itself rather than
8
+ * somewhere else on the page.
9
+ *
10
+ * ---------------------------------------------------------------------
11
+ * NOT A CHECKBOX AND NOT A SWITCH, AND THE DIFFERENCE IS NOT COSMETIC.
12
+ *
13
+ * tt-checkbox a value being collected, confirmed later by a submit.
14
+ * It has a label beside it and it lives in a form.
15
+ * tt-switch a setting that takes effect immediately. Reads as a
16
+ * sentence: "Email notifications, on".
17
+ * tt-toggle a tool that is currently selected. Usually an icon,
18
+ * usually in a row of siblings, and its meaning comes
19
+ * from what it does to something else.
20
+ *
21
+ * They carry different ARIA too, which is the real tell: a checkbox is
22
+ * `aria-checked`, a toggle is `aria-pressed`. A screen reader announces
23
+ * "pressed" rather than "checked", and that is the correct sentence for
24
+ * a bold button.
25
+ *
26
+ * ---------------------------------------------------------------------
27
+ * IT FLIPS ITSELF, UNLESS IT IS IN A GROUP.
28
+ *
29
+ * On its own it toggles and announces, the same shape as tt-switch. That
30
+ * is the only sensible default for a control that has nothing
31
+ * coordinating it.
32
+ *
33
+ * Inside tt-toggle-group the group writes `pressed` back onto every
34
+ * child after any change, so the group's answer is the one that lasts.
35
+ * That is deliberate: single-select needs someone to un-press the
36
+ * previous choice, and only the group can know which one that was.
37
+ */
38
+ export declare class TTToggle extends LitElement {
39
+ pressed: boolean;
40
+ disabled: boolean;
41
+ size: ToggleSize;
42
+ value: string;
43
+ label: string;
44
+ private toggle;
45
+ static styles: import("lit").CSSResult;
46
+ focus(options?: FocusOptions): void;
47
+ render(): import("lit-html").TemplateResult<1>;
48
+ }
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ "tt-toggle": TTToggle;
52
+ }
53
+ }
54
+ //# sourceMappingURL=tt-toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-toggle.d.ts","sourceRoot":"","sources":["../src/tt-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBACa,QAAS,SAAQ,UAAU;IACM,OAAO,UAAS;IAEhB,QAAQ,UAAS;IAElB,IAAI,EAAE,UAAU,CAAY;IAG3C,KAAK,SAAM;IAOX,KAAK,SAAM;IAEvC,OAAO,CAAC,MAAM;IAcd,MAAM,CAAC,MAAM,0BA0HX;IAIF,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,MAAM;CAcP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -0,0 +1,232 @@
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 { property, customElement } from "lit/decorators.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
10
+ /**
11
+ * A button that stays down.
12
+ *
13
+ * Bold, italic, underline. Grid view or list view. A filter that is on.
14
+ * Anything whose state is visible in the control itself rather than
15
+ * somewhere else on the page.
16
+ *
17
+ * ---------------------------------------------------------------------
18
+ * NOT A CHECKBOX AND NOT A SWITCH, AND THE DIFFERENCE IS NOT COSMETIC.
19
+ *
20
+ * tt-checkbox a value being collected, confirmed later by a submit.
21
+ * It has a label beside it and it lives in a form.
22
+ * tt-switch a setting that takes effect immediately. Reads as a
23
+ * sentence: "Email notifications, on".
24
+ * tt-toggle a tool that is currently selected. Usually an icon,
25
+ * usually in a row of siblings, and its meaning comes
26
+ * from what it does to something else.
27
+ *
28
+ * They carry different ARIA too, which is the real tell: a checkbox is
29
+ * `aria-checked`, a toggle is `aria-pressed`. A screen reader announces
30
+ * "pressed" rather than "checked", and that is the correct sentence for
31
+ * a bold button.
32
+ *
33
+ * ---------------------------------------------------------------------
34
+ * IT FLIPS ITSELF, UNLESS IT IS IN A GROUP.
35
+ *
36
+ * On its own it toggles and announces, the same shape as tt-switch. That
37
+ * is the only sensible default for a control that has nothing
38
+ * coordinating it.
39
+ *
40
+ * Inside tt-toggle-group the group writes `pressed` back onto every
41
+ * child after any change, so the group's answer is the one that lasts.
42
+ * That is deliberate: single-select needs someone to un-press the
43
+ * previous choice, and only the group can know which one that was.
44
+ */
45
+ let TTToggle = class TTToggle extends LitElement {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.pressed = false;
49
+ this.disabled = false;
50
+ this.size = "medium";
51
+ // What this toggle is called when it reports to a group.
52
+ this.value = "";
53
+ /*
54
+ Required when the content is an icon and nothing else. A button whose
55
+ only child is an SVG has no accessible name, so a screen reader
56
+ announces "button" and the user is told nothing at all.
57
+ */
58
+ this.label = "";
59
+ }
60
+ toggle() {
61
+ if (this.disabled)
62
+ return;
63
+ this.pressed = !this.pressed;
64
+ this.dispatchEvent(new CustomEvent("tt-change", {
65
+ detail: { value: this.value, pressed: this.pressed },
66
+ bubbles: true,
67
+ composed: true,
68
+ }));
69
+ }
70
+ static { this.styles = css `
71
+ /* The browser's own [hidden] rule loses to any :host display, so a
72
+ hidden element would still show. Important, so it always wins. */
73
+ :host([hidden]) {
74
+ display: none !important;
75
+ }
76
+
77
+ :host {
78
+ display: inline-flex;
79
+
80
+ /* So a group can lift the hovered or pressed item above its
81
+ neighbour when their borders are collapsed onto one edge.
82
+ z-index does nothing on a statically positioned element. */
83
+ position: relative;
84
+
85
+ font-family: var(--tt-font-sans);
86
+ -webkit-font-smoothing: antialiased;
87
+ }
88
+
89
+ button {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ gap: var(--tt-space-2);
94
+
95
+ box-sizing: border-box;
96
+ height: var(--tt-control-md);
97
+ min-width: var(--tt-control-md);
98
+ padding: 0 var(--tt-space-3);
99
+
100
+ border: 1px solid var(--tt-border);
101
+
102
+ /* Read through a property so tt-toggle-group can flatten the inner
103
+ corners of a segmented row. ::slotted() cannot reach this rule,
104
+ it only styles the host, but a custom property set on the host
105
+ inherits into here. Same channel idea as tt-sidebar. */
106
+ border-radius: var(--tt-toggle-radius, var(--tt-radius));
107
+ background: transparent;
108
+
109
+ font: inherit;
110
+ font-size: var(--tt-text-sm);
111
+ font-weight: var(--tt-weight-medium);
112
+ color: var(--tt-foreground);
113
+
114
+ cursor: pointer;
115
+ user-select: none;
116
+
117
+ /* Fast. A tool being selected should feel like a key press, not
118
+ like a page transition. */
119
+ transition:
120
+ background var(--tt-duration-fast) var(--tt-ease-out),
121
+ border-color var(--tt-duration-fast) var(--tt-ease-out),
122
+ color var(--tt-duration-fast) var(--tt-ease-out);
123
+ }
124
+
125
+ /* text-sm, not text-xs, for the same reason as tt-button's small
126
+ size: at 12px a small toggle beside a small button or field read
127
+ as a different size of control rather than one row. */
128
+ :host([size="small"]) button {
129
+ height: var(--tt-control-sm);
130
+ min-width: var(--tt-control-sm);
131
+ padding: 0 var(--tt-space-3);
132
+ font-size: var(--tt-text-sm);
133
+ }
134
+
135
+ :host([size="large"]) button {
136
+ height: var(--tt-control-lg);
137
+ min-width: var(--tt-control-lg);
138
+ padding: 0 var(--tt-space-4);
139
+ }
140
+
141
+ button:hover:not(:disabled) {
142
+ background: var(--tt-accent);
143
+ color: var(--tt-accent-foreground);
144
+ }
145
+
146
+ /*
147
+ The pressed state has to be obviously different from hover, or a
148
+ row of toggles becomes unreadable the moment the pointer is
149
+ anywhere near it. Hover is the accent surface; pressed is the
150
+ accent surface AND a border that agrees with it, which is a
151
+ difference you can still see while hovering a pressed item.
152
+
153
+ The border is --tt-border-strong, not the text colour. Full
154
+ foreground drew a black (in dark mode, white) frame round the
155
+ chosen item, which read as a focus ring rather than a selection.
156
+ The strong border still clears 3:1 against the surface, so the
157
+ state does not rest on the fill alone.
158
+ */
159
+ :host([pressed]) button {
160
+ background: var(--tt-accent);
161
+ border-color: var(--tt-border-strong);
162
+ color: var(--tt-accent-foreground);
163
+ font-weight: var(--tt-weight-semibold);
164
+ }
165
+
166
+ :host([pressed]) button:hover:not(:disabled) {
167
+ background: color-mix(
168
+ in oklab,
169
+ var(--tt-accent) 80%,
170
+ var(--tt-foreground)
171
+ );
172
+ }
173
+
174
+ /* The token file's one focus recipe. This control has a border, so
175
+ the offset is negated and the ring is drawn OVER it: a ring
176
+ sitting outside a bordered control reads as a second border with a
177
+ gap, and the control looks like it grew. */
178
+ button:focus-visible {
179
+ border-color: var(--tt-ring);
180
+ outline: var(--tt-ring-width) solid var(--tt-ring);
181
+ outline-offset: calc(var(--tt-ring-width) * -1);
182
+ }
183
+
184
+ button:disabled {
185
+ opacity: var(--tt-opacity-disabled);
186
+ cursor: not-allowed;
187
+ }
188
+
189
+ ::slotted(tt-icon) {
190
+ flex-shrink: 0;
191
+ }
192
+ `; }
193
+ // Focus has to be forwarded: focusing the host focuses nothing, since the
194
+ // control lives in the shadow root. Same as tt-slider and tt-input.
195
+ focus(options) {
196
+ this.renderRoot?.querySelector("button")?.focus(options);
197
+ }
198
+ render() {
199
+ return html `
200
+ <button
201
+ part="button"
202
+ type="button"
203
+ aria-pressed=${this.pressed ? "true" : "false"}
204
+ aria-label=${ifDefined(this.label || undefined)}
205
+ ?disabled=${this.disabled}
206
+ @click=${this.toggle}
207
+ >
208
+ <slot></slot>
209
+ </button>
210
+ `;
211
+ }
212
+ };
213
+ __decorate([
214
+ property({ type: Boolean, reflect: true })
215
+ ], TTToggle.prototype, "pressed", void 0);
216
+ __decorate([
217
+ property({ type: Boolean, reflect: true })
218
+ ], TTToggle.prototype, "disabled", void 0);
219
+ __decorate([
220
+ property({ type: String, reflect: true })
221
+ ], TTToggle.prototype, "size", void 0);
222
+ __decorate([
223
+ property({ type: String })
224
+ ], TTToggle.prototype, "value", void 0);
225
+ __decorate([
226
+ property({ type: String })
227
+ ], TTToggle.prototype, "label", void 0);
228
+ TTToggle = __decorate([
229
+ customElement("tt-toggle")
230
+ ], TTToggle);
231
+ export { TTToggle };
232
+ //# sourceMappingURL=tt-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-toggle.js","sourceRoot":"","sources":["../src/tt-toggle.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,E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;;;uBAIQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;qBACjC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;oBACnC,IAAI,CAAC,QAAQ;iBAChB,IAAI,CAAC,MAAM;;;;KAIvB,CAAC;IACJ,CAAC;;AA7K2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAiB;AAEhB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAElB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAA6B;AAG3C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAOX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAf5B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA+KpB"}
@@ -0,0 +1,26 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * The row above a list: something to filter with on the left, actions on
4
+ * the right, and a gap between them that collapses when the row wraps.
5
+ *
6
+ * This is the third copy of the same flex row in this repo, which is the
7
+ * point at which a pattern earns a component. Directory, Members and Shop
8
+ * each had their own, and each had drifted: different gaps, different
9
+ * wrap behaviour, and a hand-rolled spacer div in two of them.
10
+ *
11
+ * Pure layout. It has no idea what is in it, so a search box, a segmented
12
+ * control or a count all work without it knowing.
13
+ */
14
+ export declare class TTToolbar extends LitElement {
15
+ bordered: boolean;
16
+ stack: boolean;
17
+ align: "center" | "start";
18
+ static styles: import("lit").CSSResult;
19
+ render(): import("lit-html").TemplateResult<1>;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ "tt-toolbar": TTToolbar;
24
+ }
25
+ }
26
+ //# sourceMappingURL=tt-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-toolbar.d.ts","sourceRoot":"","sources":["../src/tt-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;;;GAWG;AACH,qBACa,SAAU,SAAQ,UAAU;IAGK,QAAQ,UAAS;IAKjB,KAAK,UAAS;IAKf,KAAK,EAAE,QAAQ,GAAG,OAAO,CACzD;IAEX,MAAM,CAAC,MAAM,0BA4FX;IAEF,MAAM;CAqBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}