@getmicdrop/svelte-components 5.1.2 → 5.2.1

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 (411) hide show
  1. package/dist/calendar/AboutShow/AboutShow.svelte +28 -34
  2. package/dist/calendar/AboutShow/AboutShow.svelte.d.ts +21 -40
  3. package/dist/calendar/AboutShow/AboutShow.svelte.d.ts.map +1 -1
  4. package/dist/calendar/Calendar/MiniMonthCalendar.svelte +781 -848
  5. package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts +33 -50
  6. package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
  7. package/dist/calendar/FAQs/FAQs.svelte +10 -15
  8. package/dist/calendar/FAQs/FAQs.svelte.d.ts +15 -36
  9. package/dist/calendar/FAQs/FAQs.svelte.d.ts.map +1 -1
  10. package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +36 -39
  11. package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte.d.ts +19 -34
  12. package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte.d.ts.map +1 -1
  13. package/dist/calendar/OrderSummary/OrderSummary.svelte +49 -75
  14. package/dist/calendar/OrderSummary/OrderSummary.svelte.d.ts +33 -62
  15. package/dist/calendar/OrderSummary/OrderSummary.svelte.d.ts.map +1 -1
  16. package/dist/calendar/PublicCard/PublicCard.svelte +21 -33
  17. package/dist/calendar/PublicCard/PublicCard.svelte.d.ts +15 -32
  18. package/dist/calendar/PublicCard/PublicCard.svelte.d.ts.map +1 -1
  19. package/dist/calendar/ShowCard/ShowCard.svelte +35 -45
  20. package/dist/calendar/ShowCard/ShowCard.svelte.d.ts +19 -36
  21. package/dist/calendar/ShowCard/ShowCard.svelte.d.ts.map +1 -1
  22. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +13 -15
  23. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts +17 -34
  24. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts.map +1 -1
  25. package/dist/components/Layout/Grid.svelte +43 -44
  26. package/dist/components/Layout/Grid.svelte.d.ts +49 -46
  27. package/dist/components/Layout/Grid.svelte.d.ts.map +1 -1
  28. package/dist/components/Layout/Section.svelte +41 -42
  29. package/dist/components/Layout/Section.svelte.d.ts +33 -46
  30. package/dist/components/Layout/Section.svelte.d.ts.map +1 -1
  31. package/dist/components/Layout/Sidebar.svelte +67 -63
  32. package/dist/components/Layout/Sidebar.svelte.d.ts +44 -50
  33. package/dist/components/Layout/Sidebar.svelte.d.ts.map +1 -1
  34. package/dist/components/Layout/Stack.svelte +45 -94
  35. package/dist/components/Layout/Stack.svelte.d.ts +19 -50
  36. package/dist/components/Layout/Stack.svelte.d.ts.map +1 -1
  37. package/dist/patterns/data/DataGrid.svelte +13 -46
  38. package/dist/patterns/data/DataGrid.svelte.d.ts +19 -45
  39. package/dist/patterns/data/DataGrid.svelte.d.ts.map +1 -1
  40. package/dist/patterns/data/DataList.svelte +11 -41
  41. package/dist/patterns/data/DataList.svelte.d.ts +17 -43
  42. package/dist/patterns/data/DataList.svelte.d.ts.map +1 -1
  43. package/dist/patterns/data/DataTable.svelte +13 -43
  44. package/dist/patterns/data/DataTable.svelte.d.ts +21 -65
  45. package/dist/patterns/data/DataTable.svelte.d.ts.map +1 -1
  46. package/dist/patterns/forms/FormActions.svelte +16 -37
  47. package/dist/patterns/forms/FormActions.svelte.d.ts +31 -46
  48. package/dist/patterns/forms/FormActions.svelte.d.ts.map +1 -1
  49. package/dist/patterns/forms/FormGrid.svelte +9 -25
  50. package/dist/patterns/forms/FormGrid.svelte.d.ts +15 -41
  51. package/dist/patterns/forms/FormGrid.svelte.d.ts.map +1 -1
  52. package/dist/patterns/forms/FormSection.svelte +8 -25
  53. package/dist/patterns/forms/FormSection.svelte.d.ts +17 -43
  54. package/dist/patterns/forms/FormSection.svelte.d.ts.map +1 -1
  55. package/dist/patterns/forms/FormValidationSummary.svelte +10 -28
  56. package/dist/patterns/forms/FormValidationSummary.svelte.d.ts +15 -30
  57. package/dist/patterns/forms/FormValidationSummary.svelte.d.ts.map +1 -1
  58. package/dist/patterns/layout/Grid.svelte +35 -38
  59. package/dist/patterns/layout/Grid.svelte.d.ts +15 -41
  60. package/dist/patterns/layout/Grid.svelte.d.ts.map +1 -1
  61. package/dist/patterns/layout/Sidebar.svelte +39 -41
  62. package/dist/patterns/layout/Sidebar.svelte.d.ts +17 -45
  63. package/dist/patterns/layout/Sidebar.svelte.d.ts.map +1 -1
  64. package/dist/patterns/layout/Stack.svelte +45 -54
  65. package/dist/patterns/layout/Stack.svelte.d.ts +21 -47
  66. package/dist/patterns/layout/Stack.svelte.d.ts.map +1 -1
  67. package/dist/patterns/navigation/BottomNav.svelte +16 -20
  68. package/dist/patterns/navigation/BottomNav.svelte.d.ts +9 -24
  69. package/dist/patterns/navigation/BottomNav.svelte.d.ts.map +1 -1
  70. package/dist/patterns/navigation/Header.svelte +35 -52
  71. package/dist/patterns/navigation/Header.svelte.d.ts +21 -40
  72. package/dist/patterns/navigation/Header.svelte.d.ts.map +1 -1
  73. package/dist/patterns/page/PageHeader.svelte +10 -35
  74. package/dist/patterns/page/PageHeader.svelte.d.ts +19 -36
  75. package/dist/patterns/page/PageHeader.svelte.d.ts.map +1 -1
  76. package/dist/patterns/page/PageLayout.svelte +39 -64
  77. package/dist/patterns/page/PageLayout.svelte.d.ts +25 -55
  78. package/dist/patterns/page/PageLayout.svelte.d.ts.map +1 -1
  79. package/dist/patterns/page/PageLoader.svelte +12 -22
  80. package/dist/patterns/page/PageLoader.svelte.d.ts +23 -49
  81. package/dist/patterns/page/PageLoader.svelte.d.ts.map +1 -1
  82. package/dist/patterns/page/SectionHeader.svelte +10 -29
  83. package/dist/patterns/page/SectionHeader.svelte.d.ts +19 -36
  84. package/dist/patterns/page/SectionHeader.svelte.d.ts.map +1 -1
  85. package/dist/primitives/Accordion/Accordion.svelte +23 -14
  86. package/dist/primitives/Accordion/Accordion.svelte.d.ts +17 -42
  87. package/dist/primitives/Accordion/Accordion.svelte.d.ts.map +1 -1
  88. package/dist/primitives/Accordion/AccordionItem.svelte +35 -19
  89. package/dist/primitives/Accordion/AccordionItem.svelte.d.ts +20 -48
  90. package/dist/primitives/Accordion/AccordionItem.svelte.d.ts.map +1 -1
  91. package/dist/primitives/Alert/Alert.svelte +56 -46
  92. package/dist/primitives/Alert/Alert.svelte.d.ts +12 -48
  93. package/dist/primitives/Alert/Alert.svelte.d.ts.map +1 -1
  94. package/dist/primitives/Avatar/Avatar.svelte +66 -56
  95. package/dist/primitives/Avatar/Avatar.svelte.d.ts +21 -35
  96. package/dist/primitives/Avatar/Avatar.svelte.d.ts.map +1 -1
  97. package/dist/primitives/Badges/Badge.svelte +68 -101
  98. package/dist/primitives/Badges/Badge.svelte.d.ts +31 -62
  99. package/dist/primitives/Badges/Badge.svelte.d.ts.map +1 -1
  100. package/dist/primitives/BottomSheet/BottomSheet.svelte +43 -29
  101. package/dist/primitives/BottomSheet/BottomSheet.svelte.d.ts +15 -50
  102. package/dist/primitives/BottomSheet/BottomSheet.svelte.d.ts.map +1 -1
  103. package/dist/primitives/Breadcrumb/Breadcrumb.svelte +36 -21
  104. package/dist/primitives/Breadcrumb/Breadcrumb.svelte.d.ts +20 -43
  105. package/dist/primitives/Breadcrumb/Breadcrumb.svelte.d.ts.map +1 -1
  106. package/dist/primitives/Button/Button.svelte +88 -34
  107. package/dist/primitives/Button/Button.svelte.d.ts +29 -60
  108. package/dist/primitives/Button/Button.svelte.d.ts.map +1 -1
  109. package/dist/primitives/Button/ButtonSaveDemo.svelte +5 -5
  110. package/dist/primitives/Button/ButtonSaveDemo.svelte.d.ts +2 -25
  111. package/dist/primitives/Button/ButtonSaveDemo.svelte.d.ts.map +1 -1
  112. package/dist/primitives/Button/ButtonVariantShowcase.svelte +3 -11
  113. package/dist/primitives/Button/ButtonVariantShowcase.svelte.d.ts +2 -25
  114. package/dist/primitives/Button/ButtonVariantShowcase.svelte.d.ts.map +1 -1
  115. package/dist/primitives/Card.svelte +22 -11
  116. package/dist/primitives/Card.svelte.d.ts +11 -44
  117. package/dist/primitives/Card.svelte.d.ts.map +1 -1
  118. package/dist/primitives/Checkbox/Checkbox.svelte +50 -31
  119. package/dist/primitives/Checkbox/Checkbox.svelte.d.ts +22 -62
  120. package/dist/primitives/Checkbox/Checkbox.svelte.d.ts.map +1 -1
  121. package/dist/primitives/DarkModeToggle.svelte +18 -30
  122. package/dist/primitives/DarkModeToggle.svelte.d.ts +6 -25
  123. package/dist/primitives/DarkModeToggle.svelte.d.ts.map +1 -1
  124. package/dist/primitives/Drawer/Drawer.svelte +48 -60
  125. package/dist/primitives/Drawer/Drawer.svelte.d.ts +37 -69
  126. package/dist/primitives/Drawer/Drawer.svelte.d.ts.map +1 -1
  127. package/dist/primitives/Dropdown/Dropdown.svelte +150 -164
  128. package/dist/primitives/Dropdown/Dropdown.svelte.d.ts +21 -51
  129. package/dist/primitives/Dropdown/Dropdown.svelte.d.ts.map +1 -1
  130. package/dist/primitives/Dropdown/DropdownItem.svelte +80 -69
  131. package/dist/primitives/Dropdown/DropdownItem.svelte.d.ts +15 -46
  132. package/dist/primitives/Dropdown/DropdownItem.svelte.d.ts.map +1 -1
  133. package/dist/primitives/Icons/ArrowLeft.svelte +1 -2
  134. package/dist/primitives/Icons/ArrowLeft.svelte.d.ts +11 -26
  135. package/dist/primitives/Icons/ArrowLeft.svelte.d.ts.map +1 -1
  136. package/dist/primitives/Icons/ArrowRight.svelte +1 -2
  137. package/dist/primitives/Icons/ArrowRight.svelte.d.ts +11 -26
  138. package/dist/primitives/Icons/ArrowRight.svelte.d.ts.map +1 -1
  139. package/dist/primitives/Icons/Availability.svelte +1 -2
  140. package/dist/primitives/Icons/Availability.svelte.d.ts +11 -26
  141. package/dist/primitives/Icons/Availability.svelte.d.ts.map +1 -1
  142. package/dist/primitives/Icons/Back.svelte +1 -2
  143. package/dist/primitives/Icons/Back.svelte.d.ts +11 -26
  144. package/dist/primitives/Icons/Back.svelte.d.ts.map +1 -1
  145. package/dist/primitives/Icons/CheckCircle.svelte +1 -2
  146. package/dist/primitives/Icons/CheckCircle.svelte.d.ts +11 -26
  147. package/dist/primitives/Icons/CheckCircle.svelte.d.ts.map +1 -1
  148. package/dist/primitives/Icons/CheckCircleOutline.svelte +1 -2
  149. package/dist/primitives/Icons/CheckCircleOutline.svelte.d.ts +11 -26
  150. package/dist/primitives/Icons/CheckCircleOutline.svelte.d.ts.map +1 -1
  151. package/dist/primitives/Icons/CheckCircleSolid.svelte +2 -4
  152. package/dist/primitives/Icons/CheckCircleSolid.svelte.d.ts +9 -24
  153. package/dist/primitives/Icons/CheckCircleSolid.svelte.d.ts.map +1 -1
  154. package/dist/primitives/Icons/CheckOutline.svelte +2 -4
  155. package/dist/primitives/Icons/CheckOutline.svelte.d.ts +9 -24
  156. package/dist/primitives/Icons/CheckOutline.svelte.d.ts.map +1 -1
  157. package/dist/primitives/Icons/ChevronDownOutline.svelte +2 -4
  158. package/dist/primitives/Icons/ChevronDownOutline.svelte.d.ts +9 -24
  159. package/dist/primitives/Icons/ChevronDownOutline.svelte.d.ts.map +1 -1
  160. package/dist/primitives/Icons/ChevronLeft.svelte +1 -2
  161. package/dist/primitives/Icons/ChevronLeft.svelte.d.ts +11 -26
  162. package/dist/primitives/Icons/ChevronLeft.svelte.d.ts.map +1 -1
  163. package/dist/primitives/Icons/ChevronLeftOutline.svelte +2 -4
  164. package/dist/primitives/Icons/ChevronLeftOutline.svelte.d.ts +9 -24
  165. package/dist/primitives/Icons/ChevronLeftOutline.svelte.d.ts.map +1 -1
  166. package/dist/primitives/Icons/ChevronRight.svelte +1 -2
  167. package/dist/primitives/Icons/ChevronRight.svelte.d.ts +11 -26
  168. package/dist/primitives/Icons/ChevronRight.svelte.d.ts.map +1 -1
  169. package/dist/primitives/Icons/ChevronRightOutline.svelte +2 -4
  170. package/dist/primitives/Icons/ChevronRightOutline.svelte.d.ts +9 -24
  171. package/dist/primitives/Icons/ChevronRightOutline.svelte.d.ts.map +1 -1
  172. package/dist/primitives/Icons/ChevronUpOutline.svelte +2 -4
  173. package/dist/primitives/Icons/ChevronUpOutline.svelte.d.ts +9 -24
  174. package/dist/primitives/Icons/ChevronUpOutline.svelte.d.ts.map +1 -1
  175. package/dist/primitives/Icons/CloseCircleOutline.svelte +2 -4
  176. package/dist/primitives/Icons/CloseCircleOutline.svelte.d.ts +9 -24
  177. package/dist/primitives/Icons/CloseCircleOutline.svelte.d.ts.map +1 -1
  178. package/dist/primitives/Icons/CloseOutline.svelte +2 -4
  179. package/dist/primitives/Icons/CloseOutline.svelte.d.ts +9 -24
  180. package/dist/primitives/Icons/CloseOutline.svelte.d.ts.map +1 -1
  181. package/dist/primitives/Icons/Copy.svelte +1 -2
  182. package/dist/primitives/Icons/Copy.svelte.d.ts +11 -26
  183. package/dist/primitives/Icons/Copy.svelte.d.ts.map +1 -1
  184. package/dist/primitives/Icons/Cross.svelte +1 -2
  185. package/dist/primitives/Icons/Cross.svelte.d.ts +11 -26
  186. package/dist/primitives/Icons/Cross.svelte.d.ts.map +1 -1
  187. package/dist/primitives/Icons/DotsHorizontalOutline.svelte +2 -4
  188. package/dist/primitives/Icons/DotsHorizontalOutline.svelte.d.ts +9 -24
  189. package/dist/primitives/Icons/DotsHorizontalOutline.svelte.d.ts.map +1 -1
  190. package/dist/primitives/Icons/DownArrow.svelte +1 -2
  191. package/dist/primitives/Icons/DownArrow.svelte.d.ts +11 -26
  192. package/dist/primitives/Icons/DownArrow.svelte.d.ts.map +1 -1
  193. package/dist/primitives/Icons/ErrorCircle.svelte +1 -2
  194. package/dist/primitives/Icons/ErrorCircle.svelte.d.ts +11 -26
  195. package/dist/primitives/Icons/ErrorCircle.svelte.d.ts.map +1 -1
  196. package/dist/primitives/Icons/ExclamationCircleOutline.svelte +2 -4
  197. package/dist/primitives/Icons/ExclamationCircleOutline.svelte.d.ts +9 -24
  198. package/dist/primitives/Icons/ExclamationCircleOutline.svelte.d.ts.map +1 -1
  199. package/dist/primitives/Icons/ExclamationTriangleOutline.svelte +2 -4
  200. package/dist/primitives/Icons/ExclamationTriangleOutline.svelte.d.ts +9 -24
  201. package/dist/primitives/Icons/ExclamationTriangleOutline.svelte.d.ts.map +1 -1
  202. package/dist/primitives/Icons/EyeOutline.svelte +2 -4
  203. package/dist/primitives/Icons/EyeOutline.svelte.d.ts +9 -24
  204. package/dist/primitives/Icons/EyeOutline.svelte.d.ts.map +1 -1
  205. package/dist/primitives/Icons/EyeSlashOutline.svelte +2 -4
  206. package/dist/primitives/Icons/EyeSlashOutline.svelte.d.ts +9 -24
  207. package/dist/primitives/Icons/EyeSlashOutline.svelte.d.ts.map +1 -1
  208. package/dist/primitives/Icons/FacebookIcon.svelte +1 -2
  209. package/dist/primitives/Icons/FacebookIcon.svelte.d.ts +11 -26
  210. package/dist/primitives/Icons/FacebookIcon.svelte.d.ts.map +1 -1
  211. package/dist/primitives/Icons/FileCopyOutline.svelte +2 -4
  212. package/dist/primitives/Icons/FileCopyOutline.svelte.d.ts +9 -24
  213. package/dist/primitives/Icons/FileCopyOutline.svelte.d.ts.map +1 -1
  214. package/dist/primitives/Icons/Home.svelte +1 -3
  215. package/dist/primitives/Icons/Home.svelte.d.ts +11 -26
  216. package/dist/primitives/Icons/Home.svelte.d.ts.map +1 -1
  217. package/dist/primitives/Icons/HomeSolid.svelte +2 -4
  218. package/dist/primitives/Icons/HomeSolid.svelte.d.ts +9 -24
  219. package/dist/primitives/Icons/HomeSolid.svelte.d.ts.map +1 -1
  220. package/dist/primitives/Icons/Icon.svelte +3 -7
  221. package/dist/primitives/Icons/Icon.svelte.d.ts +6 -29
  222. package/dist/primitives/Icons/Icon.svelte.d.ts.map +1 -1
  223. package/dist/primitives/Icons/Info.svelte +1 -2
  224. package/dist/primitives/Icons/Info.svelte.d.ts +11 -26
  225. package/dist/primitives/Icons/Info.svelte.d.ts.map +1 -1
  226. package/dist/primitives/Icons/InfoCircleOutline.svelte +2 -4
  227. package/dist/primitives/Icons/InfoCircleOutline.svelte.d.ts +9 -24
  228. package/dist/primitives/Icons/InfoCircleOutline.svelte.d.ts.map +1 -1
  229. package/dist/primitives/Icons/InstagramIcon.svelte +1 -2
  230. package/dist/primitives/Icons/InstagramIcon.svelte.d.ts +11 -26
  231. package/dist/primitives/Icons/InstagramIcon.svelte.d.ts.map +1 -1
  232. package/dist/primitives/Icons/LogoInstagram.svelte +15 -18
  233. package/dist/primitives/Icons/LogoInstagram.svelte.d.ts +11 -26
  234. package/dist/primitives/Icons/LogoInstagram.svelte.d.ts.map +1 -1
  235. package/dist/primitives/Icons/Message.svelte +1 -2
  236. package/dist/primitives/Icons/Message.svelte.d.ts +11 -26
  237. package/dist/primitives/Icons/Message.svelte.d.ts.map +1 -1
  238. package/dist/primitives/Icons/MinusOutline.svelte +2 -4
  239. package/dist/primitives/Icons/MinusOutline.svelte.d.ts +9 -24
  240. package/dist/primitives/Icons/MinusOutline.svelte.d.ts.map +1 -1
  241. package/dist/primitives/Icons/MoonIcon.svelte +1 -2
  242. package/dist/primitives/Icons/MoonIcon.svelte.d.ts +11 -26
  243. package/dist/primitives/Icons/MoonIcon.svelte.d.ts.map +1 -1
  244. package/dist/primitives/Icons/More.svelte +1 -2
  245. package/dist/primitives/Icons/More.svelte.d.ts +11 -26
  246. package/dist/primitives/Icons/More.svelte.d.ts.map +1 -1
  247. package/dist/primitives/Icons/MoreHori.svelte +1 -2
  248. package/dist/primitives/Icons/MoreHori.svelte.d.ts +11 -26
  249. package/dist/primitives/Icons/MoreHori.svelte.d.ts.map +1 -1
  250. package/dist/primitives/Icons/Notification.svelte +1 -2
  251. package/dist/primitives/Icons/Notification.svelte.d.ts +11 -26
  252. package/dist/primitives/Icons/Notification.svelte.d.ts.map +1 -1
  253. package/dist/primitives/Icons/Payment.svelte +1 -2
  254. package/dist/primitives/Icons/Payment.svelte.d.ts +11 -26
  255. package/dist/primitives/Icons/Payment.svelte.d.ts.map +1 -1
  256. package/dist/primitives/Icons/PlusOutline.svelte +2 -4
  257. package/dist/primitives/Icons/PlusOutline.svelte.d.ts +9 -24
  258. package/dist/primitives/Icons/PlusOutline.svelte.d.ts.map +1 -1
  259. package/dist/primitives/Icons/Profile.svelte +1 -2
  260. package/dist/primitives/Icons/Profile.svelte.d.ts +11 -26
  261. package/dist/primitives/Icons/Profile.svelte.d.ts.map +1 -1
  262. package/dist/primitives/Icons/Reload.svelte +1 -2
  263. package/dist/primitives/Icons/Reload.svelte.d.ts +11 -26
  264. package/dist/primitives/Icons/Reload.svelte.d.ts.map +1 -1
  265. package/dist/primitives/Icons/SearchOutline.svelte +2 -4
  266. package/dist/primitives/Icons/SearchOutline.svelte.d.ts +9 -24
  267. package/dist/primitives/Icons/SearchOutline.svelte.d.ts.map +1 -1
  268. package/dist/primitives/Icons/ShareOutline.svelte +2 -4
  269. package/dist/primitives/Icons/ShareOutline.svelte.d.ts +9 -24
  270. package/dist/primitives/Icons/ShareOutline.svelte.d.ts.map +1 -1
  271. package/dist/primitives/Icons/Shows.svelte +1 -2
  272. package/dist/primitives/Icons/Shows.svelte.d.ts +11 -26
  273. package/dist/primitives/Icons/Shows.svelte.d.ts.map +1 -1
  274. package/dist/primitives/Icons/Signout.svelte +1 -2
  275. package/dist/primitives/Icons/Signout.svelte.d.ts +11 -26
  276. package/dist/primitives/Icons/Signout.svelte.d.ts.map +1 -1
  277. package/dist/primitives/Icons/SunIcon.svelte +1 -2
  278. package/dist/primitives/Icons/SunIcon.svelte.d.ts +11 -26
  279. package/dist/primitives/Icons/SunIcon.svelte.d.ts.map +1 -1
  280. package/dist/primitives/Icons/TiktokIcon.svelte +1 -2
  281. package/dist/primitives/Icons/TiktokIcon.svelte.d.ts +11 -26
  282. package/dist/primitives/Icons/TiktokIcon.svelte.d.ts.map +1 -1
  283. package/dist/primitives/Icons/TwitterIcon.svelte +1 -2
  284. package/dist/primitives/Icons/TwitterIcon.svelte.d.ts +11 -26
  285. package/dist/primitives/Icons/TwitterIcon.svelte.d.ts.map +1 -1
  286. package/dist/primitives/Icons/WarningIcon.svelte +1 -1
  287. package/dist/primitives/Icons/WarningIcon.svelte.d.ts +9 -24
  288. package/dist/primitives/Icons/WarningIcon.svelte.d.ts.map +1 -1
  289. package/dist/primitives/Input/Input.svelte +150 -78
  290. package/dist/primitives/Input/Input.svelte.d.ts +102 -110
  291. package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
  292. package/dist/primitives/Input/Select.svelte +31 -37
  293. package/dist/primitives/Input/Select.svelte.d.ts +29 -46
  294. package/dist/primitives/Input/Select.svelte.d.ts.map +1 -1
  295. package/dist/primitives/Input/Textarea.svelte +77 -75
  296. package/dist/primitives/Input/Textarea.svelte.d.ts +47 -66
  297. package/dist/primitives/Input/Textarea.svelte.d.ts.map +1 -1
  298. package/dist/primitives/Label/Label.svelte +37 -29
  299. package/dist/primitives/Label/Label.svelte.d.ts +11 -46
  300. package/dist/primitives/Label/Label.svelte.d.ts.map +1 -1
  301. package/dist/primitives/Modal/Modal.svelte +69 -44
  302. package/dist/primitives/Modal/Modal.svelte.d.ts +28 -46
  303. package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
  304. package/dist/primitives/Pagination/Pagination.svelte +79 -80
  305. package/dist/primitives/Pagination/Pagination.svelte.d.ts +24 -59
  306. package/dist/primitives/Pagination/Pagination.svelte.d.ts.map +1 -1
  307. package/dist/primitives/Radio/Radio.svelte +33 -26
  308. package/dist/primitives/Radio/Radio.svelte.d.ts +17 -54
  309. package/dist/primitives/Radio/Radio.svelte.d.ts.map +1 -1
  310. package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -98
  311. package/dist/primitives/Skeleton/CardPlaceholder.svelte.d.ts +10 -33
  312. package/dist/primitives/Skeleton/CardPlaceholder.svelte.d.ts.map +1 -1
  313. package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -65
  314. package/dist/primitives/Skeleton/ImagePlaceholder.svelte.d.ts +9 -31
  315. package/dist/primitives/Skeleton/ImagePlaceholder.svelte.d.ts.map +1 -1
  316. package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -86
  317. package/dist/primitives/Skeleton/ListPlaceholder.svelte.d.ts +11 -35
  318. package/dist/primitives/Skeleton/ListPlaceholder.svelte.d.ts.map +1 -1
  319. package/dist/primitives/Skeleton/Skeleton.svelte +19 -24
  320. package/dist/primitives/Skeleton/Skeleton.svelte.d.ts +9 -31
  321. package/dist/primitives/Skeleton/Skeleton.svelte.d.ts.map +1 -1
  322. package/dist/primitives/Spinner/Spinner.svelte +17 -12
  323. package/dist/primitives/Spinner/Spinner.svelte.d.ts +8 -29
  324. package/dist/primitives/Spinner/Spinner.svelte.d.ts.map +1 -1
  325. package/dist/primitives/Tabs/TabItem.svelte +51 -33
  326. package/dist/primitives/Tabs/TabItem.svelte.d.ts +12 -49
  327. package/dist/primitives/Tabs/TabItem.svelte.d.ts.map +1 -1
  328. package/dist/primitives/Tabs/Tabs.svelte +127 -104
  329. package/dist/primitives/Tabs/Tabs.svelte.d.ts +10 -43
  330. package/dist/primitives/Tabs/Tabs.svelte.d.ts.map +1 -1
  331. package/dist/primitives/Toggle.svelte +28 -16
  332. package/dist/primitives/Toggle.svelte.d.ts +23 -46
  333. package/dist/primitives/Toggle.svelte.d.ts.map +1 -1
  334. package/dist/primitives/Typography/Typography.svelte +31 -28
  335. package/dist/primitives/Typography/Typography.svelte.d.ts +16 -46
  336. package/dist/primitives/Typography/Typography.svelte.d.ts.map +1 -1
  337. package/dist/primitives/ValidationError.svelte +9 -3
  338. package/dist/primitives/ValidationError.svelte.d.ts +8 -27
  339. package/dist/primitives/ValidationError.svelte.d.ts.map +1 -1
  340. package/dist/recipes/CropImage/CropImage.svelte +52 -60
  341. package/dist/recipes/CropImage/CropImage.svelte.d.ts +14 -33
  342. package/dist/recipes/CropImage/CropImage.svelte.d.ts.map +1 -1
  343. package/dist/recipes/SuperLogin/SuperLogin.svelte +8 -11
  344. package/dist/recipes/SuperLogin/SuperLogin.svelte.d.ts.map +1 -1
  345. package/dist/recipes/feedback/EmptyState/EmptyState.svelte +32 -26
  346. package/dist/recipes/feedback/EmptyState/EmptyState.svelte.d.ts +19 -35
  347. package/dist/recipes/feedback/EmptyState/EmptyState.svelte.d.ts.map +1 -1
  348. package/dist/recipes/feedback/ErrorDisplay.svelte +24 -16
  349. package/dist/recipes/feedback/ErrorDisplay.svelte.d.ts +17 -35
  350. package/dist/recipes/feedback/ErrorDisplay.svelte.d.ts.map +1 -1
  351. package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +9 -14
  352. package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte.d.ts +8 -27
  353. package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte.d.ts.map +1 -1
  354. package/dist/recipes/fields/CheckboxField.svelte +51 -48
  355. package/dist/recipes/fields/CheckboxField.svelte.d.ts +35 -53
  356. package/dist/recipes/fields/CheckboxField.svelte.d.ts.map +1 -1
  357. package/dist/recipes/fields/FormField.svelte +31 -34
  358. package/dist/recipes/fields/FormField.svelte.d.ts +21 -62
  359. package/dist/recipes/fields/FormField.svelte.d.ts.map +1 -1
  360. package/dist/recipes/fields/RadioGroup.svelte +54 -57
  361. package/dist/recipes/fields/RadioGroup.svelte.d.ts +34 -49
  362. package/dist/recipes/fields/RadioGroup.svelte.d.ts.map +1 -1
  363. package/dist/recipes/fields/SelectField.svelte +49 -36
  364. package/dist/recipes/fields/SelectField.svelte.d.ts +34 -51
  365. package/dist/recipes/fields/SelectField.svelte.d.ts.map +1 -1
  366. package/dist/recipes/fields/TextareaField.svelte +75 -44
  367. package/dist/recipes/fields/TextareaField.svelte.d.ts +46 -67
  368. package/dist/recipes/fields/TextareaField.svelte.d.ts.map +1 -1
  369. package/dist/recipes/fields/ToggleField.svelte +31 -35
  370. package/dist/recipes/fields/ToggleField.svelte.d.ts +22 -41
  371. package/dist/recipes/fields/ToggleField.svelte.d.ts.map +1 -1
  372. package/dist/recipes/inputs/MultiSelect.svelte +43 -40
  373. package/dist/recipes/inputs/MultiSelect.svelte.d.ts +33 -50
  374. package/dist/recipes/inputs/MultiSelect.svelte.d.ts.map +1 -1
  375. package/dist/recipes/inputs/OTPInput.svelte +20 -16
  376. package/dist/recipes/inputs/OTPInput.svelte.d.ts +17 -38
  377. package/dist/recipes/inputs/OTPInput.svelte.d.ts.map +1 -1
  378. package/dist/recipes/inputs/PasswordInput.svelte +44 -54
  379. package/dist/recipes/inputs/PasswordInput.svelte.d.ts +45 -62
  380. package/dist/recipes/inputs/PasswordInput.svelte.d.ts.map +1 -1
  381. package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +36 -29
  382. package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte.d.ts +17 -43
  383. package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte.d.ts.map +1 -1
  384. package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +99 -83
  385. package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts +5 -19
  386. package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
  387. package/dist/recipes/inputs/Search.svelte +84 -78
  388. package/dist/recipes/inputs/Search.svelte.d.ts +35 -65
  389. package/dist/recipes/inputs/Search.svelte.d.ts.map +1 -1
  390. package/dist/recipes/inputs/SelectDropdown.svelte +30 -44
  391. package/dist/recipes/inputs/SelectDropdown.svelte.d.ts +19 -48
  392. package/dist/recipes/inputs/SelectDropdown.svelte.d.ts.map +1 -1
  393. package/dist/recipes/modals/AlertModal.svelte +77 -78
  394. package/dist/recipes/modals/AlertModal.svelte.d.ts +25 -42
  395. package/dist/recipes/modals/AlertModal.svelte.d.ts.map +1 -1
  396. package/dist/recipes/modals/ConfirmationModal.svelte +82 -85
  397. package/dist/recipes/modals/ConfirmationModal.svelte.d.ts +41 -58
  398. package/dist/recipes/modals/ConfirmationModal.svelte.d.ts.map +1 -1
  399. package/dist/recipes/modals/InputModal.svelte +135 -130
  400. package/dist/recipes/modals/InputModal.svelte.d.ts +57 -74
  401. package/dist/recipes/modals/InputModal.svelte.d.ts.map +1 -1
  402. package/dist/recipes/modals/ModalStateManager.svelte +42 -33
  403. package/dist/recipes/modals/ModalStateManager.svelte.d.ts +28 -56
  404. package/dist/recipes/modals/ModalStateManager.svelte.d.ts.map +1 -1
  405. package/dist/recipes/modals/ModalTestWrapper.svelte +61 -18
  406. package/dist/recipes/modals/ModalTestWrapper.svelte.d.ts +21 -35
  407. package/dist/recipes/modals/ModalTestWrapper.svelte.d.ts.map +1 -1
  408. package/dist/recipes/modals/StatusModal.svelte +116 -121
  409. package/dist/recipes/modals/StatusModal.svelte.d.ts +39 -56
  410. package/dist/recipes/modals/StatusModal.svelte.d.ts.map +1 -1
  411. package/package.json +1 -1
@@ -1,848 +1,781 @@
1
- <script>
2
- /**
3
- * MiniMonthCalendar - A pure Svelte mini-month calendar component
4
- *
5
- * Supports variants:
6
- * - 'availability': For performer availability selection (click to toggle dates)
7
- * - 'display': Read-only display of events/dates
8
- * - 'public': Public-facing calendar with event cards
9
- *
10
- * Features:
11
- * - Smooth swipe gestures with momentum
12
- * - Direction-aware shadows during swipe
13
- * - Previous/next month preview days
14
- * - Full accessibility support
15
- * - Reduced motion support
16
- * - Apple Calendar-style minimal grid on mobile
17
- */
18
- import { createEventDispatcher, onMount } from 'svelte';
19
- import { ChevronLeftOutline, ChevronRightOutline, CheckCircleSolid } from '../../primitives/Icons';
20
- import Spinner from '../../primitives/Spinner/Spinner.svelte';
21
-
22
- // Props
23
- export let variant = 'availability'; // 'availability' | 'display' | 'public'
24
- export let selectedDates = []; // Array of date strings like "2025-03-22"
25
- export let events = []; // Array of event objects for display/public variants
26
- export let saveStatus = ''; // 'saving' | 'saved' | ''
27
- export let showLegend = true;
28
- export let showNavigation = true;
29
- export let showTodayButton = true;
30
- export let readOnly = false;
31
- export let showPartialPreview = true; // Show prev/next month days to fill grid
32
- export let disablePastNavigation = false; // Prevent navigating to past months
33
-
34
- const dispatch = createEventDispatcher();
35
-
36
- // State
37
- let currentDate = new Date();
38
- let currentYear = currentDate.getFullYear();
39
- let currentMonth = currentDate.getMonth();
40
-
41
- // Swipe gesture support
42
- let touchStartX = 0;
43
- let touchStartY = 0;
44
- let touchStartTime = 0;
45
- let lastTouchX = 0;
46
- let lastTouchTime = 0;
47
- let velocityX = 0;
48
- let isSwiping = false;
49
- let isAnimating = false;
50
- let swipeOffset = 0;
51
- let calendarGridElement;
52
- let monthDisplayEl;
53
- let prefersReducedMotion = false;
54
-
55
- // Button pressed states for touch feedback
56
- let prevPressed = false;
57
- let nextPressed = false;
58
- let todayPressed = false;
59
-
60
- // Momentum animation
61
- let momentumAnimationId = null;
62
- const MOMENTUM_FRICTION = 0.92;
63
- const MOMENTUM_MIN_VELOCITY = 0.05;
64
-
65
- // Thresholds
66
- const SWIPE_THRESHOLD = 0.15;
67
- const VELOCITY_THRESHOLD = 0.3;
68
- const DRAG_RESISTANCE = 0.8;
69
-
70
- // Month names
71
- const MONTH_NAMES = [
72
- "January", "February", "March", "April", "May", "June",
73
- "July", "August", "September", "October", "November", "December"
74
- ];
75
-
76
- const DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
77
- const DAY_LETTERS = ["S", "M", "T", "W", "T", "F", "S"];
78
-
79
- // Today's date (local time)
80
- const today = new Date();
81
- const todayLocal = new Date(today.getFullYear(), today.getMonth(), today.getDate());
82
- const todayLocalMonth = today.getMonth();
83
- const todayLocalYear = today.getFullYear();
84
-
85
- // Reactive: Check if at current month
86
- $: isAtCurrentMonth = currentYear === todayLocalYear && currentMonth === todayLocalMonth;
87
- $: canGoPrev = !disablePastNavigation || !isAtCurrentMonth;
88
-
89
- // Check for reduced motion preference
90
- onMount(() => {
91
- if (typeof window !== 'undefined') {
92
- const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
93
- prefersReducedMotion = mediaQuery.matches;
94
- mediaQuery.addEventListener('change', (e) => {
95
- prefersReducedMotion = e.matches;
96
- });
97
- }
98
- });
99
-
100
- // Normalize date to YYYY-MM-DD string
101
- function normalizeDate(date) {
102
- const d = new Date(date);
103
- const year = d.getFullYear();
104
- const month = String(d.getMonth() + 1).padStart(2, '0');
105
- const day = String(d.getDate()).padStart(2, '0');
106
- return `${year}-${month}-${day}`;
107
- }
108
-
109
- // Get days in month
110
- function getDaysInMonth(year, month) {
111
- return new Date(year, month + 1, 0).getDate();
112
- }
113
-
114
- // Check if date is today
115
- function isToday(year, month, day) {
116
- return (
117
- year === todayLocal.getFullYear() &&
118
- month === todayLocal.getMonth() &&
119
- day === todayLocal.getDate()
120
- );
121
- }
122
-
123
- // Check if date is in the past
124
- function isPastDate(year, month, day) {
125
- const checkDate = new Date(year, month, day);
126
- return checkDate < todayLocal;
127
- }
128
-
129
- // Check if date is selected
130
- function isSelectedDate(dateStr) {
131
- return selectedDates.includes(dateStr);
132
- }
133
-
134
- // Check if date has events (for display/public variants)
135
- function hasEventsOnDate(dateStr) {
136
- return events.some(event => event.date === dateStr);
137
- }
138
-
139
- // Get events for a specific date
140
- function getEventsForDate(dateStr) {
141
- return events.filter(event => event.date === dateStr);
142
- }
143
-
144
- // Build calendar days array - reacts to selectedDates changes
145
- $: daysInMonth = (() => {
146
- // Reference selectedDates to ensure reactivity
147
- const _ = selectedDates;
148
- const days = getDaysInMonth(currentYear, currentMonth);
149
- const firstDayOfWeek = new Date(currentYear, currentMonth, 1).getDay();
150
- const result = [];
151
-
152
- for (let i = 1; i <= days; i++) {
153
- const dateStr = normalizeDate(new Date(currentYear, currentMonth, i));
154
- result.push({
155
- day: i,
156
- dateStr,
157
- startDay: firstDayOfWeek + i - 1,
158
- isPast: isPastDate(currentYear, currentMonth, i),
159
- isToday: isToday(currentYear, currentMonth, i),
160
- isSelected: selectedDates.includes(dateStr),
161
- hasEvents: hasEventsOnDate(dateStr),
162
- events: getEventsForDate(dateStr)
163
- });
164
- }
165
- return result;
166
- })();
167
-
168
- // Previous month preview days
169
- $: prevMonthPreviewDays = (() => {
170
- if (!showPartialPreview) return [];
171
- const firstDayOfWeek = new Date(currentYear, currentMonth, 1).getDay();
172
- if (firstDayOfWeek === 0) return [];
173
-
174
- const prevMonth = currentMonth === 0 ? 11 : currentMonth - 1;
175
- const prevYear = currentMonth === 0 ? currentYear - 1 : currentYear;
176
- const daysInPrevMonth = getDaysInMonth(prevYear, prevMonth);
177
-
178
- return Array.from({ length: firstDayOfWeek }, (_, i) => ({
179
- day: daysInPrevMonth - firstDayOfWeek + i + 1,
180
- month: prevMonth,
181
- year: prevYear
182
- }));
183
- })();
184
-
185
- // Next month preview days
186
- $: nextMonthPreviewDays = (() => {
187
- if (!showPartialPreview) return [];
188
- const days = getDaysInMonth(currentYear, currentMonth);
189
- const lastDayOfWeek = new Date(currentYear, currentMonth, days).getDay();
190
- if (lastDayOfWeek === 6) return [];
191
-
192
- const daysToShow = 6 - lastDayOfWeek;
193
- const nextMonth = currentMonth === 11 ? 0 : currentMonth + 1;
194
- const nextYear = currentMonth === 11 ? currentYear + 1 : currentYear;
195
-
196
- return Array.from({ length: daysToShow }, (_, i) => ({
197
- day: i + 1,
198
- month: nextMonth,
199
- year: nextYear
200
- }));
201
- })();
202
-
203
- // Haptic feedback
204
- function triggerHaptic(style = 'light') {
205
- if (typeof window === 'undefined') return;
206
-
207
- if (window.webkit?.messageHandlers?.haptic) {
208
- window.webkit.messageHandlers.haptic.postMessage(style);
209
- return;
210
- }
211
-
212
- if (window.TapticEngine) {
213
- window.TapticEngine.impact({ style });
214
- return;
215
- }
216
-
217
- if (navigator.vibrate) {
218
- navigator.vibrate(style === 'light' ? 10 : 20);
219
- }
220
- }
221
-
222
- // Handle day tap (touchend) for mobile - bypasses click delay
223
- function handleDayTap(e, day) {
224
- // Only process if it was a tap, not a swipe
225
- if (isSwiping) return;
226
- if (readOnly) return;
227
- if (variant === 'availability' && day.isPast) return;
228
-
229
- // Process immediately on touchend
230
- if (variant === 'availability') {
231
- const isSelected = selectedDates.includes(day.dateStr);
232
-
233
- if (isSelected) {
234
- triggerHaptic('medium');
235
- dispatch('dateSelect', { date: day.dateStr, selected: false });
236
- } else {
237
- triggerHaptic('light');
238
- dispatch('dateSelect', { date: day.dateStr, selected: true });
239
- }
240
- } else if (variant === 'display' || variant === 'public') {
241
- if (day.hasEvents) {
242
- triggerHaptic('light');
243
- dispatch('dayClick', { date: day.dateStr, events: day.events });
244
- }
245
- }
246
- }
247
-
248
- // Handle day click (for desktop/keyboard)
249
- function handleDayClick(day) {
250
- // Don't trigger click if we were dragging/swiping
251
- if (isDragging || isSwiping) return;
252
- if (readOnly) return;
253
- if (variant === 'availability' && day.isPast) return;
254
-
255
- if (variant === 'availability') {
256
- const isSelected = selectedDates.includes(day.dateStr);
257
-
258
- if (isSelected) {
259
- triggerHaptic('medium');
260
- dispatch('dateSelect', { date: day.dateStr, selected: false });
261
- } else {
262
- triggerHaptic('light');
263
- dispatch('dateSelect', { date: day.dateStr, selected: true });
264
- }
265
- } else if (variant === 'display' || variant === 'public') {
266
- if (day.hasEvents) {
267
- triggerHaptic('light');
268
- dispatch('dayClick', { date: day.dateStr, events: day.events });
269
- }
270
- }
271
- }
272
-
273
- // Navigation
274
- function goToPrevMonth() {
275
- if (isAnimating || !canGoPrev) return;
276
- triggerHaptic('light');
277
- animateMonthChange(-1);
278
- }
279
-
280
- function goToNextMonth() {
281
- if (isAnimating) return;
282
- triggerHaptic('light');
283
- animateMonthChange(1);
284
- }
285
-
286
- function goToToday() {
287
- if (isAnimating || isAtCurrentMonth) return;
288
-
289
- const todayYM = today.getFullYear() * 12 + today.getMonth();
290
- const currentYM = currentYear * 12 + currentMonth;
291
-
292
- const direction = todayYM > currentYM ? 1 : -1;
293
- triggerHaptic('light');
294
- animateMonthChange(direction, () => {
295
- currentYear = today.getFullYear();
296
- currentMonth = today.getMonth();
297
- });
298
- }
299
-
300
- // Month change with animation
301
- function animateMonthChange(direction, customAction = null) {
302
- if (isAnimating || !calendarGridElement) return;
303
-
304
- if (prefersReducedMotion) {
305
- if (customAction) {
306
- customAction();
307
- } else if (direction > 0) {
308
- if (currentMonth === 11) {
309
- currentMonth = 0;
310
- currentYear++;
311
- } else {
312
- currentMonth++;
313
- }
314
- } else {
315
- if (currentMonth === 0) {
316
- currentMonth = 11;
317
- currentYear--;
318
- } else {
319
- currentMonth--;
320
- }
321
- }
322
- triggerHaptic('medium');
323
- dispatch('monthChange', { year: currentYear, month: currentMonth });
324
- return;
325
- }
326
-
327
- isAnimating = true;
328
- const containerWidth = calendarGridElement.offsetWidth || 320;
329
-
330
- // Clone current calendar
331
- const clone = calendarGridElement.cloneNode(true);
332
- clone.classList.add('calendar-clone');
333
- clone.style.position = 'absolute';
334
- clone.style.top = '0';
335
- clone.style.left = '0';
336
- clone.style.width = '100%';
337
- clone.style.transform = swipeOffset ? `translateX(${swipeOffset}px)` : 'translateX(0)';
338
- clone.style.transition = 'none';
339
- clone.style.pointerEvents = 'none';
340
- clone.style.zIndex = '1';
341
-
342
- const slideContainer = calendarGridElement.parentElement;
343
- slideContainer.style.position = 'relative';
344
- slideContainer.style.overflow = 'hidden';
345
- slideContainer.insertBefore(clone, calendarGridElement);
346
-
347
- // Change month
348
- if (customAction) {
349
- customAction();
350
- } else if (direction > 0) {
351
- if (currentMonth === 11) {
352
- currentMonth = 0;
353
- currentYear++;
354
- } else {
355
- currentMonth++;
356
- }
357
- } else {
358
- if (currentMonth === 0) {
359
- currentMonth = 11;
360
- currentYear--;
361
- } else {
362
- currentMonth--;
363
- }
364
- }
365
-
366
- triggerHaptic('medium');
367
- dispatch('monthChange', { year: currentYear, month: currentMonth });
368
-
369
- // Position new calendar off-screen
370
- const enterFrom = direction > 0 ? containerWidth : -containerWidth;
371
- calendarGridElement.style.transition = 'none';
372
- calendarGridElement.style.transform = `translateX(${enterFrom}px)`;
373
- calendarGridElement.offsetHeight; // Force reflow
374
-
375
- // Animate
376
- const duration = 0.3;
377
- const easing = 'cubic-bezier(0.25, 0.46, 0.45, 0.94)';
378
-
379
- clone.style.transition = `transform ${duration}s ${easing}`;
380
- clone.style.transform = `translateX(${direction > 0 ? -containerWidth : containerWidth}px)`;
381
-
382
- calendarGridElement.style.transition = `transform ${duration}s ${easing}`;
383
- calendarGridElement.style.transform = 'translateX(0)';
384
-
385
- // Animate header
386
- if (monthDisplayEl) {
387
- monthDisplayEl.style.transition = 'none';
388
- monthDisplayEl.style.transform = `translateX(${enterFrom * 0.3}px)`;
389
- monthDisplayEl.style.opacity = '0';
390
- monthDisplayEl.offsetHeight;
391
- monthDisplayEl.style.transition = `transform ${duration}s ${easing}, opacity ${duration}s ${easing}`;
392
- monthDisplayEl.style.transform = 'translateX(0)';
393
- monthDisplayEl.style.opacity = '1';
394
- }
395
-
396
- // Cleanup
397
- setTimeout(() => {
398
- if (clone.parentElement) clone.remove();
399
- if (calendarGridElement) {
400
- calendarGridElement.style.transition = '';
401
- calendarGridElement.style.transform = '';
402
- }
403
- if (monthDisplayEl) {
404
- monthDisplayEl.style.transition = '';
405
- monthDisplayEl.style.transform = '';
406
- monthDisplayEl.style.opacity = '';
407
- }
408
- isAnimating = false;
409
- swipeOffset = 0;
410
- }, duration * 1000 + 50);
411
- }
412
-
413
- // Mouse state for desktop dragging
414
- let isDragging = false;
415
-
416
- // Touch handlers
417
- function handleTouchStart(e) {
418
- if (isAnimating) return;
419
-
420
- touchStartX = e.touches[0].clientX;
421
- touchStartY = e.touches[0].clientY;
422
- touchStartTime = Date.now();
423
- lastTouchX = touchStartX;
424
- lastTouchTime = touchStartTime;
425
- velocityX = 0;
426
- isSwiping = false;
427
- isDragging = false; // Reset drag state on new touch
428
- swipeOffset = 0;
429
- }
430
-
431
- function handleTouchMove(e) {
432
- if (!touchStartX || isAnimating) return;
433
-
434
- const touchCurrentX = e.touches[0].clientX;
435
- const touchCurrentY = e.touches[0].clientY;
436
- const diffX = touchStartX - touchCurrentX;
437
- const diffY = touchStartY - touchCurrentY;
438
- const now = Date.now();
439
-
440
- if (!isSwiping && Math.abs(diffX) > 10) {
441
- if (Math.abs(diffX) > Math.abs(diffY)) {
442
- isSwiping = true;
443
- } else {
444
- touchStartX = 0;
445
- return;
446
- }
447
- }
448
-
449
- if (isSwiping) {
450
- e.preventDefault();
451
-
452
- const dt = now - lastTouchTime;
453
- if (dt > 0) {
454
- velocityX = (lastTouchX - touchCurrentX) / dt;
455
- }
456
- lastTouchX = touchCurrentX;
457
- lastTouchTime = now;
458
-
459
- swipeOffset = -diffX * DRAG_RESISTANCE;
460
-
461
- if (calendarGridElement) {
462
- calendarGridElement.style.transform = `translateX(${swipeOffset}px)`;
463
- calendarGridElement.style.transition = 'none';
464
-
465
- // Direction-aware shadow
466
- const shadowIntensity = Math.min(Math.abs(swipeOffset) / 80, 0.4);
467
- const blurRadius = 12 + shadowIntensity * 24;
468
- const spreadRadius = shadowIntensity * 4;
469
-
470
- if (diffX > 0) {
471
- calendarGridElement.style.boxShadow = `-${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
472
- } else {
473
- calendarGridElement.style.boxShadow = `${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
474
- }
475
- }
476
- }
477
- }
478
-
479
- function handleTouchEnd() {
480
- if (!touchStartX || !isSwiping || isAnimating) {
481
- touchStartX = 0;
482
- touchStartY = 0;
483
- isSwiping = false;
484
- return;
485
- }
486
-
487
- const containerWidth = calendarGridElement?.offsetWidth || 320;
488
- const swipePercent = Math.abs(swipeOffset) / containerWidth;
489
- const shouldChange = swipePercent > SWIPE_THRESHOLD || Math.abs(velocityX) > VELOCITY_THRESHOLD;
490
- const direction = swipeOffset > 0 ? -1 : 1;
491
-
492
- if (calendarGridElement) {
493
- calendarGridElement.style.boxShadow = '';
494
- }
495
-
496
- if (shouldChange) {
497
- animateMonthChange(direction);
498
- } else {
499
- // Snap back
500
- if (calendarGridElement) {
501
- calendarGridElement.style.transition = 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
502
- calendarGridElement.style.transform = 'translateX(0)';
503
-
504
- setTimeout(() => {
505
- if (calendarGridElement) {
506
- calendarGridElement.style.transition = '';
507
- calendarGridElement.style.transform = '';
508
- }
509
- }, 300);
510
- }
511
- }
512
-
513
- touchStartX = 0;
514
- touchStartY = 0;
515
- isSwiping = false;
516
- swipeOffset = 0;
517
- velocityX = 0;
518
- }
519
-
520
- // Mouse handlers for desktop swiping
521
- function handleMouseDown(e) {
522
- if (isAnimating || e.button !== 0) return; // Only left click
523
-
524
- isDragging = false; // Will be set to true on move
525
- touchStartX = e.clientX;
526
- touchStartY = e.clientY;
527
- touchStartTime = Date.now();
528
- lastTouchX = touchStartX;
529
- lastTouchTime = touchStartTime;
530
- velocityX = 0;
531
- isSwiping = false;
532
- swipeOffset = 0;
533
-
534
- // Prevent text selection
535
- e.preventDefault();
536
- }
537
-
538
- function handleMouseMove(e) {
539
- if (!touchStartX || isAnimating) return;
540
-
541
- const mouseCurrentX = e.clientX;
542
- const mouseCurrentY = e.clientY;
543
- const diffX = touchStartX - mouseCurrentX;
544
- const diffY = touchStartY - mouseCurrentY;
545
- const now = Date.now();
546
-
547
- // Detect drag (prevent accidental clicks)
548
- if (!isDragging && Math.abs(diffX) > 5) {
549
- isDragging = true;
550
- }
551
-
552
- if (!isSwiping && Math.abs(diffX) > 10) {
553
- if (Math.abs(diffX) > Math.abs(diffY)) {
554
- isSwiping = true;
555
- } else {
556
- touchStartX = 0;
557
- return;
558
- }
559
- }
560
-
561
- if (isSwiping) {
562
- const dt = now - lastTouchTime;
563
- if (dt > 0) {
564
- velocityX = (lastTouchX - mouseCurrentX) / dt;
565
- }
566
- lastTouchX = mouseCurrentX;
567
- lastTouchTime = now;
568
-
569
- swipeOffset = -diffX * DRAG_RESISTANCE;
570
-
571
- if (calendarGridElement) {
572
- calendarGridElement.style.transform = `translateX(${swipeOffset}px)`;
573
- calendarGridElement.style.transition = 'none';
574
-
575
- // Direction-aware shadow
576
- const shadowIntensity = Math.min(Math.abs(swipeOffset) / 80, 0.4);
577
- const blurRadius = 12 + shadowIntensity * 24;
578
- const spreadRadius = shadowIntensity * 4;
579
-
580
- if (diffX > 0) {
581
- calendarGridElement.style.boxShadow = `-${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
582
- } else {
583
- calendarGridElement.style.boxShadow = `${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
584
- }
585
- }
586
- }
587
- }
588
-
589
- function handleMouseUp() {
590
- if (!touchStartX || isAnimating) {
591
- touchStartX = 0;
592
- touchStartY = 0;
593
- isDragging = false;
594
- return;
595
- }
596
-
597
- if (!isSwiping) {
598
- touchStartX = 0;
599
- touchStartY = 0;
600
- isDragging = false;
601
- return;
602
- }
603
-
604
- const containerWidth = calendarGridElement?.offsetWidth || 320;
605
- const swipePercent = Math.abs(swipeOffset) / containerWidth;
606
- const shouldChange = swipePercent > SWIPE_THRESHOLD || Math.abs(velocityX) > VELOCITY_THRESHOLD;
607
- const direction = swipeOffset > 0 ? -1 : 1;
608
-
609
- if (calendarGridElement) {
610
- calendarGridElement.style.boxShadow = '';
611
- }
612
-
613
- if (shouldChange) {
614
- animateMonthChange(direction);
615
- } else {
616
- // Snap back
617
- if (calendarGridElement) {
618
- calendarGridElement.style.transition = 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
619
- calendarGridElement.style.transform = 'translateX(0)';
620
-
621
- setTimeout(() => {
622
- if (calendarGridElement) {
623
- calendarGridElement.style.transition = '';
624
- calendarGridElement.style.transform = '';
625
- }
626
- }, 300);
627
- }
628
- }
629
-
630
- touchStartX = 0;
631
- touchStartY = 0;
632
- isSwiping = false;
633
- swipeOffset = 0;
634
- velocityX = 0;
635
- isDragging = false;
636
- }
637
-
638
- function handleMouseLeave() {
639
- if (isSwiping) {
640
- handleMouseUp();
641
- }
642
- }
643
-
644
- // Keyboard navigation for accessibility
645
- function handleDayKeydown(event, day) {
646
- if (event.key === 'Enter' || event.key === ' ') {
647
- event.preventDefault();
648
- handleDayClick(day);
649
- }
650
- }
651
-
652
- // Generate accessible label for a day
653
- function getDayAriaLabel(day) {
654
- const date = new Date(currentYear, currentMonth, day.day);
655
- const dateStr = date.toLocaleDateString('en-US', {
656
- weekday: 'long',
657
- month: 'long',
658
- day: 'numeric',
659
- year: 'numeric'
660
- });
661
-
662
- let label = dateStr;
663
- if (day.isToday) label += ', Today';
664
- if (variant === 'availability') {
665
- label += day.isSelected ? ', Available' : ', Not available';
666
- if (!day.isPast) label += '. Press Enter to toggle.';
667
- } else if (day.hasEvents) {
668
- const count = day.events.length;
669
- label += `, ${count} event${count > 1 ? 's' : ''}. Press Enter to view.`;
670
- }
671
- return label;
672
- }
673
- </script>
674
-
675
- <!-- svelte-ignore a11y-no-static-element-interactions -->
676
- <div
677
- class="w-full max-w-full mx-auto overflow-hidden select-none"
678
- class:max-w-xs={variant === 'display'}
679
- on:touchstart={handleTouchStart}
680
- on:touchmove={handleTouchMove}
681
- on:touchend={handleTouchEnd}
682
- on:mousedown={handleMouseDown}
683
- on:mousemove={handleMouseMove}
684
- on:mouseup={handleMouseUp}
685
- on:mouseleave={handleMouseLeave}
686
- >
687
- <!-- Header: Month left, Nav right (like MonthSwitcher) -->
688
- {#if showNavigation}
689
- <header class="flex items-center justify-between mb-4 select-none">
690
- <div class="flex items-center gap-2" bind:this={monthDisplayEl}>
691
- <h2 class="text-3xl font-semibold text-gray-900 dark:text-white leading-tight m-0">{MONTH_NAMES[currentMonth]}</h2>
692
- {#if saveStatus && variant === 'availability'}
693
- <span class="flex items-center justify-center ml-1">
694
- {#if saveStatus === 'saving'}
695
- <Spinner size="sm" color="secondary" />
696
- {:else if saveStatus === 'saved'}
697
- <span class="flex items-center justify-center text-green-600">
698
- <CheckCircleSolid class="w-5 h-5" />
699
- </span>
700
- {/if}
701
- </span>
702
- {/if}
703
- </div>
704
-
705
- <div class="flex items-center gap-2">
706
- <button
707
- class="p-3 -m-1.5 flex items-center justify-center border-0 rounded-full bg-transparent text-gray-500 dark:text-gray-400 cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
708
- class:scale-90={prevPressed}
709
- class:bg-gray-100={prevPressed}
710
- class:dark:bg-gray-700={prevPressed}
711
- on:click={goToPrevMonth}
712
- on:touchstart={() => prevPressed = true}
713
- on:touchend={() => prevPressed = false}
714
- on:touchcancel={() => prevPressed = false}
715
- on:mousedown={() => prevPressed = true}
716
- on:mouseup={() => prevPressed = false}
717
- on:mouseleave={() => prevPressed = false}
718
- disabled={!canGoPrev}
719
- aria-label="Previous month"
720
- >
721
- <ChevronLeftOutline class="w-5 h-5" />
722
- </button>
723
-
724
- {#if showTodayButton}
725
- <button
726
- class="text-sm font-medium px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-lg bg-transparent text-gray-900 dark:text-white cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-blue-700 hover:text-white hover:border-blue-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 disabled:opacity-40 disabled:cursor-not-allowed"
727
- class:scale-95={todayPressed}
728
- class:bg-blue-700={todayPressed}
729
- class:text-white={todayPressed}
730
- on:click={goToToday}
731
- on:touchstart={() => todayPressed = true}
732
- on:touchend={() => todayPressed = false}
733
- on:touchcancel={() => todayPressed = false}
734
- on:mousedown={() => todayPressed = true}
735
- on:mouseup={() => todayPressed = false}
736
- on:mouseleave={() => todayPressed = false}
737
- disabled={isAtCurrentMonth}
738
- aria-label="Go to current month"
739
- >
740
- Today
741
- </button>
742
- {/if}
743
-
744
- <button
745
- class="p-3 -m-1.5 flex items-center justify-center border-0 rounded-full bg-transparent text-gray-500 dark:text-gray-400 cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2"
746
- class:scale-90={nextPressed}
747
- class:bg-gray-100={nextPressed}
748
- class:dark:bg-gray-700={nextPressed}
749
- on:click={goToNextMonth}
750
- on:touchstart={() => nextPressed = true}
751
- on:touchend={() => nextPressed = false}
752
- on:touchcancel={() => nextPressed = false}
753
- on:mousedown={() => nextPressed = true}
754
- on:mouseup={() => nextPressed = false}
755
- on:mouseleave={() => nextPressed = false}
756
- aria-label="Next month"
757
- >
758
- <ChevronRightOutline class="w-5 h-5" />
759
- </button>
760
- </div>
761
- </header>
762
- {/if}
763
-
764
- <!-- Calendar Grid -->
765
- <div class="relative overflow-hidden">
766
- <div
767
- bind:this={calendarGridElement}
768
- class="grid grid-cols-7 gap-0 bg-white dark:bg-gray-800 select-none min-h-[356px] sm:min-h-[388px] md:min-h-[448px] lg:min-h-[508px]"
769
- role="grid"
770
- aria-label="{MONTH_NAMES[currentMonth]} {currentYear}"
771
- >
772
- <!-- Day headers -->
773
- {#each DAY_NAMES as dayName, i}
774
- <div
775
- class="flex items-end justify-center pb-1 text-xs font-normal text-gray-500 dark:text-gray-400 overflow-hidden leading-none sm:pb-2 sm:pt-1 sm:justify-end sm:pr-2 sm:text-lg sm:text-gray-900 sm:dark:text-white sm:border-b sm:border-gray-200 sm:dark:border-gray-700"
776
- role="columnheader"
777
- aria-label={["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][i]}
778
- >
779
- <span class="sm:hidden">{DAY_LETTERS[i]}</span>
780
- <span class="hidden sm:block">{dayName}</span>
781
- </div>
782
- {/each}
783
-
784
- <!-- Previous month preview -->
785
- {#each prevMonthPreviewDays as previewDay}
786
- <div class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] pointer-events-none bg-transparent shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)] sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700 last:sm:border-r" role="gridcell" aria-disabled="true">
787
- <span class="text-sm font-medium text-gray-300 dark:text-gray-600 w-full text-center sm:text-lg sm:font-normal sm:text-right sm:mb-2">{previewDay.day}</span>
788
- </div>
789
- {/each}
790
-
791
- <!-- Current month days -->
792
- {#each daysInMonth as day (day.dateStr)}
793
- <!-- svelte-ignore a11y-no-static-element-interactions -->
794
- <div
795
- class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] select-none
796
- shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)]
797
- sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700
798
- {day.isPast && variant === 'availability' ? 'bg-gray-100 dark:bg-gray-700 cursor-default' : ''}
799
- {day.isPast && day.isSelected && variant === 'availability' ? 'bg-blue-100 dark:bg-blue-900/30 cursor-default' : ''}
800
- {day.isSelected && !day.isPast && variant === 'availability' ? 'bg-blue-700 dark:bg-blue-600' : ''}
801
- {!readOnly && (variant === 'availability' ? !day.isPast : day.hasEvents) ? 'cursor-pointer' : ''}
802
- {variant !== 'availability' && day.hasEvents ? 'bg-blue-50 dark:bg-blue-900/20 sm:bg-transparent sm:dark:bg-transparent' : ''}"
803
- class:last:border-r={true}
804
- role="gridcell"
805
- aria-label={getDayAriaLabel(day)}
806
- aria-selected={day.isSelected}
807
- aria-disabled={variant === 'availability' ? day.isPast : !day.hasEvents}
808
- tabindex={(!readOnly && (variant === 'availability' ? !day.isPast : day.hasEvents)) ? 0 : -1}
809
- on:click={() => handleDayClick(day)}
810
- on:touchend|preventDefault={(e) => handleDayTap(e, day)}
811
- on:keydown={(e) => handleDayKeydown(e, day)}
812
- >
813
- <span class="text-sm font-medium w-full text-center transition-transform duration-100 ease-out sm:text-lg sm:font-normal sm:text-right sm:mb-2
814
- {day.isPast ? 'text-gray-400 dark:text-gray-500' : 'text-gray-900 dark:text-white'}
815
- {day.isSelected && !day.isPast && variant === 'availability' ? 'text-white font-semibold' : ''}">{day.day}</span>
816
- {#if variant !== 'availability' && day.hasEvents}
817
- <div class="flex gap-0.5 mt-0.5">
818
- {#each day.events.slice(0, 3) as _}
819
- <span class="w-1.5 h-1.5 rounded-full bg-blue-600 dark:bg-blue-500 transition-transform duration-150 ease-out hover:scale-125"></span>
820
- {/each}
821
- </div>
822
- {/if}
823
- </div>
824
- {/each}
825
-
826
- <!-- Next month preview -->
827
- {#each nextMonthPreviewDays as previewDay}
828
- <div class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] pointer-events-none bg-transparent shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)] sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700 sm:border-b last:sm:border-r" role="gridcell" aria-disabled="true">
829
- <span class="text-sm font-medium text-gray-300 dark:text-gray-600 w-full text-center sm:text-lg sm:font-normal sm:text-right sm:mb-2">{previewDay.day}</span>
830
- </div>
831
- {/each}
832
- </div>
833
- </div>
834
-
835
- <!-- Legend -->
836
- {#if showLegend && variant === 'availability'}
837
- <div class="flex items-center justify-center gap-6 pt-4">
838
- <div class="flex items-center gap-2">
839
- <span class="w-5 h-5 rounded bg-blue-700 dark:bg-blue-600 border border-blue-700 dark:border-blue-600"></span>
840
- <span class="text-sm text-gray-900 dark:text-white">Available</span>
841
- </div>
842
- <div class="flex items-center gap-2">
843
- <span class="w-5 h-5 rounded bg-gray-50 dark:bg-gray-700 border-2 border-gray-400 dark:border-gray-500"></span>
844
- <span class="text-sm text-gray-900 dark:text-white">Unavailable</span>
845
- </div>
846
- </div>
847
- {/if}
848
- </div>
1
+ <script>
2
+ import { ChevronLeftOutline, ChevronRightOutline, CheckCircleSolid } from '../../primitives/Icons';
3
+ import Spinner from '../../primitives/Spinner/Spinner.svelte';
4
+
5
+ let {
6
+ variant = 'availability',
7
+ selectedDates = $bindable([]),
8
+ events = [],
9
+ saveStatus = '',
10
+ showLegend = true,
11
+ showNavigation = true,
12
+ showTodayButton = true,
13
+ readOnly = false,
14
+ showPartialPreview = true,
15
+ disablePastNavigation = false,
16
+ ondateSelect,
17
+ ondayClick,
18
+ onmonthChange,
19
+ } = $props();
20
+
21
+ let currentDate = new Date();
22
+ let currentYear = $state(currentDate.getFullYear());
23
+ let currentMonth = $state(currentDate.getMonth());
24
+
25
+ let touchStartX = $state(0);
26
+ let touchStartY = $state(0);
27
+ let touchStartTime = $state(0);
28
+ let lastTouchX = $state(0);
29
+ let lastTouchTime = $state(0);
30
+ let velocityX = $state(0);
31
+ let isSwiping = $state(false);
32
+ let isAnimating = $state(false);
33
+ let swipeOffset = $state(0);
34
+ let calendarGridElement = $state();
35
+ let monthDisplayEl = $state();
36
+ let prefersReducedMotion = $state(false);
37
+
38
+ let prevPressed = $state(false);
39
+ let nextPressed = $state(false);
40
+ let todayPressed = $state(false);
41
+
42
+ let momentumAnimationId = null;
43
+ const MOMENTUM_FRICTION = 0.92;
44
+ const MOMENTUM_MIN_VELOCITY = 0.05;
45
+
46
+ const SWIPE_THRESHOLD = 0.15;
47
+ const VELOCITY_THRESHOLD = 0.3;
48
+ const DRAG_RESISTANCE = 0.8;
49
+
50
+ const MONTH_NAMES = [
51
+ "January", "February", "March", "April", "May", "June",
52
+ "July", "August", "September", "October", "November", "December"
53
+ ];
54
+
55
+ const DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
56
+ const DAY_LETTERS = ["S", "M", "T", "W", "T", "F", "S"];
57
+
58
+ const today = new Date();
59
+ const todayLocal = new Date(today.getFullYear(), today.getMonth(), today.getDate());
60
+ const todayLocalMonth = today.getMonth();
61
+ const todayLocalYear = today.getFullYear();
62
+
63
+ let isAtCurrentMonth = $derived(currentYear === todayLocalYear && currentMonth === todayLocalMonth);
64
+ let canGoPrev = $derived(!disablePastNavigation || !isAtCurrentMonth);
65
+
66
+ $effect(() => {
67
+ if (typeof window !== 'undefined') {
68
+ const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
69
+ prefersReducedMotion = mediaQuery.matches;
70
+ const handler = (e) => { prefersReducedMotion = e.matches; };
71
+ mediaQuery.addEventListener('change', handler);
72
+ return () => mediaQuery.removeEventListener('change', handler);
73
+ }
74
+ });
75
+
76
+ function normalizeDate(date) {
77
+ const d = new Date(date);
78
+ const year = d.getFullYear();
79
+ const month = String(d.getMonth() + 1).padStart(2, '0');
80
+ const day = String(d.getDate()).padStart(2, '0');
81
+ return `${year}-${month}-${day}`;
82
+ }
83
+
84
+ function getDaysInMonth(year, month) {
85
+ return new Date(year, month + 1, 0).getDate();
86
+ }
87
+
88
+ function isToday(year, month, day) {
89
+ return (
90
+ year === todayLocal.getFullYear() &&
91
+ month === todayLocal.getMonth() &&
92
+ day === todayLocal.getDate()
93
+ );
94
+ }
95
+
96
+ function isPastDate(year, month, day) {
97
+ const checkDate = new Date(year, month, day);
98
+ return checkDate < todayLocal;
99
+ }
100
+
101
+ function isSelectedDate(dateStr) {
102
+ return selectedDates.includes(dateStr);
103
+ }
104
+
105
+ function hasEventsOnDate(dateStr) {
106
+ return events.some(event => event.date === dateStr);
107
+ }
108
+
109
+ function getEventsForDate(dateStr) {
110
+ return events.filter(event => event.date === dateStr);
111
+ }
112
+
113
+ let daysInMonth = $derived.by(() => {
114
+ const _ = selectedDates;
115
+ const days = getDaysInMonth(currentYear, currentMonth);
116
+ const firstDayOfWeek = new Date(currentYear, currentMonth, 1).getDay();
117
+ const result = [];
118
+
119
+ for (let i = 1; i <= days; i++) {
120
+ const dateStr = normalizeDate(new Date(currentYear, currentMonth, i));
121
+ result.push({
122
+ day: i,
123
+ dateStr,
124
+ startDay: firstDayOfWeek + i - 1,
125
+ isPast: isPastDate(currentYear, currentMonth, i),
126
+ isToday: isToday(currentYear, currentMonth, i),
127
+ isSelected: selectedDates.includes(dateStr),
128
+ hasEvents: hasEventsOnDate(dateStr),
129
+ events: getEventsForDate(dateStr)
130
+ });
131
+ }
132
+ return result;
133
+ });
134
+
135
+ let prevMonthPreviewDays = $derived.by(() => {
136
+ if (!showPartialPreview) return [];
137
+ const firstDayOfWeek = new Date(currentYear, currentMonth, 1).getDay();
138
+ if (firstDayOfWeek === 0) return [];
139
+
140
+ const prevMonth = currentMonth === 0 ? 11 : currentMonth - 1;
141
+ const prevYear = currentMonth === 0 ? currentYear - 1 : currentYear;
142
+ const daysInPrevMonth = getDaysInMonth(prevYear, prevMonth);
143
+
144
+ return Array.from({ length: firstDayOfWeek }, (_, i) => ({
145
+ day: daysInPrevMonth - firstDayOfWeek + i + 1,
146
+ month: prevMonth,
147
+ year: prevYear
148
+ }));
149
+ });
150
+
151
+ let nextMonthPreviewDays = $derived.by(() => {
152
+ if (!showPartialPreview) return [];
153
+ const days = getDaysInMonth(currentYear, currentMonth);
154
+ const lastDayOfWeek = new Date(currentYear, currentMonth, days).getDay();
155
+ if (lastDayOfWeek === 6) return [];
156
+
157
+ const daysToShow = 6 - lastDayOfWeek;
158
+ const nextMonth = currentMonth === 11 ? 0 : currentMonth + 1;
159
+ const nextYear = currentMonth === 11 ? currentYear + 1 : currentYear;
160
+
161
+ return Array.from({ length: daysToShow }, (_, i) => ({
162
+ day: i + 1,
163
+ month: nextMonth,
164
+ year: nextYear
165
+ }));
166
+ });
167
+
168
+ function triggerHaptic(style = 'light') {
169
+ if (typeof window === 'undefined') return;
170
+
171
+ if (window.webkit?.messageHandlers?.haptic) {
172
+ window.webkit.messageHandlers.haptic.postMessage(style);
173
+ return;
174
+ }
175
+
176
+ if (window.TapticEngine) {
177
+ window.TapticEngine.impact({ style });
178
+ return;
179
+ }
180
+
181
+ if (navigator.vibrate) {
182
+ navigator.vibrate(style === 'light' ? 10 : 20);
183
+ }
184
+ }
185
+
186
+ function handleDayTap(e, day) {
187
+ if (isSwiping) return;
188
+ if (readOnly) return;
189
+ if (variant === 'availability' && day.isPast) return;
190
+
191
+ if (variant === 'availability') {
192
+ const isSelected = selectedDates.includes(day.dateStr);
193
+
194
+ if (isSelected) {
195
+ triggerHaptic('medium');
196
+ ondateSelect?.({ date: day.dateStr, selected: false });
197
+ } else {
198
+ triggerHaptic('light');
199
+ ondateSelect?.({ date: day.dateStr, selected: true });
200
+ }
201
+ } else if (variant === 'display' || variant === 'public') {
202
+ if (day.hasEvents) {
203
+ triggerHaptic('light');
204
+ ondayClick?.({ date: day.dateStr, events: day.events });
205
+ }
206
+ }
207
+ }
208
+
209
+ let isDragging = $state(false);
210
+
211
+ function handleDayClick(day) {
212
+ if (isDragging || isSwiping) return;
213
+ if (readOnly) return;
214
+ if (variant === 'availability' && day.isPast) return;
215
+
216
+ if (variant === 'availability') {
217
+ const isSelected = selectedDates.includes(day.dateStr);
218
+
219
+ if (isSelected) {
220
+ triggerHaptic('medium');
221
+ ondateSelect?.({ date: day.dateStr, selected: false });
222
+ } else {
223
+ triggerHaptic('light');
224
+ ondateSelect?.({ date: day.dateStr, selected: true });
225
+ }
226
+ } else if (variant === 'display' || variant === 'public') {
227
+ if (day.hasEvents) {
228
+ triggerHaptic('light');
229
+ ondayClick?.({ date: day.dateStr, events: day.events });
230
+ }
231
+ }
232
+ }
233
+
234
+ function goToPrevMonth() {
235
+ if (isAnimating || !canGoPrev) return;
236
+ triggerHaptic('light');
237
+ animateMonthChange(-1);
238
+ }
239
+
240
+ function goToNextMonth() {
241
+ if (isAnimating) return;
242
+ triggerHaptic('light');
243
+ animateMonthChange(1);
244
+ }
245
+
246
+ function goToToday() {
247
+ if (isAnimating || isAtCurrentMonth) return;
248
+
249
+ const todayYM = today.getFullYear() * 12 + today.getMonth();
250
+ const currentYM = currentYear * 12 + currentMonth;
251
+
252
+ const direction = todayYM > currentYM ? 1 : -1;
253
+ triggerHaptic('light');
254
+ animateMonthChange(direction, () => {
255
+ currentYear = today.getFullYear();
256
+ currentMonth = today.getMonth();
257
+ });
258
+ }
259
+
260
+ function animateMonthChange(direction, customAction = null) {
261
+ if (isAnimating || !calendarGridElement) return;
262
+
263
+ if (prefersReducedMotion) {
264
+ if (customAction) {
265
+ customAction();
266
+ } else if (direction > 0) {
267
+ if (currentMonth === 11) {
268
+ currentMonth = 0;
269
+ currentYear++;
270
+ } else {
271
+ currentMonth++;
272
+ }
273
+ } else {
274
+ if (currentMonth === 0) {
275
+ currentMonth = 11;
276
+ currentYear--;
277
+ } else {
278
+ currentMonth--;
279
+ }
280
+ }
281
+ triggerHaptic('medium');
282
+ onmonthChange?.({ year: currentYear, month: currentMonth });
283
+ return;
284
+ }
285
+
286
+ isAnimating = true;
287
+ const containerWidth = calendarGridElement.offsetWidth || 320;
288
+
289
+ const clone = calendarGridElement.cloneNode(true);
290
+ clone.classList.add('calendar-clone');
291
+ clone.style.position = 'absolute';
292
+ clone.style.top = '0';
293
+ clone.style.left = '0';
294
+ clone.style.width = '100%';
295
+ clone.style.transform = swipeOffset ? `translateX(${swipeOffset}px)` : 'translateX(0)';
296
+ clone.style.transition = 'none';
297
+ clone.style.pointerEvents = 'none';
298
+ clone.style.zIndex = '1';
299
+
300
+ const slideContainer = calendarGridElement.parentElement;
301
+ slideContainer.style.position = 'relative';
302
+ slideContainer.style.overflow = 'hidden';
303
+ slideContainer.insertBefore(clone, calendarGridElement);
304
+
305
+ if (customAction) {
306
+ customAction();
307
+ } else if (direction > 0) {
308
+ if (currentMonth === 11) {
309
+ currentMonth = 0;
310
+ currentYear++;
311
+ } else {
312
+ currentMonth++;
313
+ }
314
+ } else {
315
+ if (currentMonth === 0) {
316
+ currentMonth = 11;
317
+ currentYear--;
318
+ } else {
319
+ currentMonth--;
320
+ }
321
+ }
322
+
323
+ triggerHaptic('medium');
324
+ onmonthChange?.({ year: currentYear, month: currentMonth });
325
+
326
+ const enterFrom = direction > 0 ? containerWidth : -containerWidth;
327
+ calendarGridElement.style.transition = 'none';
328
+ calendarGridElement.style.transform = `translateX(${enterFrom}px)`;
329
+ calendarGridElement.offsetHeight;
330
+
331
+ const duration = 0.3;
332
+ const easing = 'cubic-bezier(0.25, 0.46, 0.45, 0.94)';
333
+
334
+ clone.style.transition = `transform ${duration}s ${easing}`;
335
+ clone.style.transform = `translateX(${direction > 0 ? -containerWidth : containerWidth}px)`;
336
+
337
+ calendarGridElement.style.transition = `transform ${duration}s ${easing}`;
338
+ calendarGridElement.style.transform = 'translateX(0)';
339
+
340
+ if (monthDisplayEl) {
341
+ monthDisplayEl.style.transition = 'none';
342
+ monthDisplayEl.style.transform = `translateX(${enterFrom * 0.3}px)`;
343
+ monthDisplayEl.style.opacity = '0';
344
+ monthDisplayEl.offsetHeight;
345
+ monthDisplayEl.style.transition = `transform ${duration}s ${easing}, opacity ${duration}s ${easing}`;
346
+ monthDisplayEl.style.transform = 'translateX(0)';
347
+ monthDisplayEl.style.opacity = '1';
348
+ }
349
+
350
+ setTimeout(() => {
351
+ if (clone.parentElement) clone.remove();
352
+ if (calendarGridElement) {
353
+ calendarGridElement.style.transition = '';
354
+ calendarGridElement.style.transform = '';
355
+ }
356
+ if (monthDisplayEl) {
357
+ monthDisplayEl.style.transition = '';
358
+ monthDisplayEl.style.transform = '';
359
+ monthDisplayEl.style.opacity = '';
360
+ }
361
+ isAnimating = false;
362
+ swipeOffset = 0;
363
+ }, duration * 1000 + 50);
364
+ }
365
+
366
+ function handleTouchStart(e) {
367
+ if (isAnimating) return;
368
+
369
+ touchStartX = e.touches[0].clientX;
370
+ touchStartY = e.touches[0].clientY;
371
+ touchStartTime = Date.now();
372
+ lastTouchX = touchStartX;
373
+ lastTouchTime = touchStartTime;
374
+ velocityX = 0;
375
+ isSwiping = false;
376
+ isDragging = false;
377
+ swipeOffset = 0;
378
+ }
379
+
380
+ function handleTouchMove(e) {
381
+ if (!touchStartX || isAnimating) return;
382
+
383
+ const touchCurrentX = e.touches[0].clientX;
384
+ const touchCurrentY = e.touches[0].clientY;
385
+ const diffX = touchStartX - touchCurrentX;
386
+ const diffY = touchStartY - touchCurrentY;
387
+ const now = Date.now();
388
+
389
+ if (!isSwiping && Math.abs(diffX) > 10) {
390
+ if (Math.abs(diffX) > Math.abs(diffY)) {
391
+ isSwiping = true;
392
+ } else {
393
+ touchStartX = 0;
394
+ return;
395
+ }
396
+ }
397
+
398
+ if (isSwiping) {
399
+ e.preventDefault();
400
+
401
+ const dt = now - lastTouchTime;
402
+ if (dt > 0) {
403
+ velocityX = (lastTouchX - touchCurrentX) / dt;
404
+ }
405
+ lastTouchX = touchCurrentX;
406
+ lastTouchTime = now;
407
+
408
+ swipeOffset = -diffX * DRAG_RESISTANCE;
409
+
410
+ if (calendarGridElement) {
411
+ calendarGridElement.style.transform = `translateX(${swipeOffset}px)`;
412
+ calendarGridElement.style.transition = 'none';
413
+
414
+ const shadowIntensity = Math.min(Math.abs(swipeOffset) / 80, 0.4);
415
+ const blurRadius = 12 + shadowIntensity * 24;
416
+ const spreadRadius = shadowIntensity * 4;
417
+
418
+ if (diffX > 0) {
419
+ calendarGridElement.style.boxShadow = `-${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
420
+ } else {
421
+ calendarGridElement.style.boxShadow = `${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
422
+ }
423
+ }
424
+ }
425
+ }
426
+
427
+ function handleTouchEnd() {
428
+ if (!touchStartX || !isSwiping || isAnimating) {
429
+ touchStartX = 0;
430
+ touchStartY = 0;
431
+ isSwiping = false;
432
+ return;
433
+ }
434
+
435
+ const containerWidth = calendarGridElement?.offsetWidth || 320;
436
+ const swipePercent = Math.abs(swipeOffset) / containerWidth;
437
+ const shouldChange = swipePercent > SWIPE_THRESHOLD || Math.abs(velocityX) > VELOCITY_THRESHOLD;
438
+ const direction = swipeOffset > 0 ? -1 : 1;
439
+
440
+ if (calendarGridElement) {
441
+ calendarGridElement.style.boxShadow = '';
442
+ }
443
+
444
+ if (shouldChange) {
445
+ animateMonthChange(direction);
446
+ } else {
447
+ if (calendarGridElement) {
448
+ calendarGridElement.style.transition = 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
449
+ calendarGridElement.style.transform = 'translateX(0)';
450
+
451
+ setTimeout(() => {
452
+ if (calendarGridElement) {
453
+ calendarGridElement.style.transition = '';
454
+ calendarGridElement.style.transform = '';
455
+ }
456
+ }, 300);
457
+ }
458
+ }
459
+
460
+ touchStartX = 0;
461
+ touchStartY = 0;
462
+ isSwiping = false;
463
+ swipeOffset = 0;
464
+ velocityX = 0;
465
+ }
466
+
467
+ function handleMouseDown(e) {
468
+ if (isAnimating || e.button !== 0) return;
469
+
470
+ isDragging = false;
471
+ touchStartX = e.clientX;
472
+ touchStartY = e.clientY;
473
+ touchStartTime = Date.now();
474
+ lastTouchX = touchStartX;
475
+ lastTouchTime = touchStartTime;
476
+ velocityX = 0;
477
+ isSwiping = false;
478
+ swipeOffset = 0;
479
+
480
+ e.preventDefault();
481
+ }
482
+
483
+ function handleMouseMove(e) {
484
+ if (!touchStartX || isAnimating) return;
485
+
486
+ const mouseCurrentX = e.clientX;
487
+ const mouseCurrentY = e.clientY;
488
+ const diffX = touchStartX - mouseCurrentX;
489
+ const diffY = touchStartY - mouseCurrentY;
490
+ const now = Date.now();
491
+
492
+ if (!isDragging && Math.abs(diffX) > 5) {
493
+ isDragging = true;
494
+ }
495
+
496
+ if (!isSwiping && Math.abs(diffX) > 10) {
497
+ if (Math.abs(diffX) > Math.abs(diffY)) {
498
+ isSwiping = true;
499
+ } else {
500
+ touchStartX = 0;
501
+ return;
502
+ }
503
+ }
504
+
505
+ if (isSwiping) {
506
+ const dt = now - lastTouchTime;
507
+ if (dt > 0) {
508
+ velocityX = (lastTouchX - mouseCurrentX) / dt;
509
+ }
510
+ lastTouchX = mouseCurrentX;
511
+ lastTouchTime = now;
512
+
513
+ swipeOffset = -diffX * DRAG_RESISTANCE;
514
+
515
+ if (calendarGridElement) {
516
+ calendarGridElement.style.transform = `translateX(${swipeOffset}px)`;
517
+ calendarGridElement.style.transition = 'none';
518
+
519
+ const shadowIntensity = Math.min(Math.abs(swipeOffset) / 80, 0.4);
520
+ const blurRadius = 12 + shadowIntensity * 24;
521
+ const spreadRadius = shadowIntensity * 4;
522
+
523
+ if (diffX > 0) {
524
+ calendarGridElement.style.boxShadow = `-${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
525
+ } else {
526
+ calendarGridElement.style.boxShadow = `${spreadRadius}px 0 ${blurRadius}px rgba(0,0,0,${shadowIntensity})`;
527
+ }
528
+ }
529
+ }
530
+ }
531
+
532
+ function handleMouseUp() {
533
+ if (!touchStartX || isAnimating) {
534
+ touchStartX = 0;
535
+ touchStartY = 0;
536
+ isDragging = false;
537
+ return;
538
+ }
539
+
540
+ if (!isSwiping) {
541
+ touchStartX = 0;
542
+ touchStartY = 0;
543
+ isDragging = false;
544
+ return;
545
+ }
546
+
547
+ const containerWidth = calendarGridElement?.offsetWidth || 320;
548
+ const swipePercent = Math.abs(swipeOffset) / containerWidth;
549
+ const shouldChange = swipePercent > SWIPE_THRESHOLD || Math.abs(velocityX) > VELOCITY_THRESHOLD;
550
+ const direction = swipeOffset > 0 ? -1 : 1;
551
+
552
+ if (calendarGridElement) {
553
+ calendarGridElement.style.boxShadow = '';
554
+ }
555
+
556
+ if (shouldChange) {
557
+ animateMonthChange(direction);
558
+ } else {
559
+ if (calendarGridElement) {
560
+ calendarGridElement.style.transition = 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
561
+ calendarGridElement.style.transform = 'translateX(0)';
562
+
563
+ setTimeout(() => {
564
+ if (calendarGridElement) {
565
+ calendarGridElement.style.transition = '';
566
+ calendarGridElement.style.transform = '';
567
+ }
568
+ }, 300);
569
+ }
570
+ }
571
+
572
+ touchStartX = 0;
573
+ touchStartY = 0;
574
+ isSwiping = false;
575
+ swipeOffset = 0;
576
+ velocityX = 0;
577
+ isDragging = false;
578
+ }
579
+
580
+ function handleMouseLeave() {
581
+ if (isSwiping) {
582
+ handleMouseUp();
583
+ }
584
+ }
585
+
586
+ function handleDayKeydown(event, day) {
587
+ if (event.key === 'Enter' || event.key === ' ') {
588
+ event.preventDefault();
589
+ handleDayClick(day);
590
+ }
591
+ }
592
+
593
+ function getDayAriaLabel(day) {
594
+ const date = new Date(currentYear, currentMonth, day.day);
595
+ const dateStr = date.toLocaleDateString('en-US', {
596
+ weekday: 'long',
597
+ month: 'long',
598
+ day: 'numeric',
599
+ year: 'numeric'
600
+ });
601
+
602
+ let label = dateStr;
603
+ if (day.isToday) label += ', Today';
604
+ if (variant === 'availability') {
605
+ label += day.isSelected ? ', Available' : ', Not available';
606
+ if (!day.isPast) label += '. Press Enter to toggle.';
607
+ } else if (day.hasEvents) {
608
+ const count = day.events.length;
609
+ label += `, ${count} event${count > 1 ? 's' : ''}. Press Enter to view.`;
610
+ }
611
+ return label;
612
+ }
613
+ </script>
614
+
615
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
616
+ <div
617
+ class="w-full max-w-full mx-auto overflow-hidden select-none"
618
+ class:max-w-xs={variant === 'display'}
619
+ ontouchstart={handleTouchStart}
620
+ ontouchmove={handleTouchMove}
621
+ ontouchend={handleTouchEnd}
622
+ onmousedown={handleMouseDown}
623
+ onmousemove={handleMouseMove}
624
+ onmouseup={handleMouseUp}
625
+ onmouseleave={handleMouseLeave}
626
+ >
627
+ {#if showNavigation}
628
+ <header class="flex items-center justify-between mb-4 select-none">
629
+ <div class="flex items-center gap-2" bind:this={monthDisplayEl}>
630
+ <h2 class="text-3xl font-semibold text-gray-900 dark:text-white leading-tight m-0">{MONTH_NAMES[currentMonth]}</h2>
631
+ {#if saveStatus && variant === 'availability'}
632
+ <span class="flex items-center justify-center ml-1">
633
+ {#if saveStatus === 'saving'}
634
+ <Spinner size="sm" color="secondary" />
635
+ {:else if saveStatus === 'saved'}
636
+ <span class="flex items-center justify-center text-green-600">
637
+ <CheckCircleSolid class="w-5 h-5" />
638
+ </span>
639
+ {/if}
640
+ </span>
641
+ {/if}
642
+ </div>
643
+
644
+ <div class="flex items-center gap-2">
645
+ <button
646
+ class="p-3 -m-1.5 flex items-center justify-center border-0 rounded-full bg-transparent text-gray-500 dark:text-gray-400 cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
647
+ class:scale-90={prevPressed}
648
+ class:bg-gray-100={prevPressed}
649
+ class:dark:bg-gray-700={prevPressed}
650
+ onclick={goToPrevMonth}
651
+ ontouchstart={() => prevPressed = true}
652
+ ontouchend={() => prevPressed = false}
653
+ ontouchcancel={() => prevPressed = false}
654
+ onmousedown={() => prevPressed = true}
655
+ onmouseup={() => prevPressed = false}
656
+ onmouseleave={() => prevPressed = false}
657
+ disabled={!canGoPrev}
658
+ aria-label="Previous month"
659
+ >
660
+ <ChevronLeftOutline class="w-5 h-5" />
661
+ </button>
662
+
663
+ {#if showTodayButton}
664
+ <button
665
+ class="text-sm font-medium px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-lg bg-transparent text-gray-900 dark:text-white cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-blue-700 hover:text-white hover:border-blue-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 disabled:opacity-40 disabled:cursor-not-allowed"
666
+ class:scale-95={todayPressed}
667
+ class:bg-blue-700={todayPressed}
668
+ class:text-white={todayPressed}
669
+ onclick={goToToday}
670
+ ontouchstart={() => todayPressed = true}
671
+ ontouchend={() => todayPressed = false}
672
+ ontouchcancel={() => todayPressed = false}
673
+ onmousedown={() => todayPressed = true}
674
+ onmouseup={() => todayPressed = false}
675
+ onmouseleave={() => todayPressed = false}
676
+ disabled={isAtCurrentMonth}
677
+ aria-label="Go to current month"
678
+ >
679
+ Today
680
+ </button>
681
+ {/if}
682
+
683
+ <button
684
+ class="p-3 -m-1.5 flex items-center justify-center border-0 rounded-full bg-transparent text-gray-500 dark:text-gray-400 cursor-pointer select-none transition-transform duration-100 ease-out hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2"
685
+ class:scale-90={nextPressed}
686
+ class:bg-gray-100={nextPressed}
687
+ class:dark:bg-gray-700={nextPressed}
688
+ onclick={goToNextMonth}
689
+ ontouchstart={() => nextPressed = true}
690
+ ontouchend={() => nextPressed = false}
691
+ ontouchcancel={() => nextPressed = false}
692
+ onmousedown={() => nextPressed = true}
693
+ onmouseup={() => nextPressed = false}
694
+ onmouseleave={() => nextPressed = false}
695
+ aria-label="Next month"
696
+ >
697
+ <ChevronRightOutline class="w-5 h-5" />
698
+ </button>
699
+ </div>
700
+ </header>
701
+ {/if}
702
+
703
+ <div class="relative overflow-hidden">
704
+ <div
705
+ bind:this={calendarGridElement}
706
+ class="grid grid-cols-7 gap-0 bg-white dark:bg-gray-800 select-none min-h-[356px] sm:min-h-[388px] md:min-h-[448px] lg:min-h-[508px]"
707
+ role="grid"
708
+ aria-label="{MONTH_NAMES[currentMonth]} {currentYear}"
709
+ >
710
+ {#each DAY_NAMES as dayName, i}
711
+ <div
712
+ class="flex items-end justify-center pb-1 text-xs font-normal text-gray-500 dark:text-gray-400 overflow-hidden leading-none sm:pb-2 sm:pt-1 sm:justify-end sm:pr-2 sm:text-lg sm:text-gray-900 sm:dark:text-white sm:border-b sm:border-gray-200 sm:dark:border-gray-700"
713
+ role="columnheader"
714
+ aria-label={["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][i]}
715
+ >
716
+ <span class="sm:hidden">{DAY_LETTERS[i]}</span>
717
+ <span class="hidden sm:block">{dayName}</span>
718
+ </div>
719
+ {/each}
720
+
721
+ {#each prevMonthPreviewDays as previewDay}
722
+ <div class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] pointer-events-none bg-transparent shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)] sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700 last:sm:border-r" role="gridcell" aria-disabled="true">
723
+ <span class="text-sm font-medium text-gray-300 dark:text-gray-600 w-full text-center sm:text-lg sm:font-normal sm:text-right sm:mb-2">{previewDay.day}</span>
724
+ </div>
725
+ {/each}
726
+
727
+ {#each daysInMonth as day (day.dateStr)}
728
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
729
+ <div
730
+ class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] select-none
731
+ shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)]
732
+ sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700
733
+ {day.isPast && variant === 'availability' ? 'bg-gray-100 dark:bg-gray-700 cursor-default' : ''}
734
+ {day.isPast && day.isSelected && variant === 'availability' ? 'bg-blue-100 dark:bg-blue-900/30 cursor-default' : ''}
735
+ {day.isSelected && !day.isPast && variant === 'availability' ? 'bg-blue-700 dark:bg-blue-600' : ''}
736
+ {!readOnly && (variant === 'availability' ? !day.isPast : day.hasEvents) ? 'cursor-pointer' : ''}
737
+ {variant !== 'availability' && day.hasEvents ? 'bg-blue-50 dark:bg-blue-900/20 sm:bg-transparent sm:dark:bg-transparent' : ''}"
738
+ class:last:border-r={true}
739
+ role="gridcell"
740
+ aria-label={getDayAriaLabel(day)}
741
+ aria-selected={day.isSelected}
742
+ aria-disabled={variant === 'availability' ? day.isPast : !day.hasEvents}
743
+ tabindex={(!readOnly && (variant === 'availability' ? !day.isPast : day.hasEvents)) ? 0 : -1}
744
+ onclick={() => handleDayClick(day)}
745
+ ontouchend={(e) => { e.preventDefault(); handleDayTap(e, day); }}
746
+ onkeydown={(e) => handleDayKeydown(e, day)}
747
+ >
748
+ <span class="text-sm font-medium w-full text-center transition-transform duration-100 ease-out sm:text-lg sm:font-normal sm:text-right sm:mb-2
749
+ {day.isPast ? 'text-gray-400 dark:text-gray-500' : 'text-gray-900 dark:text-white'}
750
+ {day.isSelected && !day.isPast && variant === 'availability' ? 'text-white font-semibold' : ''}">{day.day}</span>
751
+ {#if variant !== 'availability' && day.hasEvents}
752
+ <div class="flex gap-0.5 mt-0.5">
753
+ {#each day.events.slice(0, 3) as _}
754
+ <span class="w-1.5 h-1.5 rounded-full bg-blue-600 dark:bg-blue-500 transition-transform duration-150 ease-out hover:scale-125"></span>
755
+ {/each}
756
+ </div>
757
+ {/if}
758
+ </div>
759
+ {/each}
760
+
761
+ {#each nextMonthPreviewDays as previewDay}
762
+ <div class="flex flex-col items-center justify-start px-1 py-0.5 min-h-[56px] sm:min-h-[60px] md:min-h-[70px] lg:min-h-[80px] pointer-events-none bg-transparent shadow-[inset_0_-1px_0_0_rgb(229_231_235)] dark:shadow-[inset_0_-1px_0_0_rgb(55_65_81)] sm:shadow-none sm:p-2 sm:border-t sm:border-l sm:border-gray-200 sm:dark:border-gray-700 sm:border-b last:sm:border-r" role="gridcell" aria-disabled="true">
763
+ <span class="text-sm font-medium text-gray-300 dark:text-gray-600 w-full text-center sm:text-lg sm:font-normal sm:text-right sm:mb-2">{previewDay.day}</span>
764
+ </div>
765
+ {/each}
766
+ </div>
767
+ </div>
768
+
769
+ {#if showLegend && variant === 'availability'}
770
+ <div class="flex items-center justify-center gap-6 pt-4">
771
+ <div class="flex items-center gap-2">
772
+ <span class="w-5 h-5 rounded bg-blue-700 dark:bg-blue-600 border border-blue-700 dark:border-blue-600"></span>
773
+ <span class="text-sm text-gray-900 dark:text-white">Available</span>
774
+ </div>
775
+ <div class="flex items-center gap-2">
776
+ <span class="w-5 h-5 rounded bg-gray-50 dark:bg-gray-700 border-2 border-gray-400 dark:border-gray-500"></span>
777
+ <span class="text-sm text-gray-900 dark:text-white">Unavailable</span>
778
+ </div>
779
+ </div>
780
+ {/if}
781
+ </div>