tyrell-components 1.0.0-TC44 → 1.0.0-TC46

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 (350) hide show
  1. package/dist/tyrell.js +1 -1
  2. package/lib/base/ty-component.d.ts +12 -7
  3. package/lib/base/ty-component.js +8 -139
  4. package/lib/components/button.d.ts +2 -16
  5. package/lib/components/button.js +0 -36
  6. package/lib/components/calendar-month.d.ts +2 -48
  7. package/lib/components/calendar-month.js +4 -166
  8. package/lib/components/calendar-navigation.d.ts +3 -48
  9. package/lib/components/calendar-navigation.js +3 -126
  10. package/lib/components/calendar.d.ts +3 -80
  11. package/lib/components/calendar.js +8 -230
  12. package/lib/components/checkbox.d.ts +4 -71
  13. package/lib/components/checkbox.js +7 -151
  14. package/lib/components/copy.d.ts +3 -56
  15. package/lib/components/copy.js +1 -120
  16. package/lib/components/date-picker.d.ts +10 -160
  17. package/lib/components/date-picker.js +31 -577
  18. package/lib/components/file-upload.d.ts +3 -15
  19. package/lib/components/file-upload.js +0 -37
  20. package/lib/components/icon.d.ts +3 -24
  21. package/lib/components/icon.js +1 -90
  22. package/lib/components/input.d.ts +7 -107
  23. package/lib/components/input.js +4 -193
  24. package/lib/components/modal.d.ts +3 -26
  25. package/lib/components/modal.js +1 -188
  26. package/lib/components/option.d.ts +2 -9
  27. package/lib/components/option.js +0 -48
  28. package/lib/components/popup.d.ts +2 -17
  29. package/lib/components/popup.js +3 -130
  30. package/lib/components/radio.d.ts +3 -23
  31. package/lib/components/radio.js +0 -63
  32. package/lib/components/resize-observer.d.ts +2 -30
  33. package/lib/components/resize-observer.js +0 -45
  34. package/lib/components/scroll-container.d.ts +2 -12
  35. package/lib/components/scroll-container.js +3 -46
  36. package/lib/components/select.d.ts +43 -150
  37. package/lib/components/select.js +68 -558
  38. package/lib/components/selected-tags.d.ts +4 -47
  39. package/lib/components/selected-tags.js +0 -94
  40. package/lib/components/step.d.ts +1 -6
  41. package/lib/components/step.js +0 -6
  42. package/lib/components/switch.d.ts +0 -11
  43. package/lib/components/switch.js +2 -36
  44. package/lib/components/tab.d.ts +1 -6
  45. package/lib/components/tab.js +0 -7
  46. package/lib/components/tabs.d.ts +3 -63
  47. package/lib/components/tabs.js +2 -282
  48. package/lib/components/tag.d.ts +2 -36
  49. package/lib/components/tag.js +5 -105
  50. package/lib/components/textarea.d.ts +6 -86
  51. package/lib/components/textarea.js +2 -173
  52. package/lib/components/tooltip.d.ts +3 -11
  53. package/lib/components/tooltip.js +0 -154
  54. package/lib/components/wizard.d.ts +4 -54
  55. package/lib/components/wizard.js +0 -228
  56. package/lib/icons/fontawesome/brands.d.ts +0 -1
  57. package/lib/icons/fontawesome/brands.js +0 -8
  58. package/lib/icons/fontawesome/regular.d.ts +0 -1
  59. package/lib/icons/fontawesome/regular.js +0 -8
  60. package/lib/icons/fontawesome/solid.d.ts +0 -1
  61. package/lib/icons/fontawesome/solid.js +0 -8
  62. package/lib/icons/heroicons/micro.d.ts +0 -1
  63. package/lib/icons/heroicons/micro.js +0 -8
  64. package/lib/icons/heroicons/mini.d.ts +0 -1
  65. package/lib/icons/heroicons/mini.js +0 -8
  66. package/lib/icons/heroicons/outline.d.ts +0 -1
  67. package/lib/icons/heroicons/outline.js +0 -8
  68. package/lib/icons/heroicons/solid.d.ts +0 -1
  69. package/lib/icons/heroicons/solid.js +0 -8
  70. package/lib/icons/lucide.d.ts +0 -1
  71. package/lib/icons/lucide.js +0 -1872
  72. package/lib/icons/material/filled.d.ts +0 -1
  73. package/lib/icons/material/filled.js +0 -10
  74. package/lib/icons/material/outlined.d.ts +0 -1
  75. package/lib/icons/material/outlined.js +0 -10
  76. package/lib/icons/material/round.d.ts +0 -1
  77. package/lib/icons/material/round.js +0 -10
  78. package/lib/icons/material/sharp.d.ts +0 -1
  79. package/lib/icons/material/sharp.js +0 -10
  80. package/lib/icons/material/two-tone.d.ts +0 -1
  81. package/lib/icons/material/two-tone.js +0 -10
  82. package/lib/index.d.ts +0 -1
  83. package/lib/index.js +0 -20
  84. package/lib/styles/button.d.ts +2 -20
  85. package/lib/styles/button.js +13 -120
  86. package/lib/styles/calendar-month.d.ts +1 -5
  87. package/lib/styles/calendar-month.js +3 -60
  88. package/lib/styles/calendar-navigation.d.ts +2 -6
  89. package/lib/styles/calendar-navigation.js +1 -26
  90. package/lib/styles/calendar.d.ts +1 -2
  91. package/lib/styles/calendar.js +0 -13
  92. package/lib/styles/checkbox.d.ts +0 -1
  93. package/lib/styles/checkbox.js +1 -23
  94. package/lib/styles/copy.d.ts +0 -1
  95. package/lib/styles/copy.js +2 -17
  96. package/lib/styles/custom-scrollbar.d.ts +1 -2
  97. package/lib/styles/custom-scrollbar.js +3 -18
  98. package/lib/styles/date-picker.d.ts +1 -5
  99. package/lib/styles/date-picker.js +5 -35
  100. package/lib/styles/file-upload.d.ts +1 -2
  101. package/lib/styles/file-upload.js +0 -15
  102. package/lib/styles/icon.d.ts +2 -6
  103. package/lib/styles/icon.js +1 -26
  104. package/lib/styles/input.d.ts +1 -6
  105. package/lib/styles/input.js +3 -53
  106. package/lib/styles/modal.d.ts +1 -2
  107. package/lib/styles/modal.js +3 -23
  108. package/lib/styles/option.d.ts +2 -6
  109. package/lib/styles/option.js +1 -11
  110. package/lib/styles/popup.d.ts +1 -2
  111. package/lib/styles/popup.js +4 -25
  112. package/lib/styles/radio.d.ts +0 -1
  113. package/lib/styles/radio.js +1 -15
  114. package/lib/styles/resize-observer.d.ts +1 -2
  115. package/lib/styles/resize-observer.js +0 -7
  116. package/lib/styles/scroll-container.d.ts +1 -2
  117. package/lib/styles/scroll-container.js +0 -19
  118. package/lib/styles/select-base.d.ts +0 -1
  119. package/lib/styles/select-base.js +9 -70
  120. package/lib/styles/select.d.ts +1 -2
  121. package/lib/styles/select.js +50 -18
  122. package/lib/styles/step.d.ts +1 -2
  123. package/lib/styles/step.js +0 -4
  124. package/lib/styles/switch.d.ts +0 -1
  125. package/lib/styles/switch.js +2 -20
  126. package/lib/styles/tab.d.ts +1 -2
  127. package/lib/styles/tab.js +0 -5
  128. package/lib/styles/tabs.d.ts +3 -11
  129. package/lib/styles/tabs.js +4 -47
  130. package/lib/styles/tag.d.ts +1 -5
  131. package/lib/styles/tag.js +2 -31
  132. package/lib/styles/textarea.d.ts +1 -2
  133. package/lib/styles/textarea.js +0 -44
  134. package/lib/styles/tooltip.d.ts +0 -1
  135. package/lib/styles/tooltip.js +0 -10
  136. package/lib/styles/wizard.d.ts +5 -21
  137. package/lib/styles/wizard.js +5 -85
  138. package/lib/types/common.d.ts +0 -2
  139. package/lib/types/common.js +0 -12
  140. package/lib/utils/calendar-utils.d.ts +4 -21
  141. package/lib/utils/calendar-utils.js +4 -177
  142. package/lib/utils/custom-scrollbar.d.ts +6 -20
  143. package/lib/utils/custom-scrollbar.js +1 -45
  144. package/lib/utils/flavor-sheet.d.ts +0 -1
  145. package/lib/utils/flavor-sheet.js +0 -23
  146. package/lib/utils/icon-registry.d.ts +0 -2
  147. package/lib/utils/icon-registry.js +1 -107
  148. package/lib/utils/icons.d.ts +0 -1
  149. package/lib/utils/icons.js +0 -9
  150. package/lib/utils/loader-registry.d.ts +0 -1
  151. package/lib/utils/loader-registry.js +0 -32
  152. package/lib/utils/locale.d.ts +2 -23
  153. package/lib/utils/locale.js +0 -86
  154. package/lib/utils/mobile.d.ts +0 -1
  155. package/lib/utils/mobile.js +0 -17
  156. package/lib/utils/number-format.d.ts +0 -2
  157. package/lib/utils/number-format.js +2 -65
  158. package/lib/utils/positioning.d.ts +4 -2
  159. package/lib/utils/positioning.js +2 -54
  160. package/lib/utils/property-capture.d.ts +5 -27
  161. package/lib/utils/property-capture.js +0 -108
  162. package/lib/utils/property-manager.d.ts +0 -1
  163. package/lib/utils/property-manager.js +0 -70
  164. package/lib/utils/resize-observer.d.ts +0 -1
  165. package/lib/utils/resize-observer.js +0 -36
  166. package/lib/utils/scroll-lock.d.ts +4 -11
  167. package/lib/utils/scroll-lock.js +0 -107
  168. package/lib/utils/styles.d.ts +0 -1
  169. package/lib/utils/styles.js +0 -24
  170. package/lib/version.d.ts +1 -2
  171. package/lib/version.js +1 -11
  172. package/package.json +2 -2
  173. package/lib/base/ty-component.d.ts.map +0 -1
  174. package/lib/base/ty-component.js.map +0 -1
  175. package/lib/components/button.d.ts.map +0 -1
  176. package/lib/components/button.js.map +0 -1
  177. package/lib/components/calendar-month.d.ts.map +0 -1
  178. package/lib/components/calendar-month.js.map +0 -1
  179. package/lib/components/calendar-navigation.d.ts.map +0 -1
  180. package/lib/components/calendar-navigation.js.map +0 -1
  181. package/lib/components/calendar.d.ts.map +0 -1
  182. package/lib/components/calendar.js.map +0 -1
  183. package/lib/components/checkbox.d.ts.map +0 -1
  184. package/lib/components/checkbox.js.map +0 -1
  185. package/lib/components/copy.d.ts.map +0 -1
  186. package/lib/components/copy.js.map +0 -1
  187. package/lib/components/date-picker.d.ts.map +0 -1
  188. package/lib/components/date-picker.js.map +0 -1
  189. package/lib/components/file-upload.d.ts.map +0 -1
  190. package/lib/components/file-upload.js.map +0 -1
  191. package/lib/components/icon.d.ts.map +0 -1
  192. package/lib/components/icon.js.map +0 -1
  193. package/lib/components/input.d.ts.map +0 -1
  194. package/lib/components/input.js.map +0 -1
  195. package/lib/components/modal.d.ts.map +0 -1
  196. package/lib/components/modal.js.map +0 -1
  197. package/lib/components/option.d.ts.map +0 -1
  198. package/lib/components/option.js.map +0 -1
  199. package/lib/components/popup.d.ts.map +0 -1
  200. package/lib/components/popup.js.map +0 -1
  201. package/lib/components/radio.d.ts.map +0 -1
  202. package/lib/components/radio.js.map +0 -1
  203. package/lib/components/resize-observer.d.ts.map +0 -1
  204. package/lib/components/resize-observer.js.map +0 -1
  205. package/lib/components/scroll-container.d.ts.map +0 -1
  206. package/lib/components/scroll-container.js.map +0 -1
  207. package/lib/components/select.d.ts.map +0 -1
  208. package/lib/components/select.js.map +0 -1
  209. package/lib/components/selected-tags.d.ts.map +0 -1
  210. package/lib/components/selected-tags.js.map +0 -1
  211. package/lib/components/step.d.ts.map +0 -1
  212. package/lib/components/step.js.map +0 -1
  213. package/lib/components/switch.d.ts.map +0 -1
  214. package/lib/components/switch.js.map +0 -1
  215. package/lib/components/tab.d.ts.map +0 -1
  216. package/lib/components/tab.js.map +0 -1
  217. package/lib/components/tabs.d.ts.map +0 -1
  218. package/lib/components/tabs.js.map +0 -1
  219. package/lib/components/tag.d.ts.map +0 -1
  220. package/lib/components/tag.js.map +0 -1
  221. package/lib/components/textarea.d.ts.map +0 -1
  222. package/lib/components/textarea.js.map +0 -1
  223. package/lib/components/tooltip.d.ts.map +0 -1
  224. package/lib/components/tooltip.js.map +0 -1
  225. package/lib/components/wizard.d.ts.map +0 -1
  226. package/lib/components/wizard.js.map +0 -1
  227. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  228. package/lib/icons/fontawesome/brands.js.map +0 -1
  229. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  230. package/lib/icons/fontawesome/regular.js.map +0 -1
  231. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  232. package/lib/icons/fontawesome/solid.js.map +0 -1
  233. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  234. package/lib/icons/heroicons/micro.js.map +0 -1
  235. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  236. package/lib/icons/heroicons/mini.js.map +0 -1
  237. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  238. package/lib/icons/heroicons/outline.js.map +0 -1
  239. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  240. package/lib/icons/heroicons/solid.js.map +0 -1
  241. package/lib/icons/lucide.d.ts.map +0 -1
  242. package/lib/icons/lucide.js.map +0 -1
  243. package/lib/icons/material/filled.d.ts.map +0 -1
  244. package/lib/icons/material/filled.js.map +0 -1
  245. package/lib/icons/material/outlined.d.ts.map +0 -1
  246. package/lib/icons/material/outlined.js.map +0 -1
  247. package/lib/icons/material/round.d.ts.map +0 -1
  248. package/lib/icons/material/round.js.map +0 -1
  249. package/lib/icons/material/sharp.d.ts.map +0 -1
  250. package/lib/icons/material/sharp.js.map +0 -1
  251. package/lib/icons/material/two-tone.d.ts.map +0 -1
  252. package/lib/icons/material/two-tone.js.map +0 -1
  253. package/lib/index.d.ts.map +0 -1
  254. package/lib/index.js.map +0 -1
  255. package/lib/styles/button.d.ts.map +0 -1
  256. package/lib/styles/button.js.map +0 -1
  257. package/lib/styles/calendar-month.d.ts.map +0 -1
  258. package/lib/styles/calendar-month.js.map +0 -1
  259. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  260. package/lib/styles/calendar-navigation.js.map +0 -1
  261. package/lib/styles/calendar.d.ts.map +0 -1
  262. package/lib/styles/calendar.js.map +0 -1
  263. package/lib/styles/checkbox.d.ts.map +0 -1
  264. package/lib/styles/checkbox.js.map +0 -1
  265. package/lib/styles/copy.d.ts.map +0 -1
  266. package/lib/styles/copy.js.map +0 -1
  267. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  268. package/lib/styles/custom-scrollbar.js.map +0 -1
  269. package/lib/styles/date-picker.d.ts.map +0 -1
  270. package/lib/styles/date-picker.js.map +0 -1
  271. package/lib/styles/file-upload.d.ts.map +0 -1
  272. package/lib/styles/file-upload.js.map +0 -1
  273. package/lib/styles/icon.d.ts.map +0 -1
  274. package/lib/styles/icon.js.map +0 -1
  275. package/lib/styles/input.d.ts.map +0 -1
  276. package/lib/styles/input.js.map +0 -1
  277. package/lib/styles/modal.d.ts.map +0 -1
  278. package/lib/styles/modal.js.map +0 -1
  279. package/lib/styles/multiselect.d.ts +0 -8
  280. package/lib/styles/multiselect.d.ts.map +0 -1
  281. package/lib/styles/multiselect.js +0 -849
  282. package/lib/styles/multiselect.js.map +0 -1
  283. package/lib/styles/option.d.ts.map +0 -1
  284. package/lib/styles/option.js.map +0 -1
  285. package/lib/styles/popup.d.ts.map +0 -1
  286. package/lib/styles/popup.js.map +0 -1
  287. package/lib/styles/radio.d.ts.map +0 -1
  288. package/lib/styles/radio.js.map +0 -1
  289. package/lib/styles/resize-observer.d.ts.map +0 -1
  290. package/lib/styles/resize-observer.js.map +0 -1
  291. package/lib/styles/scroll-container.d.ts.map +0 -1
  292. package/lib/styles/scroll-container.js.map +0 -1
  293. package/lib/styles/select-base.d.ts.map +0 -1
  294. package/lib/styles/select-base.js.map +0 -1
  295. package/lib/styles/select.d.ts.map +0 -1
  296. package/lib/styles/select.js.map +0 -1
  297. package/lib/styles/step.d.ts.map +0 -1
  298. package/lib/styles/step.js.map +0 -1
  299. package/lib/styles/switch.d.ts.map +0 -1
  300. package/lib/styles/switch.js.map +0 -1
  301. package/lib/styles/tab.d.ts.map +0 -1
  302. package/lib/styles/tab.js.map +0 -1
  303. package/lib/styles/tabs.d.ts.map +0 -1
  304. package/lib/styles/tabs.js.map +0 -1
  305. package/lib/styles/tag.d.ts.map +0 -1
  306. package/lib/styles/tag.js.map +0 -1
  307. package/lib/styles/textarea.d.ts.map +0 -1
  308. package/lib/styles/textarea.js.map +0 -1
  309. package/lib/styles/tooltip.d.ts.map +0 -1
  310. package/lib/styles/tooltip.js.map +0 -1
  311. package/lib/styles/wizard.d.ts.map +0 -1
  312. package/lib/styles/wizard.js.map +0 -1
  313. package/lib/types/common.d.ts.map +0 -1
  314. package/lib/types/common.js.map +0 -1
  315. package/lib/utils/calendar-utils.d.ts.map +0 -1
  316. package/lib/utils/calendar-utils.js.map +0 -1
  317. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  318. package/lib/utils/custom-scrollbar.js.map +0 -1
  319. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  320. package/lib/utils/flavor-sheet.js.map +0 -1
  321. package/lib/utils/icon-registry.d.ts.map +0 -1
  322. package/lib/utils/icon-registry.js.map +0 -1
  323. package/lib/utils/icons.d.ts.map +0 -1
  324. package/lib/utils/icons.js.map +0 -1
  325. package/lib/utils/loader-registry.d.ts.map +0 -1
  326. package/lib/utils/loader-registry.js.map +0 -1
  327. package/lib/utils/locale.d.ts.map +0 -1
  328. package/lib/utils/locale.js.map +0 -1
  329. package/lib/utils/mobile.d.ts.map +0 -1
  330. package/lib/utils/mobile.js.map +0 -1
  331. package/lib/utils/number-format.d.ts.map +0 -1
  332. package/lib/utils/number-format.js.map +0 -1
  333. package/lib/utils/parse-boolean.d.ts +0 -39
  334. package/lib/utils/parse-boolean.d.ts.map +0 -1
  335. package/lib/utils/parse-boolean.js +0 -58
  336. package/lib/utils/parse-boolean.js.map +0 -1
  337. package/lib/utils/positioning.d.ts.map +0 -1
  338. package/lib/utils/positioning.js.map +0 -1
  339. package/lib/utils/property-capture.d.ts.map +0 -1
  340. package/lib/utils/property-capture.js.map +0 -1
  341. package/lib/utils/property-manager.d.ts.map +0 -1
  342. package/lib/utils/property-manager.js.map +0 -1
  343. package/lib/utils/resize-observer.d.ts.map +0 -1
  344. package/lib/utils/resize-observer.js.map +0 -1
  345. package/lib/utils/scroll-lock.d.ts.map +0 -1
  346. package/lib/utils/scroll-lock.js.map +0 -1
  347. package/lib/utils/styles.d.ts.map +0 -1
  348. package/lib/utils/styles.js.map +0 -1
  349. package/lib/version.d.ts.map +0 -1
  350. package/lib/version.js.map +0 -1
@@ -1,115 +1,38 @@
1
- /**
2
- * TyCopy Web Component
3
- *
4
- * Read-only field with copy-to-clipboard functionality
5
- * Perfect for API keys, tokens, URLs, code snippets, etc.
6
- *
7
- * Features:
8
- * - Read-only display (not an input)
9
- * - Copy icon on the right
10
- * - Icon animation on copy (copy → check → copy)
11
- * - Same styling as ty-input for consistency
12
- * - Label support
13
- * - Size and flavor variants
14
- */
15
1
  import { TyComponent } from '../base/ty-component.js';
16
2
  import { ensureStyles } from '../utils/styles.js';
17
3
  import { syncCustomFlavorSheet } from '../utils/flavor-sheet.js';
18
4
  import { inputStyles } from '../styles/input.js';
19
5
  import { copyStyles, copyCustomFlavorCss } from '../styles/copy.js';
20
- /**
21
- * Copy icon SVG (from Lucide)
22
- */
23
6
  const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
24
- /**
25
- * Check icon SVG (from Lucide) - shown after successful copy
26
- */
27
7
  const CHECK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`;
28
- /**
29
- * X icon SVG (from Lucide) - shown on copy failure
30
- */
31
8
  const ERROR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;
32
9
  import { REQUIRED_ICON_SVG } from '../utils/icons.js';
33
- /**
34
- * Ty Copy Field Component
35
- *
36
- * @example
37
- * ```html
38
- * <!-- Basic copy field -->
39
- * <ty-copy
40
- * label="API Key"
41
- * value="sk_live_1234567890abcdef">
42
- * </ty-copy>
43
- *
44
- * <!-- Code format -->
45
- * <ty-copy
46
- * label="Install Command"
47
- * value="npm install tyrell-components"
48
- * format="code">
49
- * </ty-copy>
50
- *
51
- * <!-- Different sizes -->
52
- * <ty-copy size="sm" value="Small field"></ty-copy>
53
- * <ty-copy size="lg" value="Large field"></ty-copy>
54
- *
55
- * <!-- Semantic flavors -->
56
- * <ty-copy flavor="primary" value="Primary"></ty-copy>
57
- * <ty-copy flavor="success" value="Success"></ty-copy>
58
- * ```
59
- */
60
10
  export class TyCopy extends TyComponent {
61
11
  constructor() {
62
- super(); // TyComponent handles attachInternals() and attachShadow()
63
- // ============================================================================
64
- // INTERNAL STATE - Not managed by PropertyManager
65
- // ============================================================================
12
+ super();
66
13
  this._copyTimeout = null;
67
14
  this._showingSuccess = false;
68
15
  this._customFlavorSheet = null;
69
- // Apply both input and copy-specific styles
70
16
  ensureStyles(this.shadowRoot, { css: inputStyles, id: 'ty-input' });
71
17
  ensureStyles(this.shadowRoot, { css: copyStyles, id: 'ty-copy' });
72
18
  }
73
- // observedAttributes auto-generated by TyComponent from properties config
74
- // ============================================================================
75
- // TYCOMPONENT LIFECYCLE HOOKS
76
- // ============================================================================
77
- /**
78
- * Called when component connects to DOM
79
- * TyComponent already handled pre-connection property capture
80
- */
81
19
  onConnect() {
82
- // TyComponent will call render() automatically after this hook
83
20
  this._syncCustomFlavor();
84
21
  }
85
- /** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
86
22
  _syncCustomFlavor() {
87
23
  this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => copyCustomFlavorCss(base));
88
24
  }
89
- /**
90
- * Called when component disconnects from DOM
91
- */
92
25
  onDisconnect() {
93
- // Clear any pending timeout
94
26
  if (this._copyTimeout !== null) {
95
27
  clearTimeout(this._copyTimeout);
96
28
  this._copyTimeout = null;
97
29
  }
98
30
  }
99
- /**
100
- * Handle property changes - called BEFORE render
101
- */
102
31
  onPropertiesChanged(changes) {
103
32
  if (changes.some((c) => c.name === 'flavor')) {
104
33
  this._syncCustomFlavor();
105
34
  }
106
35
  }
107
- // ============================================================================
108
- // PRIVATE METHODS
109
- // ============================================================================
110
- /**
111
- * Build CSS class list
112
- */
113
36
  buildClassList() {
114
37
  const classes = [this.size];
115
38
  if (this.disabled)
@@ -118,15 +41,11 @@ export class TyCopy extends TyComponent {
118
41
  classes.push('required');
119
42
  return classes.join(' ');
120
43
  }
121
- /**
122
- * Copy value to clipboard
123
- */
124
44
  async copyToClipboard() {
125
45
  if (this.disabled || !this.value)
126
46
  return;
127
47
  try {
128
48
  await navigator.clipboard.writeText(this.value);
129
- // Emit success event
130
49
  this.dispatchEvent(new CustomEvent('copy-success', {
131
50
  detail: { value: this.value },
132
51
  bubbles: true,
@@ -134,7 +53,6 @@ export class TyCopy extends TyComponent {
134
53
  }));
135
54
  }
136
55
  catch (err) {
137
- // Fallback for non-secure contexts (non-HTTPS)
138
56
  try {
139
57
  const textarea = document.createElement('textarea');
140
58
  textarea.value = this.value;
@@ -161,27 +79,19 @@ export class TyCopy extends TyComponent {
161
79
  return;
162
80
  }
163
81
  }
164
- // Show success animation (after either method succeeds)
165
82
  this.showCopySuccess();
166
83
  }
167
- /**
168
- * Show copy success animation
169
- * Uses state flag so render() can show the correct icon
170
- */
171
84
  showCopySuccess() {
172
- // Clear any existing timeout
173
85
  if (this._copyTimeout !== null) {
174
86
  clearTimeout(this._copyTimeout);
175
87
  }
176
88
  this._showingSuccess = true;
177
- // Update just the button without full re-render
178
89
  const copyButton = this.shadowRoot.querySelector('.copy-button');
179
90
  if (copyButton) {
180
91
  copyButton.classList.add('success');
181
92
  copyButton.innerHTML = CHECK_ICON_SVG;
182
93
  copyButton.setAttribute('aria-label', 'Copied!');
183
94
  }
184
- // Reset after 2 seconds
185
95
  this._copyTimeout = window.setTimeout(() => {
186
96
  this._showingSuccess = false;
187
97
  const btn = this.shadowRoot.querySelector('.copy-button');
@@ -193,10 +103,6 @@ export class TyCopy extends TyComponent {
193
103
  this._copyTimeout = null;
194
104
  }, 2000);
195
105
  }
196
- /**
197
- * Show copy error animation
198
- * Swaps copy icon → red X icon → copy icon
199
- */
200
106
  showCopyError() {
201
107
  if (this._copyTimeout !== null) {
202
108
  clearTimeout(this._copyTimeout);
@@ -218,40 +124,29 @@ export class TyCopy extends TyComponent {
218
124
  this._copyTimeout = null;
219
125
  }, 2000);
220
126
  }
221
- /**
222
- * Setup event listeners
223
- */
224
127
  setupEventListeners() {
225
128
  const shadow = this.shadowRoot;
226
129
  const inputWrapper = shadow.querySelector('.input-wrapper');
227
130
  const copyButton = shadow.querySelector('.copy-button');
228
- // Make entire field clickable for copying
229
131
  if (inputWrapper && !this.disabled) {
230
132
  const wrapperEl = inputWrapper;
231
133
  wrapperEl.addEventListener('click', (e) => {
232
- // Prevent double-triggering if button was clicked
233
134
  if (e.target === copyButton || e.target.closest('.copy-button')) {
234
135
  return;
235
136
  }
236
137
  this.copyToClipboard();
237
138
  });
238
- // Add visual feedback - make it look clickable
239
139
  wrapperEl.style.cursor = 'pointer';
240
140
  }
241
- // Button click handler
242
141
  if (copyButton) {
243
142
  copyButton.addEventListener('click', () => {
244
143
  this.copyToClipboard();
245
144
  });
246
145
  }
247
146
  }
248
- /**
249
- * Render the component
250
- */
251
147
  render() {
252
148
  const shadow = this.shadowRoot;
253
149
  const classes = this.buildClassList();
254
- // Determine display element based on format, multiline and scroll
255
150
  const valueClass = [
256
151
  'copy-field-value',
257
152
  this.multiline ? 'multiline' : '',
@@ -277,12 +172,8 @@ export class TyCopy extends TyComponent {
277
172
  </div>
278
173
  </div>
279
174
  `;
280
- // Re-setup event listeners after render
281
175
  this.setupEventListeners();
282
176
  }
283
- // ============================================================================
284
- // PROPERTY ACCESSORS - Simple wrappers (no logic!)
285
- // ============================================================================
286
177
  get value() {
287
178
  return this.getProperty('value');
288
179
  }
@@ -339,9 +230,6 @@ export class TyCopy extends TyComponent {
339
230
  }
340
231
  }
341
232
  TyCopy.formAssociated = true;
342
- // ============================================================================
343
- // PROPERTY CONFIGURATION - Declarative property lifecycle
344
- // ============================================================================
345
233
  TyCopy.properties = {
346
234
  value: {
347
235
  type: 'string',
@@ -367,9 +255,6 @@ TyCopy.properties = {
367
255
  return v;
368
256
  },
369
257
  },
370
- // Any string is accepted: built-ins get static CSS, other identifiers
371
- // become custom flavors (see _syncCustomFlavor), garbage degrades to
372
- // the default look.
373
258
  flavor: {
374
259
  type: 'string',
375
260
  visual: true,
@@ -402,14 +287,10 @@ TyCopy.properties = {
402
287
  default: false,
403
288
  },
404
289
  };
405
- // Register the custom element
406
290
  if (!customElements.get('ty-copy')) {
407
291
  customElements.define('ty-copy', TyCopy);
408
292
  }
409
- // Also exposed as ty-copy-field — says what it is (a read-only field with a
410
- // copy button). A constructor can only register once, hence the subclass.
411
293
  if (!customElements.get('ty-copy-field')) {
412
294
  customElements.define('ty-copy-field', class TyCopyField extends TyCopy {
413
295
  });
414
296
  }
415
- //# sourceMappingURL=copy.js.map
@@ -1,50 +1,7 @@
1
1
  /**
2
- * TyDatePicker Web Component
3
- * PORTED FROM: cljs/ty/components/date_picker.cljs
4
- *
5
- * A date picker component with read-only input and calendar dropdown.
6
- * Supports date-only and date+time modes with smart time input.
7
- *
8
- * Architecture:
9
- * - Read-only input stub (displays formatted date)
10
- * - Calendar dropdown (modal dialog with ty-calendar)
11
- * - Optional time input (with smart digit navigation)
12
- * - Form participation via ElementInternals
13
- * - UTC output, local display
14
- *
15
- * Features:
16
- * - Date selection with calendar dropdown
17
- * - Optional time input with smart navigation
18
- * - Form integration (works with FormData)
19
- * - UTC value output for server communication
20
- * - Localized display formatting (Intl API)
21
- * - Clearable with clear button
22
- * - Keyboard navigation (Escape to close)
23
- * - Outside click handling
24
- *
25
- * @example
26
- * ```html
27
- * <!-- Basic date picker -->
28
- * <ty-date-picker
29
- * label="Select Date"
30
- * placeholder="Choose a date">
31
- * </ty-date-picker>
32
- *
33
- * <!-- With time -->
34
- * <ty-date-picker
35
- * with-time="true"
36
- * label="Select Date & Time">
37
- * </ty-date-picker>
38
- *
39
- * <!-- Form integration -->
40
- * <form>
41
- * <ty-date-picker name="booking-date"></ty-date-picker>
42
- * <button type="submit">Submit</button>
43
- * </form>
44
- *
45
- * <!-- Pre-filled value (UTC) -->
46
- * <ty-date-picker value="2024-09-21T08:30:00.000Z"></ty-date-picker>
47
- * ```
2
+ * TyDatePicker Web Component — read-only input stub + calendar dropdown
3
+ * (modal <dialog>), optional time input, form participation via
4
+ * ElementInternals. Value is UTC; display is local.
48
5
  */
49
6
  import { TyComponent } from '../base/ty-component.js';
50
7
  import type { Flavor } from '../types/common.js';
@@ -66,17 +23,11 @@ interface DatePickerState extends DateComponents {
66
23
  withTime: boolean;
67
24
  open: boolean;
68
25
  }
69
- /**
70
- * Date picker sizes
71
- */
72
26
  type DatePickerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
73
27
  /**
74
28
  * Date picker flavors (visual styles)
75
29
  */
76
30
  type DatePickerFlavor = 'default' | Flavor;
77
- /**
78
- * Date format types
79
- */
80
31
  type DateFormatType = 'short' | 'medium' | 'long' | 'full';
81
32
  /**
82
33
  * Change event detail
@@ -178,35 +129,20 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
178
129
  private _timeInput?;
179
130
  private _localeObserver?;
180
131
  private _customFlavorSheet;
181
- /**
182
- * Form-associated custom element
183
- */
184
132
  static formAssociated: boolean;
185
133
  constructor();
186
- /**
187
- * Called when component connects to DOM
188
- * TyComponent handles property capture automatically
189
- */
134
+ /** TyComponent handles property capture automatically. */
190
135
  protected onConnect(): void;
191
136
  /** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
192
137
  private _syncCustomFlavor;
193
- /**
194
- * Called when component disconnects from DOM
195
- */
196
138
  protected onDisconnect(): void;
197
- /**
198
- * Called when properties change
199
- * Handle state updates BEFORE render
200
- */
139
+ /** Handle state updates BEFORE render. */
201
140
  protected onPropertiesChanged(changes: PropertyChange[]): void;
202
141
  /**
203
142
  * Get form value - returns UTC string from current state
204
143
  * TyComponent calls this automatically when value property changes
205
144
  */
206
145
  protected getFormValue(): FormDataEntryValue | null;
207
- /**
208
- * Extract current date components from internal state
209
- */
210
146
  private getComponents;
211
147
  /**
212
148
  * Whether internal state has a complete date
@@ -218,15 +154,8 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
218
154
  private getFormattedValue;
219
155
  /**
220
156
  * Initialize component state from attributes
221
- *
222
- * PORTED FROM: init-component-state! in date_picker.cljs
223
157
  */
224
158
  private initializeState;
225
- /**
226
- * Update internal state
227
- *
228
- * PORTED FROM: update-component-state! in date_picker.cljs
229
- */
230
159
  private updateState;
231
160
  /**
232
161
  * Sync form value with current state
@@ -235,15 +164,8 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
235
164
  private syncFormValue;
236
165
  /**
237
166
  * Handle time input changes from TimeInput class
238
- *
239
- * PORTED FROM: handle-time-change! in date_picker.cljs
240
167
  */
241
168
  handleTimeInputChange(hour: number, minute: number): void;
242
- /**
243
- * Emit change event
244
- *
245
- * PORTED FROM: emit-change-event! in date_picker.cljs
246
- */
247
169
  private emitChangeEvent;
248
170
  get size(): DatePickerSize;
249
171
  set size(v: DatePickerSize);
@@ -283,32 +205,16 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
283
205
  */
284
206
  set value(val: string | Date | null);
285
207
  /**
286
- * Build CSS classes for the stub element
287
- *
288
- * PORTED FROM: build-stub-classes in date_picker.cljs
208
+ * Clear the date value programmatically WITH a change event (source:
209
+ * 'clear'). Works regardless of the `clearable` attribute — lets any
210
+ * external trigger (e.g. a button elsewhere in the page) clear the value
211
+ * without needing the built-in clear button. Mirrors ty-select's clear().
289
212
  */
213
+ clear(): void;
290
214
  private buildStubClasses;
291
- /**
292
- * Render the date picker stub (input display)
293
- *
294
- * PORTED FROM: render-date-picker-stub in date_picker.cljs
295
- */
296
215
  private renderStub;
297
- /**
298
- * Create time input element
299
- *
300
- * PORTED FROM: create-time-input in date_picker.cljs
301
- */
302
216
  private createTimeInputElement;
303
- /**
304
- * Render time input section
305
- */
306
217
  private renderTimeSection;
307
- /**
308
- * Render calendar dropdown with dialog
309
- *
310
- * PORTED FROM: render-calendar-dropdown in date_picker.cljs
311
- */
312
218
  private renderCalendarDropdown;
313
219
  /**
314
220
  * Render native date input for mobile touch devices.
@@ -316,33 +222,13 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
316
222
  * Reuses .date-picker-stub styling and existing event/state infrastructure.
317
223
  */
318
224
  private renderNativeInput;
319
- /**
320
- * Calculate calendar position
321
- *
322
- * PORTED FROM: calculate-calendar-position! in date_picker.cljs
323
- */
324
225
  private calculateCalendarPosition;
325
- /**
326
- * Render container structure
327
- *
328
- * PORTED FROM: render-container-structure in date_picker.cljs
329
- */
330
226
  private renderContainer;
331
- /**
332
- * Main render method
333
- *
334
- * PORTED FROM: render! in date_picker.cljs
335
- */
336
227
  protected render(): void;
337
228
  /**
338
229
  * Update display without destroying DOM (for open dialog)
339
- *
340
- * PORTED FROM: update-display! in date_picker.cljs
341
230
  */
342
231
  private updateDisplay;
343
- /**
344
- * Setup document-level event listeners
345
- */
346
232
  private setupEventListeners;
347
233
  private handleStubClick;
348
234
  /**
@@ -350,48 +236,12 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
350
236
  */
351
237
  private clearValue;
352
238
  private handleClearClick;
353
- /**
354
- * Handle calendar date selection
355
- *
356
- * PORTED FROM: handle-calendar-change! in date_picker.cljs
357
- */
358
239
  private handleCalendarChange;
359
- /**
360
- * Handle dialog backdrop clicks
361
- *
362
- * PORTED FROM: handle-dialog-click! in date_picker.cljs
363
- */
364
240
  private handleDialogClick;
365
- /**
366
- * Handle clicks outside the date picker
367
- *
368
- * PORTED FROM: handle-outside-click! in date_picker.cljs
369
- */
370
241
  private handleOutsideClick;
371
- /**
372
- * Handle Escape key press
373
- *
374
- * PORTED FROM: handle-escape-key! in date_picker.cljs
375
- */
376
242
  private handleEscapeKey;
377
- /**
378
- * Open calendar dropdown
379
- *
380
- * PORTED FROM: open-dropdown! in date_picker.cljs
381
- */
382
243
  private openDropdown;
383
- /**
384
- * Close calendar dropdown
385
- *
386
- * PORTED FROM: close-dropdown! in date_picker.cljs
387
- */
388
244
  private closeDropdown;
389
- /**
390
- * Clean up event listeners and state
391
- *
392
- * PORTED FROM: cleanup! in date_picker.cljs
393
- */
394
245
  private cleanup;
395
246
  }
396
247
  export {};
397
- //# sourceMappingURL=date-picker.d.ts.map