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,45 +1,8 @@
1
- /**
2
- * TyCalendarNavigation Web Component
3
- * PORTED FROM: cljs/ty/components/calendar_navigation.cljs
4
- *
5
- * A pure presentation component for calendar month/year navigation.
6
- * Stateless - all state comes from properties, changes emitted via events.
7
- *
8
- * Features:
9
- * - Year/Month navigation (prev/next month, prev/next year)
10
- * - Localized month name display
11
- * - Custom event emission on navigation
12
- * - Property-driven API (no internal state)
13
- * - Inline SVG icons
14
- * - Shadow DOM encapsulation
15
- *
16
- * @example
17
- * ```html
18
- * <!-- Basic usage -->
19
- * <ty-calendar-navigation
20
- * display-month="10"
21
- * display-year="2025"
22
- * locale="en-US">
23
- * </ty-calendar-navigation>
24
- *
25
- * <!-- Listen for changes -->
26
- * <script type="module">
27
- * const nav = document.querySelector('ty-calendar-navigation');
28
- * nav.addEventListener('change', (e) => {
29
- * console.log('New month:', e.detail.month);
30
- * console.log('New year:', e.detail.year);
31
- * });
32
- * </script>
33
- * ```
34
- */
35
1
  import { ensureStyles } from '../utils/styles.js';
36
2
  import { calendarNavigationStyles } from '../styles/calendar-navigation.js';
37
3
  import { getMonthName, parseISODate } from '../utils/calendar-utils.js';
38
4
  import { getEffectiveLocale, observeLocaleChanges } from '../utils/locale.js';
39
5
  import { TyComponent } from '../base/ty-component.js';
40
- // ============================================================================
41
- // SVG Icons (Material Design)
42
- // ============================================================================
43
6
  const CHEVRON_LEFT_SVG = `<?xml version='1.0' encoding='UTF-8'?>
44
7
  <svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>
45
8
  <path fill='none' d='M0 0h24v24H0V0z'/>
@@ -74,56 +37,31 @@ const CHEVRONS_RIGHT_SVG = `<?xml version='1.0' encoding='UTF-8'?>
74
37
  </g>
75
38
  </g>
76
39
  </svg>`;
77
- // ============================================================================
78
- // Component Implementation
79
- // ============================================================================
80
- /**
81
- * TyCalendarNavigation Web Component
82
- */
83
40
  export class TyCalendarNavigation extends TyComponent {
84
41
  constructor() {
85
- super(); // TyComponent handles attachShadow
86
- // Initialize state with current date
42
+ super();
87
43
  const today = new Date();
88
44
  this._state = {
89
45
  displayMonth: today.getMonth() + 1,
90
46
  displayYear: today.getFullYear()
91
47
  };
92
- // Initialize styles in shadow root
93
48
  const shadow = this.shadowRoot;
94
49
  ensureStyles(shadow, { css: calendarNavigationStyles, id: 'ty-calendar-navigation' });
95
50
  }
96
- // ==========================================================================
97
- // Lifecycle Hooks (TyComponent)
98
- // ==========================================================================
99
- /**
100
- * Called when component connects to DOM
101
- */
102
51
  onConnect() {
103
- // Sync state from properties
104
52
  this._state.displayMonth = this.displayMonth;
105
53
  this._state.displayYear = this.displayYear;
106
- // Setup locale observer to watch for ancestor lang changes
107
54
  this._localeObserver = observeLocaleChanges(this, () => {
108
55
  this.render();
109
56
  });
110
- // Initial render
111
57
  this.render();
112
58
  }
113
- /**
114
- * Called when component disconnects from DOM
115
- */
116
59
  onDisconnect() {
117
- // Cleanup locale observer
118
60
  if (this._localeObserver) {
119
61
  this._localeObserver();
120
62
  this._localeObserver = undefined;
121
63
  }
122
64
  }
123
- /**
124
- * Called when properties change
125
- * Update internal state BEFORE render
126
- */
127
65
  onPropertiesChanged(changes) {
128
66
  for (const { name, newValue } of changes) {
129
67
  switch (name) {
@@ -136,15 +74,10 @@ export class TyCalendarNavigation extends TyComponent {
136
74
  case 'locale':
137
75
  case 'size':
138
76
  case 'width':
139
- // These properties just affect rendering
140
- // TyComponent will call render() automatically for visual properties
141
77
  break;
142
78
  }
143
79
  }
144
80
  }
145
- // ==========================================================================
146
- // Property Accessors - Simple wrappers using TyComponent
147
- // ==========================================================================
148
81
  get displayMonth() {
149
82
  return this.getProperty('display-month');
150
83
  }
@@ -158,7 +91,6 @@ export class TyCalendarNavigation extends TyComponent {
158
91
  this.setProperty('display-year', value);
159
92
  }
160
93
  get locale() {
161
- // Use getEffectiveLocale to check ancestor lang attributes
162
94
  return getEffectiveLocale(this, this.getProperty('locale'));
163
95
  }
164
96
  set locale(value) {
@@ -188,12 +120,6 @@ export class TyCalendarNavigation extends TyComponent {
188
120
  set max(value) {
189
121
  this.setProperty('max', value ?? '');
190
122
  }
191
- // ==========================================================================
192
- // Event Dispatching
193
- // ==========================================================================
194
- /**
195
- * Emit change event with new month/year
196
- */
197
123
  emitChangeEvent(month, year) {
198
124
  const detail = {
199
125
  month,
@@ -206,18 +132,9 @@ export class TyCalendarNavigation extends TyComponent {
206
132
  });
207
133
  this.dispatchEvent(event);
208
134
  }
209
- // ==========================================================================
210
- // Navigation Logic
211
- // ==========================================================================
212
- /**
213
- * Month index (year * 12 + month - 1) — flat, comparable month math.
214
- */
215
135
  static monthIndex(year, month) {
216
136
  return year * 12 + (month - 1);
217
137
  }
218
- /**
219
- * min/max as month indices (null when unset/invalid)
220
- */
221
138
  boundIndices() {
222
139
  const min = parseISODate(this.min);
223
140
  const max = parseISODate(this.max);
@@ -226,9 +143,6 @@ export class TyCalendarNavigation extends TyComponent {
226
143
  maxIdx: max ? TyCalendarNavigation.monthIndex(max.year, max.month) : null,
227
144
  };
228
145
  }
229
- /**
230
- * Clamp a target month index to [min, max]
231
- */
232
146
  clampIndex(idx) {
233
147
  const { minIdx, maxIdx } = this.boundIndices();
234
148
  if (minIdx !== null && idx < minIdx)
@@ -237,30 +151,17 @@ export class TyCalendarNavigation extends TyComponent {
237
151
  return maxIdx;
238
152
  return idx;
239
153
  }
240
- /**
241
- * Navigate by month/year delta, clamped to bounds.
242
- * Year jumps near a bound land ON the bound month instead of overshooting.
243
- */
244
154
  navigateBy(deltaMonths) {
245
155
  const current = TyCalendarNavigation.monthIndex(this._state.displayYear, this._state.displayMonth);
246
156
  const target = this.clampIndex(current + deltaMonths);
247
157
  if (target === current)
248
- return; // Already at the bound
158
+ return;
249
159
  this.emitChangeEvent((target % 12) + 1, Math.floor(target / 12));
250
160
  }
251
- /**
252
- * True when navigating by deltaMonths can't move the display (bound reached)
253
- */
254
161
  isNavDisabled(deltaMonths) {
255
162
  const current = TyCalendarNavigation.monthIndex(this._state.displayYear, this._state.displayMonth);
256
163
  return this.clampIndex(current + deltaMonths) === current;
257
164
  }
258
- // ==========================================================================
259
- // Rendering
260
- // ==========================================================================
261
- /**
262
- * Create navigation button
263
- */
264
165
  createButton(className, title, svg, onClick, disabled = false) {
265
166
  const button = document.createElement('button');
266
167
  button.className = className;
@@ -270,19 +171,13 @@ export class TyCalendarNavigation extends TyComponent {
270
171
  button.addEventListener('click', onClick);
271
172
  return button;
272
173
  }
273
- /**
274
- * Main render function
275
- */
276
174
  render() {
277
175
  const root = this.shadowRoot;
278
176
  if (!root)
279
177
  return;
280
- // Ensure styles are loaded
281
178
  ensureStyles(root, { css: calendarNavigationStyles, id: 'ty-calendar-navigation' });
282
- // Apply size as data attribute for CSS targeting
283
179
  const size = this.size;
284
180
  this.setAttribute('data-size', size);
285
- // Apply width property as CSS custom property
286
181
  const width = this.width;
287
182
  if (width) {
288
183
  this.style.setProperty('--nav-width', width);
@@ -290,46 +185,35 @@ export class TyCalendarNavigation extends TyComponent {
290
185
  else {
291
186
  this.style.removeProperty('--nav-width');
292
187
  }
293
- // Get localized month name using current state
294
188
  const monthName = getMonthName(this._state.displayMonth, this.locale, 'long');
295
- // Clear and rebuild
296
189
  root.innerHTML = '';
297
- // Create main header container
298
190
  const header = document.createElement('div');
299
191
  header.className = 'calendar-navigation-header';
300
- // Left group: [⟪ ‹]
301
192
  const leftGroup = document.createElement('div');
302
193
  leftGroup.className = 'nav-group nav-group-left';
303
194
  leftGroup.appendChild(this.createButton('nav-btn nav-year-prev', 'Previous year', CHEVRONS_LEFT_SVG, () => this.navigateBy(-12), this.isNavDisabled(-12)));
304
195
  leftGroup.appendChild(this.createButton('nav-btn nav-month-prev', 'Previous month', CHEVRON_LEFT_SVG, () => this.navigateBy(-1), this.isNavDisabled(-1)));
305
- // Center group: [Month Year]
306
196
  const centerGroup = document.createElement('div');
307
197
  centerGroup.className = 'nav-group nav-group-center';
308
198
  const monthYearDisplay = document.createElement('div');
309
199
  monthYearDisplay.className = 'month-year-display';
310
200
  monthYearDisplay.textContent = `${monthName} ${this._state.displayYear}`;
311
201
  centerGroup.appendChild(monthYearDisplay);
312
- // Right group: [› ⟫]
313
202
  const rightGroup = document.createElement('div');
314
203
  rightGroup.className = 'nav-group nav-group-right';
315
204
  rightGroup.appendChild(this.createButton('nav-btn nav-month-next', 'Next month', CHEVRON_RIGHT_SVG, () => this.navigateBy(1), this.isNavDisabled(1)));
316
205
  rightGroup.appendChild(this.createButton('nav-btn nav-year-next', 'Next year', CHEVRONS_RIGHT_SVG, () => this.navigateBy(12), this.isNavDisabled(12)));
317
- // Assemble header
318
206
  header.appendChild(leftGroup);
319
207
  header.appendChild(centerGroup);
320
208
  header.appendChild(rightGroup);
321
209
  root.appendChild(header);
322
210
  }
323
211
  }
324
- // ============================================================================
325
- // PROPERTY CONFIGURATION - Single source of truth
326
- // ============================================================================
327
212
  TyCalendarNavigation.properties = {
328
- // Display properties
329
213
  'display-month': {
330
214
  type: 'number',
331
215
  visual: true,
332
- default: () => new Date().getMonth() + 1, // 1-based
216
+ default: () => new Date().getMonth() + 1,
333
217
  validate: (v) => {
334
218
  const num = Number(v);
335
219
  return Number.isInteger(num) && num >= 1 && num <= 12;
@@ -360,13 +244,11 @@ TyCalendarNavigation.properties = {
360
244
  return num;
361
245
  }
362
246
  },
363
- // Locale property
364
247
  locale: {
365
248
  type: 'string',
366
249
  visual: true,
367
250
  default: 'en-US'
368
251
  },
369
- // Size property
370
252
  size: {
371
253
  type: 'string',
372
254
  visual: true,
@@ -380,14 +262,11 @@ TyCalendarNavigation.properties = {
380
262
  return v;
381
263
  }
382
264
  },
383
- // Width property
384
265
  width: {
385
266
  type: 'string',
386
267
  visual: true,
387
268
  default: ''
388
269
  },
389
- // Navigation bounds — ISO dates. Buttons that would move the display
390
- // entirely outside [min, max] months are disabled; year jumps clamp.
391
270
  min: {
392
271
  type: 'string',
393
272
  visual: true,
@@ -399,8 +278,6 @@ TyCalendarNavigation.properties = {
399
278
  default: ''
400
279
  }
401
280
  };
402
- // Register the custom element
403
281
  if (!customElements.get('ty-calendar-navigation')) {
404
282
  customElements.define('ty-calendar-navigation', TyCalendarNavigation);
405
283
  }
406
- //# sourceMappingURL=calendar-navigation.js.map
@@ -1,53 +1,7 @@
1
1
  /**
2
- * TyCalendar Web Component
3
- * PORTED FROM: cljs/ty/components/calendar.cljs
4
- *
5
- * A complete calendar orchestration component that combines navigation and month display.
6
- * Manages selection state, form participation, and event coordination.
7
- *
8
- * Architecture:
9
- * - year/month/day HTML attributes for intuitive API
10
- * - Internal state management (private properties)
11
- * - Distributes properties to child components (navigation + month)
12
- * - Single 'change' event with complete day context
13
- * - Form participation via ElementInternals
14
- *
15
- * Features:
16
- * - Combines ty-calendar-navigation + ty-calendar-month
17
- * - Date selection with visual feedback
18
- * - Form integration (works with FormData)
19
- * - Custom render functions (dayContentFn)
20
- * - Custom CSS injection
21
- * - Automatic date validation
22
- * - Event coordination between components
23
- *
24
- * @example
25
- * ```html
26
- * <!-- Basic usage -->
27
- * <ty-calendar
28
- * year="2025"
29
- * month="10"
30
- * day="15">
31
- * </ty-calendar>
32
- *
33
- * <!-- Form integration -->
34
- * <form>
35
- * <ty-calendar name="booking-date"></ty-calendar>
36
- * <button type="submit">Submit</button>
37
- * </form>
38
- *
39
- * <!-- With custom rendering -->
40
- * <ty-calendar id="custom"></ty-calendar>
41
- * <script type="module">
42
- * const cal = document.getElementById('custom');
43
- * cal.dayContentFn = (ctx) => {
44
- * const el = document.createElement('div');
45
- * el.textContent = ctx.dayInMonth;
46
- * if (ctx.today) el.style.fontWeight = 'bold';
47
- * return el;
48
- * };
49
- * </script>
50
- * ```
2
+ * TyCalendar Web Component — orchestrates ty-calendar-navigation +
3
+ * ty-calendar-month: owns selection state, distributes properties to the
4
+ * children, and participates in forms via ElementInternals.
51
5
  */
52
6
  import './calendar-month.js';
53
7
  import './calendar-navigation.js';
@@ -91,13 +45,7 @@ export declare class TyCalendar extends HTMLElement {
91
45
  private _monthDisplay?;
92
46
  private _internals?;
93
47
  private _localeObserver?;
94
- /**
95
- * Form-associated custom element
96
- */
97
48
  static formAssociated: boolean;
98
- /**
99
- * Observed attributes
100
- */
101
49
  static get observedAttributes(): string[];
102
50
  constructor();
103
51
  connectedCallback(): void;
@@ -135,47 +83,22 @@ export declare class TyCalendar extends HTMLElement {
135
83
  * Initialize state from HTML attributes on first load
136
84
  */
137
85
  private initializeFromAttributes;
138
- /**
139
- * Sync state from changed attributes
140
- */
141
86
  private syncStateFromAttributes;
142
- /**
143
- * Update child components with current state
144
- */
145
87
  private syncChildComponents;
146
- /**
147
- * Update form value using ElementInternals
148
- */
149
88
  private updateFormValue;
150
89
  /**
151
90
  * Selection outside [min, max] => rangeUnderflow/rangeOverflow.
152
91
  * UI can't produce this (days are disabled), but programmatic values can.
153
92
  */
154
93
  private updateValidity;
155
- /**
156
- * Handle navigation change (month/year navigation)
157
- */
158
94
  private handleNavigationChange;
159
- /**
160
- * Handle day click (day selection)
161
- */
162
95
  private handleDayClick;
163
96
  /**
164
97
  * Force re-render of the calendar
165
98
  * Useful after updating dayContentFn or other dynamic properties
166
99
  */
167
100
  refresh(): void;
168
- /**
169
- * Create navigation element
170
- */
171
101
  private createNavigation;
172
- /**
173
- * Create month display element
174
- */
175
102
  private createMonthDisplay;
176
- /**
177
- * Main render function
178
- */
179
103
  private render;
180
104
  }
181
- //# sourceMappingURL=calendar.d.ts.map