@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,380 @@
1
+ import { compare, compileAvailability, createControllable, createId, defaultMessages, getHiddenInputs, getTimeZoneLabel, mergeMessages, nowZoned, toInstant, } from "../../foundation/index.js";
2
+ import { createDateInputController, } from "../../date/index.js";
3
+ import { createTimeInputController, } from "../../time/index.js";
4
+ import { compose, decompose, sameDateTime } from "../compose.js";
5
+ import { getBounds, isDayDisabled, timeBoundsFor } from "../constraints.js";
6
+ import { formatOffset } from "../zone/day-instants.js";
7
+ import { parseDateTime } from "./parse.js";
8
+ import { withOptional } from "../../foundation/index.js";
9
+ const DATE_PARTS = new Set(["day", "month", "year"]);
10
+ const isDatePart = (part) => DATE_PARTS.has(part);
11
+ /** The text between the date and the time of a locale ("," + space, or a space). */
12
+ function separatorOf(locale) {
13
+ const parts = new Intl.DateTimeFormat(locale, {
14
+ year: "numeric",
15
+ month: "numeric",
16
+ day: "numeric",
17
+ hour: "numeric",
18
+ minute: "numeric",
19
+ timeZone: "UTC",
20
+ }).formatToParts(Date.UTC(2020, 0, 1, 15, 4));
21
+ let sawDate = false;
22
+ let text = "";
23
+ for (const part of parts) {
24
+ if (part.type === "day" || part.type === "month" || part.type === "year") {
25
+ sawDate = true;
26
+ text = "";
27
+ }
28
+ else if (sawDate && part.type === "literal") {
29
+ text += part.value;
30
+ }
31
+ else if (part.type === "hour")
32
+ break;
33
+ }
34
+ return text || " ";
35
+ }
36
+ const pad = (n) => String(n).padStart(2, "0");
37
+ /** A date and a time input composed by one controller (plan 08 X10). */
38
+ export function createDateTimeInputController(initial = {}) {
39
+ let options = initial;
40
+ const id = options.id ?? createId("chrono-datetime-input");
41
+ const zone = () => ({
42
+ timeZone: options.timeZone,
43
+ valueTimeZone: options.valueTimeZone,
44
+ disambiguation: options.disambiguation,
45
+ });
46
+ const bounds = () => getBounds({
47
+ min: options.min,
48
+ max: options.max,
49
+ disablePast: options.disablePast,
50
+ timeZone: options.timeZone,
51
+ now: options.now,
52
+ });
53
+ const control = createControllable({
54
+ value: options.value,
55
+ defaultValue: options.defaultValue ?? null,
56
+ onChange: (value) => options.onValueChange?.(value, { adjusted: lastAdjusted }),
57
+ equals: sameDateTime,
58
+ });
59
+ let lastAdjusted = false;
60
+ let draft = decompose(control.get(), zone());
61
+ let focusedGroup = "date";
62
+ let lastCommitted = control.get();
63
+ const availabilityOf = () => options.availability === undefined
64
+ ? undefined
65
+ : compileAvailability(options.availability, {
66
+ timeZone: options.timeZone,
67
+ now: options.now,
68
+ });
69
+ const dateOptions = () => {
70
+ const b = bounds();
71
+ return {
72
+ id: `${id}-date`,
73
+ mode: options.mode,
74
+ value: draft.date,
75
+ onValueChange: (date) => setDraft({ date, time: draft.time }),
76
+ locale: options.locale,
77
+ timeZone: options.timeZone,
78
+ now: options.now,
79
+ min: b.min,
80
+ max: b.max,
81
+ isDateDisabled: (d) => isDayDisabled(d, b) || (options.isDateDisabled?.(d) ?? false),
82
+ isDateUnavailable: options.isDateUnavailable,
83
+ availability: options.availability,
84
+ onInvalidInput: options.onInvalidInput,
85
+ required: options.required,
86
+ readOnly: options.readOnly,
87
+ disabled: options.disabled,
88
+ messages: options.messages,
89
+ onFocusEdge: (direction) => edge("date", direction),
90
+ };
91
+ };
92
+ const timeOptions = () => {
93
+ const date = draft.date;
94
+ const limit = date ? timeBoundsFor(date, bounds()) : {};
95
+ return {
96
+ id: `${id}-time`,
97
+ mode: options.mode,
98
+ value: draft.time,
99
+ onValueChange: (time) => setDraft({ date: draft.date, time }),
100
+ locale: options.locale,
101
+ timeZone: options.timeZone,
102
+ now: options.now,
103
+ granularity: options.granularity,
104
+ hourCycle: options.hourCycle,
105
+ step: options.step,
106
+ min: limit.min,
107
+ max: limit.max,
108
+ isTimeDisabled: date ? (t) => options.isTimeDisabled?.(t, date) ?? false : undefined,
109
+ isTimeUnavailable: date
110
+ ? (t) => {
111
+ const availability = availabilityOf();
112
+ return availability ? !availability.isTimeAvailable(date, t) : false;
113
+ }
114
+ : undefined,
115
+ onInvalidInput: options.onInvalidInput,
116
+ required: options.required,
117
+ readOnly: options.readOnly,
118
+ disabled: options.disabled,
119
+ messages: options.messages,
120
+ onFocusEdge: (direction) => edge("time", direction),
121
+ };
122
+ };
123
+ const dateCtl = createDateInputController(dateOptions());
124
+ const timeCtl = createTimeInputController(timeOptions());
125
+ const firstLast = (group, which) => {
126
+ const parts = (group === "date" ? dateCtl.getState().segments : timeCtl.getState().segments)
127
+ .filter((segment) => segment.type !== "literal")
128
+ .map((segment) => segment.type);
129
+ return (which === "first" ? parts[0] : parts[parts.length - 1]);
130
+ };
131
+ function edge(group, direction) {
132
+ if (group === "date" && direction === 1) {
133
+ focusedGroup = "time";
134
+ timeCtl.focusPart(firstLast("time", "first"));
135
+ }
136
+ else if (group === "time" && direction === -1) {
137
+ focusedGroup = "date";
138
+ dateCtl.focusPart(firstLast("date", "last"));
139
+ }
140
+ else {
141
+ options.onFocusEdge?.(direction);
142
+ }
143
+ emit();
144
+ }
145
+ let state;
146
+ const listeners = new Set();
147
+ const evaluate = () => {
148
+ const composed = compose(draft, zone());
149
+ const b = bounds();
150
+ let value = composed.value;
151
+ if (value && draft.date && draft.time) {
152
+ const wall = draft.date;
153
+ const t = draft.time;
154
+ void wall;
155
+ const limit = timeBoundsFor(draft.date, b);
156
+ if (limit.min && compare(t, limit.min) < 0)
157
+ value = null;
158
+ if (limit.max && compare(t, limit.max) > 0)
159
+ value = null;
160
+ }
161
+ return {
162
+ value,
163
+ adjusted: composed.adjusted,
164
+ nonexistent: composed.nonexistent,
165
+ };
166
+ };
167
+ let current = evaluate();
168
+ const validity = () => {
169
+ const d = dateCtl.getState().validity;
170
+ const t = timeCtl.getState().validity;
171
+ if (d === "empty" && t === "empty")
172
+ return "empty";
173
+ for (const v of [d, t]) {
174
+ if (v !== "valid" && v !== "empty" && v !== "incomplete")
175
+ return v;
176
+ }
177
+ if (d !== "valid" || t !== "valid")
178
+ return "incomplete";
179
+ if (current.nonexistent)
180
+ return "nonexistent-time";
181
+ if (!current.value) {
182
+ const wall = draft.time && draft.date ? timeBoundsFor(draft.date, bounds()) : {};
183
+ return wall.min && draft.time && compare(draft.time, wall.min) < 0
184
+ ? "before-min"
185
+ : "after-max";
186
+ }
187
+ return "valid";
188
+ };
189
+ const formString = (value) => {
190
+ if (options.formValue)
191
+ return options.formValue(value);
192
+ const seconds = options.granularity === "second";
193
+ const base = `${value.year}-${pad(value.month)}-${pad(value.day)}T${pad(value.hour)}:${pad(value.minute)}${seconds ? `:${pad(value.second)}` : ""}`;
194
+ return "timeZone" in value ? `${base}${formatOffset(value.offset)}` : base;
195
+ };
196
+ const compute = () => {
197
+ const dateState = dateCtl.getState();
198
+ const timeState = timeCtl.getState();
199
+ const messages = mergeMessages(defaultMessages, options.messages);
200
+ const mode = options.mode ?? "segmented";
201
+ const literal = {
202
+ type: "literal",
203
+ text: separatorOf(options.locale ?? undefined),
204
+ value: null,
205
+ placeholder: "",
206
+ min: 0,
207
+ max: 0,
208
+ valueText: "",
209
+ editable: false,
210
+ };
211
+ const value = control.get();
212
+ const at = options.now ?? (value && "timeZone" in value ? toInstant(value) : 0);
213
+ return withOptional({
214
+ id,
215
+ mode,
216
+ segments: [...dateState.segments, literal, ...timeState.segments],
217
+ dateField: dateState,
218
+ timeField: timeState,
219
+ value,
220
+ validity: validity(),
221
+ adjusted: current.adjusted,
222
+ focusedPart: focusedGroup === "date" ? dateState.focusedPart : timeState.focusedPart,
223
+ zoneLabel: options.timeZone ? getTimeZoneLabel(options.timeZone, options.locale, at) : null,
224
+ required: options.required ?? false,
225
+ readOnly: options.readOnly ?? false,
226
+ disabled: options.disabled ?? false,
227
+ direction: dateState.direction,
228
+ locale: dateState.locale,
229
+ messages,
230
+ hidden: getHiddenInputs([[options.name, value ? formString(value) : null]]),
231
+ });
232
+ };
233
+ const emit = () => {
234
+ const next = compute();
235
+ if (state && JSON.stringify(state) === JSON.stringify(next))
236
+ return;
237
+ state = next;
238
+ for (const listener of [...listeners])
239
+ listener(state);
240
+ };
241
+ function setDraft(next) {
242
+ draft = next;
243
+ current = evaluate();
244
+ dateCtl.setOptions(dateOptions());
245
+ timeCtl.setOptions(timeOptions());
246
+ if (!sameDateTime(control.get(), current.value)) {
247
+ lastAdjusted = current.adjusted;
248
+ control.set(current.value);
249
+ }
250
+ emit();
251
+ }
252
+ state = compute();
253
+ dateCtl.subscribe(emit);
254
+ timeCtl.subscribe(emit);
255
+ void nowZoned;
256
+ const groupOf = (part) => (isDatePart(part) ? dateCtl : timeCtl);
257
+ const controller = {
258
+ getState: () => state,
259
+ subscribe(listener) {
260
+ listeners.add(listener);
261
+ return () => {
262
+ listeners.delete(listener);
263
+ };
264
+ },
265
+ setOptions(next) {
266
+ options = { ...options, ...next };
267
+ control.sync({ value: options.value });
268
+ if (!sameDateTime(current.value, control.get())) {
269
+ draft = decompose(control.get(), zone());
270
+ }
271
+ current = evaluate();
272
+ dateCtl.setOptions(dateOptions());
273
+ timeCtl.setOptions(timeOptions());
274
+ emit();
275
+ },
276
+ getDate: () => dateCtl,
277
+ getTime: () => timeCtl,
278
+ handleKeyDown(part, key, modifiers) {
279
+ focusedGroup = isDatePart(part) ? "date" : "time";
280
+ const group = groupOf(part);
281
+ return group.handleKeyDown(part, key, modifiers);
282
+ },
283
+ focusPart(part) {
284
+ focusedGroup = isDatePart(part) ? "date" : "time";
285
+ groupOf(part).focusPart(part);
286
+ emit();
287
+ },
288
+ settle() {
289
+ dateCtl.settle();
290
+ timeCtl.settle();
291
+ },
292
+ paste(text) {
293
+ if (options.disabled || options.readOnly)
294
+ return false;
295
+ const result = parseDateTime(text, {
296
+ locale: options.locale,
297
+ timeZone: options.timeZone,
298
+ });
299
+ if ("error" in result) {
300
+ options.onInvalidInput?.(text);
301
+ return false;
302
+ }
303
+ setDraft({
304
+ date: result.date ?? draft.date,
305
+ time: result.time ?? draft.time,
306
+ });
307
+ return true;
308
+ },
309
+ commit() {
310
+ dateCtl.commit();
311
+ timeCtl.commit();
312
+ const value = control.get();
313
+ if (value && state.validity === "valid" && !sameDateTime(value, lastCommitted)) {
314
+ lastCommitted = value;
315
+ options.onValueCommit?.(value);
316
+ }
317
+ },
318
+ clear() {
319
+ if (options.disabled || options.readOnly)
320
+ return;
321
+ dateCtl.clear();
322
+ timeCtl.clear();
323
+ focusedGroup = "date";
324
+ draft = { date: null, time: null };
325
+ lastCommitted = null;
326
+ setDraft(draft);
327
+ },
328
+ reset() {
329
+ const value = options.defaultValue ?? null;
330
+ draft = decompose(value, zone());
331
+ lastCommitted = value;
332
+ dateCtl.reset();
333
+ timeCtl.reset();
334
+ control.set(value);
335
+ setDraft(draft);
336
+ },
337
+ getRootAttributes: () => ({
338
+ role: "group",
339
+ "data-chrono-datetime-input": true,
340
+ "data-mode": state.mode,
341
+ "data-disabled": state.disabled,
342
+ "data-readonly": state.readOnly,
343
+ "data-invalid": state.validity !== "valid" && state.validity !== "empty",
344
+ "data-adjusted": state.adjusted,
345
+ "aria-disabled": state.disabled ? "true" : undefined,
346
+ dir: state.direction,
347
+ }),
348
+ getSegmentAttributes(segment) {
349
+ if (segment.type === "literal")
350
+ return dateCtl.getSegmentAttributes(segment);
351
+ const base = groupOf(segment.type) === dateCtl
352
+ ? dateCtl.getSegmentAttributes(segment)
353
+ : timeCtl.getSegmentAttributes(segment);
354
+ return {
355
+ ...base,
356
+ // One tab stop for the whole group, not one per sub-controller.
357
+ tabindex: state.disabled ? undefined : segment.type === state.focusedPart ? 0 : -1,
358
+ };
359
+ },
360
+ getDateFieldAttributes: () => ({
361
+ ...dateCtl.getTextFieldAttributes(),
362
+ "aria-label": state.messages.date,
363
+ }),
364
+ getTimeFieldAttributes: () => ({
365
+ ...timeCtl.getTextFieldAttributes(),
366
+ "aria-label": state.messages.time,
367
+ }),
368
+ getClearButtonAttributes: () => ({
369
+ type: "button",
370
+ "aria-label": state.messages.clear,
371
+ "data-disabled": state.disabled || state.validity === "empty",
372
+ }),
373
+ destroy() {
374
+ listeners.clear();
375
+ dateCtl.destroy();
376
+ timeCtl.destroy();
377
+ },
378
+ };
379
+ return controller;
380
+ }
@@ -0,0 +1,46 @@
1
+ import { type Attributes, type HiddenInput } from "../../foundation/index.js";
2
+ import { type DateTimeRangeReason } from "../constraints.js";
3
+ import type { DateTimeRangeValue, DateTimeValue } from "../types.js";
4
+ import { type DateTimeInputController, type DateTimeInputOptions, type DateTimeInputState, type DateTimeValidity } from "./datetime-input-controller.js";
5
+ export type DateTimeRangeInputOptions = Omit<DateTimeInputOptions, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | "name" | "onFocusEdge"> & {
6
+ value?: DateTimeRangeValue;
7
+ defaultValue?: DateTimeRangeValue;
8
+ onValueChange?: (value: DateTimeRangeValue) => void;
9
+ onValueCommit?: (value: {
10
+ start: NonNullable<DateTimeValue>;
11
+ end: NonNullable<DateTimeValue>;
12
+ }) => void;
13
+ name?: string;
14
+ startName?: string;
15
+ endName?: string;
16
+ /** Minutes. */
17
+ minDuration?: number;
18
+ maxDuration?: number;
19
+ };
20
+ export type DateTimeRangeValidity = DateTimeValidity | DateTimeRangeReason;
21
+ export type DateTimeRangeInputState = {
22
+ id: string;
23
+ value: DateTimeRangeValue;
24
+ validity: DateTimeRangeValidity;
25
+ start: DateTimeInputState;
26
+ end: DateTimeInputState;
27
+ duration: number | null;
28
+ disabled: boolean;
29
+ readOnly: boolean;
30
+ hidden: HiddenInput[];
31
+ messages: DateTimeInputState["messages"];
32
+ };
33
+ export type DateTimeRangeInputController = {
34
+ getState(): DateTimeRangeInputState;
35
+ subscribe(listener: (state: DateTimeRangeInputState) => void): () => void;
36
+ setOptions(options: Partial<DateTimeRangeInputOptions>): void;
37
+ getStart(): DateTimeInputController;
38
+ getEnd(): DateTimeInputController;
39
+ commit(): void;
40
+ clear(): void;
41
+ reset(): void;
42
+ getRootAttributes(): Attributes;
43
+ destroy(): void;
44
+ };
45
+ /** Two date-time inputs in one group (plan 08 X10). */
46
+ export declare function createDateTimeRangeInputController(initial?: DateTimeRangeInputOptions): DateTimeRangeInputController;
@@ -0,0 +1,171 @@
1
+ import { createControllable, createId, getHiddenInputs, } from "../../foundation/index.js";
2
+ import { sameDateTime } from "../compose.js";
3
+ import { checkDateTimeRange, getBounds } from "../constraints.js";
4
+ import { createDateTimeInputController, } from "./datetime-input-controller.js";
5
+ const sameRange = (a, b) => a === b ||
6
+ (a !== null && b !== null && sameDateTime(a.start, b.start) && sameDateTime(a.end, b.end));
7
+ /** Two date-time inputs in one group (plan 08 X10). */
8
+ export function createDateTimeRangeInputController(initial = {}) {
9
+ let options = initial;
10
+ const id = options.id ?? createId("chrono-datetime-range-input");
11
+ const control = createControllable({
12
+ value: options.value,
13
+ defaultValue: options.defaultValue ?? null,
14
+ onChange: (value) => options.onValueChange?.(value),
15
+ equals: sameRange,
16
+ });
17
+ let lastCommitted = control.get();
18
+ const childOptions = () => {
19
+ const { value: _v, defaultValue: _d, onValueChange: _c, onValueCommit: _m, name: _n, startName: _s, endName: _e, minDuration: _a, maxDuration: _b, ...shared } = options;
20
+ // The fields only format the hidden value; this range names the inputs.
21
+ return {
22
+ ...shared,
23
+ name: options.name || options.startName || options.endName ? "value" : undefined,
24
+ };
25
+ };
26
+ const combine = (start, end) => start === null && end === null ? null : { start, end };
27
+ const setSide = (side, value) => {
28
+ const now = control.get();
29
+ control.set(combine(side === "start" ? value : (now?.start ?? null), side === "end" ? value : (now?.end ?? null)));
30
+ propagate();
31
+ refresh();
32
+ };
33
+ const startCtl = createDateTimeInputController({
34
+ ...childOptions(),
35
+ id: `${id}-start`,
36
+ value: control.get()?.start ?? null,
37
+ defaultValue: undefined,
38
+ onValueChange: (value) => setSide("start", value),
39
+ });
40
+ const endCtl = createDateTimeInputController({
41
+ ...childOptions(),
42
+ id: `${id}-end`,
43
+ value: control.get()?.end ?? null,
44
+ defaultValue: undefined,
45
+ onValueChange: (value) => setSide("end", value),
46
+ });
47
+ function propagate() {
48
+ const value = control.get();
49
+ startCtl.setOptions({ value: value?.start ?? null });
50
+ endCtl.setOptions({ value: value?.end ?? null });
51
+ }
52
+ let state;
53
+ const listeners = new Set();
54
+ const compute = () => {
55
+ const start = startCtl.getState();
56
+ const end = endCtl.getState();
57
+ let validity;
58
+ let duration = null;
59
+ if (start.validity === "empty" && end.validity === "empty")
60
+ validity = "empty";
61
+ else if (start.validity !== "valid" && start.validity !== "empty")
62
+ validity = start.validity;
63
+ else if (end.validity !== "valid" && end.validity !== "empty")
64
+ validity = end.validity;
65
+ else if (!start.value || !end.value)
66
+ validity = "incomplete";
67
+ else {
68
+ const check = checkDateTimeRange(start.value, end.value, {
69
+ minDuration: options.minDuration,
70
+ maxDuration: options.maxDuration,
71
+ bounds: getBounds({
72
+ min: options.min,
73
+ max: options.max,
74
+ disablePast: options.disablePast,
75
+ timeZone: options.timeZone,
76
+ now: options.now,
77
+ }),
78
+ });
79
+ validity = check.valid ? "valid" : check.reason;
80
+ if (check.valid)
81
+ duration = check.duration;
82
+ }
83
+ const value = control.get();
84
+ const name = options.name;
85
+ return {
86
+ id,
87
+ value,
88
+ validity,
89
+ start,
90
+ end,
91
+ duration,
92
+ disabled: start.disabled,
93
+ readOnly: start.readOnly,
94
+ hidden: getHiddenInputs([
95
+ [options.startName ?? (name ? `${name}-start` : undefined), start.hidden[0]?.value ?? null],
96
+ [options.endName ?? (name ? `${name}-end` : undefined), end.hidden[0]?.value ?? null],
97
+ ]),
98
+ messages: start.messages,
99
+ };
100
+ };
101
+ const refresh = () => {
102
+ const next = compute();
103
+ if (state && JSON.stringify(state) === JSON.stringify(next))
104
+ return;
105
+ state = next;
106
+ for (const listener of [...listeners])
107
+ listener(state);
108
+ };
109
+ state = compute();
110
+ startCtl.subscribe(refresh);
111
+ endCtl.subscribe(refresh);
112
+ return {
113
+ getState: () => state,
114
+ subscribe(listener) {
115
+ listeners.add(listener);
116
+ return () => {
117
+ listeners.delete(listener);
118
+ };
119
+ },
120
+ setOptions(next) {
121
+ options = { ...options, ...next };
122
+ control.sync({ value: options.value });
123
+ const shared = childOptions();
124
+ // The hidden values belong to this range; the two fields carry no `name`.
125
+ startCtl.setOptions({ ...shared, value: control.get()?.start ?? null });
126
+ endCtl.setOptions({ ...shared, value: control.get()?.end ?? null });
127
+ refresh();
128
+ },
129
+ getStart: () => startCtl,
130
+ getEnd: () => endCtl,
131
+ commit() {
132
+ const value = control.get();
133
+ if (state.validity === "valid" &&
134
+ value?.start &&
135
+ value.end &&
136
+ !sameRange(value, lastCommitted)) {
137
+ lastCommitted = value;
138
+ options.onValueCommit?.({ start: value.start, end: value.end });
139
+ }
140
+ },
141
+ clear() {
142
+ startCtl.clear();
143
+ endCtl.clear();
144
+ lastCommitted = null;
145
+ },
146
+ reset() {
147
+ const value = options.defaultValue ?? null;
148
+ control.set(value);
149
+ propagate();
150
+ startCtl.reset();
151
+ endCtl.reset();
152
+ lastCommitted = value;
153
+ refresh();
154
+ },
155
+ getRootAttributes: () => ({
156
+ role: "group",
157
+ "data-chrono-datetime-range-input": true,
158
+ "data-mode": state.start.mode,
159
+ "data-disabled": state.disabled,
160
+ "data-readonly": state.readOnly,
161
+ "data-invalid": state.validity !== "valid" && state.validity !== "empty",
162
+ "aria-disabled": state.disabled ? "true" : undefined,
163
+ dir: state.start.direction,
164
+ }),
165
+ destroy() {
166
+ listeners.clear();
167
+ startCtl.destroy();
168
+ endCtl.destroy();
169
+ },
170
+ };
171
+ }
@@ -0,0 +1,20 @@
1
+ import { type PlainDate, type PlainTime } from "../../foundation/index.js";
2
+ export type DateTimeParseContext = {
3
+ locale?: string | undefined;
4
+ /** The display zone; an ISO string with an offset or `Z` is converted into it. */
5
+ timeZone?: string | undefined;
6
+ today?: PlainDate;
7
+ };
8
+ /** `date` and `time` are `null` when the text holds only the other one (plan 08 §13.2). */
9
+ export type DateTimeParseResult = {
10
+ date: PlainDate | null;
11
+ time: PlainTime | null;
12
+ } | {
13
+ error: "empty" | "unparseable" | "invalid";
14
+ };
15
+ /**
16
+ * Split pasted text into a date and a time and parse each with the Date and Time
17
+ * parsers: ISO with `T`, `17/11/2026 9:30`, `Nov 17, 2026 9:30 PM`, a bare date or a
18
+ * bare time. Built on `date/` and `time/` only.
19
+ */
20
+ export declare function parseDateTime(text: string, context?: DateTimeParseContext): DateTimeParseResult;
@@ -0,0 +1,56 @@
1
+ import { toPlainDateTime, plainDate, plainTime, } from "../../foundation/index.js";
2
+ import { parseDate } from "../../date/index.js";
3
+ import { dayPeriodOf, parseTime } from "../../time/index.js";
4
+ const fail = (error) => ({
5
+ error: error === "invalid" || error === "invalid-date" ? "invalid" : "unparseable",
6
+ });
7
+ const ISO = /^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?)(Z|[+-]\d{2}:?\d{2})?$/;
8
+ const TIME_TAIL = /(\d{1,2}:\d{2}(?::\d{2})?)(?:\s*([^\d\s:]+\.?))?\s*$/u;
9
+ const HOUR_TAIL = /(\d{1,2})\s*([^\d\s:]+\.?)\s*$/u;
10
+ /**
11
+ * Split pasted text into a date and a time and parse each with the Date and Time
12
+ * parsers: ISO with `T`, `17/11/2026 9:30`, `Nov 17, 2026 9:30 PM`, a bare date or a
13
+ * bare time. Built on `date/` and `time/` only.
14
+ */
15
+ export function parseDateTime(text, context = {}) {
16
+ const trimmed = text.trim();
17
+ if (trimmed === "")
18
+ return { error: "empty" };
19
+ const iso = ISO.exec(trimmed);
20
+ if (iso) {
21
+ try {
22
+ const wall = toPlainDateTime(iso[3] ? `${iso[1]}T${iso[2]}${iso[3]}` : `${iso[1]}T${iso[2]}`, context.timeZone ?? "UTC");
23
+ return {
24
+ date: plainDate(wall.year, wall.month, wall.day),
25
+ time: plainTime(wall.hour, wall.minute, wall.second),
26
+ };
27
+ }
28
+ catch {
29
+ return { error: "invalid" };
30
+ }
31
+ }
32
+ let datePart = trimmed;
33
+ let timePart = "";
34
+ const withColon = TIME_TAIL.exec(trimmed);
35
+ const hourOnly = HOUR_TAIL.exec(trimmed);
36
+ if (withColon && (!withColon[2] || dayPeriodOf(withColon[2], context.locale))) {
37
+ timePart = withColon[0];
38
+ datePart = trimmed.slice(0, withColon.index);
39
+ }
40
+ else if (hourOnly && dayPeriodOf(hourOnly[2], context.locale)) {
41
+ timePart = hourOnly[0];
42
+ datePart = trimmed.slice(0, hourOnly.index);
43
+ }
44
+ datePart = datePart.replace(/[\s,]+(at)?[\s,]*$/i, "").trim();
45
+ if (timePart === "") {
46
+ const date = parseDate(datePart, context);
47
+ return "date" in date ? { date: date.date, time: null } : fail(date.error);
48
+ }
49
+ const time = parseTime(timePart, { locale: context.locale });
50
+ if (!("time" in time))
51
+ return fail(time.error);
52
+ if (datePart === "")
53
+ return { date: null, time: time.time };
54
+ const date = parseDate(datePart, context);
55
+ return "date" in date ? { date: date.date, time: time.time } : fail(date.error);
56
+ }