@ankhorage/zora 27.5.3 → 27.6.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 (276) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +13 -1
  4. package/dist/capabilities/index.js.map +5 -4
  5. package/dist/features/calendar/adapters/inbound/Calendar.d.ts +5 -0
  6. package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -0
  7. package/dist/features/calendar/adapters/inbound/Calendar.js +126 -0
  8. package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -0
  9. package/dist/features/calendar/application/createCalendarMonth.d.ts +9 -0
  10. package/dist/features/calendar/application/createCalendarMonth.d.ts.map +1 -0
  11. package/dist/features/calendar/application/createCalendarMonth.js +25 -0
  12. package/dist/features/calendar/application/createCalendarMonth.js.map +1 -0
  13. package/dist/features/calendar/application/isCalendarDateDisabled.d.ts +10 -0
  14. package/dist/features/calendar/application/isCalendarDateDisabled.d.ts.map +1 -0
  15. package/dist/features/calendar/application/isCalendarDateDisabled.js +23 -0
  16. package/dist/features/calendar/application/isCalendarDateDisabled.js.map +1 -0
  17. package/dist/features/calendar/calendarMeta.d.ts +10 -0
  18. package/dist/features/calendar/calendarMeta.d.ts.map +1 -0
  19. package/dist/features/calendar/calendarMeta.js +10 -0
  20. package/dist/features/calendar/calendarMeta.js.map +1 -0
  21. package/dist/features/calendar/public.d.ts +2 -0
  22. package/dist/features/calendar/public.d.ts.map +1 -1
  23. package/dist/features/calendar/public.js +1 -1
  24. package/dist/features/calendar/public.js.map +1 -1
  25. package/dist/features/data-table/adapters/inbound/DataTable.d.ts +1 -1
  26. package/dist/features/data-table/adapters/inbound/DataTable.d.ts.map +1 -1
  27. package/dist/features/data-table/adapters/inbound/DataTable.js +82 -23
  28. package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
  29. package/dist/features/date-picker/composition/DatePickerContent.d.ts +1 -1
  30. package/dist/features/date-picker/composition/DatePickerContent.d.ts.map +1 -1
  31. package/dist/features/date-picker/composition/DatePickerContent.js +5 -104
  32. package/dist/features/date-picker/composition/DatePickerContent.js.map +1 -1
  33. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js +7 -2
  34. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js.map +1 -1
  35. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
  36. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +27 -4
  37. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
  38. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.d.ts.map +1 -1
  39. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js +18 -6
  40. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js.map +1 -1
  41. package/dist/features/grid-view/adapters/inbound/GridView.d.ts +1 -1
  42. package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
  43. package/dist/features/grid-view/adapters/inbound/GridView.js +6 -5
  44. package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
  45. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
  46. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +2 -0
  47. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
  48. package/dist/features/registry/componentMeta.d.ts.map +1 -1
  49. package/dist/features/registry/componentMeta.js +2 -0
  50. package/dist/features/registry/componentMeta.js.map +1 -1
  51. package/dist/features/timeline/adapters/inbound/Timeline.d.ts.map +1 -1
  52. package/dist/features/timeline/adapters/inbound/Timeline.js +17 -11
  53. package/dist/features/timeline/adapters/inbound/Timeline.js.map +1 -1
  54. package/dist/readerFree.d.ts +1 -0
  55. package/dist/readerFree.d.ts.map +1 -1
  56. package/dist/readerFree.js +1 -0
  57. package/dist/readerFree.js.map +1 -1
  58. package/dist/types/calendar.d.ts +24 -0
  59. package/dist/types/calendar.d.ts.map +1 -0
  60. package/dist/types/calendar.js +2 -0
  61. package/dist/types/calendar.js.map +1 -0
  62. package/dist/types/data-table.d.ts +4 -0
  63. package/dist/types/data-table.d.ts.map +1 -1
  64. package/dist/types/data-table.js.map +1 -1
  65. package/dist/types/grid-view.d.ts +2 -0
  66. package/dist/types/grid-view.d.ts.map +1 -1
  67. package/dist/types/grid-view.js.map +1 -1
  68. package/dist/types/timeline.d.ts +3 -0
  69. package/dist/types/timeline.d.ts.map +1 -1
  70. package/dist/types/timeline.js.map +1 -1
  71. package/package.json +2 -2
  72. package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +115 -0
  73. package/src/features/calendar/adapters/inbound/Calendar.tsx +219 -0
  74. package/src/features/calendar/application/createCalendarMonth.test.ts +23 -0
  75. package/src/features/calendar/application/createCalendarMonth.ts +38 -0
  76. package/src/features/calendar/application/isCalendarDateDisabled.test.ts +49 -0
  77. package/src/features/calendar/application/isCalendarDateDisabled.ts +41 -0
  78. package/src/features/calendar/calendarMeta.ts +11 -0
  79. package/src/features/calendar/public.test.ts +14 -0
  80. package/src/features/calendar/public.ts +7 -0
  81. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +242 -0
  82. package/src/features/data-table/adapters/inbound/DataTable.tsx +162 -38
  83. package/src/features/date-picker/composition/DatePickerContent.tsx +8 -192
  84. package/src/features/date-picker/public.test.ts +2 -1
  85. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts +9 -2
  86. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +210 -4
  87. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +36 -3
  88. package/src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.test.ts +33 -0
  89. package/src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.ts +19 -5
  90. package/src/features/grid-view/adapters/inbound/GridView.tsx +6 -4
  91. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
  92. package/src/features/registry/componentMeta.ts +2 -0
  93. package/src/features/timeline/adapters/inbound/Timeline.test.tsx +175 -0
  94. package/src/features/timeline/adapters/inbound/Timeline.tsx +47 -26
  95. package/src/readerFree.ts +7 -0
  96. package/src/types/calendar.ts +25 -0
  97. package/src/types/data-table.ts +4 -0
  98. package/src/types/grid-view.ts +2 -0
  99. package/src/types/timeline.ts +3 -0
  100. package/web-dist/chunks/{Accordion-k81eyekh.js → Accordion-0j4xzcwz.js} +2 -2
  101. package/web-dist/chunks/{Accordion-5f9e10c6.js → Accordion-252dr90x.js} +1 -1
  102. package/web-dist/chunks/{Accordion-0pryvztw.js → Accordion-260pyaxy.js} +1 -1
  103. package/web-dist/chunks/{Accordion-g9hn7fht.js → Accordion-4c7hqeg3.js} +1 -1
  104. package/web-dist/chunks/{Accordion-0z8nry94.js → Accordion-4kmh6s2k.js} +1 -1
  105. package/web-dist/chunks/{Accordion-g758dqfc.js → Accordion-5pbvgvqc.js} +1 -1
  106. package/web-dist/chunks/{Accordion-jp5xt2kz.js → Accordion-5z8pbn4z.js} +1 -1
  107. package/web-dist/chunks/{Accordion-qzx53csd.js → Accordion-6jsea4e0.js} +4 -4
  108. package/web-dist/chunks/{Accordion-yd025qec.js → Accordion-7788ybcs.js} +2 -2
  109. package/web-dist/chunks/{Accordion-ppksc4jh.js → Accordion-7mnan4q4.js} +4 -4
  110. package/web-dist/chunks/{Accordion-0pm8dvcy.js → Accordion-8j7t77tf.js} +2 -2
  111. package/web-dist/chunks/{Accordion-6tesp7jr.js → Accordion-c44m1q0m.js} +1 -1
  112. package/web-dist/chunks/{Accordion-a6h4ff7g.js → Accordion-f2n2zz1x.js} +2 -2
  113. package/web-dist/chunks/{Accordion-ep9xpmbw.js → Accordion-fbehwpr1.js} +3 -3
  114. package/web-dist/chunks/{Accordion-j09h3pg1.js → Accordion-hf4nfkn0.js} +7 -7
  115. package/web-dist/chunks/{Accordion-xr81ntxh.js → Accordion-hh48jjhk.js} +4 -4
  116. package/web-dist/chunks/{Accordion-3qz6s2z9.js → Accordion-j6bs1yfn.js} +1 -1
  117. package/web-dist/chunks/{Accordion-dnpfe329.js → Accordion-jh94mg56.js} +3 -3
  118. package/web-dist/chunks/{Accordion-6c2ykyad.js → Accordion-jx9tc6p1.js} +2 -2
  119. package/web-dist/chunks/{Accordion-8xgdw6ry.js → Accordion-kcca65d8.js} +1 -1
  120. package/web-dist/chunks/{Accordion-g009pehq.js → Accordion-m3xb7z7j.js} +3 -3
  121. package/web-dist/chunks/{Accordion-eqkmzs33.js → Accordion-mpebzjby.js} +1 -1
  122. package/web-dist/chunks/{Accordion-n29svm40.js → Accordion-ms1y70gq.js} +1 -1
  123. package/web-dist/chunks/{Accordion-t0k1cjca.js → Accordion-neg1cgeh.js} +7 -5
  124. package/web-dist/chunks/{Accordion-wfrt39d2.js → Accordion-nnhznqgf.js} +1 -1
  125. package/web-dist/chunks/{Accordion-cqdfhyr9.js → Accordion-np16p9mh.js} +1 -1
  126. package/web-dist/chunks/{Accordion-zjygy6n2.js → Accordion-p2f0e4pn.js} +3 -3
  127. package/web-dist/chunks/{Accordion-q1vqpaw6.js → Accordion-p7mxkxhs.js} +4 -4
  128. package/web-dist/chunks/{Accordion-d6f4vr6s.js → Accordion-r6zvzrkd.js} +1 -1
  129. package/web-dist/chunks/Accordion-r86ce0wj.js +237 -0
  130. package/web-dist/chunks/{Accordion-b8659jt9.js → Accordion-rwc34cn2.js} +1 -1
  131. package/web-dist/chunks/{Accordion-rcff84ws.js → Accordion-s9nbkzky.js} +1 -1
  132. package/web-dist/chunks/{Accordion-01s50nga.js → Accordion-sxzts6bj.js} +1 -1
  133. package/web-dist/chunks/{Accordion-36nt5xmp.js → Accordion-t2cvrn0r.js} +4 -4
  134. package/web-dist/chunks/{Accordion-y5kdx80m.js → Accordion-tnt1txfq.js} +3 -3
  135. package/web-dist/chunks/{Accordion-bj7hv2dq.js → Accordion-vq8zrnwh.js} +1 -1
  136. package/web-dist/chunks/{Accordion-hh6jrz1e.js → Accordion-w0prbwy0.js} +4 -4
  137. package/web-dist/chunks/{Accordion-zqzqg9yc.js → Accordion-wvghkwxx.js} +6 -6
  138. package/web-dist/chunks/{Accordion-cp82h5jx.js → Accordion-wx0jp5cn.js} +4 -4
  139. package/web-dist/chunks/{Accordion-bwp6m0zd.js → Accordion-yb4as6wc.js} +2 -2
  140. package/web-dist/chunks/{Accordion-e9c80kn7.js → Accordion-yrzm02g2.js} +2 -2
  141. package/web-dist/components/accordion/Accordion.js +3 -3
  142. package/web-dist/components/accordion-item/AccordionItem.js +3 -3
  143. package/web-dist/components/app-bar/AppBar.js +8 -8
  144. package/web-dist/components/app-header/AppHeader.js +8 -8
  145. package/web-dist/components/app-shell/AppShell.js +2 -2
  146. package/web-dist/components/auth-screen/AuthScreen.js +12 -12
  147. package/web-dist/components/avatar/Avatar.js +3 -3
  148. package/web-dist/components/avatar-group/AvatarGroup.js +3 -3
  149. package/web-dist/components/badge/Badge.js +2 -2
  150. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +11 -11
  151. package/web-dist/components/bottom-sheet/BottomSheet.js +3 -3
  152. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +3 -3
  153. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +3 -3
  154. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +3 -3
  155. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +3 -3
  156. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +3 -3
  157. package/web-dist/components/breadcrumbs/Breadcrumbs.js +5 -5
  158. package/web-dist/components/button/Button.js +5 -5
  159. package/web-dist/components/button-group/ButtonGroup.js +5 -5
  160. package/web-dist/components/calendar/Calendar.d.ts +8 -0
  161. package/web-dist/components/calendar/Calendar.dependency-0.d.ts +27 -0
  162. package/web-dist/components/calendar/Calendar.dependency-1.d.ts +3 -0
  163. package/web-dist/components/calendar/Calendar.js +25 -0
  164. package/web-dist/components/calendar/Calendar.types-0.d.ts +27 -0
  165. package/web-dist/components/calendar/Calendar.types-1.d.ts +146 -0
  166. package/web-dist/components/calendar/index.d.ts +2 -0
  167. package/web-dist/components/calendar/index.js +2 -0
  168. package/web-dist/components/camera-permission-view/CameraPermissionView.js +11 -11
  169. package/web-dist/components/card/Card.js +10 -10
  170. package/web-dist/components/chat-list-item/ChatListItem.js +6 -6
  171. package/web-dist/components/checkbox/Checkbox.js +4 -4
  172. package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
  173. package/web-dist/components/chess-board/ChessBoard.js +2 -2
  174. package/web-dist/components/chip/Chip.js +4 -4
  175. package/web-dist/components/chip-group/ChipGroup.js +4 -4
  176. package/web-dist/components/collection-editor/CollectionEditor.js +10 -10
  177. package/web-dist/components/color-hue-scale/ColorHueScale.js +6 -6
  178. package/web-dist/components/color-picker/ColorPicker.js +6 -6
  179. package/web-dist/components/color-tone/ColorTone.js +6 -6
  180. package/web-dist/components/color-wheel/ColorWheel.js +6 -6
  181. package/web-dist/components/content-rail/ContentRail.js +5 -5
  182. package/web-dist/components/data-table/DataTable.d.ts +1 -1
  183. package/web-dist/components/data-table/DataTable.js +149 -64
  184. package/web-dist/components/data-table/DataTable.types-0.d.ts +4 -0
  185. package/web-dist/components/date-picker/DatePicker.js +19 -160
  186. package/web-dist/components/dialog/Dialog.js +4 -4
  187. package/web-dist/components/divider/Divider.js +2 -2
  188. package/web-dist/components/empty-state/EmptyState.js +11 -11
  189. package/web-dist/components/explorer/Explorer.js +5 -5
  190. package/web-dist/components/field/Field.js +4 -4
  191. package/web-dist/components/file-explorer/FileExplorer.js +5 -5
  192. package/web-dist/components/flat-list/FlatList.js +5 -5
  193. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +12 -12
  194. package/web-dist/components/form/Form.js +8 -8
  195. package/web-dist/components/form-actions/FormActions.js +8 -8
  196. package/web-dist/components/form-error/FormError.js +8 -8
  197. package/web-dist/components/game/Game.js +3 -3
  198. package/web-dist/components/game-entity/GameEntity.js +3 -3
  199. package/web-dist/components/game-field/GameField.js +3 -3
  200. package/web-dist/components/game-input-zone/GameInputZone.js +3 -3
  201. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -3
  202. package/web-dist/components/game-overlay/GameOverlay.js +3 -3
  203. package/web-dist/components/gradient/Gradient.js +3 -3
  204. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -3
  205. package/web-dist/components/graph-view/GraphView.js +34 -11
  206. package/web-dist/components/grid/Grid.js +2 -2
  207. package/web-dist/components/grid-view/GridView.d.ts +1 -1
  208. package/web-dist/components/grid-view/GridView.js +1 -1
  209. package/web-dist/components/grid-view/GridView.types-0.d.ts +2 -0
  210. package/web-dist/components/hero/Hero.js +10 -10
  211. package/web-dist/components/icon-button/IconButton.js +5 -5
  212. package/web-dist/components/image/Image.js +3 -3
  213. package/web-dist/components/list/List.js +5 -5
  214. package/web-dist/components/list-item/ListItem.js +5 -5
  215. package/web-dist/components/list-section/ListSection.js +5 -5
  216. package/web-dist/components/matrix-grid/MatrixGrid.js +1 -1
  217. package/web-dist/components/media-card/MediaCard.js +10 -10
  218. package/web-dist/components/media-explorer/MediaExplorer.js +5 -5
  219. package/web-dist/components/message-bubble/MessageBubble.js +6 -6
  220. package/web-dist/components/metric-card/MetricCard.js +10 -10
  221. package/web-dist/components/missing-element/MissingElement.js +3 -3
  222. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +12 -12
  223. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +12 -12
  224. package/web-dist/components/opening-book/OpeningBook.js +2 -2
  225. package/web-dist/components/otp-form/OtpForm.js +12 -12
  226. package/web-dist/components/pagination/Pagination.js +5 -5
  227. package/web-dist/components/palette-item/PaletteItem.js +10 -10
  228. package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
  229. package/web-dist/components/post-card/PostCard.js +10 -10
  230. package/web-dist/components/product-card/ProductCard.js +10 -10
  231. package/web-dist/components/progress/Progress.js +3 -3
  232. package/web-dist/components/progress-ring/ProgressRing.js +3 -3
  233. package/web-dist/components/radio/Radio.js +4 -4
  234. package/web-dist/components/radio-group/RadioGroup.js +4 -4
  235. package/web-dist/components/rating/Rating.js +2 -2
  236. package/web-dist/components/reader/Reader.js +11 -11
  237. package/web-dist/components/scan-overlay/ScanOverlay.js +11 -11
  238. package/web-dist/components/screen/Screen.js +2 -2
  239. package/web-dist/components/screen-section/ScreenSection.js +3 -3
  240. package/web-dist/components/scroll-view/ScrollView.js +2 -2
  241. package/web-dist/components/search-input/SearchInput.js +6 -6
  242. package/web-dist/components/section-header/SectionHeader.js +3 -3
  243. package/web-dist/components/section-list/SectionList.js +5 -5
  244. package/web-dist/components/select/Select.js +8 -8
  245. package/web-dist/components/sign-in-form/SignInForm.js +12 -12
  246. package/web-dist/components/sign-up-form/SignUpForm.js +12 -12
  247. package/web-dist/components/skeleton/Skeleton.js +13 -13
  248. package/web-dist/components/skeleton-card/SkeletonCard.js +13 -13
  249. package/web-dist/components/skeleton-list/SkeletonList.js +13 -13
  250. package/web-dist/components/skeleton-text/SkeletonText.js +13 -13
  251. package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
  252. package/web-dist/components/surface/Surface.js +3 -3
  253. package/web-dist/components/switch/Switch.js +2 -2
  254. package/web-dist/components/tab/Tab.js +2 -2
  255. package/web-dist/components/tab-list/TabList.js +2 -2
  256. package/web-dist/components/tab-panel/TabPanel.js +2 -2
  257. package/web-dist/components/tabs/Tabs.js +2 -2
  258. package/web-dist/components/text-input/TextInput.js +6 -6
  259. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +5 -5
  260. package/web-dist/components/tile-grid/TileGrid.js +1 -1
  261. package/web-dist/components/time-grid/TimeGrid.js +1 -1
  262. package/web-dist/components/time-picker/TimePicker.js +9 -9
  263. package/web-dist/components/timeline/Timeline.dependency-2.d.ts +8 -2
  264. package/web-dist/components/timeline/Timeline.dependency-3.d.ts +23 -0
  265. package/web-dist/components/timeline/Timeline.dependency-4.d.ts +3 -0
  266. package/web-dist/components/timeline/Timeline.js +30 -11
  267. package/web-dist/components/timeline/Timeline.types-0.d.ts +5 -1
  268. package/web-dist/components/toast/Toast.js +4 -4
  269. package/web-dist/components/toast-provider/ToastProvider.js +4 -4
  270. package/web-dist/components/toolbar/Toolbar.js +10 -10
  271. package/web-dist/components/tree-item/TreeItem.js +7 -7
  272. package/web-dist/components/uploader/Uploader.js +14 -14
  273. package/web-dist/components/view/View.js +2 -2
  274. package/web-dist/manifest.json +720 -673
  275. package/web-dist/runtime/ZoraProvider.js +3 -3
  276. /package/web-dist/chunks/{Accordion-kpk964z0.js → Accordion-a8k3cvj0.js} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "27.5.3",
4
+ "version": "27.6.1",
5
5
  "description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
6
6
  "homepage": "https://github.com/ankhorage/zora#readme",
7
7
  "bugs": {
@@ -168,7 +168,7 @@
168
168
  "version-packages": "ankhorage-changeset version"
169
169
  },
170
170
  "devDependencies": {
171
- "@ankhorage/devtools": "^2.10.7",
171
+ "@ankhorage/devtools": "^2.10.9",
172
172
  "@ankhorage/paradox": "^0.6.0",
173
173
  "@react-native-vector-icons/fontawesome": "^14.0.0",
174
174
  "@react-native-vector-icons/fontawesome5": "^14.0.0",
@@ -0,0 +1,115 @@
1
+ import { join } from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
3
+
4
+ import { expect, test } from 'bun:test';
5
+ import { Window } from 'happy-dom';
6
+ import React, { act } from 'react';
7
+ import { createRoot } from 'react-dom/client';
8
+
9
+ import type { ZoraProvider as ZoraProviderComponent } from '../../../theme/runtime';
10
+ import type { Calendar as CalendarComponent } from './Calendar';
11
+
12
+ const webDistRoot = join(import.meta.dir, '../../../../../web-dist');
13
+
14
+ test('selects adjacent days through the locked GridView in regular and compact calendars', async () => {
15
+ const [{ Calendar }, { ZoraProvider }] = (await Promise.all([
16
+ import(pathToFileURL(join(webDistRoot, 'components', 'calendar', 'index.js')).href),
17
+ import(pathToFileURL(join(webDistRoot, 'runtime/ZoraProvider.js')).href),
18
+ ])) as [{ Calendar: typeof CalendarComponent }, { ZoraProvider: typeof ZoraProviderComponent }];
19
+
20
+ await withBrowserAsync(async (host) => {
21
+ const selections: string[] = [];
22
+ const displayedMonths: string[] = [];
23
+ const root = createRoot(host);
24
+ try {
25
+ await interactAsync(() =>
26
+ root.render(
27
+ <ZoraProvider mode="light">
28
+ <Calendar
29
+ defaultDisplayedMonth={new Date(2024, 1, 1)}
30
+ density="regular"
31
+ onDisplayedMonthChange={(month) => displayedMonths.push(formatDate(month))}
32
+ onSelectedDateChange={(date) => selections.push(formatDate(date))}
33
+ testID="regular-calendar"
34
+ />
35
+ <Calendar
36
+ defaultDisplayedMonth={new Date(2024, 1, 1)}
37
+ density="compact"
38
+ onDisplayedMonthChange={(month) => displayedMonths.push(formatDate(month))}
39
+ onSelectedDateChange={(date) => selections.push(formatDate(date))}
40
+ testID="compact-calendar"
41
+ />
42
+ </ZoraProvider>,
43
+ ),
44
+ );
45
+
46
+ const regularGrid = host.querySelector<HTMLElement>('[data-testid="regular-calendar-grid"]');
47
+ const compactGrid = host.querySelector<HTMLElement>('[data-testid="compact-calendar-grid"]');
48
+ const regularAdjacent = host.querySelector<HTMLButtonElement>(
49
+ '[data-testid="regular-calendar-day-2024-03-01"]',
50
+ );
51
+ const compactAdjacent = host.querySelector<HTMLButtonElement>(
52
+ '[data-testid="compact-calendar-day-2024-03-02"]',
53
+ );
54
+ if (!regularGrid || !compactGrid || !regularAdjacent || !compactAdjacent) {
55
+ throw new Error('Missing Calendar GridView or adjacent month controls');
56
+ }
57
+
58
+ expect(
59
+ regularGrid.querySelector('[data-testid="regular-calendar-day-2024-03-01"]'),
60
+ ).not.toBeNull();
61
+ expect(
62
+ compactGrid.querySelector('[data-testid="compact-calendar-day-2024-03-02"]'),
63
+ ).not.toBeNull();
64
+ expect(regularAdjacent.style.borderWidth).not.toBe('0px');
65
+ expect(compactAdjacent.style.borderWidth).not.toBe('0px');
66
+
67
+ await interactAsync(() => regularAdjacent.click());
68
+ await interactAsync(() => compactAdjacent.click());
69
+
70
+ expect(selections).toEqual(['2024-03-01', '2024-03-02']);
71
+ expect(displayedMonths).toEqual(['2024-03-01', '2024-03-01']);
72
+ } finally {
73
+ await interactAsync(() => root.unmount());
74
+ }
75
+ });
76
+ });
77
+
78
+ /*** Executes a React interaction after the renderer has a chance to flush effects. */
79
+ function interactAsync(action: () => void): Promise<void> {
80
+ return act(() => Promise.resolve().then(action));
81
+ }
82
+
83
+ /*** Formats a local Date for observable Calendar selection assertions. */
84
+ function formatDate(value: Date): string {
85
+ return `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, '0')}-${String(
86
+ value.getDate(),
87
+ ).padStart(2, '0')}`;
88
+ }
89
+
90
+ /*** Mounts an isolated browser surface and restores global DOM bindings after a test. */
91
+ async function withBrowserAsync(testBrowser: (host: HTMLElement) => Promise<void>): Promise<void> {
92
+ const browserWindow = new Window();
93
+ const keys = ['window', 'document', 'Node', 'navigator', 'IS_REACT_ACT_ENVIRONMENT'] as const;
94
+ const previous = keys.map(
95
+ (key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)] as const,
96
+ );
97
+ Object.assign(globalThis, {
98
+ IS_REACT_ACT_ENVIRONMENT: true,
99
+ window: browserWindow,
100
+ document: browserWindow.document,
101
+ Node: browserWindow.Node,
102
+ navigator: browserWindow.navigator,
103
+ });
104
+ const host = document.createElement('div');
105
+ document.body.appendChild(host);
106
+ try {
107
+ await testBrowser(host);
108
+ } finally {
109
+ browserWindow.close();
110
+ for (const [key, descriptor] of previous) {
111
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor);
112
+ else Reflect.deleteProperty(globalThis, key);
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,219 @@
1
+ import type { GridRectItem } from '@ankhorage/grid-view';
2
+ import React from 'react';
3
+
4
+ import type { CalendarProps } from '../../../../types/calendar';
5
+ import { Button } from '../../../button/public';
6
+ import { GridView } from '../../../grid-view/public';
7
+ import { View } from '../../../layout/public';
8
+ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
9
+ import { Text } from '../../../typography/public';
10
+ import { createCalendarMonth } from '../../application/createCalendarMonth';
11
+ import { isCalendarDateDisabled } from '../../application/isCalendarDateDisabled';
12
+
13
+ const GRID_COLUMNS = 7;
14
+ const GRID_ROWS = 6;
15
+
16
+ /*** Renders a locale-aware, accessible month calendar using canonical GridView geometry. */
17
+ export const Calendar = withZoraThemeScope(CalendarInner);
18
+
19
+ /*** Connects controlled Calendar state to the shared month grid presentation. */
20
+ function CalendarInner({
21
+ defaultDisplayedMonth,
22
+ density = 'regular',
23
+ disabledDates = [],
24
+ displayedMonth: controlledDisplayedMonth,
25
+ interactionPolicy,
26
+ isDateDisabled,
27
+ locale,
28
+ maxDate,
29
+ minDate,
30
+ onDisplayedMonthChange,
31
+ onSelectedDateChange,
32
+ selectedDate,
33
+ testID,
34
+ weekStartsOn = 0,
35
+ }: CalendarProps) {
36
+ const [uncontrolledDisplayedMonth, setUncontrolledDisplayedMonth] = React.useState(() =>
37
+ startOfLocalMonth(defaultDisplayedMonth ?? selectedDate ?? minDate ?? new Date()),
38
+ );
39
+ const displayedMonth = startOfLocalMonth(controlledDisplayedMonth ?? uncontrolledDisplayedMonth);
40
+ const cellSize = density === 'compact' ? 42 : 48;
41
+ const gridWidth = cellSize * GRID_COLUMNS;
42
+ const gridHeight = cellSize * GRID_ROWS;
43
+ const cells = React.useMemo(
44
+ () => createCalendarMonth(displayedMonth, weekStartsOn),
45
+ [displayedMonth, weekStartsOn],
46
+ );
47
+ const gridItems = React.useMemo<readonly GridRectItem[]>(
48
+ () =>
49
+ cells.map((cell, index) => ({
50
+ height: cellSize,
51
+ id: cell.id,
52
+ width: cellSize,
53
+ x: (index % GRID_COLUMNS) * cellSize,
54
+ y: Math.floor(index / GRID_COLUMNS) * cellSize,
55
+ })),
56
+ [cellSize, cells],
57
+ );
58
+ const cellsById = React.useMemo(() => new Map(cells.map((cell) => [cell.id, cell])), [cells]);
59
+ const disabledDateIds = React.useMemo(
60
+ () => new Set(disabledDates.map(formatCalendarDate)),
61
+ [disabledDates],
62
+ );
63
+ const weekdays = React.useMemo(
64
+ () => createWeekdayLabels(locale, weekStartsOn),
65
+ [locale, weekStartsOn],
66
+ );
67
+ const setDisplayedMonth = React.useCallback(
68
+ (month: Date) => {
69
+ const nextMonth = startOfLocalMonth(month);
70
+ if (controlledDisplayedMonth === undefined) setUncontrolledDisplayedMonth(nextMonth);
71
+ onDisplayedMonthChange?.(nextMonth);
72
+ },
73
+ [controlledDisplayedMonth, onDisplayedMonthChange],
74
+ );
75
+ const previousMonth = addMonths(displayedMonth, -1);
76
+ const nextMonth = addMonths(displayedMonth, 1);
77
+
78
+ return (
79
+ <View accessibilityLabel="Calendar" gap={density === 'compact' ? 's' : 'm'} testID={testID}>
80
+ <View align="center" direction="row" justify="space-between">
81
+ <Button
82
+ disabled={!monthIntersectsRange(previousMonth, minDate, maxDate)}
83
+ interactionPolicy={interactionPolicy}
84
+ onPress={() => setDisplayedMonth(previousMonth)}
85
+ size="s"
86
+ variant="ghost"
87
+ >
88
+ Previous
89
+ </Button>
90
+ <Text accessibilityRole="header" align="center" variant="label" weight="semiBold">
91
+ {formatMonthLabel(displayedMonth, locale)}
92
+ </Text>
93
+ <Button
94
+ disabled={!monthIntersectsRange(nextMonth, minDate, maxDate)}
95
+ interactionPolicy={interactionPolicy}
96
+ onPress={() => setDisplayedMonth(nextMonth)}
97
+ size="s"
98
+ variant="ghost"
99
+ >
100
+ Next
101
+ </Button>
102
+ </View>
103
+ <View direction="row">
104
+ {weekdays.map((weekday) => (
105
+ <View key={weekday.id} width={cellSize}>
106
+ <Text align="center" emphasis="muted" variant="caption" weight="semiBold">
107
+ {weekday.label}
108
+ </Text>
109
+ </View>
110
+ ))}
111
+ </View>
112
+ <GridView
113
+ contentHeight={gridHeight}
114
+ contentWidth={gridWidth}
115
+ height={gridHeight}
116
+ interactionPolicy={interactionPolicy}
117
+ items={gridItems}
118
+ overscanPixels={0}
119
+ renderItem={(item) => {
120
+ const cell = cellsById.get(item.id);
121
+ if (!cell) return null;
122
+ const selected =
123
+ selectedDate !== null &&
124
+ selectedDate !== undefined &&
125
+ isSameLocalDay(selectedDate, cell.date);
126
+ const disabled = isCalendarDateDisabled({
127
+ date: cell.date,
128
+ disabledDateIds,
129
+ isDateDisabled,
130
+ maxDate,
131
+ minDate,
132
+ });
133
+ const selectCell = () => {
134
+ if (!cell.inDisplayedMonth) setDisplayedMonth(cell.date);
135
+ onSelectedDateChange?.(cell.date);
136
+ };
137
+ return (
138
+ <Button
139
+ accessibilityState={{ disabled, selected }}
140
+ color={selected ? 'primary' : 'neutral'}
141
+ disabled={disabled}
142
+ interactionPolicy={interactionPolicy}
143
+ onPress={selectCell}
144
+ size="s"
145
+ testID={testID ? `${testID}-day-${cell.id}` : undefined}
146
+ variant={selected ? 'solid' : cell.inDisplayedMonth ? 'ghost' : 'outline'}
147
+ >
148
+ {cell.date.getDate()}
149
+ </Button>
150
+ );
151
+ }}
152
+ testID={testID ? `${testID}-grid` : undefined}
153
+ viewportInteraction="locked"
154
+ width={gridWidth}
155
+ />
156
+ </View>
157
+ );
158
+ }
159
+
160
+ /*** Produces the ordered weekday labels for one local calendar week. */
161
+ function createWeekdayLabels(locale: string | undefined, weekStartsOn: number) {
162
+ const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });
163
+ const sunday = new Date(2023, 0, 1);
164
+ return Array.from({ length: GRID_COLUMNS }, (_, index) => {
165
+ const day = new Date(
166
+ sunday.getFullYear(),
167
+ sunday.getMonth(),
168
+ sunday.getDate() + ((weekStartsOn + index) % GRID_COLUMNS),
169
+ );
170
+ return { id: String(index), label: formatter.format(day) };
171
+ });
172
+ }
173
+
174
+ /*** Moves a local month without carrying a day-of-month overflow into the target month. */
175
+ function addMonths(month: Date, count: number): Date {
176
+ return new Date(month.getFullYear(), month.getMonth() + count, 1);
177
+ }
178
+
179
+ /*** Normalizes a value to the first local day of its month. */
180
+ function startOfLocalMonth(value: Date): Date {
181
+ return new Date(value.getFullYear(), value.getMonth(), 1);
182
+ }
183
+
184
+ /*** Formats a Date as a timezone-independent local calendar identifier. */
185
+ function formatCalendarDate(value: Date): string {
186
+ const year = String(value.getFullYear()).padStart(4, '0');
187
+ const month = String(value.getMonth() + 1).padStart(2, '0');
188
+ const day = String(value.getDate()).padStart(2, '0');
189
+ return `${year}-${month}-${day}`;
190
+ }
191
+
192
+ /*** Compares local calendar dates using their canonical date-only identifiers. */
193
+ function compareLocalDates(left: Date, right: Date): number {
194
+ return formatCalendarDate(left).localeCompare(formatCalendarDate(right));
195
+ }
196
+
197
+ /*** Reports whether a candidate month contains at least one date inside the configured range. */
198
+ function monthIntersectsRange(
199
+ month: Date,
200
+ minDate: Date | undefined,
201
+ maxDate: Date | undefined,
202
+ ): boolean {
203
+ const first = startOfLocalMonth(month);
204
+ const last = new Date(first.getFullYear(), first.getMonth() + 1, 0);
205
+ return (
206
+ (!minDate || compareLocalDates(last, minDate) >= 0) &&
207
+ (!maxDate || compareLocalDates(first, maxDate) <= 0)
208
+ );
209
+ }
210
+
211
+ /*** Reports whether two values identify the same local calendar day. */
212
+ function isSameLocalDay(left: Date, right: Date): boolean {
213
+ return formatCalendarDate(left) === formatCalendarDate(right);
214
+ }
215
+
216
+ /*** Formats a display month with the caller's locale. */
217
+ function formatMonthLabel(value: Date, locale: string | undefined): string {
218
+ return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(value);
219
+ }
@@ -0,0 +1,23 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+
3
+ import { createCalendarMonth } from './createCalendarMonth';
4
+
5
+ describe('createCalendarMonth', () => {
6
+ test('creates six complete weeks around a leap-year February with Sunday week start', () => {
7
+ const cells = createCalendarMonth(new Date(2024, 1, 1), 0);
8
+
9
+ expect(cells).toHaveLength(42);
10
+ expect(cells[0]?.id).toBe('2024-01-28');
11
+ expect(cells.find((cell) => cell.id === '2024-02-29')?.inDisplayedMonth).toBe(true);
12
+ expect(cells[41]?.id).toBe('2024-03-09');
13
+ });
14
+
15
+ test('rotates month boundaries for Monday week starts without changing local date IDs', () => {
16
+ const sunday = createCalendarMonth(new Date(2026, 2, 1), 0);
17
+ const monday = createCalendarMonth(new Date(2026, 2, 1), 1);
18
+
19
+ expect(sunday[0]?.id).toBe('2026-03-01');
20
+ expect(monday[0]?.id).toBe('2026-02-23');
21
+ expect(monday.find((cell) => cell.id === '2026-03-01')?.inDisplayedMonth).toBe(true);
22
+ });
23
+ });
@@ -0,0 +1,38 @@
1
+ import type { CalendarWeekStart } from '../../../types/calendar';
2
+
3
+ export type CalendarMonthCell = Readonly<{
4
+ date: Date;
5
+ id: string;
6
+ inDisplayedMonth: boolean;
7
+ }>;
8
+
9
+ /*** Creates the fixed six-week local-date month geometry shared by every Calendar density. */
10
+ export function createCalendarMonth(
11
+ month: Date,
12
+ weekStartsOn: CalendarWeekStart,
13
+ ): readonly CalendarMonthCell[] {
14
+ const firstDay = startOfLocalMonth(month);
15
+ const leadingDays = (firstDay.getDay() - weekStartsOn + 7) % 7;
16
+
17
+ return Array.from({ length: 42 }, (_, index) => {
18
+ const date = new Date(firstDay.getFullYear(), firstDay.getMonth(), index - leadingDays + 1);
19
+ return {
20
+ date,
21
+ id: formatLocalDate(date),
22
+ inDisplayedMonth: date.getMonth() === firstDay.getMonth(),
23
+ };
24
+ });
25
+ }
26
+
27
+ /*** Formats a Date as a timezone-independent local calendar identifier. */
28
+ function formatLocalDate(value: Date): string {
29
+ const year = String(value.getFullYear()).padStart(4, '0');
30
+ const month = String(value.getMonth() + 1).padStart(2, '0');
31
+ const day = String(value.getDate()).padStart(2, '0');
32
+ return `${year}-${month}-${day}`;
33
+ }
34
+
35
+ /*** Normalizes a value to the first local day of its month. */
36
+ function startOfLocalMonth(value: Date): Date {
37
+ return new Date(value.getFullYear(), value.getMonth(), 1);
38
+ }
@@ -0,0 +1,49 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+
3
+ import { isCalendarDateDisabled } from './isCalendarDateDisabled';
4
+
5
+ describe('isCalendarDateDisabled', () => {
6
+ test('applies local-date min/max bounds regardless of time of day', () => {
7
+ expect(
8
+ isCalendarDateDisabled({
9
+ date: new Date(2026, 4, 9, 23),
10
+ disabledDateIds: new Set(),
11
+ isDateDisabled: undefined,
12
+ maxDate: new Date(2026, 4, 20),
13
+ minDate: new Date(2026, 4, 10, 18),
14
+ }),
15
+ ).toBe(true);
16
+ expect(
17
+ isCalendarDateDisabled({
18
+ date: new Date(2026, 4, 20, 1),
19
+ disabledDateIds: new Set(),
20
+ isDateDisabled: undefined,
21
+ maxDate: new Date(2026, 4, 20, 0),
22
+ minDate: new Date(2026, 4, 10),
23
+ }),
24
+ ).toBe(false);
25
+ });
26
+
27
+ test('combines explicit and predicate disabled dates', () => {
28
+ const disabledDateIds = new Set(['2026-05-12']);
29
+
30
+ expect(
31
+ isCalendarDateDisabled({
32
+ date: new Date(2026, 4, 12),
33
+ disabledDateIds,
34
+ isDateDisabled: undefined,
35
+ maxDate: undefined,
36
+ minDate: undefined,
37
+ }),
38
+ ).toBe(true);
39
+ expect(
40
+ isCalendarDateDisabled({
41
+ date: new Date(2026, 4, 13),
42
+ disabledDateIds,
43
+ isDateDisabled: (date) => date.getDay() === 3,
44
+ maxDate: undefined,
45
+ minDate: undefined,
46
+ }),
47
+ ).toBe(true);
48
+ });
49
+ });
@@ -0,0 +1,41 @@
1
+ import type { CalendarProps } from '../../../types/calendar';
2
+
3
+ /*** Resolves whether local-date range and disabled-date policy prevent selecting a calendar day. */
4
+ export function isCalendarDateDisabled({
5
+ date,
6
+ disabledDateIds,
7
+ isDateDisabled,
8
+ maxDate,
9
+ minDate,
10
+ }: {
11
+ date: Date;
12
+ disabledDateIds: ReadonlySet<string>;
13
+ isDateDisabled: CalendarProps['isDateDisabled'];
14
+ maxDate: Date | undefined;
15
+ minDate: Date | undefined;
16
+ }): boolean {
17
+ return (
18
+ (minDate !== undefined && compareLocalDates(date, minDate) < 0) ||
19
+ (maxDate !== undefined && compareLocalDates(date, maxDate) > 0) ||
20
+ disabledDateIds.has(formatCalendarDate(date)) ||
21
+ isDateDisabled?.(date) === true
22
+ );
23
+ }
24
+
25
+ /*** Compares values by local calendar date rather than their instant or time of day. */
26
+ function compareLocalDates(left: Date, right: Date): number {
27
+ return startOfLocalDay(left).getTime() - startOfLocalDay(right).getTime();
28
+ }
29
+
30
+ /*** Removes a time-of-day component while retaining the caller's local calendar date. */
31
+ function startOfLocalDay(value: Date): Date {
32
+ return new Date(value.getFullYear(), value.getMonth(), value.getDate());
33
+ }
34
+
35
+ /*** Formats a Date as a timezone-independent local calendar identifier. */
36
+ function formatCalendarDate(value: Date): string {
37
+ const year = String(value.getFullYear()).padStart(4, '0');
38
+ const month = String(value.getMonth() + 1).padStart(2, '0');
39
+ const day = String(value.getDate()).padStart(2, '0');
40
+ return `${year}-${month}-${day}`;
41
+ }
@@ -0,0 +1,11 @@
1
+ import type { ZoraComponentMeta } from '../../types/authoring';
2
+
3
+ export const calendarMeta = {
4
+ name: 'Calendar',
5
+ category: 'component',
6
+ description: 'Reusable local-date calendar with a month view backed by GridView geometry.',
7
+ directManifestNode: false,
8
+ note: 'Uses Date values and executable change callbacks; available through the public code API.',
9
+ allowedChildren: [],
10
+ props: {},
11
+ } as const satisfies ZoraComponentMeta;
@@ -0,0 +1,14 @@
1
+ import { expect, test } from 'bun:test';
2
+
3
+ import { calendarMeta } from './calendarMeta';
4
+
5
+ test('Calendar publishes one locked GridView month presentation for both densities', async () => {
6
+ const source = await Bun.file('src/features/calendar/adapters/inbound/Calendar.tsx').text();
7
+
8
+ expect(calendarMeta.directManifestNode).toBe(false);
9
+ expect(calendarMeta.description).toContain('GridView');
10
+ expect(source).toContain('<GridView');
11
+ expect(source).toContain('viewportInteraction="locked"');
12
+ expect(source).toContain("density === 'compact' ? 42 : 48");
13
+ expect(source).toContain('onSelectedDateChange?.(cell.date)');
14
+ });
@@ -1,3 +1,9 @@
1
+ export type {
2
+ CalendarDensity,
3
+ CalendarProps,
4
+ CalendarView,
5
+ CalendarWeekStart,
6
+ } from '../../types/calendar';
1
7
  export type {
2
8
  TemporalAllDayEvent,
3
9
  TemporalAllDayRange,
@@ -20,3 +26,4 @@ export type {
20
26
  TemporalTimeZone,
21
27
  TemporalTone,
22
28
  } from '../../types/temporal';
29
+ export { Calendar } from './adapters/inbound/Calendar';