tyrell-components 1.0.0-TC45 → 1.0.0-TC47

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 (353) hide show
  1. package/README.md +1 -1
  2. package/css/tyrell-theme.css +93 -100
  3. package/dist/tyrell-theme.css +93 -100
  4. package/dist/tyrell.js +1 -1
  5. package/lib/base/ty-component.d.ts +12 -7
  6. package/lib/base/ty-component.js +8 -139
  7. package/lib/components/button.d.ts +2 -16
  8. package/lib/components/button.js +0 -36
  9. package/lib/components/calendar-month.d.ts +2 -48
  10. package/lib/components/calendar-month.js +4 -166
  11. package/lib/components/calendar-navigation.d.ts +3 -48
  12. package/lib/components/calendar-navigation.js +3 -126
  13. package/lib/components/calendar.d.ts +3 -80
  14. package/lib/components/calendar.js +8 -230
  15. package/lib/components/checkbox.d.ts +4 -71
  16. package/lib/components/checkbox.js +7 -151
  17. package/lib/components/copy.d.ts +3 -56
  18. package/lib/components/copy.js +1 -120
  19. package/lib/components/date-picker.d.ts +13 -162
  20. package/lib/components/date-picker.js +39 -584
  21. package/lib/components/file-upload.d.ts +3 -15
  22. package/lib/components/file-upload.js +0 -37
  23. package/lib/components/icon.d.ts +3 -24
  24. package/lib/components/icon.js +1 -90
  25. package/lib/components/input.d.ts +7 -107
  26. package/lib/components/input.js +4 -193
  27. package/lib/components/modal.d.ts +3 -26
  28. package/lib/components/modal.js +1 -188
  29. package/lib/components/option.d.ts +2 -9
  30. package/lib/components/option.js +0 -48
  31. package/lib/components/popup.d.ts +2 -17
  32. package/lib/components/popup.js +4 -135
  33. package/lib/components/radio.d.ts +3 -23
  34. package/lib/components/radio.js +0 -63
  35. package/lib/components/resize-observer.d.ts +2 -30
  36. package/lib/components/resize-observer.js +0 -45
  37. package/lib/components/scroll-container.d.ts +2 -12
  38. package/lib/components/scroll-container.js +3 -46
  39. package/lib/components/select.d.ts +22 -153
  40. package/lib/components/select.js +30 -585
  41. package/lib/components/selected-tags.d.ts +4 -47
  42. package/lib/components/selected-tags.js +0 -94
  43. package/lib/components/step.d.ts +1 -6
  44. package/lib/components/step.js +0 -6
  45. package/lib/components/switch.d.ts +0 -11
  46. package/lib/components/switch.js +2 -36
  47. package/lib/components/tab.d.ts +1 -6
  48. package/lib/components/tab.js +0 -7
  49. package/lib/components/tabs.d.ts +3 -63
  50. package/lib/components/tabs.js +5 -283
  51. package/lib/components/tag.d.ts +2 -36
  52. package/lib/components/tag.js +5 -105
  53. package/lib/components/textarea.d.ts +6 -86
  54. package/lib/components/textarea.js +2 -173
  55. package/lib/components/tooltip.d.ts +3 -11
  56. package/lib/components/tooltip.js +2 -160
  57. package/lib/components/wizard.d.ts +4 -54
  58. package/lib/components/wizard.js +0 -228
  59. package/lib/icons/fontawesome/brands.d.ts +0 -1
  60. package/lib/icons/fontawesome/brands.js +0 -8
  61. package/lib/icons/fontawesome/regular.d.ts +0 -1
  62. package/lib/icons/fontawesome/regular.js +0 -8
  63. package/lib/icons/fontawesome/solid.d.ts +0 -1
  64. package/lib/icons/fontawesome/solid.js +0 -8
  65. package/lib/icons/heroicons/micro.d.ts +0 -1
  66. package/lib/icons/heroicons/micro.js +0 -8
  67. package/lib/icons/heroicons/mini.d.ts +0 -1
  68. package/lib/icons/heroicons/mini.js +0 -8
  69. package/lib/icons/heroicons/outline.d.ts +0 -1
  70. package/lib/icons/heroicons/outline.js +0 -8
  71. package/lib/icons/heroicons/solid.d.ts +0 -1
  72. package/lib/icons/heroicons/solid.js +0 -8
  73. package/lib/icons/lucide.d.ts +0 -1
  74. package/lib/icons/lucide.js +0 -1872
  75. package/lib/icons/material/filled.d.ts +0 -1
  76. package/lib/icons/material/filled.js +0 -10
  77. package/lib/icons/material/outlined.d.ts +0 -1
  78. package/lib/icons/material/outlined.js +0 -10
  79. package/lib/icons/material/round.d.ts +0 -1
  80. package/lib/icons/material/round.js +0 -10
  81. package/lib/icons/material/sharp.d.ts +0 -1
  82. package/lib/icons/material/sharp.js +0 -10
  83. package/lib/icons/material/two-tone.d.ts +0 -1
  84. package/lib/icons/material/two-tone.js +0 -10
  85. package/lib/index.d.ts +0 -1
  86. package/lib/index.js +0 -20
  87. package/lib/styles/button.d.ts +2 -20
  88. package/lib/styles/button.js +18 -121
  89. package/lib/styles/calendar-month.d.ts +1 -5
  90. package/lib/styles/calendar-month.js +4 -61
  91. package/lib/styles/calendar-navigation.d.ts +2 -6
  92. package/lib/styles/calendar-navigation.js +2 -27
  93. package/lib/styles/calendar.d.ts +1 -2
  94. package/lib/styles/calendar.js +1 -14
  95. package/lib/styles/checkbox.d.ts +0 -1
  96. package/lib/styles/checkbox.js +1 -23
  97. package/lib/styles/copy.d.ts +0 -1
  98. package/lib/styles/copy.js +2 -17
  99. package/lib/styles/custom-scrollbar.d.ts +1 -2
  100. package/lib/styles/custom-scrollbar.js +3 -18
  101. package/lib/styles/date-picker.d.ts +1 -5
  102. package/lib/styles/date-picker.js +8 -38
  103. package/lib/styles/file-upload.d.ts +1 -2
  104. package/lib/styles/file-upload.js +1 -16
  105. package/lib/styles/icon.d.ts +2 -6
  106. package/lib/styles/icon.js +7 -21
  107. package/lib/styles/input.d.ts +1 -6
  108. package/lib/styles/input.js +5 -54
  109. package/lib/styles/modal.d.ts +1 -2
  110. package/lib/styles/modal.js +3 -23
  111. package/lib/styles/option.d.ts +2 -6
  112. package/lib/styles/option.js +2 -12
  113. package/lib/styles/popup.d.ts +1 -2
  114. package/lib/styles/popup.js +4 -25
  115. package/lib/styles/radio.d.ts +0 -1
  116. package/lib/styles/radio.js +2 -16
  117. package/lib/styles/resize-observer.d.ts +1 -2
  118. package/lib/styles/resize-observer.js +0 -7
  119. package/lib/styles/scroll-container.d.ts +1 -2
  120. package/lib/styles/scroll-container.js +0 -19
  121. package/lib/styles/select-base.d.ts +0 -1
  122. package/lib/styles/select-base.js +15 -74
  123. package/lib/styles/select.d.ts +1 -2
  124. package/lib/styles/select.js +2 -14
  125. package/lib/styles/step.d.ts +1 -2
  126. package/lib/styles/step.js +0 -4
  127. package/lib/styles/switch.d.ts +0 -1
  128. package/lib/styles/switch.js +2 -20
  129. package/lib/styles/tab.d.ts +1 -2
  130. package/lib/styles/tab.js +0 -5
  131. package/lib/styles/tabs.d.ts +3 -11
  132. package/lib/styles/tabs.js +10 -48
  133. package/lib/styles/tag.d.ts +1 -5
  134. package/lib/styles/tag.js +2 -31
  135. package/lib/styles/textarea.d.ts +1 -2
  136. package/lib/styles/textarea.js +2 -45
  137. package/lib/styles/tooltip.d.ts +0 -1
  138. package/lib/styles/tooltip.js +0 -10
  139. package/lib/styles/wizard.d.ts +5 -21
  140. package/lib/styles/wizard.js +8 -88
  141. package/lib/types/common.d.ts +0 -2
  142. package/lib/types/common.js +0 -12
  143. package/lib/utils/calendar-utils.d.ts +4 -21
  144. package/lib/utils/calendar-utils.js +4 -177
  145. package/lib/utils/custom-scrollbar.d.ts +6 -20
  146. package/lib/utils/custom-scrollbar.js +1 -45
  147. package/lib/utils/flavor-sheet.d.ts +0 -1
  148. package/lib/utils/flavor-sheet.js +0 -23
  149. package/lib/utils/icon-registry.d.ts +0 -2
  150. package/lib/utils/icon-registry.js +1 -107
  151. package/lib/utils/icons.d.ts +0 -1
  152. package/lib/utils/icons.js +0 -9
  153. package/lib/utils/loader-registry.d.ts +0 -1
  154. package/lib/utils/loader-registry.js +0 -32
  155. package/lib/utils/locale.d.ts +2 -23
  156. package/lib/utils/locale.js +0 -86
  157. package/lib/utils/mobile.d.ts +0 -1
  158. package/lib/utils/mobile.js +0 -17
  159. package/lib/utils/number-format.d.ts +0 -2
  160. package/lib/utils/number-format.js +2 -65
  161. package/lib/utils/positioning.d.ts +50 -7
  162. package/lib/utils/positioning.js +49 -59
  163. package/lib/utils/property-capture.d.ts +5 -27
  164. package/lib/utils/property-capture.js +0 -108
  165. package/lib/utils/property-manager.d.ts +0 -1
  166. package/lib/utils/property-manager.js +0 -70
  167. package/lib/utils/resize-observer.d.ts +0 -1
  168. package/lib/utils/resize-observer.js +0 -36
  169. package/lib/utils/scroll-lock.d.ts +4 -11
  170. package/lib/utils/scroll-lock.js +0 -107
  171. package/lib/utils/styles.d.ts +0 -1
  172. package/lib/utils/styles.js +0 -24
  173. package/lib/version.d.ts +1 -2
  174. package/lib/version.js +1 -11
  175. package/package.json +2 -2
  176. package/lib/base/ty-component.d.ts.map +0 -1
  177. package/lib/base/ty-component.js.map +0 -1
  178. package/lib/components/button.d.ts.map +0 -1
  179. package/lib/components/button.js.map +0 -1
  180. package/lib/components/calendar-month.d.ts.map +0 -1
  181. package/lib/components/calendar-month.js.map +0 -1
  182. package/lib/components/calendar-navigation.d.ts.map +0 -1
  183. package/lib/components/calendar-navigation.js.map +0 -1
  184. package/lib/components/calendar.d.ts.map +0 -1
  185. package/lib/components/calendar.js.map +0 -1
  186. package/lib/components/checkbox.d.ts.map +0 -1
  187. package/lib/components/checkbox.js.map +0 -1
  188. package/lib/components/copy.d.ts.map +0 -1
  189. package/lib/components/copy.js.map +0 -1
  190. package/lib/components/date-picker.d.ts.map +0 -1
  191. package/lib/components/date-picker.js.map +0 -1
  192. package/lib/components/file-upload.d.ts.map +0 -1
  193. package/lib/components/file-upload.js.map +0 -1
  194. package/lib/components/icon.d.ts.map +0 -1
  195. package/lib/components/icon.js.map +0 -1
  196. package/lib/components/input.d.ts.map +0 -1
  197. package/lib/components/input.js.map +0 -1
  198. package/lib/components/modal.d.ts.map +0 -1
  199. package/lib/components/modal.js.map +0 -1
  200. package/lib/components/option.d.ts.map +0 -1
  201. package/lib/components/option.js.map +0 -1
  202. package/lib/components/popup.d.ts.map +0 -1
  203. package/lib/components/popup.js.map +0 -1
  204. package/lib/components/radio.d.ts.map +0 -1
  205. package/lib/components/radio.js.map +0 -1
  206. package/lib/components/resize-observer.d.ts.map +0 -1
  207. package/lib/components/resize-observer.js.map +0 -1
  208. package/lib/components/scroll-container.d.ts.map +0 -1
  209. package/lib/components/scroll-container.js.map +0 -1
  210. package/lib/components/select.d.ts.map +0 -1
  211. package/lib/components/select.js.map +0 -1
  212. package/lib/components/selected-tags.d.ts.map +0 -1
  213. package/lib/components/selected-tags.js.map +0 -1
  214. package/lib/components/step.d.ts.map +0 -1
  215. package/lib/components/step.js.map +0 -1
  216. package/lib/components/switch.d.ts.map +0 -1
  217. package/lib/components/switch.js.map +0 -1
  218. package/lib/components/tab.d.ts.map +0 -1
  219. package/lib/components/tab.js.map +0 -1
  220. package/lib/components/tabs.d.ts.map +0 -1
  221. package/lib/components/tabs.js.map +0 -1
  222. package/lib/components/tag.d.ts.map +0 -1
  223. package/lib/components/tag.js.map +0 -1
  224. package/lib/components/textarea.d.ts.map +0 -1
  225. package/lib/components/textarea.js.map +0 -1
  226. package/lib/components/tooltip.d.ts.map +0 -1
  227. package/lib/components/tooltip.js.map +0 -1
  228. package/lib/components/wizard.d.ts.map +0 -1
  229. package/lib/components/wizard.js.map +0 -1
  230. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  231. package/lib/icons/fontawesome/brands.js.map +0 -1
  232. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  233. package/lib/icons/fontawesome/regular.js.map +0 -1
  234. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  235. package/lib/icons/fontawesome/solid.js.map +0 -1
  236. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  237. package/lib/icons/heroicons/micro.js.map +0 -1
  238. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  239. package/lib/icons/heroicons/mini.js.map +0 -1
  240. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  241. package/lib/icons/heroicons/outline.js.map +0 -1
  242. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  243. package/lib/icons/heroicons/solid.js.map +0 -1
  244. package/lib/icons/lucide.d.ts.map +0 -1
  245. package/lib/icons/lucide.js.map +0 -1
  246. package/lib/icons/material/filled.d.ts.map +0 -1
  247. package/lib/icons/material/filled.js.map +0 -1
  248. package/lib/icons/material/outlined.d.ts.map +0 -1
  249. package/lib/icons/material/outlined.js.map +0 -1
  250. package/lib/icons/material/round.d.ts.map +0 -1
  251. package/lib/icons/material/round.js.map +0 -1
  252. package/lib/icons/material/sharp.d.ts.map +0 -1
  253. package/lib/icons/material/sharp.js.map +0 -1
  254. package/lib/icons/material/two-tone.d.ts.map +0 -1
  255. package/lib/icons/material/two-tone.js.map +0 -1
  256. package/lib/index.d.ts.map +0 -1
  257. package/lib/index.js.map +0 -1
  258. package/lib/styles/button.d.ts.map +0 -1
  259. package/lib/styles/button.js.map +0 -1
  260. package/lib/styles/calendar-month.d.ts.map +0 -1
  261. package/lib/styles/calendar-month.js.map +0 -1
  262. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  263. package/lib/styles/calendar-navigation.js.map +0 -1
  264. package/lib/styles/calendar.d.ts.map +0 -1
  265. package/lib/styles/calendar.js.map +0 -1
  266. package/lib/styles/checkbox.d.ts.map +0 -1
  267. package/lib/styles/checkbox.js.map +0 -1
  268. package/lib/styles/copy.d.ts.map +0 -1
  269. package/lib/styles/copy.js.map +0 -1
  270. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  271. package/lib/styles/custom-scrollbar.js.map +0 -1
  272. package/lib/styles/date-picker.d.ts.map +0 -1
  273. package/lib/styles/date-picker.js.map +0 -1
  274. package/lib/styles/file-upload.d.ts.map +0 -1
  275. package/lib/styles/file-upload.js.map +0 -1
  276. package/lib/styles/icon.d.ts.map +0 -1
  277. package/lib/styles/icon.js.map +0 -1
  278. package/lib/styles/input.d.ts.map +0 -1
  279. package/lib/styles/input.js.map +0 -1
  280. package/lib/styles/modal.d.ts.map +0 -1
  281. package/lib/styles/modal.js.map +0 -1
  282. package/lib/styles/multiselect.d.ts +0 -8
  283. package/lib/styles/multiselect.d.ts.map +0 -1
  284. package/lib/styles/multiselect.js +0 -849
  285. package/lib/styles/multiselect.js.map +0 -1
  286. package/lib/styles/option.d.ts.map +0 -1
  287. package/lib/styles/option.js.map +0 -1
  288. package/lib/styles/popup.d.ts.map +0 -1
  289. package/lib/styles/popup.js.map +0 -1
  290. package/lib/styles/radio.d.ts.map +0 -1
  291. package/lib/styles/radio.js.map +0 -1
  292. package/lib/styles/resize-observer.d.ts.map +0 -1
  293. package/lib/styles/resize-observer.js.map +0 -1
  294. package/lib/styles/scroll-container.d.ts.map +0 -1
  295. package/lib/styles/scroll-container.js.map +0 -1
  296. package/lib/styles/select-base.d.ts.map +0 -1
  297. package/lib/styles/select-base.js.map +0 -1
  298. package/lib/styles/select.d.ts.map +0 -1
  299. package/lib/styles/select.js.map +0 -1
  300. package/lib/styles/step.d.ts.map +0 -1
  301. package/lib/styles/step.js.map +0 -1
  302. package/lib/styles/switch.d.ts.map +0 -1
  303. package/lib/styles/switch.js.map +0 -1
  304. package/lib/styles/tab.d.ts.map +0 -1
  305. package/lib/styles/tab.js.map +0 -1
  306. package/lib/styles/tabs.d.ts.map +0 -1
  307. package/lib/styles/tabs.js.map +0 -1
  308. package/lib/styles/tag.d.ts.map +0 -1
  309. package/lib/styles/tag.js.map +0 -1
  310. package/lib/styles/textarea.d.ts.map +0 -1
  311. package/lib/styles/textarea.js.map +0 -1
  312. package/lib/styles/tooltip.d.ts.map +0 -1
  313. package/lib/styles/tooltip.js.map +0 -1
  314. package/lib/styles/wizard.d.ts.map +0 -1
  315. package/lib/styles/wizard.js.map +0 -1
  316. package/lib/types/common.d.ts.map +0 -1
  317. package/lib/types/common.js.map +0 -1
  318. package/lib/utils/calendar-utils.d.ts.map +0 -1
  319. package/lib/utils/calendar-utils.js.map +0 -1
  320. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  321. package/lib/utils/custom-scrollbar.js.map +0 -1
  322. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  323. package/lib/utils/flavor-sheet.js.map +0 -1
  324. package/lib/utils/icon-registry.d.ts.map +0 -1
  325. package/lib/utils/icon-registry.js.map +0 -1
  326. package/lib/utils/icons.d.ts.map +0 -1
  327. package/lib/utils/icons.js.map +0 -1
  328. package/lib/utils/loader-registry.d.ts.map +0 -1
  329. package/lib/utils/loader-registry.js.map +0 -1
  330. package/lib/utils/locale.d.ts.map +0 -1
  331. package/lib/utils/locale.js.map +0 -1
  332. package/lib/utils/mobile.d.ts.map +0 -1
  333. package/lib/utils/mobile.js.map +0 -1
  334. package/lib/utils/number-format.d.ts.map +0 -1
  335. package/lib/utils/number-format.js.map +0 -1
  336. package/lib/utils/parse-boolean.d.ts +0 -39
  337. package/lib/utils/parse-boolean.d.ts.map +0 -1
  338. package/lib/utils/parse-boolean.js +0 -58
  339. package/lib/utils/parse-boolean.js.map +0 -1
  340. package/lib/utils/positioning.d.ts.map +0 -1
  341. package/lib/utils/positioning.js.map +0 -1
  342. package/lib/utils/property-capture.d.ts.map +0 -1
  343. package/lib/utils/property-capture.js.map +0 -1
  344. package/lib/utils/property-manager.d.ts.map +0 -1
  345. package/lib/utils/property-manager.js.map +0 -1
  346. package/lib/utils/resize-observer.d.ts.map +0 -1
  347. package/lib/utils/resize-observer.js.map +0 -1
  348. package/lib/utils/scroll-lock.d.ts.map +0 -1
  349. package/lib/utils/scroll-lock.js.map +0 -1
  350. package/lib/utils/styles.d.ts.map +0 -1
  351. package/lib/utils/styles.js.map +0 -1
  352. package/lib/version.d.ts.map +0 -1
  353. package/lib/version.js.map +0 -1
@@ -1,46 +1,16 @@
1
- /**
2
- * Tooltip Component
3
- *
4
- * Shows helpful content on hover/focus with smart positioning.
5
- * Follows the same shadow DOM pattern as other components.
6
- *
7
- * @example
8
- * <ty-tooltip placement="top" flavor="primary" delay="600">
9
- * Helpful tooltip text
10
- * </ty-tooltip>
11
- */
12
- import { findBestPosition, placementPreferences } from '../utils/positioning.js';
1
+ import { findBestPosition, preferenceChain } from '../utils/positioning.js';
13
2
  import { ensureStyles } from '../utils/styles.js';
14
3
  import { tooltipStyles } from '../styles/tooltip.js';
15
- // ============================================================================
16
- // WeakMaps for State Management
17
- // ============================================================================
18
4
  const autoUpdateCleanup = new WeakMap();
19
5
  const eventCleanup = new WeakMap();
20
6
  const timeoutState = new WeakMap();
21
7
  const popoverElements = new WeakMap();
22
- // Cached separately from getAnchorElement()/el.parentElement — by the time
23
- // disconnectedCallback fires the element has already been removed from the
24
- // DOM, so parentElement is null and cleanup() couldn't otherwise find the
25
- // anchor to strip its aria-describedby.
26
8
  const anchorElements = new WeakMap();
27
- // ============================================================================
28
- // Helper Functions
29
- // ============================================================================
30
- /**
31
- * Normalize the flavor attribute. Any plain identifier (with optional +/-
32
- * shade suffix) is accepted — built-ins and custom flavors alike get their
33
- * colors from tokens in applyFlavorStyles(). Anything else (including
34
- * would-be CSS injection through the attribute) falls back to 'dark'.
35
- */
36
9
  function validateFlavor(flavor) {
37
10
  const full = flavor || 'dark';
38
11
  const base = full.replace(/[+-]$/, '');
39
12
  return /^[A-Za-z][A-Za-z0-9_-]*$/.test(base) ? full : 'dark';
40
13
  }
41
- /**
42
- * Get timeout state for element
43
- */
44
14
  function getTimeoutState(el) {
45
15
  let state = timeoutState.get(el);
46
16
  if (!state) {
@@ -49,15 +19,9 @@ function getTimeoutState(el) {
49
19
  }
50
20
  return state;
51
21
  }
52
- /**
53
- * Parse boolean attribute
54
- */
55
22
  function parseBoolAttr(el, name) {
56
23
  return el.hasAttribute(name);
57
24
  }
58
- /**
59
- * Parse integer attribute
60
- */
61
25
  function parseIntAttr(el, name, defaultValue) {
62
26
  const value = el.getAttribute(name);
63
27
  if (value === null)
@@ -65,9 +29,6 @@ function parseIntAttr(el, name, defaultValue) {
65
29
  const parsed = parseInt(value, 10);
66
30
  return isNaN(parsed) ? defaultValue : parsed;
67
31
  }
68
- /**
69
- * Read all tooltip attributes from element
70
- */
71
32
  function getTooltipAttributes(el) {
72
33
  return {
73
34
  placement: (el.getAttribute('placement') || 'top'),
@@ -77,17 +38,9 @@ function getTooltipAttributes(el) {
77
38
  flavor: validateFlavor(el.getAttribute('flavor')),
78
39
  };
79
40
  }
80
- /**
81
- * Get the parent element (anchor)
82
- */
83
41
  function getAnchorElement(el) {
84
42
  return el.parentElement;
85
43
  }
86
- /**
87
- * Add `id` to the anchor's aria-describedby without clobbering a value the
88
- * consumer may already have set for something else (WAI-ARIA APG tooltip
89
- * pattern: append, don't overwrite).
90
- */
91
44
  function addDescribedBy(anchor, id) {
92
45
  const ids = (anchor.getAttribute('aria-describedby') || '').split(/\s+/).filter(Boolean);
93
46
  if (!ids.includes(id)) {
@@ -95,7 +48,6 @@ function addDescribedBy(anchor, id) {
95
48
  anchor.setAttribute('aria-describedby', ids.join(' '));
96
49
  }
97
50
  }
98
- /** Inverse of addDescribedBy — used on teardown. */
99
51
  function removeDescribedBy(anchor, id) {
100
52
  const ids = (anchor.getAttribute('aria-describedby') || '').split(/\s+/).filter((x) => x && x !== id);
101
53
  if (ids.length > 0) {
@@ -105,24 +57,14 @@ function removeDescribedBy(anchor, id) {
105
57
  anchor.removeAttribute('aria-describedby');
106
58
  }
107
59
  }
108
- /**
109
- * Get or create popover element using Popover API
110
- * The popover is created in document.body for top-layer placement
111
- */
112
60
  function getOrCreatePopover(el) {
113
61
  let popover = popoverElements.get(el);
114
62
  if (!popover) {
115
- // Create popover element
116
63
  popover = document.createElement('div');
117
64
  popover.id = `ty-tooltip-${Math.random().toString(36).slice(2, 11)}`;
118
65
  popover.setAttribute('popover', 'manual');
119
- // WAI-ARIA APG tooltip pattern: the popover needs role="tooltip" and
120
- // the trigger needs aria-describedby pointing at it, or a keyboard/
121
- // screen-reader user gets no indication the tooltip exists at all —
122
- // hover-only visibility isn't enough on its own.
123
66
  popover.setAttribute('role', 'tooltip');
124
67
  popover.className = 'ty-tooltip-popover';
125
- // Apply inline styles (since popover is outside shadow DOM, we need inline styles)
126
68
  const styles = `
127
69
  position: fixed;
128
70
  margin: 0;
@@ -141,51 +83,24 @@ function getOrCreatePopover(el) {
141
83
  pointer-events: none;
142
84
  `;
143
85
  popover.style.cssText = styles;
144
- // Append to body
145
86
  document.body.appendChild(popover);
146
- // Store reference
147
87
  popoverElements.set(el, popover);
148
88
  const anchor = anchorElements.get(el);
149
89
  if (anchor)
150
90
  addDescribedBy(anchor, popover.id);
151
91
  }
152
- // Resync on every call (not just creation) — content and flavor can
153
- // change between shows, and this is eagerly called from connectedCallback
154
- // (see below) so a keyboard user tabbing straight to the trigger gets a
155
- // real aria-describedby target immediately, not one that only exists
156
- // after the (default 600ms) hover delay has already elapsed.
157
92
  const { flavor } = getTooltipAttributes(el);
158
93
  popover.setAttribute('data-flavor', flavor);
159
- // innerHTML, not textContent — the tooltip's own docs promise "Content is
160
- // any HTML nested inside the ty-tooltip element"; textContent silently
161
- // stripped it. Relocating the developer's own authored markup between two
162
- // elements they control isn't a new trust boundary (same model ty-select
163
- // already uses to clone rich option HTML into its trigger).
164
94
  popover.innerHTML = el.innerHTML;
165
95
  applyFlavorStyles(popover, flavor);
166
96
  return popover;
167
97
  }
168
- /**
169
- * Apply flavor-specific styles to popover.
170
- *
171
- * dark / light / info are hand-written extras; every other flavor —
172
- * built-in semantic or custom — is one token formula, with neutral
173
- * fallbacks so a custom flavor with missing tokens degrades gracefully.
174
- * flavor has passed validateFlavor's identifier guard, so interpolating
175
- * it into var() names is safe.
176
- */
177
98
  function applyFlavorStyles(popover, flavor) {
178
- // Reset to defaults first
179
99
  popover.style.removeProperty('background');
180
100
  popover.style.removeProperty('color');
181
101
  popover.style.removeProperty('border-color');
182
102
  switch (flavor) {
183
103
  case 'dark':
184
- // Default look — theme-INDEPENDENT on purpose (matches Material/
185
- // Bootstrap/Ant/Shoelace: a tooltip stays a fixed dark chip whether
186
- // the page is light or dark, so it always pops). Routed through the
187
- // --ty-tooltip-* tokens (defined once in :root, not redeclared in
188
- // html.dark) so consumers can retheme without a flavor.
189
104
  popover.style.background = 'var(--ty-tooltip-bg, #262626)';
190
105
  popover.style.color = 'var(--ty-tooltip-color, #f5f5f5)';
191
106
  popover.style.borderColor = 'var(--ty-tooltip-border, #404040)';
@@ -211,9 +126,6 @@ function applyFlavorStyles(popover, flavor) {
211
126
  }
212
127
  }
213
128
  }
214
- /**
215
- * Update tooltip position based on current anchor/popover state
216
- */
217
129
  function updatePosition(el) {
218
130
  const { placement, offset } = getTooltipAttributes(el);
219
131
  const anchor = getAnchorElement(el);
@@ -222,26 +134,16 @@ function updatePosition(el) {
222
134
  console.warn('[ty-tooltip] updatePosition: missing anchor or popover');
223
135
  return;
224
136
  }
225
- // Calculate preferences based on placement
226
- const preferences = placement === 'top' ? placementPreferences.tooltip :
227
- placement === 'bottom' ? ['bottom', 'top', 'left', 'right'] :
228
- placement === 'left' ? ['left', 'right', 'top', 'bottom'] :
229
- placement === 'right' ? ['right', 'left', 'top', 'bottom'] :
230
- placementPreferences.tooltip;
231
- // Use positioning engine to find best position
137
+ const preferences = preferenceChain(placement);
232
138
  const position = findBestPosition({
233
139
  targetEl: anchor,
234
140
  floatingEl: popover,
235
141
  preferences,
236
142
  offset,
237
143
  });
238
- // Apply position directly to popover
239
144
  popover.style.left = `${position.x}px`;
240
145
  popover.style.top = `${position.y}px`;
241
146
  }
242
- /**
243
- * Cleanup auto-update system
244
- */
245
147
  function cleanupAutoUpdate(el) {
246
148
  const cleanup = autoUpdateCleanup.get(el);
247
149
  if (cleanup) {
@@ -249,10 +151,6 @@ function cleanupAutoUpdate(el) {
249
151
  autoUpdateCleanup.delete(el);
250
152
  }
251
153
  }
252
- /**
253
- * Setup auto-update system for position tracking
254
- * Note: This does NOT calculate initial position - call updatePosition() separately
255
- */
256
154
  function setupAutoUpdate(el) {
257
155
  const anchor = getAnchorElement(el);
258
156
  const popover = popoverElements.get(el);
@@ -260,7 +158,6 @@ function setupAutoUpdate(el) {
260
158
  console.warn('[ty-tooltip] setupAutoUpdate: missing anchor or popover');
261
159
  return;
262
160
  }
263
- // Debounced update function
264
161
  let timeoutId = null;
265
162
  const debouncedUpdate = () => {
266
163
  if (timeoutId !== null) {
@@ -271,11 +168,9 @@ function setupAutoUpdate(el) {
271
168
  updatePosition(el);
272
169
  }, 10);
273
170
  };
274
- // Setup ResizeObserver for anchor and popover
275
171
  const resizeObserver = new ResizeObserver(debouncedUpdate);
276
172
  resizeObserver.observe(anchor);
277
173
  resizeObserver.observe(popover);
278
- // Scroll handler with requestAnimationFrame
279
174
  let scrollRafId = null;
280
175
  const handleScroll = () => {
281
176
  if (scrollRafId === null) {
@@ -285,10 +180,8 @@ function setupAutoUpdate(el) {
285
180
  });
286
181
  }
287
182
  };
288
- // Listen for scroll and resize
289
183
  window.addEventListener('scroll', handleScroll, true);
290
184
  window.addEventListener('resize', debouncedUpdate);
291
- // Store cleanup function
292
185
  const cleanup = () => {
293
186
  resizeObserver.disconnect();
294
187
  window.removeEventListener('scroll', handleScroll, true);
@@ -302,9 +195,6 @@ function setupAutoUpdate(el) {
302
195
  };
303
196
  autoUpdateCleanup.set(el, cleanup);
304
197
  }
305
- /**
306
- * Clear all timeouts
307
- */
308
198
  function clearTimeouts(el) {
309
199
  const state = getTimeoutState(el);
310
200
  if (state.showTimeout !== null) {
@@ -316,20 +206,14 @@ function clearTimeouts(el) {
316
206
  state.hideTimeout = null;
317
207
  }
318
208
  }
319
- /**
320
- * Show tooltip immediately using Popover API
321
- */
322
209
  function showTooltip(el) {
323
210
  const { disabled } = getTooltipAttributes(el);
324
211
  if (disabled)
325
212
  return;
326
- // Create popover if it doesn't exist
327
213
  const popover = getOrCreatePopover(el);
328
214
  try {
329
- // Show using Popover API
330
215
  popover.showPopover();
331
216
  el._open = true;
332
- // Position and setup observers
333
217
  updatePosition(el);
334
218
  setupAutoUpdate(el);
335
219
  }
@@ -337,9 +221,6 @@ function showTooltip(el) {
337
221
  console.warn('[ty-tooltip] Failed to show popover', e);
338
222
  }
339
223
  }
340
- /**
341
- * Hide tooltip immediately using Popover API
342
- */
343
224
  function hideTooltip(el) {
344
225
  const popover = popoverElements.get(el);
345
226
  if (!popover)
@@ -350,29 +231,19 @@ function hideTooltip(el) {
350
231
  cleanupAutoUpdate(el);
351
232
  }
352
233
  catch (e) {
353
- // Already hidden, ignore
354
234
  }
355
235
  }
356
- /**
357
- * Schedule tooltip to show after delay
358
- */
359
236
  function scheduleShow(el) {
360
237
  const state = getTimeoutState(el);
361
238
  const { delay } = getTooltipAttributes(el);
362
239
  clearTimeouts(el);
363
240
  state.showTimeout = window.setTimeout(() => showTooltip(el), delay);
364
241
  }
365
- /**
366
- * Schedule tooltip to hide after delay
367
- */
368
242
  function scheduleHide(el) {
369
243
  const state = getTimeoutState(el);
370
244
  clearTimeouts(el);
371
245
  state.hideTimeout = window.setTimeout(() => hideTooltip(el), 200);
372
246
  }
373
- /**
374
- * Setup event listeners on anchor element
375
- */
376
247
  function setupEvents(el) {
377
248
  const anchor = getAnchorElement(el);
378
249
  if (!anchor)
@@ -382,12 +253,10 @@ function setupEvents(el) {
382
253
  const handleLeave = () => scheduleHide(el);
383
254
  const handleFocus = () => scheduleShow(el);
384
255
  const handleBlur = () => scheduleHide(el);
385
- // Add event listeners
386
256
  anchor.addEventListener('mouseenter', handleEnter);
387
257
  anchor.addEventListener('mouseleave', handleLeave);
388
258
  anchor.addEventListener('focusin', handleFocus);
389
259
  anchor.addEventListener('focusout', handleBlur);
390
- // Store cleanup function
391
260
  eventCleanup.set(el, () => {
392
261
  anchor.removeEventListener('mouseenter', handleEnter);
393
262
  anchor.removeEventListener('mouseleave', handleLeave);
@@ -395,9 +264,6 @@ function setupEvents(el) {
395
264
  anchor.removeEventListener('focusout', handleBlur);
396
265
  });
397
266
  }
398
- /**
399
- * Cleanup all resources including popover element
400
- */
401
267
  function cleanup(el) {
402
268
  clearTimeouts(el);
403
269
  cleanupAutoUpdate(el);
@@ -406,9 +272,6 @@ function cleanup(el) {
406
272
  eventsCleanup();
407
273
  eventCleanup.delete(el);
408
274
  }
409
- // Strip aria-describedby before removing the popover it points at — by
410
- // this point (disconnectedCallback) el.parentElement is already null, so
411
- // this must use the cached anchor, not getAnchorElement(el).
412
275
  const popover = popoverElements.get(el);
413
276
  const anchor = anchorElements.get(el);
414
277
  if (popover && anchor) {
@@ -421,43 +284,25 @@ function cleanup(el) {
421
284
  anchorElements.delete(el);
422
285
  timeoutState.delete(el);
423
286
  }
424
- // ============================================================================
425
- // Component Definition
426
- // ============================================================================
427
- /**
428
- * TyTooltip Web Component
429
- */
430
287
  export class TyTooltip extends HTMLElement {
431
- /** Observed attributes */
432
288
  static get observedAttributes() {
433
289
  return ['placement', 'offset', 'delay', 'disabled', 'flavor'];
434
290
  }
435
291
  constructor() {
436
292
  super();
437
- /** Internal open state */
438
293
  this._open = false;
439
294
  this.attachShadow({ mode: 'open' });
440
295
  }
441
296
  connectedCallback() {
442
- // Initialize open state
443
297
  this._open = false;
444
- // Inject styles (for :host display: contents)
445
298
  ensureStyles(this.shadowRoot, tooltipStyles);
446
- // Setup events on anchor
447
299
  setupEvents(this);
448
- // Eagerly create the (hidden) popover so role="tooltip" + the anchor's
449
- // aria-describedby exist from connect, not only after the first show —
450
- // a keyboard user tabbing to the trigger must not wait out the hover
451
- // delay just to get an accessible description.
452
300
  getOrCreatePopover(this);
453
301
  }
454
302
  disconnectedCallback() {
455
303
  cleanup(this);
456
304
  }
457
305
  attributeChangedCallback(name, _oldValue, newValue) {
458
- // Restyle the popover on flavor change even while hidden — it's cached
459
- // in popoverElements once created, so a change made while closed would
460
- // otherwise be silently lost until the element is torn down.
461
306
  if (name === 'flavor') {
462
307
  const popover = popoverElements.get(this);
463
308
  if (popover) {
@@ -465,14 +310,11 @@ export class TyTooltip extends HTMLElement {
465
310
  applyFlavorStyles(popover, flavor);
466
311
  }
467
312
  }
468
- // Close tooltip if disabled
469
313
  if (name === 'disabled' && newValue !== null) {
470
314
  hideTooltip(this);
471
315
  }
472
316
  }
473
317
  }
474
- // Register the custom element
475
318
  if (!customElements.get('ty-tooltip')) {
476
319
  customElements.define('ty-tooltip', TyTooltip);
477
320
  }
478
- //# sourceMappingURL=tooltip.js.map
@@ -1,56 +1,8 @@
1
1
  /**
2
- * Wizard Component
3
- *
4
- * A carousel-based wizard/stepper component with smooth animations, progress tracking, and completion state.
5
- * Features horizontal sliding transitions between steps, animated progress line, and step completion tracking.
6
- * Behaves like tabs - a "dumb" component that only renders and fires events. All navigation and validation
7
- * is controlled by the user.
8
- *
9
- * Features:
10
- * - Carousel animation with smooth sliding transitions between steps
11
- * - Fixed dimensions prevent layout shift between steps
12
- * - Animated progress line showing completion status
13
- * - Step indicators with completed/active/pending states
14
- * - Rich indicator support via slots (icons, custom content)
15
- * - Independent panel scrolling with scroll position reset
16
- * - ResizeObserver for responsive percentage widths
17
- * - Smart rendering - only updates DOM when necessary
18
- * - Accessibility with ARIA roles and attributes
19
- * - Fires events on step clicks - user controls navigation
20
- *
21
- * @example
22
- * <!-- Basic wizard with text labels -->
23
- * <ty-wizard width="900px" height="600px" active="welcome">
24
- * <ty-step id="welcome" label="Welcome">
25
- * <div class="p-6">
26
- * <h1>Welcome!</h1>
27
- * <button onclick="goToStep('account')">Next</button>
28
- * </div>
29
- * </ty-step>
30
- * <ty-step id="account" label="Account Setup">
31
- * <div class="p-6">
32
- * <h2>Account Setup</h2>
33
- * <button onclick="goToStep('welcome')">Previous</button>
34
- * <button onclick="goToStep('complete')">Next</button>
35
- * </div>
36
- * </ty-step>
37
- * </ty-wizard>
38
- *
39
- * @example
40
- * <!-- Wizard with custom indicators -->
41
- * <ty-wizard width="100%" height="700px" active="welcome" completed="welcome,account">
42
- * <!-- Custom indicator icons -->
43
- * <div slot="indicator-welcome">
44
- * <ty-icon name="hand" size="sm"></ty-icon>
45
- * </div>
46
- * <div slot="indicator-account">
47
- * <span class="text-lg font-bold">1</span>
48
- * </div>
49
- *
50
- * <ty-step id="welcome" label="Welcome">...</ty-step>
51
- * <ty-step id="account" label="Account">...</ty-step>
52
- * <ty-step id="profile" label="Profile">...</ty-step>
53
- * </ty-wizard>
2
+ * Wizard Component — carousel-based stepper with sliding transitions, an
3
+ * animated progress line, and step completion tracking. Expects `ty-step`
4
+ * children. "Dumb" like ty-tabs: it renders and fires events; all navigation
5
+ * and validation is the consumer's.
54
6
  */
55
7
  /**
56
8
  * Wizard container attributes configuration
@@ -76,11 +28,9 @@ export interface WizardStepChangeDetail {
76
28
  * TyWizard Web Component
77
29
  */
78
30
  export declare class TyWizard extends HTMLElement {
79
- /** Observed attributes */
80
31
  static get observedAttributes(): string[];
81
32
  constructor();
82
33
  connectedCallback(): void;
83
34
  disconnectedCallback(): void;
84
35
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
85
36
  }
86
- //# sourceMappingURL=wizard.d.ts.map