tyrell-components 1.0.0-RC13 → 1.0.0-RC14

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 (355) hide show
  1. package/README.md +1 -1
  2. package/css/tyrell-theme.css +167 -178
  3. package/css/tyrell.css +19 -0
  4. package/dist/tyrell-theme.css +167 -178
  5. package/dist/tyrell.css +19 -0
  6. package/dist/tyrell.js +1 -1
  7. package/lib/base/ty-component.d.ts +20 -10
  8. package/lib/base/ty-component.js +21 -144
  9. package/lib/components/button.d.ts +2 -16
  10. package/lib/components/button.js +0 -36
  11. package/lib/components/calendar-month.d.ts +2 -48
  12. package/lib/components/calendar-month.js +4 -166
  13. package/lib/components/calendar-navigation.d.ts +3 -48
  14. package/lib/components/calendar-navigation.js +3 -126
  15. package/lib/components/calendar.d.ts +3 -80
  16. package/lib/components/calendar.js +8 -230
  17. package/lib/components/checkbox.d.ts +4 -71
  18. package/lib/components/checkbox.js +7 -151
  19. package/lib/components/copy.d.ts +3 -56
  20. package/lib/components/copy.js +1 -120
  21. package/lib/components/date-picker.d.ts +13 -162
  22. package/lib/components/date-picker.js +41 -592
  23. package/lib/components/file-upload.d.ts +9 -15
  24. package/lib/components/file-upload.js +19 -41
  25. package/lib/components/icon.d.ts +3 -24
  26. package/lib/components/icon.js +1 -90
  27. package/lib/components/input.d.ts +7 -107
  28. package/lib/components/input.js +5 -193
  29. package/lib/components/modal.d.ts +17 -26
  30. package/lib/components/modal.js +57 -201
  31. package/lib/components/option.d.ts +2 -9
  32. package/lib/components/option.js +0 -48
  33. package/lib/components/popup.d.ts +2 -17
  34. package/lib/components/popup.js +8 -139
  35. package/lib/components/radio.d.ts +3 -23
  36. package/lib/components/radio.js +10 -65
  37. package/lib/components/resize-observer.d.ts +3 -30
  38. package/lib/components/resize-observer.js +12 -46
  39. package/lib/components/scroll-container.d.ts +2 -12
  40. package/lib/components/scroll-container.js +3 -46
  41. package/lib/components/select.d.ts +22 -153
  42. package/lib/components/select.js +33 -590
  43. package/lib/components/selected-tags.d.ts +4 -47
  44. package/lib/components/selected-tags.js +1 -95
  45. package/lib/components/step.d.ts +1 -6
  46. package/lib/components/step.js +0 -6
  47. package/lib/components/switch.d.ts +0 -11
  48. package/lib/components/switch.js +2 -36
  49. package/lib/components/tab.d.ts +1 -6
  50. package/lib/components/tab.js +0 -7
  51. package/lib/components/tabs.d.ts +5 -63
  52. package/lib/components/tabs.js +20 -283
  53. package/lib/components/tag.d.ts +2 -36
  54. package/lib/components/tag.js +5 -105
  55. package/lib/components/textarea.d.ts +6 -86
  56. package/lib/components/textarea.js +2 -173
  57. package/lib/components/tooltip.d.ts +3 -11
  58. package/lib/components/tooltip.js +24 -160
  59. package/lib/components/wizard.d.ts +6 -54
  60. package/lib/components/wizard.js +15 -228
  61. package/lib/icons/fontawesome/brands.d.ts +0 -1
  62. package/lib/icons/fontawesome/brands.js +0 -8
  63. package/lib/icons/fontawesome/regular.d.ts +0 -1
  64. package/lib/icons/fontawesome/regular.js +0 -8
  65. package/lib/icons/fontawesome/solid.d.ts +0 -1
  66. package/lib/icons/fontawesome/solid.js +0 -8
  67. package/lib/icons/heroicons/micro.d.ts +0 -1
  68. package/lib/icons/heroicons/micro.js +0 -8
  69. package/lib/icons/heroicons/mini.d.ts +0 -1
  70. package/lib/icons/heroicons/mini.js +0 -8
  71. package/lib/icons/heroicons/outline.d.ts +0 -1
  72. package/lib/icons/heroicons/outline.js +0 -8
  73. package/lib/icons/heroicons/solid.d.ts +0 -1
  74. package/lib/icons/heroicons/solid.js +0 -8
  75. package/lib/icons/lucide.d.ts +0 -1
  76. package/lib/icons/lucide.js +0 -1872
  77. package/lib/icons/material/filled.d.ts +0 -1
  78. package/lib/icons/material/filled.js +0 -10
  79. package/lib/icons/material/outlined.d.ts +0 -1
  80. package/lib/icons/material/outlined.js +0 -10
  81. package/lib/icons/material/round.d.ts +0 -1
  82. package/lib/icons/material/round.js +0 -10
  83. package/lib/icons/material/sharp.d.ts +0 -1
  84. package/lib/icons/material/sharp.js +0 -10
  85. package/lib/icons/material/two-tone.d.ts +0 -1
  86. package/lib/icons/material/two-tone.js +0 -10
  87. package/lib/index.d.ts +0 -1
  88. package/lib/index.js +0 -20
  89. package/lib/styles/button.d.ts +2 -20
  90. package/lib/styles/button.js +22 -122
  91. package/lib/styles/calendar-month.d.ts +1 -5
  92. package/lib/styles/calendar-month.js +4 -61
  93. package/lib/styles/calendar-navigation.d.ts +2 -6
  94. package/lib/styles/calendar-navigation.js +2 -27
  95. package/lib/styles/calendar.d.ts +1 -2
  96. package/lib/styles/calendar.js +1 -14
  97. package/lib/styles/checkbox.d.ts +0 -1
  98. package/lib/styles/checkbox.js +1 -23
  99. package/lib/styles/copy.d.ts +0 -1
  100. package/lib/styles/copy.js +2 -17
  101. package/lib/styles/custom-scrollbar.d.ts +1 -2
  102. package/lib/styles/custom-scrollbar.js +3 -18
  103. package/lib/styles/date-picker.d.ts +1 -5
  104. package/lib/styles/date-picker.js +35 -39
  105. package/lib/styles/file-upload.d.ts +1 -2
  106. package/lib/styles/file-upload.js +1 -16
  107. package/lib/styles/icon.d.ts +2 -6
  108. package/lib/styles/icon.js +7 -21
  109. package/lib/styles/input.d.ts +1 -6
  110. package/lib/styles/input.js +5 -54
  111. package/lib/styles/modal.d.ts +1 -2
  112. package/lib/styles/modal.js +21 -23
  113. package/lib/styles/option.d.ts +2 -6
  114. package/lib/styles/option.js +17 -12
  115. package/lib/styles/popup.d.ts +1 -2
  116. package/lib/styles/popup.js +26 -30
  117. package/lib/styles/radio.d.ts +0 -1
  118. package/lib/styles/radio.js +2 -16
  119. package/lib/styles/resize-observer.d.ts +1 -2
  120. package/lib/styles/resize-observer.js +0 -7
  121. package/lib/styles/scroll-container.d.ts +1 -2
  122. package/lib/styles/scroll-container.js +0 -19
  123. package/lib/styles/select-base.d.ts +0 -1
  124. package/lib/styles/select-base.js +68 -79
  125. package/lib/styles/select.d.ts +1 -2
  126. package/lib/styles/select.js +7 -15
  127. package/lib/styles/step.d.ts +1 -2
  128. package/lib/styles/step.js +0 -4
  129. package/lib/styles/switch.d.ts +0 -1
  130. package/lib/styles/switch.js +2 -20
  131. package/lib/styles/tab.d.ts +1 -2
  132. package/lib/styles/tab.js +0 -5
  133. package/lib/styles/tabs.d.ts +3 -11
  134. package/lib/styles/tabs.js +10 -48
  135. package/lib/styles/tag.d.ts +1 -5
  136. package/lib/styles/tag.js +2 -31
  137. package/lib/styles/textarea.d.ts +1 -2
  138. package/lib/styles/textarea.js +2 -45
  139. package/lib/styles/tooltip.d.ts +0 -1
  140. package/lib/styles/tooltip.js +0 -10
  141. package/lib/styles/wizard.d.ts +5 -21
  142. package/lib/styles/wizard.js +8 -88
  143. package/lib/types/common.d.ts +0 -2
  144. package/lib/types/common.js +0 -12
  145. package/lib/utils/calendar-utils.d.ts +4 -21
  146. package/lib/utils/calendar-utils.js +4 -177
  147. package/lib/utils/custom-scrollbar.d.ts +6 -20
  148. package/lib/utils/custom-scrollbar.js +1 -45
  149. package/lib/utils/flavor-sheet.d.ts +0 -1
  150. package/lib/utils/flavor-sheet.js +0 -23
  151. package/lib/utils/icon-registry.d.ts +0 -2
  152. package/lib/utils/icon-registry.js +1 -107
  153. package/lib/utils/icons.d.ts +0 -1
  154. package/lib/utils/icons.js +0 -9
  155. package/lib/utils/loader-registry.d.ts +0 -1
  156. package/lib/utils/loader-registry.js +0 -32
  157. package/lib/utils/locale.d.ts +2 -23
  158. package/lib/utils/locale.js +0 -86
  159. package/lib/utils/mobile.d.ts +0 -1
  160. package/lib/utils/mobile.js +0 -17
  161. package/lib/utils/number-format.d.ts +6 -3
  162. package/lib/utils/number-format.js +11 -67
  163. package/lib/utils/positioning.d.ts +50 -7
  164. package/lib/utils/positioning.js +52 -62
  165. package/lib/utils/property-capture.d.ts +5 -27
  166. package/lib/utils/property-capture.js +0 -108
  167. package/lib/utils/property-manager.d.ts +0 -1
  168. package/lib/utils/property-manager.js +0 -70
  169. package/lib/utils/resize-observer.d.ts +0 -1
  170. package/lib/utils/resize-observer.js +0 -36
  171. package/lib/utils/scroll-lock.d.ts +4 -11
  172. package/lib/utils/scroll-lock.js +0 -107
  173. package/lib/utils/styles.d.ts +0 -1
  174. package/lib/utils/styles.js +0 -24
  175. package/lib/version.d.ts +1 -2
  176. package/lib/version.js +1 -11
  177. package/package.json +2 -2
  178. package/lib/base/ty-component.d.ts.map +0 -1
  179. package/lib/base/ty-component.js.map +0 -1
  180. package/lib/components/button.d.ts.map +0 -1
  181. package/lib/components/button.js.map +0 -1
  182. package/lib/components/calendar-month.d.ts.map +0 -1
  183. package/lib/components/calendar-month.js.map +0 -1
  184. package/lib/components/calendar-navigation.d.ts.map +0 -1
  185. package/lib/components/calendar-navigation.js.map +0 -1
  186. package/lib/components/calendar.d.ts.map +0 -1
  187. package/lib/components/calendar.js.map +0 -1
  188. package/lib/components/checkbox.d.ts.map +0 -1
  189. package/lib/components/checkbox.js.map +0 -1
  190. package/lib/components/copy.d.ts.map +0 -1
  191. package/lib/components/copy.js.map +0 -1
  192. package/lib/components/date-picker.d.ts.map +0 -1
  193. package/lib/components/date-picker.js.map +0 -1
  194. package/lib/components/file-upload.d.ts.map +0 -1
  195. package/lib/components/file-upload.js.map +0 -1
  196. package/lib/components/icon.d.ts.map +0 -1
  197. package/lib/components/icon.js.map +0 -1
  198. package/lib/components/input.d.ts.map +0 -1
  199. package/lib/components/input.js.map +0 -1
  200. package/lib/components/modal.d.ts.map +0 -1
  201. package/lib/components/modal.js.map +0 -1
  202. package/lib/components/option.d.ts.map +0 -1
  203. package/lib/components/option.js.map +0 -1
  204. package/lib/components/popup.d.ts.map +0 -1
  205. package/lib/components/popup.js.map +0 -1
  206. package/lib/components/radio.d.ts.map +0 -1
  207. package/lib/components/radio.js.map +0 -1
  208. package/lib/components/resize-observer.d.ts.map +0 -1
  209. package/lib/components/resize-observer.js.map +0 -1
  210. package/lib/components/scroll-container.d.ts.map +0 -1
  211. package/lib/components/scroll-container.js.map +0 -1
  212. package/lib/components/select.d.ts.map +0 -1
  213. package/lib/components/select.js.map +0 -1
  214. package/lib/components/selected-tags.d.ts.map +0 -1
  215. package/lib/components/selected-tags.js.map +0 -1
  216. package/lib/components/step.d.ts.map +0 -1
  217. package/lib/components/step.js.map +0 -1
  218. package/lib/components/switch.d.ts.map +0 -1
  219. package/lib/components/switch.js.map +0 -1
  220. package/lib/components/tab.d.ts.map +0 -1
  221. package/lib/components/tab.js.map +0 -1
  222. package/lib/components/tabs.d.ts.map +0 -1
  223. package/lib/components/tabs.js.map +0 -1
  224. package/lib/components/tag.d.ts.map +0 -1
  225. package/lib/components/tag.js.map +0 -1
  226. package/lib/components/textarea.d.ts.map +0 -1
  227. package/lib/components/textarea.js.map +0 -1
  228. package/lib/components/tooltip.d.ts.map +0 -1
  229. package/lib/components/tooltip.js.map +0 -1
  230. package/lib/components/wizard.d.ts.map +0 -1
  231. package/lib/components/wizard.js.map +0 -1
  232. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  233. package/lib/icons/fontawesome/brands.js.map +0 -1
  234. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  235. package/lib/icons/fontawesome/regular.js.map +0 -1
  236. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  237. package/lib/icons/fontawesome/solid.js.map +0 -1
  238. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  239. package/lib/icons/heroicons/micro.js.map +0 -1
  240. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  241. package/lib/icons/heroicons/mini.js.map +0 -1
  242. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  243. package/lib/icons/heroicons/outline.js.map +0 -1
  244. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  245. package/lib/icons/heroicons/solid.js.map +0 -1
  246. package/lib/icons/lucide.d.ts.map +0 -1
  247. package/lib/icons/lucide.js.map +0 -1
  248. package/lib/icons/material/filled.d.ts.map +0 -1
  249. package/lib/icons/material/filled.js.map +0 -1
  250. package/lib/icons/material/outlined.d.ts.map +0 -1
  251. package/lib/icons/material/outlined.js.map +0 -1
  252. package/lib/icons/material/round.d.ts.map +0 -1
  253. package/lib/icons/material/round.js.map +0 -1
  254. package/lib/icons/material/sharp.d.ts.map +0 -1
  255. package/lib/icons/material/sharp.js.map +0 -1
  256. package/lib/icons/material/two-tone.d.ts.map +0 -1
  257. package/lib/icons/material/two-tone.js.map +0 -1
  258. package/lib/index.d.ts.map +0 -1
  259. package/lib/index.js.map +0 -1
  260. package/lib/styles/button.d.ts.map +0 -1
  261. package/lib/styles/button.js.map +0 -1
  262. package/lib/styles/calendar-month.d.ts.map +0 -1
  263. package/lib/styles/calendar-month.js.map +0 -1
  264. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  265. package/lib/styles/calendar-navigation.js.map +0 -1
  266. package/lib/styles/calendar.d.ts.map +0 -1
  267. package/lib/styles/calendar.js.map +0 -1
  268. package/lib/styles/checkbox.d.ts.map +0 -1
  269. package/lib/styles/checkbox.js.map +0 -1
  270. package/lib/styles/copy.d.ts.map +0 -1
  271. package/lib/styles/copy.js.map +0 -1
  272. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  273. package/lib/styles/custom-scrollbar.js.map +0 -1
  274. package/lib/styles/date-picker.d.ts.map +0 -1
  275. package/lib/styles/date-picker.js.map +0 -1
  276. package/lib/styles/file-upload.d.ts.map +0 -1
  277. package/lib/styles/file-upload.js.map +0 -1
  278. package/lib/styles/icon.d.ts.map +0 -1
  279. package/lib/styles/icon.js.map +0 -1
  280. package/lib/styles/input.d.ts.map +0 -1
  281. package/lib/styles/input.js.map +0 -1
  282. package/lib/styles/modal.d.ts.map +0 -1
  283. package/lib/styles/modal.js.map +0 -1
  284. package/lib/styles/multiselect.d.ts +0 -8
  285. package/lib/styles/multiselect.d.ts.map +0 -1
  286. package/lib/styles/multiselect.js +0 -849
  287. package/lib/styles/multiselect.js.map +0 -1
  288. package/lib/styles/option.d.ts.map +0 -1
  289. package/lib/styles/option.js.map +0 -1
  290. package/lib/styles/popup.d.ts.map +0 -1
  291. package/lib/styles/popup.js.map +0 -1
  292. package/lib/styles/radio.d.ts.map +0 -1
  293. package/lib/styles/radio.js.map +0 -1
  294. package/lib/styles/resize-observer.d.ts.map +0 -1
  295. package/lib/styles/resize-observer.js.map +0 -1
  296. package/lib/styles/scroll-container.d.ts.map +0 -1
  297. package/lib/styles/scroll-container.js.map +0 -1
  298. package/lib/styles/select-base.d.ts.map +0 -1
  299. package/lib/styles/select-base.js.map +0 -1
  300. package/lib/styles/select.d.ts.map +0 -1
  301. package/lib/styles/select.js.map +0 -1
  302. package/lib/styles/step.d.ts.map +0 -1
  303. package/lib/styles/step.js.map +0 -1
  304. package/lib/styles/switch.d.ts.map +0 -1
  305. package/lib/styles/switch.js.map +0 -1
  306. package/lib/styles/tab.d.ts.map +0 -1
  307. package/lib/styles/tab.js.map +0 -1
  308. package/lib/styles/tabs.d.ts.map +0 -1
  309. package/lib/styles/tabs.js.map +0 -1
  310. package/lib/styles/tag.d.ts.map +0 -1
  311. package/lib/styles/tag.js.map +0 -1
  312. package/lib/styles/textarea.d.ts.map +0 -1
  313. package/lib/styles/textarea.js.map +0 -1
  314. package/lib/styles/tooltip.d.ts.map +0 -1
  315. package/lib/styles/tooltip.js.map +0 -1
  316. package/lib/styles/wizard.d.ts.map +0 -1
  317. package/lib/styles/wizard.js.map +0 -1
  318. package/lib/types/common.d.ts.map +0 -1
  319. package/lib/types/common.js.map +0 -1
  320. package/lib/utils/calendar-utils.d.ts.map +0 -1
  321. package/lib/utils/calendar-utils.js.map +0 -1
  322. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  323. package/lib/utils/custom-scrollbar.js.map +0 -1
  324. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  325. package/lib/utils/flavor-sheet.js.map +0 -1
  326. package/lib/utils/icon-registry.d.ts.map +0 -1
  327. package/lib/utils/icon-registry.js.map +0 -1
  328. package/lib/utils/icons.d.ts.map +0 -1
  329. package/lib/utils/icons.js.map +0 -1
  330. package/lib/utils/loader-registry.d.ts.map +0 -1
  331. package/lib/utils/loader-registry.js.map +0 -1
  332. package/lib/utils/locale.d.ts.map +0 -1
  333. package/lib/utils/locale.js.map +0 -1
  334. package/lib/utils/mobile.d.ts.map +0 -1
  335. package/lib/utils/mobile.js.map +0 -1
  336. package/lib/utils/number-format.d.ts.map +0 -1
  337. package/lib/utils/number-format.js.map +0 -1
  338. package/lib/utils/parse-boolean.d.ts +0 -39
  339. package/lib/utils/parse-boolean.d.ts.map +0 -1
  340. package/lib/utils/parse-boolean.js +0 -58
  341. package/lib/utils/parse-boolean.js.map +0 -1
  342. package/lib/utils/positioning.d.ts.map +0 -1
  343. package/lib/utils/positioning.js.map +0 -1
  344. package/lib/utils/property-capture.d.ts.map +0 -1
  345. package/lib/utils/property-capture.js.map +0 -1
  346. package/lib/utils/property-manager.d.ts.map +0 -1
  347. package/lib/utils/property-manager.js.map +0 -1
  348. package/lib/utils/resize-observer.d.ts.map +0 -1
  349. package/lib/utils/resize-observer.js.map +0 -1
  350. package/lib/utils/scroll-lock.d.ts.map +0 -1
  351. package/lib/utils/scroll-lock.js.map +0 -1
  352. package/lib/utils/styles.d.ts.map +0 -1
  353. package/lib/utils/styles.js.map +0 -1
  354. package/lib/version.d.ts.map +0 -1
  355. 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,35 @@ 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
- */
60
+ function ensureTooltipMotionStyles() {
61
+ if (document.getElementById('ty-tooltip-motion'))
62
+ return;
63
+ const style = document.createElement('style');
64
+ style.id = 'ty-tooltip-motion';
65
+ style.textContent = `
66
+ .ty-tooltip-popover:popover-open {
67
+ transition:
68
+ opacity var(--ty-tooltip-duration, 120ms) ease-out,
69
+ translate var(--ty-tooltip-duration, 120ms) ease-out;
70
+ }
71
+ @starting-style {
72
+ .ty-tooltip-popover:popover-open { opacity: 0; translate: 0 4px; }
73
+ .ty-tooltip-popover:popover-open[data-side="bottom"] { translate: 0 -4px; }
74
+ .ty-tooltip-popover:popover-open[data-side="left"] { translate: 4px 0; }
75
+ .ty-tooltip-popover:popover-open[data-side="right"] { translate: -4px 0; }
76
+ }
77
+ `;
78
+ document.head.appendChild(style);
79
+ }
112
80
  function getOrCreatePopover(el) {
81
+ ensureTooltipMotionStyles();
113
82
  let popover = popoverElements.get(el);
114
83
  if (!popover) {
115
- // Create popover element
116
84
  popover = document.createElement('div');
117
85
  popover.id = `ty-tooltip-${Math.random().toString(36).slice(2, 11)}`;
118
86
  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
87
  popover.setAttribute('role', 'tooltip');
124
88
  popover.className = 'ty-tooltip-popover';
125
- // Apply inline styles (since popover is outside shadow DOM, we need inline styles)
126
89
  const styles = `
127
90
  position: fixed;
128
91
  margin: 0;
@@ -141,51 +104,24 @@ function getOrCreatePopover(el) {
141
104
  pointer-events: none;
142
105
  `;
143
106
  popover.style.cssText = styles;
144
- // Append to body
145
107
  document.body.appendChild(popover);
146
- // Store reference
147
108
  popoverElements.set(el, popover);
148
109
  const anchor = anchorElements.get(el);
149
110
  if (anchor)
150
111
  addDescribedBy(anchor, popover.id);
151
112
  }
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
113
  const { flavor } = getTooltipAttributes(el);
158
114
  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
115
  popover.innerHTML = el.innerHTML;
165
116
  applyFlavorStyles(popover, flavor);
166
117
  return popover;
167
118
  }
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
119
  function applyFlavorStyles(popover, flavor) {
178
- // Reset to defaults first
179
120
  popover.style.removeProperty('background');
180
121
  popover.style.removeProperty('color');
181
122
  popover.style.removeProperty('border-color');
182
123
  switch (flavor) {
183
124
  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
125
  popover.style.background = 'var(--ty-tooltip-bg, #262626)';
190
126
  popover.style.color = 'var(--ty-tooltip-color, #f5f5f5)';
191
127
  popover.style.borderColor = 'var(--ty-tooltip-border, #404040)';
@@ -211,9 +147,6 @@ function applyFlavorStyles(popover, flavor) {
211
147
  }
212
148
  }
213
149
  }
214
- /**
215
- * Update tooltip position based on current anchor/popover state
216
- */
217
150
  function updatePosition(el) {
218
151
  const { placement, offset } = getTooltipAttributes(el);
219
152
  const anchor = getAnchorElement(el);
@@ -222,26 +155,17 @@ function updatePosition(el) {
222
155
  console.warn('[ty-tooltip] updatePosition: missing anchor or popover');
223
156
  return;
224
157
  }
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
158
+ const preferences = preferenceChain(placement);
232
159
  const position = findBestPosition({
233
160
  targetEl: anchor,
234
161
  floatingEl: popover,
235
162
  preferences,
236
163
  offset,
237
164
  });
238
- // Apply position directly to popover
239
165
  popover.style.left = `${position.x}px`;
240
166
  popover.style.top = `${position.y}px`;
167
+ popover.dataset.side = position.placement.split('-')[0];
241
168
  }
242
- /**
243
- * Cleanup auto-update system
244
- */
245
169
  function cleanupAutoUpdate(el) {
246
170
  const cleanup = autoUpdateCleanup.get(el);
247
171
  if (cleanup) {
@@ -249,10 +173,6 @@ function cleanupAutoUpdate(el) {
249
173
  autoUpdateCleanup.delete(el);
250
174
  }
251
175
  }
252
- /**
253
- * Setup auto-update system for position tracking
254
- * Note: This does NOT calculate initial position - call updatePosition() separately
255
- */
256
176
  function setupAutoUpdate(el) {
257
177
  const anchor = getAnchorElement(el);
258
178
  const popover = popoverElements.get(el);
@@ -260,7 +180,6 @@ function setupAutoUpdate(el) {
260
180
  console.warn('[ty-tooltip] setupAutoUpdate: missing anchor or popover');
261
181
  return;
262
182
  }
263
- // Debounced update function
264
183
  let timeoutId = null;
265
184
  const debouncedUpdate = () => {
266
185
  if (timeoutId !== null) {
@@ -271,11 +190,9 @@ function setupAutoUpdate(el) {
271
190
  updatePosition(el);
272
191
  }, 10);
273
192
  };
274
- // Setup ResizeObserver for anchor and popover
275
193
  const resizeObserver = new ResizeObserver(debouncedUpdate);
276
194
  resizeObserver.observe(anchor);
277
195
  resizeObserver.observe(popover);
278
- // Scroll handler with requestAnimationFrame
279
196
  let scrollRafId = null;
280
197
  const handleScroll = () => {
281
198
  if (scrollRafId === null) {
@@ -285,10 +202,8 @@ function setupAutoUpdate(el) {
285
202
  });
286
203
  }
287
204
  };
288
- // Listen for scroll and resize
289
205
  window.addEventListener('scroll', handleScroll, true);
290
206
  window.addEventListener('resize', debouncedUpdate);
291
- // Store cleanup function
292
207
  const cleanup = () => {
293
208
  resizeObserver.disconnect();
294
209
  window.removeEventListener('scroll', handleScroll, true);
@@ -302,9 +217,6 @@ function setupAutoUpdate(el) {
302
217
  };
303
218
  autoUpdateCleanup.set(el, cleanup);
304
219
  }
305
- /**
306
- * Clear all timeouts
307
- */
308
220
  function clearTimeouts(el) {
309
221
  const state = getTimeoutState(el);
310
222
  if (state.showTimeout !== null) {
@@ -316,20 +228,14 @@ function clearTimeouts(el) {
316
228
  state.hideTimeout = null;
317
229
  }
318
230
  }
319
- /**
320
- * Show tooltip immediately using Popover API
321
- */
322
231
  function showTooltip(el) {
323
232
  const { disabled } = getTooltipAttributes(el);
324
233
  if (disabled)
325
234
  return;
326
- // Create popover if it doesn't exist
327
235
  const popover = getOrCreatePopover(el);
328
236
  try {
329
- // Show using Popover API
330
237
  popover.showPopover();
331
238
  el._open = true;
332
- // Position and setup observers
333
239
  updatePosition(el);
334
240
  setupAutoUpdate(el);
335
241
  }
@@ -337,9 +243,6 @@ function showTooltip(el) {
337
243
  console.warn('[ty-tooltip] Failed to show popover', e);
338
244
  }
339
245
  }
340
- /**
341
- * Hide tooltip immediately using Popover API
342
- */
343
246
  function hideTooltip(el) {
344
247
  const popover = popoverElements.get(el);
345
248
  if (!popover)
@@ -350,29 +253,19 @@ function hideTooltip(el) {
350
253
  cleanupAutoUpdate(el);
351
254
  }
352
255
  catch (e) {
353
- // Already hidden, ignore
354
256
  }
355
257
  }
356
- /**
357
- * Schedule tooltip to show after delay
358
- */
359
258
  function scheduleShow(el) {
360
259
  const state = getTimeoutState(el);
361
260
  const { delay } = getTooltipAttributes(el);
362
261
  clearTimeouts(el);
363
262
  state.showTimeout = window.setTimeout(() => showTooltip(el), delay);
364
263
  }
365
- /**
366
- * Schedule tooltip to hide after delay
367
- */
368
264
  function scheduleHide(el) {
369
265
  const state = getTimeoutState(el);
370
266
  clearTimeouts(el);
371
267
  state.hideTimeout = window.setTimeout(() => hideTooltip(el), 200);
372
268
  }
373
- /**
374
- * Setup event listeners on anchor element
375
- */
376
269
  function setupEvents(el) {
377
270
  const anchor = getAnchorElement(el);
378
271
  if (!anchor)
@@ -382,12 +275,10 @@ function setupEvents(el) {
382
275
  const handleLeave = () => scheduleHide(el);
383
276
  const handleFocus = () => scheduleShow(el);
384
277
  const handleBlur = () => scheduleHide(el);
385
- // Add event listeners
386
278
  anchor.addEventListener('mouseenter', handleEnter);
387
279
  anchor.addEventListener('mouseleave', handleLeave);
388
280
  anchor.addEventListener('focusin', handleFocus);
389
281
  anchor.addEventListener('focusout', handleBlur);
390
- // Store cleanup function
391
282
  eventCleanup.set(el, () => {
392
283
  anchor.removeEventListener('mouseenter', handleEnter);
393
284
  anchor.removeEventListener('mouseleave', handleLeave);
@@ -395,9 +286,6 @@ function setupEvents(el) {
395
286
  anchor.removeEventListener('focusout', handleBlur);
396
287
  });
397
288
  }
398
- /**
399
- * Cleanup all resources including popover element
400
- */
401
289
  function cleanup(el) {
402
290
  clearTimeouts(el);
403
291
  cleanupAutoUpdate(el);
@@ -406,9 +294,6 @@ function cleanup(el) {
406
294
  eventsCleanup();
407
295
  eventCleanup.delete(el);
408
296
  }
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
297
  const popover = popoverElements.get(el);
413
298
  const anchor = anchorElements.get(el);
414
299
  if (popover && anchor) {
@@ -421,43 +306,25 @@ function cleanup(el) {
421
306
  anchorElements.delete(el);
422
307
  timeoutState.delete(el);
423
308
  }
424
- // ============================================================================
425
- // Component Definition
426
- // ============================================================================
427
- /**
428
- * TyTooltip Web Component
429
- */
430
309
  export class TyTooltip extends HTMLElement {
431
- /** Observed attributes */
432
310
  static get observedAttributes() {
433
311
  return ['placement', 'offset', 'delay', 'disabled', 'flavor'];
434
312
  }
435
313
  constructor() {
436
314
  super();
437
- /** Internal open state */
438
315
  this._open = false;
439
316
  this.attachShadow({ mode: 'open' });
440
317
  }
441
318
  connectedCallback() {
442
- // Initialize open state
443
319
  this._open = false;
444
- // Inject styles (for :host display: contents)
445
320
  ensureStyles(this.shadowRoot, tooltipStyles);
446
- // Setup events on anchor
447
321
  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
322
  getOrCreatePopover(this);
453
323
  }
454
324
  disconnectedCallback() {
455
325
  cleanup(this);
456
326
  }
457
327
  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
328
  if (name === 'flavor') {
462
329
  const popover = popoverElements.get(this);
463
330
  if (popover) {
@@ -465,14 +332,11 @@ export class TyTooltip extends HTMLElement {
465
332
  applyFlavorStyles(popover, flavor);
466
333
  }
467
334
  }
468
- // Close tooltip if disabled
469
335
  if (name === 'disabled' && newValue !== null) {
470
336
  hideTooltip(this);
471
337
  }
472
338
  }
473
339
  }
474
- // Register the custom element
475
340
  if (!customElements.get('ty-tooltip')) {
476
341
  customElements.define('ty-tooltip', TyTooltip);
477
342
  }
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,11 @@ 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();
33
+ private _childObserver;
34
+ private _childRenderQueued;
82
35
  connectedCallback(): void;
83
36
  disconnectedCallback(): void;
84
37
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
85
38
  }
86
- //# sourceMappingURL=wizard.d.ts.map