@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 @@
1
+ {"version":3,"file":"tt-input.d.ts","sourceRoot":"","sources":["../src/tt-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI1C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAyBrD,MAAM,MAAM,iBAAiB,GACzB,IAAI,GACJ,KAAK,GACL,MAAM,GACN,YAAY,GACZ,aAAa,GACb,UAAU,GACV,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,SA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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 { ifDefined } from "lit/directives/if-defined.js";
9
+ import { property, customElement } from "lit/decorators.js";
10
+ import { srOnly } from "./sr-only.js";
11
+ let uid = 0;
12
+ let TTInput = class TTInput extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.internals = this.attachInternals();
16
+ this.label = "";
17
+ this.placeholder = "";
18
+ this.value = "";
19
+ // Field name under which the value is submitted with the form.
20
+ /*
21
+ Reflected, and it has to be.
22
+
23
+ A form-associated custom element is submitted under its name CONTENT
24
+ ATTRIBUTE, not its JS property. Without reflect, setting .name = "x"
25
+ from script leaves the attribute absent and the field vanishes from
26
+ FormData with no error anywhere. It only appeared to work because
27
+ every call site so far wrote name="x" in markup, which sets the
28
+ attribute directly.
29
+ */
30
+ this.name = "";
31
+ this.type = "text";
32
+ this.size = "medium";
33
+ // Reflected, as on every other control, so tt-input[disabled] works as
34
+ // a selector. tt-modal's focus trap skips :not([disabled]) controls,
35
+ // and without the attribute it never could.
36
+ this.disabled = false;
37
+ this.required = false;
38
+ this.fullWidth = false;
39
+ this.error = "";
40
+ /*
41
+ Keeps the label for screen readers while taking it off screen. Same
42
+ contract as tt-checkbox: for a field whose purpose is obvious to the
43
+ eye (a search box with an icon, a chat composer) but would otherwise
44
+ have no name at all. A placeholder is not a name: it vanishes as soon
45
+ as anyone types.
46
+ */
47
+ this.labelHidden = false;
48
+ this.inputId = `tt-input-${++uid}`;
49
+ }
50
+ // Participate in native <form> submission, validation and reset.
51
+ // Without this the shadow-DOM <input> is invisible to FormData.
52
+ static { this.formAssociated = true; }
53
+ get form() {
54
+ return this.internals.form;
55
+ }
56
+ get validity() {
57
+ return this.internals.validity;
58
+ }
59
+ // Exposed so tt-form (and any consumer) can validate without reaching
60
+ // into internals. Form-associated elements do not get these for free.
61
+ checkValidity() {
62
+ return this.internals.checkValidity();
63
+ }
64
+ reportValidity() {
65
+ return this.internals.reportValidity();
66
+ }
67
+ connectedCallback() {
68
+ super.connectedCallback();
69
+ this.syncFormState();
70
+ }
71
+ updated(changed) {
72
+ if (changed.has("value") || changed.has("required")) {
73
+ this.syncFormState();
74
+ }
75
+ }
76
+ // Reports both the value and whether it satisfies `required`. Without
77
+ // setValidity the field submits happily while empty, which is what this
78
+ // component did until tests caught it.
79
+ syncFormState() {
80
+ this.internals.setFormValue(this.value);
81
+ const missing = this.required && this.value.trim() === "";
82
+ if (missing) {
83
+ this.internals.setValidity({ valueMissing: true }, "Please fill in this field.", this.renderRoot?.querySelector("input") ?? undefined);
84
+ }
85
+ else {
86
+ this.internals.setValidity({});
87
+ }
88
+ }
89
+ // Called by the browser when the containing form is reset.
90
+ formResetCallback() {
91
+ this.value = "";
92
+ }
93
+ // Called by the browser when the form state is restored (bfcache, autofill).
94
+ formStateRestoreCallback(state) {
95
+ this.value = state ?? "";
96
+ }
97
+ handleInput(event) {
98
+ const input = event.target;
99
+ this.value = input.value;
100
+ this.dispatchEvent(new CustomEvent("tt-input", {
101
+ detail: {
102
+ value: this.value,
103
+ },
104
+ bubbles: true,
105
+ composed: true,
106
+ }));
107
+ }
108
+ handleChange() {
109
+ this.dispatchEvent(new CustomEvent("tt-change", {
110
+ detail: {
111
+ value: this.value,
112
+ },
113
+ bubbles: true,
114
+ composed: true,
115
+ }));
116
+ }
117
+ focus(options) {
118
+ this.renderRoot?.querySelector("input")?.focus(options);
119
+ }
120
+ /*
121
+ A click on the box's padding, or on a decorative prefix icon, focuses
122
+ the input. The whole field used to sit inside the <label>, which did
123
+ this for free, and also swept everything else in the box into the
124
+ field's NAME. See render().
125
+ */
126
+ focusFromBox(event) {
127
+ const target = event.target;
128
+ if (target === event.currentTarget || target.closest('[aria-hidden="true"]')) {
129
+ this.focus();
130
+ }
131
+ }
132
+ static { this.styles = [srOnly, css `
133
+ /* The browser's own [hidden] rule loses to any :host display, so a
134
+ hidden element would still show. Important, so it always wins. */
135
+ :host([hidden]) {
136
+ display: none !important;
137
+ }
138
+
139
+ :host {
140
+ /*
141
+ A grid or flex item defaults to min-width: auto, which floors it at
142
+ its MIN-CONTENT width rather than letting it shrink.
143
+
144
+ For most fields that is harmless. For type="date" the min-content
145
+ width is the whole dd/mm/yyyy mask plus the picker icon, so in a
146
+ 1fr 1fr row the date field pushed its own column past its share,
147
+ the field beside it shrank to compensate, and the pair stopped
148
+ lining up with the full-width fields above. The date looked like it
149
+ had wandered left, which it had.
150
+
151
+ Every field component carries this now, because any of them can end
152
+ up as a grid item and the failure is silent until a layout looks
153
+ subtly wrong.
154
+ */
155
+ min-width: 0;
156
+
157
+ display: inline-block;
158
+ width: auto;
159
+
160
+ font-family: var(--tt-font-sans);
161
+ -webkit-font-smoothing: antialiased;
162
+ }
163
+
164
+ :host([full-width]) {
165
+ display: block;
166
+ width: 100%;
167
+ }
168
+
169
+ .field {
170
+ display: flex;
171
+ flex-direction: column;
172
+ gap: var(--tt-space-2);
173
+ }
174
+
175
+ label {
176
+ font-size: var(--tt-text-sm);
177
+ font-weight: var(--tt-weight-medium);
178
+ letter-spacing: -0.005em;
179
+
180
+ color: var(--tt-foreground);
181
+ }
182
+
183
+ .req {
184
+ margin-left: 2px;
185
+ color: var(--tt-destructive);
186
+ }
187
+
188
+ /*
189
+ The BORDER lives on this wrapper, not on the input, so slotted
190
+ content can sit inside the field rather than beside it. A search
191
+ icon or a currency symbol belongs within the box it labels; bolting
192
+ a separate control on next to it reads as two controls.
193
+ */
194
+ .control {
195
+ display: flex;
196
+ align-items: center;
197
+ gap: var(--tt-space-2);
198
+
199
+ width: 100%;
200
+ box-sizing: border-box;
201
+
202
+ border: 1px solid var(--tt-input);
203
+ /* tt-button-group flattens this per position, so controls that
204
+ sit together share one edge instead of stacking two. */
205
+ border-radius: var(--tt-group-radius, var(--tt-radius));
206
+
207
+ background: var(--tt-field);
208
+ color: var(--tt-foreground);
209
+
210
+ transition: border-color var(--tt-duration-normal) var(--tt-ease);
211
+ }
212
+
213
+ .control:hover:not(.disabled):not(.error) {
214
+ border-color: var(--tt-border-strong);
215
+ }
216
+
217
+ /*
218
+ focus-within, not focus. The input no longer carries the border, so
219
+ the ring has to come from the wrapper when anything inside it takes
220
+ focus, including a slotted clear button.
221
+ */
222
+ .control:focus-within {
223
+ border-color: var(--tt-ring);
224
+
225
+ outline: var(--tt-ring-width) solid var(--tt-ring);
226
+ outline-offset: calc(var(--tt-ring-width) * -1);
227
+ }
228
+
229
+ .control.disabled {
230
+ background: var(--tt-muted);
231
+ color: var(--tt-muted-foreground);
232
+ cursor: not-allowed;
233
+ }
234
+
235
+ /*
236
+ Stripped bare. The wrapper owns the box now, so the input owning any
237
+ of it again would draw a second one inside the first.
238
+ */
239
+ input {
240
+ flex: 1;
241
+ min-width: 0;
242
+
243
+ padding: 0;
244
+ border: none;
245
+ background: transparent;
246
+ color: inherit;
247
+
248
+ font-family: inherit;
249
+ font-size: inherit;
250
+ }
251
+
252
+ input:focus {
253
+ outline: none;
254
+ }
255
+
256
+ input::placeholder {
257
+ color: var(--tt-muted-foreground);
258
+ }
259
+
260
+ /*
261
+ Date and time fields.
262
+
263
+ The browser draws its own editor and picker button inside the input,
264
+ and neither of them respects the box this component set up. Chrome
265
+ pads ::-webkit-datetime-edit internally, which pushes the text off the
266
+ baseline every other field in the row sits on, and it gives the picker
267
+ button its own margin, so the icon lands short of the field's right
268
+ padding instead of flush with it. Next to a plain input or a number
269
+ field the whole row reads as misaligned.
270
+
271
+ Stripping both back to zero puts the text and the icon on exactly the
272
+ edges .control already defines. The picker icon itself needs no
273
+ recolouring: tokens.css sets color-scheme, so the browser draws it
274
+ light or dark to match on its own.
275
+ */
276
+ input::-webkit-datetime-edit {
277
+ padding: 0;
278
+ }
279
+
280
+ input::-webkit-datetime-edit-fields-wrapper {
281
+ padding: 0;
282
+ }
283
+
284
+ input::-webkit-calendar-picker-indicator {
285
+ /* auto rather than a fixed value, so it sits at the right edge
286
+ whether or not the field also has a suffix slotted in. */
287
+ margin: 0;
288
+ margin-inline-start: auto;
289
+ padding: 0;
290
+
291
+ cursor: pointer;
292
+
293
+ /* Matches the weight of a tt-icon in the same row, which is drawn at
294
+ the muted foreground rather than at full contrast. */
295
+ opacity: 0.6;
296
+
297
+ transition: opacity var(--tt-duration-fast) var(--tt-ease);
298
+ }
299
+
300
+ input::-webkit-calendar-picker-indicator:hover {
301
+ opacity: 1;
302
+ }
303
+
304
+ input:disabled {
305
+ color: inherit;
306
+ cursor: not-allowed;
307
+ }
308
+
309
+ /* Slots are display:contents by default, so an empty one adds no box
310
+ and costs no gap. Nothing to hide when unused. */
311
+ ::slotted(*) {
312
+ flex: 0 0 auto;
313
+ color: var(--tt-muted-foreground);
314
+ }
315
+
316
+ /* min-height, not height: the field still grows for a slotted button
317
+ or a taller font, it simply never sits below the control size. */
318
+ .small {
319
+ min-height: var(--tt-control-sm);
320
+ padding: 0 11px;
321
+ font-size: var(--tt-text-sm);
322
+ }
323
+
324
+ .medium {
325
+ min-height: var(--tt-control-md);
326
+ padding: 0 13px;
327
+ font-size: var(--tt-text-sm);
328
+ }
329
+
330
+ .large {
331
+ min-height: var(--tt-control-lg);
332
+ padding: 0 16px;
333
+ font-size: var(--tt-text-md);
334
+ }
335
+
336
+ .error {
337
+ border-color: var(--tt-destructive);
338
+ }
339
+
340
+ .error:hover:not(.disabled),
341
+ .error:focus-within {
342
+ border-color: var(--tt-destructive);
343
+ }
344
+
345
+ /* An invalid field still gets a ring, in the destructive colour, so
346
+ the ring carries the error instead of a second glow doing it. */
347
+ .error:focus-within {
348
+ outline-color: var(--tt-destructive);
349
+ }
350
+
351
+ .error-text {
352
+ color: var(--tt-destructive);
353
+ font-size: var(--tt-text-xs);
354
+ font-weight: var(--tt-weight-medium);
355
+ }
356
+
357
+ /* iOS zooms the viewport when a focused field is under 16px. */
358
+ @media (max-width: 480px) {
359
+ .small,
360
+ .medium,
361
+ .large {
362
+ font-size: 16px;
363
+ }
364
+ }
365
+
366
+ `]; }
367
+ render() {
368
+ const errorId = this.error ? `${this.inputId}-error` : undefined;
369
+ /*
370
+ The <label> holds the label TEXT and nothing else.
371
+
372
+ It used to wrap the whole field: the prefix and suffix slots and the
373
+ error message too. A <label>'s whole content becomes the input's
374
+ accessible name, so a slotted clear button made the field's name
375
+ "Email Clear search", and an error was read twice, once as the name
376
+ and once as the description. Worse, with no label set, tt-search's
377
+ field was named just "Clear search".
378
+ */
379
+ return html `
380
+ <div class="field">
381
+ ${this.label
382
+ ? html `
383
+ <label
384
+ for=${this.inputId}
385
+ part="label"
386
+ class=${this.labelHidden ? "sr-only" : ""}
387
+ >
388
+ ${this.label}
389
+ ${this.required
390
+ ? html `<span class="req" aria-hidden="true">*</span>`
391
+ : ""}
392
+ </label>
393
+ `
394
+ : ""}
395
+
396
+ <div
397
+ part="control"
398
+ class="control ${this.size} ${this.error ? "error" : ""} ${this
399
+ .disabled
400
+ ? "disabled"
401
+ : ""}"
402
+ @click=${this.focusFromBox}
403
+ >
404
+ <slot name="prefix"></slot>
405
+
406
+ <input
407
+ part="input"
408
+ id=${this.inputId}
409
+ .value=${this.value}
410
+ name=${this.name}
411
+ placeholder=${this.placeholder}
412
+ type=${this.type}
413
+ autocomplete=${ifDefined(this.autocomplete)}
414
+ ?disabled=${this.disabled}
415
+ ?required=${this.required}
416
+ aria-invalid=${this.error ? "true" : "false"}
417
+ aria-describedby=${ifDefined(errorId)}
418
+ @input=${this.handleInput}
419
+ @change=${this.handleChange}
420
+ />
421
+
422
+ <slot name="suffix"></slot>
423
+ </div>
424
+
425
+ ${this.error
426
+ ? html `
427
+ <span id=${ifDefined(errorId)} class="error-text" role="alert">
428
+ ${this.error}
429
+ </span>
430
+ `
431
+ : null}
432
+ </div>
433
+ `;
434
+ }
435
+ };
436
+ __decorate([
437
+ property()
438
+ ], TTInput.prototype, "label", void 0);
439
+ __decorate([
440
+ property()
441
+ ], TTInput.prototype, "placeholder", void 0);
442
+ __decorate([
443
+ property()
444
+ ], TTInput.prototype, "value", void 0);
445
+ __decorate([
446
+ property({ type: String, reflect: true })
447
+ ], TTInput.prototype, "name", void 0);
448
+ __decorate([
449
+ property()
450
+ ], TTInput.prototype, "type", void 0);
451
+ __decorate([
452
+ property()
453
+ ], TTInput.prototype, "autocomplete", void 0);
454
+ __decorate([
455
+ property()
456
+ ], TTInput.prototype, "size", void 0);
457
+ __decorate([
458
+ property({ type: Boolean, reflect: true })
459
+ ], TTInput.prototype, "disabled", void 0);
460
+ __decorate([
461
+ property({ type: Boolean })
462
+ ], TTInput.prototype, "required", void 0);
463
+ __decorate([
464
+ property({ type: Boolean, attribute: "full-width", reflect: true })
465
+ ], TTInput.prototype, "fullWidth", void 0);
466
+ __decorate([
467
+ property()
468
+ ], TTInput.prototype, "error", void 0);
469
+ __decorate([
470
+ property({ type: Boolean, attribute: "label-hidden", reflect: true })
471
+ ], TTInput.prototype, "labelHidden", void 0);
472
+ TTInput = __decorate([
473
+ customElement("tt-input")
474
+ ], TTInput);
475
+ export { TTInput };
476
+ //# sourceMappingURL=tt-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-input.js","sourceRoot":"","sources":["../src/tt-input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAoFtC,IAAI,GAAG,GAAG,CAAC,CAAC;AAGL,IAAM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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAClD;AAGlB;IADC,QAAQ,EAAE;sCACA;AAUX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAClD;AAzET,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAoenB"}
@@ -0,0 +1,39 @@
1
+ import { LitElement } from "lit";
2
+ export type KbdSize = "small" | "medium";
3
+ /**
4
+ * A keyboard key, as printed in documentation and menus.
5
+ *
6
+ * Renders a real `<kbd>`, which is the element the HTML spec defines for
7
+ * "user input from a keyboard". A styled `<span>` looks identical and
8
+ * tells a screen reader nothing, so this is one of the rare cases where
9
+ * picking the right tag IS the accessibility work.
10
+ *
11
+ * Presentational only. It displays a key, it never listens for one.
12
+ *
13
+ * ---------------------------------------------------------------------
14
+ * ON `keys`.
15
+ *
16
+ * A combination is one idea, so it is one element:
17
+ *
18
+ * <tt-kbd keys="Ctrl+K"></tt-kbd>
19
+ *
20
+ * splits on "+" and renders a separator between the parts. Writing three
21
+ * elements and two literal plus signs in the markup instead would leave
22
+ * the separator's spacing to whoever typed it, and it would be different
23
+ * on every page by the end of the month.
24
+ *
25
+ * The default slot is the escape hatch for anything that is not a
26
+ * plus-separated combination, an arrow glyph say.
27
+ */
28
+ export declare class TTKbd extends LitElement {
29
+ keys: string;
30
+ size: KbdSize;
31
+ static styles: import("lit").CSSResult;
32
+ render(): import("lit-html").TemplateResult<1>;
33
+ }
34
+ declare global {
35
+ interface HTMLElementTagNameMap {
36
+ "tt-kbd": TTKbd;
37
+ }
38
+ }
39
+ //# sourceMappingURL=tt-kbd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-kbd.d.ts","sourceRoot":"","sources":["../src/tt-kbd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,KAAM,SAAQ,UAAU;IACP,IAAI,SAAM;IAEK,IAAI,EAAE,OAAO,CAAY;IAEpE,MAAM,CAAC,MAAM,0BAsEX;IAEF,MAAM;CA2BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,KAAK,CAAC;KACjB;CACF"}
package/dist/tt-kbd.js ADDED
@@ -0,0 +1,145 @@
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
+ /**
10
+ * A keyboard key, as printed in documentation and menus.
11
+ *
12
+ * Renders a real `<kbd>`, which is the element the HTML spec defines for
13
+ * "user input from a keyboard". A styled `<span>` looks identical and
14
+ * tells a screen reader nothing, so this is one of the rare cases where
15
+ * picking the right tag IS the accessibility work.
16
+ *
17
+ * Presentational only. It displays a key, it never listens for one.
18
+ *
19
+ * ---------------------------------------------------------------------
20
+ * ON `keys`.
21
+ *
22
+ * A combination is one idea, so it is one element:
23
+ *
24
+ * <tt-kbd keys="Ctrl+K"></tt-kbd>
25
+ *
26
+ * splits on "+" and renders a separator between the parts. Writing three
27
+ * elements and two literal plus signs in the markup instead would leave
28
+ * the separator's spacing to whoever typed it, and it would be different
29
+ * on every page by the end of the month.
30
+ *
31
+ * The default slot is the escape hatch for anything that is not a
32
+ * plus-separated combination, an arrow glyph say.
33
+ */
34
+ let TTKbd = class TTKbd extends LitElement {
35
+ constructor() {
36
+ super(...arguments);
37
+ this.keys = "";
38
+ this.size = "medium";
39
+ }
40
+ static { this.styles = css `
41
+ /* The browser's own [hidden] rule loses to any :host display, so a
42
+ hidden element would still show. Important, so it always wins. */
43
+ :host([hidden]) {
44
+ display: none !important;
45
+ }
46
+
47
+ :host {
48
+ display: inline-flex;
49
+ vertical-align: middle;
50
+ max-width: 100%;
51
+ }
52
+
53
+ .kbd {
54
+ display: inline-flex;
55
+ align-items: center;
56
+ gap: var(--tt-space-1);
57
+
58
+ font-family: var(--tt-font-sans);
59
+ max-width: 100%;
60
+ min-width: 0;
61
+ }
62
+
63
+ kbd {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+
68
+ box-sizing: border-box;
69
+ min-width: 1.5em;
70
+ padding: 0 var(--tt-space-2);
71
+
72
+ /* The height comes from a control token rather than from padding,
73
+ so a key beside an input lines up with it, and so the density
74
+ modes and the coarse-pointer block remap it for free. */
75
+ height: calc(var(--tt-control-sm) * 0.72);
76
+
77
+ font-family: var(--tt-font-mono);
78
+ font-size: var(--tt-text-xs);
79
+ font-weight: var(--tt-weight-medium);
80
+
81
+ /* A key is not a paragraph. An inherited body line-height adds
82
+ invisible space above and below the glyph and the key comes out
83
+ taller than it looks. Same trap as tt-badge. */
84
+ line-height: 1;
85
+ white-space: nowrap;
86
+
87
+ color: var(--tt-muted-foreground);
88
+ background: var(--tt-muted);
89
+
90
+ border: 1px solid var(--tt-border);
91
+ border-radius: var(--tt-radius-sm);
92
+
93
+ /* One hairline under the key. This is the whole illusion of a
94
+ physical key, and one pixel is enough: a real shadow here reads
95
+ as a floating card rather than as a keycap. */
96
+ box-shadow: 0 1px 0 var(--tt-border);
97
+ }
98
+
99
+ :host([size="small"]) kbd {
100
+ height: calc(var(--tt-control-sm) * 0.6);
101
+ padding: 0 var(--tt-space-1);
102
+ font-size: 0.6875rem;
103
+ }
104
+
105
+ .sep {
106
+ font-size: var(--tt-text-xs);
107
+ color: var(--tt-muted-foreground);
108
+ opacity: 0.6;
109
+ }
110
+ `; }
111
+ render() {
112
+ /*
113
+ Filter after splitting, so "Ctrl++" (the plus key) does not produce
114
+ an empty key between two separators.
115
+ */
116
+ const parts = this.keys
117
+ .split("+")
118
+ .map((k) => k.trim())
119
+ .filter(Boolean);
120
+ if (parts.length === 0) {
121
+ return html `<span class="kbd"
122
+ ><kbd part="key"><slot></slot></kbd
123
+ ></span>`;
124
+ }
125
+ return html `
126
+ <span class="kbd">
127
+ ${parts.map((key, i) => html `
128
+ ${i > 0 ? html `<span class="sep" aria-hidden="true">+</span>` : ""}
129
+ <kbd part="key">${key}</kbd>
130
+ `)}
131
+ </span>
132
+ `;
133
+ }
134
+ };
135
+ __decorate([
136
+ property({ type: String })
137
+ ], TTKbd.prototype, "keys", void 0);
138
+ __decorate([
139
+ property({ type: String, reflect: true })
140
+ ], TTKbd.prototype, "size", void 0);
141
+ TTKbd = __decorate([
142
+ customElement("tt-kbd")
143
+ ], TTKbd);
144
+ export { TTKbd };
145
+ //# sourceMappingURL=tt-kbd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-kbd.js","sourceRoot":"","sources":["../src/tt-kbd.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAI5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,UAAU;IAA9B;;QACuB,SAAI,GAAG,EAAE,CAAC;QAEK,SAAI,GAAY,QAAQ,CAAC;IAqGtE,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