@zealakit/chrono-react 0.0.0-stage → 1.0.0-beta.2

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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +625 -2
  3. package/dist/calendar/components.d.ts +346 -0
  4. package/dist/calendar/components.js +243 -0
  5. package/dist/calendar/context.d.ts +636 -0
  6. package/dist/calendar/context.js +21 -0
  7. package/dist/calendar/index.d.ts +6 -0
  8. package/dist/calendar/index.js +6 -0
  9. package/dist/calendar/mini-calendar.d.ts +60 -0
  10. package/dist/calendar/mini-calendar.js +51 -0
  11. package/dist/calendar/options.d.ts +4 -0
  12. package/dist/calendar/options.js +98 -0
  13. package/dist/calendar/use-calendar.d.ts +340 -0
  14. package/dist/calendar/use-calendar.js +154 -0
  15. package/dist/calendar/use-mini-calendar.d.ts +302 -0
  16. package/dist/calendar/use-mini-calendar.js +56 -0
  17. package/dist/calendar/utilities.d.ts +9 -0
  18. package/dist/calendar/utilities.js +8 -0
  19. package/dist/date/bind-panel.d.ts +30 -0
  20. package/dist/date/bind-panel.js +125 -0
  21. package/dist/date/components.d.ts +197 -0
  22. package/dist/date/components.js +193 -0
  23. package/dist/date/context.d.ts +34 -0
  24. package/dist/date/context.js +19 -0
  25. package/dist/date/index.d.ts +4 -0
  26. package/dist/date/index.js +4 -0
  27. package/dist/date/options.d.ts +7 -0
  28. package/dist/date/options.js +91 -0
  29. package/dist/date/use-date-input.d.ts +43 -0
  30. package/dist/date/use-date-input.js +138 -0
  31. package/dist/date/use-date-panel.d.ts +81 -0
  32. package/dist/date/use-date-panel.js +21 -0
  33. package/dist/date/utilities.d.ts +4 -0
  34. package/dist/date/utilities.js +4 -0
  35. package/dist/datetime/components.d.ts +121 -0
  36. package/dist/datetime/components.js +164 -0
  37. package/dist/datetime/context.d.ts +8 -0
  38. package/dist/datetime/context.js +18 -0
  39. package/dist/datetime/index.d.ts +4 -0
  40. package/dist/datetime/index.js +4 -0
  41. package/dist/datetime/options.d.ts +5 -0
  42. package/dist/datetime/options.js +99 -0
  43. package/dist/datetime/use-datetime-input.d.ts +44 -0
  44. package/dist/datetime/use-datetime-input.js +145 -0
  45. package/dist/datetime/use-datetime-panel.d.ts +128 -0
  46. package/dist/datetime/use-datetime-panel.js +60 -0
  47. package/dist/datetime/utilities.d.ts +4 -0
  48. package/dist/datetime/utilities.js +4 -0
  49. package/dist/index.d.ts +4 -0
  50. package/dist/index.js +4 -0
  51. package/dist/shared/defined-options.d.ts +18 -0
  52. package/dist/shared/defined-options.js +9 -0
  53. package/dist/shared/merge-props.d.ts +9 -0
  54. package/dist/shared/merge-props.js +31 -0
  55. package/dist/shared/modifiers.d.ts +7 -0
  56. package/dist/shared/modifiers.js +6 -0
  57. package/dist/shared/part.d.ts +10 -0
  58. package/dist/shared/part.js +9 -0
  59. package/dist/shared/slot.d.ts +12 -0
  60. package/dist/shared/slot.js +57 -0
  61. package/dist/shared/style-properties.d.ts +8 -0
  62. package/dist/shared/style-properties.js +13 -0
  63. package/dist/shared/to-react-props.d.ts +11 -0
  64. package/dist/shared/to-react-props.js +27 -0
  65. package/dist/time/bind-panel.d.ts +19 -0
  66. package/dist/time/bind-panel.js +97 -0
  67. package/dist/time/components.d.ts +183 -0
  68. package/dist/time/components.js +169 -0
  69. package/dist/time/context.d.ts +24 -0
  70. package/dist/time/context.js +19 -0
  71. package/dist/time/index.d.ts +4 -0
  72. package/dist/time/index.js +4 -0
  73. package/dist/time/options.d.ts +5 -0
  74. package/dist/time/options.js +85 -0
  75. package/dist/time/use-time-input.d.ts +43 -0
  76. package/dist/time/use-time-input.js +138 -0
  77. package/dist/time/use-time-panel.d.ts +37 -0
  78. package/dist/time/use-time-panel.js +18 -0
  79. package/dist/time/utilities.d.ts +4 -0
  80. package/dist/time/utilities.js +4 -0
  81. package/dist/vendor/core/calendar/availability.d.ts +39 -0
  82. package/dist/vendor/core/calendar/availability.js +73 -0
  83. package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
  84. package/dist/vendor/core/calendar/controllers/calendar-controller.js +1396 -0
  85. package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
  86. package/dist/vendor/core/calendar/controllers/drag-engine.js +363 -0
  87. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
  88. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +171 -0
  89. package/dist/vendor/core/calendar/controllers/shared.d.ts +33 -0
  90. package/dist/vendor/core/calendar/controllers/shared.js +82 -0
  91. package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
  92. package/dist/vendor/core/calendar/events/agenda-layout.js +72 -0
  93. package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
  94. package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
  95. package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
  96. package/dist/vendor/core/calendar/events/background-layout.js +106 -0
  97. package/dist/vendor/core/calendar/events/index.d.ts +17 -0
  98. package/dist/vendor/core/calendar/events/index.js +8 -0
  99. package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
  100. package/dist/vendor/core/calendar/events/month-layout.js +157 -0
  101. package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
  102. package/dist/vendor/core/calendar/events/normalize.js +156 -0
  103. package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
  104. package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
  105. package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
  106. package/dist/vendor/core/calendar/events/overflow.js +112 -0
  107. package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
  108. package/dist/vendor/core/calendar/events/sort.js +35 -0
  109. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
  110. package/dist/vendor/core/calendar/events/time-grid-layout.js +177 -0
  111. package/dist/vendor/core/calendar/events/types.d.ts +141 -0
  112. package/dist/vendor/core/calendar/events/types.js +1 -0
  113. package/dist/vendor/core/calendar/index.d.ts +70 -0
  114. package/dist/vendor/core/calendar/index.js +37 -0
  115. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +11 -0
  116. package/dist/vendor/core/calendar/interaction/auto-scroll.js +37 -0
  117. package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
  118. package/dist/vendor/core/calendar/interaction/drag-geometry.js +122 -0
  119. package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
  120. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +53 -0
  121. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +24 -0
  122. package/dist/vendor/core/calendar/interaction/drag-pointer.js +43 -0
  123. package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
  124. package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
  125. package/dist/vendor/core/calendar/interaction/gesture-handle.d.ts +17 -0
  126. package/dist/vendor/core/calendar/interaction/gesture-handle.js +26 -0
  127. package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
  128. package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
  129. package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
  130. package/dist/vendor/core/calendar/interaction/pending.js +17 -0
  131. package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
  132. package/dist/vendor/core/calendar/interaction/pointer.js +169 -0
  133. package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
  134. package/dist/vendor/core/calendar/interaction/selection.js +47 -0
  135. package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
  136. package/dist/vendor/core/calendar/internal/equal.js +43 -0
  137. package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
  138. package/dist/vendor/core/calendar/navigation/navigate.js +81 -0
  139. package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
  140. package/dist/vendor/core/calendar/navigation/range.js +52 -0
  141. package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
  142. package/dist/vendor/core/calendar/navigation/title.js +39 -0
  143. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
  144. package/dist/vendor/core/calendar/navigation/view-definition.js +62 -0
  145. package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
  146. package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
  147. package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
  148. package/dist/vendor/core/calendar/recurrence/apply.js +206 -0
  149. package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
  150. package/dist/vendor/core/calendar/recurrence/expand.js +298 -0
  151. package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
  152. package/dist/vendor/core/calendar/recurrence/pack.js +248 -0
  153. package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
  154. package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
  155. package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
  156. package/dist/vendor/core/calendar/recurrence/rrule.js +278 -0
  157. package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
  158. package/dist/vendor/core/calendar/recurrence/series.js +163 -0
  159. package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
  160. package/dist/vendor/core/calendar/recurrence/types.js +1 -0
  161. package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
  162. package/dist/vendor/core/calendar/resources/keys.js +2 -0
  163. package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
  164. package/dist/vendor/core/calendar/resources/resource-time-grid.js +129 -0
  165. package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
  166. package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
  167. package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
  168. package/dist/vendor/core/calendar/resources/timeline-layout.js +109 -0
  169. package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
  170. package/dist/vendor/core/calendar/resources/tree.js +86 -0
  171. package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
  172. package/dist/vendor/core/calendar/resources/types.js +1 -0
  173. package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
  174. package/dist/vendor/core/calendar/resources/views.js +45 -0
  175. package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
  176. package/dist/vendor/core/calendar/resources/windowing.js +17 -0
  177. package/dist/vendor/core/calendar/views/day.d.ts +37 -0
  178. package/dist/vendor/core/calendar/views/day.js +36 -0
  179. package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
  180. package/dist/vendor/core/calendar/views/list-layout.js +5 -0
  181. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
  182. package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
  183. package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
  184. package/dist/vendor/core/calendar/views/month-layout.js +63 -0
  185. package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
  186. package/dist/vendor/core/calendar/views/time-grid-layout.js +27 -0
  187. package/dist/vendor/core/date/index.d.ts +9 -0
  188. package/dist/vendor/core/date/index.js +9 -0
  189. package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
  190. package/dist/vendor/core/date/input/date-input-controller.js +466 -0
  191. package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
  192. package/dist/vendor/core/date/input/date-range-input-controller.js +186 -0
  193. package/dist/vendor/core/date/input/parse.d.ts +22 -0
  194. package/dist/vendor/core/date/input/parse.js +78 -0
  195. package/dist/vendor/core/date/input/validity.d.ts +6 -0
  196. package/dist/vendor/core/date/input/validity.js +13 -0
  197. package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
  198. package/dist/vendor/core/date/panel/panel-controller.js +704 -0
  199. package/dist/vendor/core/date/presets.d.ts +22 -0
  200. package/dist/vendor/core/date/presets.js +103 -0
  201. package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
  202. package/dist/vendor/core/date/selection/multiple.js +29 -0
  203. package/dist/vendor/core/date/selection/range.d.ts +29 -0
  204. package/dist/vendor/core/date/selection/range.js +35 -0
  205. package/dist/vendor/core/date/types.d.ts +12 -0
  206. package/dist/vendor/core/date/types.js +1 -0
  207. package/dist/vendor/core/datetime/compose.d.ts +24 -0
  208. package/dist/vendor/core/datetime/compose.js +49 -0
  209. package/dist/vendor/core/datetime/constraints.d.ts +42 -0
  210. package/dist/vendor/core/datetime/constraints.js +56 -0
  211. package/dist/vendor/core/datetime/index.d.ts +9 -0
  212. package/dist/vendor/core/datetime/index.js +9 -0
  213. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
  214. package/dist/vendor/core/datetime/input/datetime-input-controller.js +380 -0
  215. package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
  216. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +171 -0
  217. package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
  218. package/dist/vendor/core/datetime/input/parse.js +56 -0
  219. package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
  220. package/dist/vendor/core/datetime/panel/controller.js +191 -0
  221. package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
  222. package/dist/vendor/core/datetime/panel/range-controller.js +205 -0
  223. package/dist/vendor/core/datetime/types.d.ts +12 -0
  224. package/dist/vendor/core/datetime/types.js +1 -0
  225. package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
  226. package/dist/vendor/core/datetime/zone/day-instants.js +52 -0
  227. package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
  228. package/dist/vendor/core/datetime/zone/resolve.js +24 -0
  229. package/dist/vendor/core/dom/auto-scroll.d.ts +37 -0
  230. package/dist/vendor/core/dom/auto-scroll.js +57 -0
  231. package/dist/vendor/core/dom/drag-session.d.ts +25 -0
  232. package/dist/vendor/core/dom/drag-session.js +257 -0
  233. package/dist/vendor/core/foundation/a11y/announcer.d.ts +12 -0
  234. package/dist/vendor/core/foundation/a11y/announcer.js +24 -0
  235. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
  236. package/dist/vendor/core/foundation/a11y/grid-navigation.js +76 -0
  237. package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
  238. package/dist/vendor/core/foundation/a11y/index.js +5 -0
  239. package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
  240. package/dist/vendor/core/foundation/a11y/labels.js +43 -0
  241. package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
  242. package/dist/vendor/core/foundation/a11y/messages.js +74 -0
  243. package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
  244. package/dist/vendor/core/foundation/a11y/roving-focus.js +73 -0
  245. package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
  246. package/dist/vendor/core/foundation/constraints/availability-rules.js +64 -0
  247. package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
  248. package/dist/vendor/core/foundation/constraints/availability.js +480 -0
  249. package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
  250. package/dist/vendor/core/foundation/constraints/date.js +41 -0
  251. package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
  252. package/dist/vendor/core/foundation/constraints/index.js +4 -0
  253. package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
  254. package/dist/vendor/core/foundation/constraints/range.js +70 -0
  255. package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
  256. package/dist/vendor/core/foundation/constraints/time.js +56 -0
  257. package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
  258. package/dist/vendor/core/foundation/grid/index.js +4 -0
  259. package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
  260. package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
  261. package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
  262. package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
  263. package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
  264. package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
  265. package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
  266. package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
  267. package/dist/vendor/core/foundation/index.d.ts +8 -0
  268. package/dist/vendor/core/foundation/index.js +8 -0
  269. package/dist/vendor/core/foundation/input/form.d.ts +7 -0
  270. package/dist/vendor/core/foundation/input/form.js +10 -0
  271. package/dist/vendor/core/foundation/input/index.d.ts +6 -0
  272. package/dist/vendor/core/foundation/input/index.js +3 -0
  273. package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
  274. package/dist/vendor/core/foundation/input/segment-engine.js +45 -0
  275. package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
  276. package/dist/vendor/core/foundation/input/tokenize.js +24 -0
  277. package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
  278. package/dist/vendor/core/foundation/locale/digits.js +35 -0
  279. package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
  280. package/dist/vendor/core/foundation/locale/direction.js +25 -0
  281. package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
  282. package/dist/vendor/core/foundation/locale/format.js +77 -0
  283. package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
  284. package/dist/vendor/core/foundation/locale/hour-cycle.js +41 -0
  285. package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
  286. package/dist/vendor/core/foundation/locale/index.js +8 -0
  287. package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
  288. package/dist/vendor/core/foundation/locale/names.js +30 -0
  289. package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
  290. package/dist/vendor/core/foundation/locale/resolve.js +39 -0
  291. package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
  292. package/dist/vendor/core/foundation/locale/week-info.js +60 -0
  293. package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
  294. package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
  295. package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
  296. package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
  297. package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
  298. package/dist/vendor/core/foundation/ranges/index.js +2 -0
  299. package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
  300. package/dist/vendor/core/foundation/ranges/interval.js +54 -0
  301. package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
  302. package/dist/vendor/core/foundation/store/attributes.js +43 -0
  303. package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
  304. package/dist/vendor/core/foundation/store/controllable.js +50 -0
  305. package/dist/vendor/core/foundation/store/env.d.ts +1 -0
  306. package/dist/vendor/core/foundation/store/env.js +3 -0
  307. package/dist/vendor/core/foundation/store/ids.d.ts +9 -0
  308. package/dist/vendor/core/foundation/store/ids.js +12 -0
  309. package/dist/vendor/core/foundation/store/index.d.ts +11 -0
  310. package/dist/vendor/core/foundation/store/index.js +7 -0
  311. package/dist/vendor/core/foundation/store/store.d.ts +7 -0
  312. package/dist/vendor/core/foundation/store/store.js +25 -0
  313. package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
  314. package/dist/vendor/core/foundation/store/ticker.js +27 -0
  315. package/dist/vendor/core/foundation/store/with-optional.d.ts +15 -0
  316. package/dist/vendor/core/foundation/store/with-optional.js +3 -0
  317. package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
  318. package/dist/vendor/core/foundation/values/clock.js +21 -0
  319. package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
  320. package/dist/vendor/core/foundation/values/compare.js +70 -0
  321. package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
  322. package/dist/vendor/core/foundation/values/convert.js +108 -0
  323. package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
  324. package/dist/vendor/core/foundation/values/epoch-day.js +43 -0
  325. package/dist/vendor/core/foundation/values/index.d.ts +14 -0
  326. package/dist/vendor/core/foundation/values/index.js +10 -0
  327. package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
  328. package/dist/vendor/core/foundation/values/iso.js +111 -0
  329. package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
  330. package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
  331. package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
  332. package/dist/vendor/core/foundation/values/plain-date.js +105 -0
  333. package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
  334. package/dist/vendor/core/foundation/values/plain-time.js +43 -0
  335. package/dist/vendor/core/foundation/values/types.d.ts +37 -0
  336. package/dist/vendor/core/foundation/values/types.js +1 -0
  337. package/dist/vendor/core/foundation/values/week.d.ts +9 -0
  338. package/dist/vendor/core/foundation/values/week.js +31 -0
  339. package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
  340. package/dist/vendor/core/foundation/values/year-month.js +19 -0
  341. package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
  342. package/dist/vendor/core/foundation/values/zoned.js +152 -0
  343. package/dist/vendor/core/index.d.ts +5 -0
  344. package/dist/vendor/core/index.js +5 -0
  345. package/dist/vendor/core/time/index.d.ts +8 -0
  346. package/dist/vendor/core/time/index.js +8 -0
  347. package/dist/vendor/core/time/input/parse.d.ts +19 -0
  348. package/dist/vendor/core/time/input/parse.js +82 -0
  349. package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
  350. package/dist/vendor/core/time/input/time-input-controller.js +547 -0
  351. package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
  352. package/dist/vendor/core/time/input/time-range-input-controller.js +178 -0
  353. package/dist/vendor/core/time/input/validity.d.ts +7 -0
  354. package/dist/vendor/core/time/input/validity.js +16 -0
  355. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
  356. package/dist/vendor/core/time/panel/time-panel-controller.js +809 -0
  357. package/dist/vendor/core/time/selection/range.d.ts +25 -0
  358. package/dist/vendor/core/time/selection/range.js +35 -0
  359. package/dist/vendor/core/time/selection/slots.d.ts +46 -0
  360. package/dist/vendor/core/time/selection/slots.js +76 -0
  361. package/dist/vendor/core/time/types.d.ts +11 -0
  362. package/dist/vendor/core/time/types.js +1 -0
  363. package/package.json +83 -4
@@ -0,0 +1,125 @@
1
+ "use client";
2
+ import { focusDateCell, plainDate, toIsoString, } from "../vendor/core/foundation/index.js";
3
+ import { useEffect, useLayoutEffect, useMemo, useRef, useSyncExternalStore, } from "react";
4
+ import { modifiersOf } from "../shared/modifiers.js";
5
+ import { toReactProps } from "../shared/to-react-props.js";
6
+ const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
7
+ /** The `data-chrono-key` of the cell that holds the tab stop at the current level. */
8
+ function focusKeyOf(state) {
9
+ const { focusedDate, level } = state;
10
+ return level === "day"
11
+ ? toIsoString(focusedDate)
12
+ : level === "month"
13
+ ? `${focusedDate.year}-${String(focusedDate.month).padStart(2, "0")}`
14
+ : String(focusedDate.year);
15
+ }
16
+ // oxlint-disable-next-line typescript/no-explicit-any -- the panels share one binding
17
+ export function useBoundPanel(controller, options) {
18
+ const rootRef = useRef(null);
19
+ const keyboardMove = useRef(false);
20
+ useIsomorphicLayoutEffect(() => {
21
+ if (options === null)
22
+ return; // a composite controller pushes its own options
23
+ const { id: _id, ...next } = options;
24
+ controller.setOptions(next);
25
+ });
26
+ const state = useSyncExternalStore(controller.subscribe, controller.getState, controller.getState);
27
+ // autoFocus is opt-in and runs after mount, never during render or SSR (A8).
28
+ useEffect(() => {
29
+ const first = controller.getState();
30
+ if (first.autoFocus && rootRef.current) {
31
+ focusDateCell(rootRef.current, focusKeyOf(first));
32
+ }
33
+ }, [controller]);
34
+ useIsomorphicLayoutEffect(() => {
35
+ if (!keyboardMove.current || !rootRef.current)
36
+ return;
37
+ focusDateCell(rootRef.current, focusKeyOf(state));
38
+ keyboardMove.current = false;
39
+ }, [state]);
40
+ return useMemo(() => {
41
+ const keyHandler = (focus) => (event) => {
42
+ // The key press starts from the cell it happened on.
43
+ focus();
44
+ if (controller.handleKeyDown(event.key, modifiersOf(event))) {
45
+ event.preventDefault();
46
+ // Escape is stopped only when it cancelled something (A18).
47
+ if (event.key === "Escape")
48
+ event.stopPropagation();
49
+ keyboardMove.current = true;
50
+ }
51
+ };
52
+ return {
53
+ state,
54
+ controller,
55
+ actions: {
56
+ prev: controller.prev,
57
+ next: controller.next,
58
+ today: controller.today,
59
+ clear: controller.clear,
60
+ commit: controller.commit,
61
+ setLevel: controller.setLevel,
62
+ },
63
+ getRootProps: () => ({
64
+ ...toReactProps(controller.getRootAttributes()),
65
+ ref: rootRef,
66
+ onKeyUp: () => {
67
+ keyboardMove.current = false;
68
+ },
69
+ onMouseLeave: () => {
70
+ if (state.draft)
71
+ controller.setPreview(null);
72
+ },
73
+ }),
74
+ getTitleProps: () => toReactProps(controller.getTitleAttributes()),
75
+ getLevelButtonProps: () => ({
76
+ ...toReactProps(controller.getLevelButtonAttributes()),
77
+ onClick: () => {
78
+ const next = state.level === "day" ? "month" : "year";
79
+ if (state.canGoUp)
80
+ controller.setLevel(next);
81
+ },
82
+ }),
83
+ getNavProps: (kind) => ({
84
+ ...toReactProps(controller.getNavAttributes(kind)),
85
+ onClick: controller[kind],
86
+ }),
87
+ getTodayButtonProps: () => ({
88
+ ...toReactProps(controller.getTodayButtonAttributes()),
89
+ onClick: controller.today,
90
+ }),
91
+ getGridProps: () => toReactProps(controller.getGridAttributes()),
92
+ getColumnHeaderProps: (header) => toReactProps(controller.getColumnHeaderAttributes(header)),
93
+ getWeekNumberProps: (weekNumber) => toReactProps(controller.getWeekNumberAttributes(weekNumber)),
94
+ getCellProps: (day) => {
95
+ const attributes = toReactProps(controller.getCellAttributes(day));
96
+ if (day.hidden)
97
+ return attributes;
98
+ return {
99
+ ...attributes,
100
+ onClick: (event) => {
101
+ if (state.kind === "multi" && event.shiftKey) {
102
+ controller.extendTo(day.date);
103
+ }
104
+ else {
105
+ controller.pick(day.date, "pointer");
106
+ }
107
+ },
108
+ onMouseEnter: () => {
109
+ if (state.draft)
110
+ controller.setPreview(day.date);
111
+ },
112
+ onKeyDown: keyHandler(() => controller.focusDate(day.date)),
113
+ };
114
+ },
115
+ getLevelCellProps: (cell) => {
116
+ const date = plainDate(cell.year, cell.month, 1);
117
+ return {
118
+ ...toReactProps(controller.getLevelCellAttributes(cell)),
119
+ onClick: () => controller.pick(date, "pointer"),
120
+ onKeyDown: keyHandler(() => controller.focusDate(date)),
121
+ };
122
+ },
123
+ };
124
+ }, [controller, state]);
125
+ }
@@ -0,0 +1,197 @@
1
+ import type { DateInputOptions, DateInputState, DatePanelOptions, DateRangeInputOptions, DateRangePanelOptions, MultiDatePanelOptions, PanelCell, PanelDay, SegmentView } from "../vendor/core/date/index.js";
2
+ import type { WeekdayHeader } from "../vendor/core/foundation/index.js";
3
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
4
+ type PartProps<T extends keyof React.JSX.IntrinsicElements> = Omit<ComponentPropsWithoutRef<T>, "children"> & {
5
+ asChild?: boolean;
6
+ };
7
+ export type DateInputSegmentProps = PartProps<"span"> & {
8
+ segment: SegmentView;
9
+ children?: ReactNode;
10
+ };
11
+ /** One editable part (day, month or year). */
12
+ export declare const DateInputSegment: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & {
13
+ asChild?: boolean;
14
+ } & {
15
+ segment: SegmentView;
16
+ children?: ReactNode;
17
+ } & import("react").RefAttributes<HTMLSpanElement>>;
18
+ export type DateInputLiteralProps = PartProps<"span"> & {
19
+ segment: SegmentView;
20
+ children?: ReactNode;
21
+ };
22
+ /** A separator between parts. Hidden from assistive technology. */
23
+ export declare const DateInputLiteral: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & {
24
+ asChild?: boolean;
25
+ } & {
26
+ segment: SegmentView;
27
+ children?: ReactNode;
28
+ } & import("react").RefAttributes<HTMLSpanElement>>;
29
+ export type DateInputTextFieldProps = PartProps<"input">;
30
+ /** The native text field of `mode="text"`. */
31
+ export declare const DateInputTextField: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "children"> & {
32
+ asChild?: boolean;
33
+ } & import("react").RefAttributes<HTMLInputElement>>;
34
+ export type DateInputClearButtonProps = PartProps<"button"> & {
35
+ children?: ReactNode;
36
+ };
37
+ export declare const DateInputClearButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
38
+ asChild?: boolean;
39
+ } & {
40
+ children?: ReactNode;
41
+ } & import("react").RefAttributes<HTMLButtonElement>>;
42
+ export type DateInputProps = Omit<PartProps<"div">, keyof DateInputOptions> & DateInputOptions & {
43
+ children?: ReactNode | ((state: DateInputState) => ReactNode);
44
+ };
45
+ /** A date field: segmented (default) or text. Use `DateInputSegment` parts for custom layouts. */
46
+ export declare const DateInput: import("react").ForwardRefExoticComponent<Omit<PartProps<"div">, keyof DateInputOptions> & DateInputOptions & {
47
+ children?: ReactNode | ((state: DateInputState) => ReactNode);
48
+ } & import("react").RefAttributes<HTMLElement>>;
49
+ export declare const DateRangeInputStart: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
50
+ asChild?: boolean;
51
+ } & {
52
+ children?: ReactNode | ((state: DateInputState) => ReactNode);
53
+ } & import("react").RefAttributes<HTMLElement>>;
54
+ export declare const DateRangeInputEnd: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
55
+ asChild?: boolean;
56
+ } & {
57
+ children?: ReactNode | ((state: DateInputState) => ReactNode);
58
+ } & import("react").RefAttributes<HTMLElement>>;
59
+ export type DateRangeInputProps = Omit<PartProps<"div">, keyof DateRangeInputOptions> & DateRangeInputOptions & {
60
+ children?: ReactNode;
61
+ };
62
+ /** Two date fields (start and end) in one group, in both modes. */
63
+ export declare const DateRangeInput: import("react").ForwardRefExoticComponent<Omit<PartProps<"div">, "value" | "defaultValue" | "disabled" | "id" | "locale" | "timeZone" | "now" | "min" | "max" | "messages" | "availability" | "name" | "onValueChange" | "onValueCommit" | "mode" | "placeholderValue" | "parse" | "format" | "onInvalidInput" | "required" | "readOnly" | "isDateDisabled" | "isDateUnavailable" | "onFocusEdge" | "startName" | "endName" | "minDays" | "maxDays" | "allowUnavailableInside" | "allowDisabledInside"> & Omit<DateInputOptions, "value" | "defaultValue" | "name" | "onValueChange" | "onValueCommit"> & {
64
+ value?: import("../vendor/core/date/index.js").DateRangeValue;
65
+ defaultValue?: import("../vendor/core/date/index.js").DateRangeValue;
66
+ onValueChange?: (value: import("../vendor/core/date/index.js").DateRangeValue) => void;
67
+ onValueCommit?: (value: import("../vendor/core/foundation/index.js").DateRange) => void;
68
+ name?: string;
69
+ startName?: string;
70
+ endName?: string;
71
+ minDays?: import("../vendor/core/date/index.js").PickConstraints["minDays"];
72
+ maxDays?: import("../vendor/core/date/index.js").PickConstraints["maxDays"];
73
+ allowUnavailableInside?: boolean;
74
+ allowDisabledInside?: boolean;
75
+ } & {
76
+ children?: ReactNode;
77
+ } & import("react").RefAttributes<HTMLElement>>;
78
+ export type DatePanelTitleProps = PartProps<"h2"> & {
79
+ children?: ReactNode;
80
+ };
81
+ export declare const DatePanelTitle: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "children"> & {
82
+ asChild?: boolean;
83
+ } & {
84
+ children?: ReactNode;
85
+ } & import("react").RefAttributes<HTMLHeadingElement>>;
86
+ /** The title as a button: day level to month level to year level. */
87
+ export declare const DatePanelLevelButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
88
+ asChild?: boolean;
89
+ } & {
90
+ children?: ReactNode;
91
+ } & import("react").RefAttributes<HTMLButtonElement>>;
92
+ export declare const DatePanelPrevButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
93
+ asChild?: boolean;
94
+ } & {
95
+ children?: ReactNode;
96
+ } & import("react").RefAttributes<HTMLButtonElement>>;
97
+ export declare const DatePanelNextButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
98
+ asChild?: boolean;
99
+ } & {
100
+ children?: ReactNode;
101
+ } & import("react").RefAttributes<HTMLButtonElement>>;
102
+ /** Shows today's month; with `selectToday` it also picks today. */
103
+ export declare const DatePanelTodayButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
104
+ asChild?: boolean;
105
+ } & {
106
+ children?: ReactNode;
107
+ } & import("react").RefAttributes<HTMLButtonElement>>;
108
+ export type DatePanelWeekdayHeaderProps = PartProps<"th"> & {
109
+ header: WeekdayHeader;
110
+ children?: ReactNode;
111
+ };
112
+ export declare const DatePanelWeekdayHeader: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "children"> & {
113
+ asChild?: boolean;
114
+ } & {
115
+ header: WeekdayHeader;
116
+ children?: ReactNode;
117
+ } & import("react").RefAttributes<HTMLTableCellElement>>;
118
+ export type DatePanelWeekNumberProps = PartProps<"th"> & {
119
+ weekNumber: number;
120
+ children?: ReactNode;
121
+ };
122
+ export declare const DatePanelWeekNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "children"> & {
123
+ asChild?: boolean;
124
+ } & {
125
+ weekNumber: number;
126
+ children?: ReactNode;
127
+ } & import("react").RefAttributes<HTMLTableCellElement>>;
128
+ export type DatePanelCellProps = PartProps<"td"> & ({
129
+ day: PanelDay;
130
+ cell?: never;
131
+ } | {
132
+ cell: PanelCell;
133
+ day?: never;
134
+ }) & {
135
+ children?: ReactNode;
136
+ };
137
+ /** A day cell (`day`) or, at the month and year levels, a month or year cell (`cell`). */
138
+ export declare const DatePanelCell: import("react").ForwardRefExoticComponent<DatePanelCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
139
+ export type DatePanelGridProps = PartProps<"table"> & {
140
+ /** Index of the month grid in a multi-month panel. */
141
+ month?: number;
142
+ /** Content of each day cell. Defaults to the day number. */
143
+ children?: (day: PanelDay) => ReactNode;
144
+ };
145
+ /** The grid of the current level. Month and year levels render in the first grid only. */
146
+ export declare const DatePanelGrid: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "children"> & {
147
+ asChild?: boolean;
148
+ } & {
149
+ /** Index of the month grid in a multi-month panel. */
150
+ month?: number;
151
+ /** Content of each day cell. Defaults to the day number. */
152
+ children?: (day: PanelDay) => ReactNode;
153
+ } & import("react").RefAttributes<HTMLTableElement>>;
154
+ export type DatePanelProps = Omit<PartProps<"div">, keyof DatePanelOptions> & DatePanelOptions & {
155
+ children?: ReactNode;
156
+ };
157
+ /** A single-date panel. Compose it with `DatePanelGrid` and friends, or render it bare. */
158
+ export declare const DatePanel: import("react").ForwardRefExoticComponent<Omit<PartProps<"div">, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | keyof import("../vendor/core/date/index.js").DatePanelBaseOptions> & import("../vendor/core/date/index.js").DatePanelBaseOptions & {
159
+ value?: import("../vendor/core/date/index.js").DateValue;
160
+ defaultValue?: import("../vendor/core/date/index.js").DateValue;
161
+ onValueChange?: (value: import("../vendor/core/date/index.js").DateValue) => void;
162
+ onValueCommit?: (value: import("../vendor/core/foundation/index.js").PlainDate) => void;
163
+ } & {
164
+ children?: ReactNode;
165
+ } & import("react").RefAttributes<HTMLElement>>;
166
+ export type DateRangePanelProps = Omit<PartProps<"div">, keyof DateRangePanelOptions> & DateRangePanelOptions & {
167
+ children?: ReactNode;
168
+ };
169
+ /** A range panel (two picks). Shows two months by default. */
170
+ export declare const DateRangePanel: import("react").ForwardRefExoticComponent<Omit<PartProps<"div">, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | "minDays" | "maxDays" | "allowUnavailableInside" | "allowDisabledInside" | keyof import("../vendor/core/date/index.js").DatePanelBaseOptions | "onRangePreviewChange" | "onInvalidRange"> & import("../vendor/core/date/index.js").DatePanelBaseOptions & {
171
+ value?: import("../vendor/core/date/index.js").DateRangeValue;
172
+ defaultValue?: import("../vendor/core/date/index.js").DateRangeValue;
173
+ onValueChange?: (value: import("../vendor/core/date/index.js").DateRangeValue) => void;
174
+ onValueCommit?: (value: import("../vendor/core/foundation/index.js").DateRange) => void;
175
+ onRangePreviewChange?: (preview: import("../vendor/core/foundation/index.js").DateRange | null) => void;
176
+ onInvalidRange?: (reason: import("../vendor/core/date/index.js").RangeReason) => void;
177
+ minDays?: number | ((start: import("../vendor/core/foundation/index.js").PlainDate) => number);
178
+ maxDays?: number | ((start: import("../vendor/core/foundation/index.js").PlainDate) => number);
179
+ allowUnavailableInside?: boolean;
180
+ allowDisabledInside?: boolean;
181
+ } & {
182
+ children?: ReactNode;
183
+ } & import("react").RefAttributes<HTMLElement>>;
184
+ export type MultiDatePanelProps = Omit<PartProps<"div">, keyof MultiDatePanelOptions> & MultiDatePanelOptions & {
185
+ children?: ReactNode;
186
+ };
187
+ /** A panel that selects any number of dates. */
188
+ export declare const MultiDatePanel: import("react").ForwardRefExoticComponent<Omit<PartProps<"div">, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | keyof import("../vendor/core/date/index.js").DatePanelBaseOptions | "maxSelected"> & import("../vendor/core/date/index.js").DatePanelBaseOptions & {
189
+ value?: import("../vendor/core/date/index.js").MultiDateValue;
190
+ defaultValue?: import("../vendor/core/date/index.js").MultiDateValue;
191
+ onValueChange?: (value: import("../vendor/core/date/index.js").MultiDateValue) => void;
192
+ onValueCommit?: (value: import("../vendor/core/date/index.js").MultiDateValue) => void;
193
+ maxSelected?: number;
194
+ } & {
195
+ children?: ReactNode;
196
+ } & import("react").RefAttributes<HTMLElement>>;
197
+ export {};
@@ -0,0 +1,193 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
4
+ import { mergeProps } from "../shared/merge-props.js";
5
+ import { Part } from "../shared/part.js";
6
+ import { composeRefs } from "../shared/slot.js";
7
+ import { DateFieldContext, DatePanelContext, useDateFieldContext, useDatePanelContext, } from "./context.js";
8
+ import { splitDateInputProps, splitDatePanelProps, splitDateRangeInputProps, splitDateRangePanelProps, splitMultiDatePanelProps, } from "./options.js";
9
+ import { useDateInput, useDateRangeInput } from "./use-date-input.js";
10
+ import { useDatePanel, useDateRangePanel, useMultiDatePanel } from "./use-date-panel.js";
11
+ const withChrono = (consumer, chrono) => mergeProps(consumer, chrono);
12
+ /** Hidden form inputs (A15). Rendered on the server too, so forms post without JS. */
13
+ function HiddenInputs({ inputs }) {
14
+ return (_jsx(_Fragment, { children: inputs.map((input) => (_jsx("input", { type: "hidden", name: input.name, value: input.value }, `${input.name}:${input.value}`))) }));
15
+ }
16
+ /** One editable part (day, month or year). */
17
+ export const DateInputSegment = forwardRef(function DateInputSegment({ segment, children, asChild, ...rest }, ref) {
18
+ const field = useDateFieldContext("DateInputSegment");
19
+ return (_jsx(Part, { as: "span", asChild: asChild, ref: ref, ...withChrono(rest, field.getSegmentProps(segment)), children: children ?? segment.text }));
20
+ });
21
+ /** A separator between parts. Hidden from assistive technology. */
22
+ export const DateInputLiteral = forwardRef(function DateInputLiteral({ segment, children, asChild, ...rest }, ref) {
23
+ const field = useDateFieldContext("DateInputLiteral");
24
+ return (_jsx(Part, { as: "span", asChild: asChild, ref: ref, ...withChrono(rest, field.getSegmentProps(segment)), children: children ?? segment.text }));
25
+ });
26
+ /** The native text field of `mode="text"`. */
27
+ export const DateInputTextField = forwardRef(function DateInputTextField({ asChild, ...rest }, ref) {
28
+ const field = useDateFieldContext("DateInputTextField");
29
+ return (_jsx(Part, { as: "input", asChild: asChild, ref: ref, ...withChrono(rest, field.getTextFieldProps()) }));
30
+ });
31
+ export const DateInputClearButton = forwardRef(function DateInputClearButton({ children, asChild, ...rest }, ref) {
32
+ const field = useDateFieldContext("DateInputClearButton");
33
+ const props = field.getClearButtonProps();
34
+ return (_jsx(Part, { as: "button", asChild: asChild, ref: ref, ...withChrono(rest, props), children: children ?? props["aria-label"] }));
35
+ });
36
+ /** The default content of a field: segments, or the text field. */
37
+ function FieldContent() {
38
+ const { state } = useDateFieldContext("DateInput");
39
+ if (state.mode === "text")
40
+ return _jsx(DateInputTextField, {});
41
+ return (_jsx(_Fragment, { children: state.segments.map((segment, index) => segment.type === "literal" ? (_jsx(DateInputLiteral, { segment: segment }, index)) : (_jsx(DateInputSegment, { segment: segment }, segment.type))) }));
42
+ }
43
+ /** A date field: segmented (default) or text. Use `DateInputSegment` parts for custom layouts. */
44
+ export const DateInput = forwardRef(function DateInput({ children, asChild, ...props }, ref) {
45
+ const [options, rest] = splitDateInputProps(props);
46
+ const input = useDateInput(definedOptions({
47
+ ...options,
48
+ id: props.id,
49
+ }));
50
+ const { ref: rootRef, ...rootProps } = input.getRootProps();
51
+ const { id: _id, ...elementProps } = rest;
52
+ return (_jsx(DateFieldContext.Provider, { value: input, children: _jsxs(Part, { as: "div", asChild: asChild, ref: composeRefs(ref, rootRef), ...withChrono(elementProps, rootProps), children: [typeof children === "function" ? children(input.state) : (children ?? _jsx(FieldContent, {})), _jsx(HiddenInputs, { inputs: input.state.hidden })] }) }));
53
+ });
54
+ function RangeField({ side, children, asChild, forwardedRef, ...rest }) {
55
+ const range = useRangeContext(side === "start" ? "DateRangeInputStart" : "DateRangeInputEnd");
56
+ const field = range[side];
57
+ const { ref: rootRef, ...rootProps } = field.getRootProps();
58
+ return (_jsx(DateFieldContext.Provider, { value: field, children: _jsx(Part, { as: "div", asChild: asChild, ref: composeRefs(forwardedRef, rootRef), ...withChrono(rest, {
59
+ ...rootProps,
60
+ role: "group",
61
+ "aria-label": field.state.messages[side === "start" ? "startDate" : "endDate"],
62
+ }), children: typeof children === "function" ? children(field.state) : (children ?? _jsx(FieldContent, {})) }) }));
63
+ }
64
+ import { createContext, useContext } from "react";
65
+ import { definedOptions } from "./../shared/defined-options.js";
66
+ const RangeContext = createContext(null);
67
+ function useRangeContext(part) {
68
+ const value = useContext(RangeContext);
69
+ if (!value) {
70
+ throw new Error(`[chrono-react] <${part}> must be used inside <DateRangeInput>.`);
71
+ }
72
+ return value;
73
+ }
74
+ export const DateRangeInputStart = forwardRef(function DateRangeInputStart(props, ref) {
75
+ return _jsx(RangeField, { side: "start", forwardedRef: ref, ...props });
76
+ });
77
+ export const DateRangeInputEnd = forwardRef(function DateRangeInputEnd(props, ref) {
78
+ return _jsx(RangeField, { side: "end", forwardedRef: ref, ...props });
79
+ });
80
+ /** Two date fields (start and end) in one group, in both modes. */
81
+ export const DateRangeInput = forwardRef(function DateRangeInput({ children, asChild, ...props }, ref) {
82
+ const [options, rest] = splitDateRangeInputProps(props);
83
+ const range = useDateRangeInput(definedOptions({
84
+ ...options,
85
+ id: props.id,
86
+ }));
87
+ const { ref: rootRef, ...rootProps } = range.getRootProps();
88
+ const { id: _id, ...elementProps } = rest;
89
+ return (_jsx(RangeContext.Provider, { value: range, children: _jsxs(Part, { as: "div", asChild: asChild, ref: composeRefs(ref, rootRef), ...withChrono(elementProps, rootProps), children: [children ?? (_jsxs(_Fragment, { children: [_jsx(DateRangeInputStart, {}), _jsx("span", { "aria-hidden": "true", children: "\u2013" }), _jsx(DateRangeInputEnd, {})] })), _jsx(HiddenInputs, { inputs: range.state.hidden })] }) }));
90
+ });
91
+ export const DatePanelTitle = forwardRef(function DatePanelTitle({ children, asChild, ...rest }, ref) {
92
+ const panel = useDatePanelContext("DatePanelTitle");
93
+ return (_jsx(Part, { as: "h2", asChild: asChild, ref: ref, ...withChrono(rest, panel.getTitleProps()), children: children ?? panel.state.title }));
94
+ });
95
+ /** The title as a button: day level to month level to year level. */
96
+ export const DatePanelLevelButton = forwardRef(function DatePanelLevelButton({ children, asChild, ...rest }, ref) {
97
+ const panel = useDatePanelContext("DatePanelLevelButton");
98
+ return (_jsx(Part, { as: "button", asChild: asChild, ref: ref, ...withChrono(rest, panel.getLevelButtonProps()), children: children ?? panel.state.title }));
99
+ });
100
+ const NavButton = forwardRef(function NavButton({ kind, part, children, asChild, ...rest }, ref) {
101
+ const panel = useDatePanelContext(part);
102
+ const props = panel.getNavProps(kind);
103
+ return (_jsx(Part, { as: "button", asChild: asChild, ref: ref, ...withChrono(rest, props), children: children ?? props["aria-label"] }));
104
+ });
105
+ export const DatePanelPrevButton = forwardRef(function DatePanelPrevButton(props, ref) {
106
+ return _jsx(NavButton, { ...props, ref: ref, kind: "prev", part: "DatePanelPrevButton" });
107
+ });
108
+ export const DatePanelNextButton = forwardRef(function DatePanelNextButton(props, ref) {
109
+ return _jsx(NavButton, { ...props, ref: ref, kind: "next", part: "DatePanelNextButton" });
110
+ });
111
+ /** Shows today's month; with `selectToday` it also picks today. */
112
+ export const DatePanelTodayButton = forwardRef(function DatePanelTodayButton({ children, asChild, ...rest }, ref) {
113
+ const panel = useDatePanelContext("DatePanelTodayButton");
114
+ const props = panel.getTodayButtonProps();
115
+ return (_jsx(Part, { as: "button", asChild: asChild, ref: ref, ...withChrono(rest, props), children: children ?? props["aria-label"] }));
116
+ });
117
+ export const DatePanelWeekdayHeader = forwardRef(function DatePanelWeekdayHeader({ header, children, asChild, ...rest }, ref) {
118
+ const panel = useDatePanelContext("DatePanelWeekdayHeader");
119
+ return (_jsx(Part, { as: "th", asChild: asChild, ref: ref, ...withChrono(rest, panel.getColumnHeaderProps(header)), children: children ?? header.short }));
120
+ });
121
+ export const DatePanelWeekNumber = forwardRef(function DatePanelWeekNumber({ weekNumber, children, asChild, ...rest }, ref) {
122
+ const panel = useDatePanelContext("DatePanelWeekNumber");
123
+ return (_jsx(Part, { as: "th", asChild: asChild, ref: ref, ...withChrono(rest, panel.getWeekNumberProps(weekNumber)), children: children ?? weekNumber }));
124
+ });
125
+ /** A day cell (`day`) or, at the month and year levels, a month or year cell (`cell`). */
126
+ export const DatePanelCell = forwardRef(function DatePanelCell({ day, cell, children, asChild, ...rest }, ref) {
127
+ const panel = useDatePanelContext("DatePanelCell");
128
+ const chrono = day ? panel.getCellProps(day) : panel.getLevelCellProps(cell);
129
+ const fallback = day ? (day.hidden ? null : day.date.day) : cell.text;
130
+ return (_jsx(Part, { as: "td", asChild: asChild, ref: ref, ...withChrono(rest, chrono), children: children ?? fallback }));
131
+ });
132
+ /** The grid of the current level. Month and year levels render in the first grid only. */
133
+ export const DatePanelGrid = forwardRef(function DatePanelGrid({ month = 0, children, asChild, ...rest }, ref) {
134
+ const panel = useDatePanelContext("DatePanelGrid");
135
+ const { state } = panel;
136
+ let body = null;
137
+ if (state.level === "day") {
138
+ const model = state.months[month];
139
+ if (!model)
140
+ return null;
141
+ body = (_jsxs(_Fragment, { children: [_jsx("thead", { children: _jsxs("tr", { children: [state.weekNumbers ? _jsx("td", {}) : null, state.weekdays.map((header) => (_jsx(DatePanelWeekdayHeader, { header: header }, header.dayOfWeek)))] }) }), _jsx("tbody", { children: model.weeks.map((week) => (_jsxs("tr", { children: [state.weekNumbers ? _jsx(DatePanelWeekNumber, { weekNumber: week.weekNumber }) : null, week.days.map((day) => (_jsx(DatePanelCell, { day: day, children: day.hidden ? null : children?.(day) }, `${day.date.month}-${day.date.day}`)))] }, `${model.key}-${week.days[0]?.date.day}-${week.days[0]?.date.month}`))) })] }));
142
+ }
143
+ else {
144
+ if (month !== 0)
145
+ return null;
146
+ const rows = [];
147
+ state.cells.forEach((cell, index) => {
148
+ if (index % 4 === 0)
149
+ rows.push([]);
150
+ rows[rows.length - 1]?.push(cell);
151
+ });
152
+ body = (_jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: row.map((cell) => (_jsx(DatePanelCell, { cell: cell }, cell.key))) }, row[0]?.key))) }));
153
+ }
154
+ return (_jsx(Part, { as: "table", asChild: asChild, ref: ref, ...withChrono(rest, panel.getGridProps()), children: body }));
155
+ });
156
+ function PanelContent() {
157
+ const panel = useDatePanelContext("DatePanel");
158
+ const count = panel.state.level === "day" ? panel.state.months.length : 1;
159
+ return (_jsxs(_Fragment, { children: [_jsx(DatePanelPrevButton, {}), _jsx(DatePanelTitle, {}), _jsx(DatePanelNextButton, {}), Array.from({ length: count }, (_, index) => (_jsx(DatePanelGrid, { month: index }, index)))] }));
160
+ }
161
+ function PanelRoot({ panel, forwardedRef, asChild, children, rest, }) {
162
+ const { ref: rootRef, ...rootProps } = panel.getRootProps();
163
+ const { id: _id, ...elementProps } = rest;
164
+ return (_jsx(DatePanelContext.Provider, { value: panel, children: _jsx(Part, { as: "div", asChild: asChild, ref: composeRefs(forwardedRef, rootRef), ...withChrono(elementProps, rootProps), children: children ?? _jsx(PanelContent, {}) }) }));
165
+ }
166
+ /** A single-date panel. Compose it with `DatePanelGrid` and friends, or render it bare. */
167
+ export const DatePanel = forwardRef(function DatePanel({ children, asChild, ...props }, ref) {
168
+ const [options, rest] = splitDatePanelProps(props);
169
+ const panel = useDatePanel(definedOptions({
170
+ ...options,
171
+ id: props.id,
172
+ }));
173
+ return (_jsx(PanelRoot, { panel: panel, forwardedRef: ref, asChild: asChild, rest: rest, children: children }));
174
+ });
175
+ /** A range panel (two picks). Shows two months by default. */
176
+ export const DateRangePanel = forwardRef(function DateRangePanel({ children, asChild, months = 2, ...props }, ref) {
177
+ const [options, rest] = splitDateRangePanelProps(props);
178
+ const panel = useDateRangePanel(definedOptions({
179
+ ...options,
180
+ months,
181
+ id: props.id,
182
+ }));
183
+ return (_jsx(PanelRoot, { panel: panel, forwardedRef: ref, asChild: asChild, rest: rest, children: children }));
184
+ });
185
+ /** A panel that selects any number of dates. */
186
+ export const MultiDatePanel = forwardRef(function MultiDatePanel({ children, asChild, ...props }, ref) {
187
+ const [options, rest] = splitMultiDatePanelProps(props);
188
+ const panel = useMultiDatePanel(definedOptions({
189
+ ...options,
190
+ id: props.id,
191
+ }));
192
+ return (_jsx(PanelRoot, { panel: panel, forwardedRef: ref, asChild: asChild, rest: rest, children: children }));
193
+ });
@@ -0,0 +1,34 @@
1
+ import type { DateInputPropGetters } from "./use-date-input.js";
2
+ import type { DatePanelPropGetters } from "./use-date-panel.js";
3
+ export type DatePanelContextValue = DatePanelPropGetters;
4
+ export type DateFieldContextValue = Pick<DateInputPropGetters, "state" | "controller" | "getSegmentProps" | "getTextFieldProps" | "getClearButtonProps">;
5
+ export declare const DatePanelContext: import("react").Context<{
6
+ state: import("../vendor/core/date/index.js").PanelState;
7
+ controller: import("../vendor/core/date/index.js").PanelController<import("../vendor/core/date/index.js").DateValue, import("../vendor/core/date/index.js").DatePanelOptions>;
8
+ actions: {
9
+ prev: () => void;
10
+ next: () => void;
11
+ today: () => void;
12
+ clear: () => void;
13
+ commit: () => void;
14
+ setLevel: (level: import("../vendor/core/date/index.js").PanelLevel) => void;
15
+ };
16
+ getRootProps: () => import("react").HTMLAttributes<HTMLElement> & {
17
+ [key: `data-${string}`]: string;
18
+ } & {
19
+ ref: import("react").RefObject<HTMLElement>;
20
+ };
21
+ getTitleProps: () => import("../shared/to-react-props.js").ChronoProps;
22
+ getLevelButtonProps: () => import("../shared/to-react-props.js").ChronoProps;
23
+ getNavProps: (kind: "prev" | "next") => import("../shared/to-react-props.js").ChronoProps;
24
+ getTodayButtonProps: () => import("../shared/to-react-props.js").ChronoProps;
25
+ getGridProps: () => import("../shared/to-react-props.js").ChronoProps;
26
+ getColumnHeaderProps: (header: import("../vendor/core/foundation/index.js").WeekdayHeader) => import("../shared/to-react-props.js").ChronoProps;
27
+ getWeekNumberProps: (weekNumber: number) => import("../shared/to-react-props.js").ChronoProps;
28
+ getCellProps: (day: import("../vendor/core/date/index.js").PanelDay) => import("../shared/to-react-props.js").ChronoProps;
29
+ getLevelCellProps: (cell: import("../vendor/core/date/index.js").PanelCell) => import("../shared/to-react-props.js").ChronoProps;
30
+ } | null>;
31
+ export declare const DateFieldContext: import("react").Context<DateFieldContextValue | null>;
32
+ /** Internal: parts read their panel from the nearest panel root (no global Provider). */
33
+ export declare function useDatePanelContext(part: string): DatePanelContextValue;
34
+ export declare function useDateFieldContext(part: string): DateFieldContextValue;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { createContext, useContext } from "react";
3
+ export const DatePanelContext = createContext(null);
4
+ export const DateFieldContext = createContext(null);
5
+ /** Internal: parts read their panel from the nearest panel root (no global Provider). */
6
+ export function useDatePanelContext(part) {
7
+ const value = useContext(DatePanelContext);
8
+ if (!value) {
9
+ throw new Error(`[chrono-react] <${part}> must be used inside <DatePanel>, <DateRangePanel> or <MultiDatePanel>.`);
10
+ }
11
+ return value;
12
+ }
13
+ export function useDateFieldContext(part) {
14
+ const value = useContext(DateFieldContext);
15
+ if (!value) {
16
+ throw new Error(`[chrono-react] <${part}> must be used inside <DateInput> or a <DateRangeInput> field.`);
17
+ }
18
+ return value;
19
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./components.js";
2
+ export * from "./use-date-input.js";
3
+ export * from "./use-date-panel.js";
4
+ export * from "./utilities.js";
@@ -0,0 +1,4 @@
1
+ export * from "./components.js";
2
+ export * from "./use-date-input.js";
3
+ export * from "./use-date-panel.js";
4
+ export * from "./utilities.js";
@@ -0,0 +1,7 @@
1
+ import type { DatePanelOptions, DateInputOptions, DateRangeInputOptions, DateRangePanelOptions, MultiDatePanelOptions } from "../vendor/core/date/index.js";
2
+ /** Separate the controller options from the element props a part receives. */
3
+ export declare const splitDatePanelProps: (props: object) => [DatePanelOptions, Record<string, unknown>];
4
+ export declare const splitDateRangePanelProps: (props: object) => [DateRangePanelOptions, Record<string, unknown>];
5
+ export declare const splitMultiDatePanelProps: (props: object) => [MultiDatePanelOptions, Record<string, unknown>];
6
+ export declare const splitDateInputProps: (props: object) => [DateInputOptions, Record<string, unknown>];
7
+ export declare const splitDateRangeInputProps: (props: object) => [DateRangeInputOptions, Record<string, unknown>];