@cdx-ui/primitives 0.0.1-beta.140 → 0.0.1-beta.142

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 (433) hide show
  1. package/lib/commonjs/calendar/CalendarGrid.js +33 -0
  2. package/lib/commonjs/calendar/CalendarGrid.js.map +1 -0
  3. package/lib/commonjs/calendar/CalendarRoot.js +95 -0
  4. package/lib/commonjs/calendar/CalendarRoot.js.map +1 -0
  5. package/lib/commonjs/calendar/context.js +17 -0
  6. package/lib/commonjs/calendar/context.js.map +1 -0
  7. package/lib/commonjs/calendar/index.js +27 -0
  8. package/lib/commonjs/calendar/index.js.map +1 -0
  9. package/lib/commonjs/calendar/types.js +6 -0
  10. package/lib/commonjs/calendar/types.js.map +1 -0
  11. package/lib/commonjs/checkbox/CheckboxRoot.web.js +91 -28
  12. package/lib/commonjs/checkbox/CheckboxRoot.web.js.map +1 -1
  13. package/lib/commonjs/checkbox/useCheckboxRoot.js +33 -19
  14. package/lib/commonjs/checkbox/useCheckboxRoot.js.map +1 -1
  15. package/lib/commonjs/date-field/DateFieldHiddenInput.js +148 -0
  16. package/lib/commonjs/date-field/DateFieldHiddenInput.js.map +1 -0
  17. package/lib/commonjs/date-field/DateFieldInput.js +122 -0
  18. package/lib/commonjs/date-field/DateFieldInput.js.map +1 -0
  19. package/lib/commonjs/date-field/DateFieldRoot.js +85 -0
  20. package/lib/commonjs/date-field/DateFieldRoot.js.map +1 -0
  21. package/lib/commonjs/date-field/DateFieldSegment.js +92 -0
  22. package/lib/commonjs/date-field/DateFieldSegment.js.map +1 -0
  23. package/lib/commonjs/date-field/context.js +19 -0
  24. package/lib/commonjs/date-field/context.js.map +1 -0
  25. package/lib/commonjs/date-field/index.js +34 -0
  26. package/lib/commonjs/date-field/index.js.map +1 -0
  27. package/lib/commonjs/date-field/segmentIndex.js +23 -0
  28. package/lib/commonjs/date-field/segmentIndex.js.map +1 -0
  29. package/lib/commonjs/date-field/segmentKeyboard.js +169 -0
  30. package/lib/commonjs/date-field/segmentKeyboard.js.map +1 -0
  31. package/lib/commonjs/date-field/types.js +6 -0
  32. package/lib/commonjs/date-field/types.js.map +1 -0
  33. package/lib/commonjs/date-field/useDateFieldSegmentState.js +381 -0
  34. package/lib/commonjs/date-field/useDateFieldSegmentState.js.map +1 -0
  35. package/lib/commonjs/date-field/useRangeDateFieldBridge.js +67 -0
  36. package/lib/commonjs/date-field/useRangeDateFieldBridge.js.map +1 -0
  37. package/lib/commonjs/date-picker/DatePickerRoot.js +123 -0
  38. package/lib/commonjs/date-picker/DatePickerRoot.js.map +1 -0
  39. package/lib/commonjs/date-picker/context.js +17 -0
  40. package/lib/commonjs/date-picker/context.js.map +1 -0
  41. package/lib/commonjs/date-picker/index.js +26 -0
  42. package/lib/commonjs/date-picker/index.js.map +1 -0
  43. package/lib/commonjs/date-range-picker/DateRangePickerRoot.js +144 -0
  44. package/lib/commonjs/date-range-picker/DateRangePickerRoot.js.map +1 -0
  45. package/lib/commonjs/date-range-picker/context.js +23 -0
  46. package/lib/commonjs/date-range-picker/context.js.map +1 -0
  47. package/lib/commonjs/date-range-picker/index.js +26 -0
  48. package/lib/commonjs/date-range-picker/index.js.map +1 -0
  49. package/lib/commonjs/date-time-field/DateTimeFieldHiddenInput.js +150 -0
  50. package/lib/commonjs/date-time-field/DateTimeFieldHiddenInput.js.map +1 -0
  51. package/lib/commonjs/date-time-field/DateTimeFieldInput.js +104 -0
  52. package/lib/commonjs/date-time-field/DateTimeFieldInput.js.map +1 -0
  53. package/lib/commonjs/date-time-field/DateTimeFieldRoot.js +159 -0
  54. package/lib/commonjs/date-time-field/DateTimeFieldRoot.js.map +1 -0
  55. package/lib/commonjs/date-time-field/DateTimeFieldSegment.js +87 -0
  56. package/lib/commonjs/date-time-field/DateTimeFieldSegment.js.map +1 -0
  57. package/lib/commonjs/date-time-field/context.js +17 -0
  58. package/lib/commonjs/date-time-field/context.js.map +1 -0
  59. package/lib/commonjs/date-time-field/index.js +40 -0
  60. package/lib/commonjs/date-time-field/index.js.map +1 -0
  61. package/lib/commonjs/date-time-field/useDateTimeFieldSegmentState.js +564 -0
  62. package/lib/commonjs/date-time-field/useDateTimeFieldSegmentState.js.map +1 -0
  63. package/lib/commonjs/date-time-list/DateTimeListRoot.js +418 -0
  64. package/lib/commonjs/date-time-list/DateTimeListRoot.js.map +1 -0
  65. package/lib/commonjs/date-time-list/context.js +26 -0
  66. package/lib/commonjs/date-time-list/context.js.map +1 -0
  67. package/lib/commonjs/date-time-list/index.js +62 -0
  68. package/lib/commonjs/date-time-list/index.js.map +1 -0
  69. package/lib/commonjs/date-time-picker/DateTimePickerRoot.js +134 -0
  70. package/lib/commonjs/date-time-picker/DateTimePickerRoot.js.map +1 -0
  71. package/lib/commonjs/date-time-picker/context.js +17 -0
  72. package/lib/commonjs/date-time-picker/context.js.map +1 -0
  73. package/lib/commonjs/date-time-picker/index.js +26 -0
  74. package/lib/commonjs/date-time-picker/index.js.map +1 -0
  75. package/lib/commonjs/dialog/DialogRoot.js +1 -1
  76. package/lib/commonjs/dialog/DialogRoot.js.map +1 -1
  77. package/lib/commonjs/index.js +148 -0
  78. package/lib/commonjs/index.js.map +1 -1
  79. package/lib/commonjs/month-calendar/MonthCalendarCell.js +64 -0
  80. package/lib/commonjs/month-calendar/MonthCalendarCell.js.map +1 -0
  81. package/lib/commonjs/month-calendar/MonthCalendarRoot.js +103 -0
  82. package/lib/commonjs/month-calendar/MonthCalendarRoot.js.map +1 -0
  83. package/lib/commonjs/month-calendar/MonthCalendarYearCell.js +63 -0
  84. package/lib/commonjs/month-calendar/MonthCalendarYearCell.js.map +1 -0
  85. package/lib/commonjs/month-calendar/context.js +17 -0
  86. package/lib/commonjs/month-calendar/context.js.map +1 -0
  87. package/lib/commonjs/month-calendar/index.js +34 -0
  88. package/lib/commonjs/month-calendar/index.js.map +1 -0
  89. package/lib/commonjs/month-picker/MonthPickerRoot.js +118 -0
  90. package/lib/commonjs/month-picker/MonthPickerRoot.js.map +1 -0
  91. package/lib/commonjs/month-picker/context.js +17 -0
  92. package/lib/commonjs/month-picker/context.js.map +1 -0
  93. package/lib/commonjs/month-picker/index.js +26 -0
  94. package/lib/commonjs/month-picker/index.js.map +1 -0
  95. package/lib/commonjs/overlay/useAnchorPosition.js +27 -16
  96. package/lib/commonjs/overlay/useAnchorPosition.js.map +1 -1
  97. package/lib/commonjs/overlay/useDismissOverlay.web.js +10 -2
  98. package/lib/commonjs/overlay/useDismissOverlay.web.js.map +1 -1
  99. package/lib/commonjs/overlay/useOverlayPosition.js +5 -2
  100. package/lib/commonjs/overlay/useOverlayPosition.js.map +1 -1
  101. package/lib/commonjs/portal/portal.js +59 -2
  102. package/lib/commonjs/portal/portal.js.map +1 -1
  103. package/lib/commonjs/radio/RadioGroup.js +65 -16
  104. package/lib/commonjs/radio/RadioGroup.js.map +1 -1
  105. package/lib/commonjs/radio/RadioRoot.web.js +114 -26
  106. package/lib/commonjs/radio/RadioRoot.web.js.map +1 -1
  107. package/lib/commonjs/radio/context.js.map +1 -1
  108. package/lib/commonjs/radio/useRadioGroupNavigation.js +79 -0
  109. package/lib/commonjs/radio/useRadioGroupNavigation.js.map +1 -0
  110. package/lib/commonjs/radio/useRadioRoot.js +14 -13
  111. package/lib/commonjs/radio/useRadioRoot.js.map +1 -1
  112. package/lib/commonjs/range-calendar/RangeCalendarRoot.js +148 -0
  113. package/lib/commonjs/range-calendar/RangeCalendarRoot.js.map +1 -0
  114. package/lib/commonjs/range-calendar/context.js +17 -0
  115. package/lib/commonjs/range-calendar/context.js.map +1 -0
  116. package/lib/commonjs/range-calendar/index.js +20 -0
  117. package/lib/commonjs/range-calendar/index.js.map +1 -0
  118. package/lib/commonjs/select/SelectRoot.js +1 -1
  119. package/lib/commonjs/select/SelectRoot.js.map +1 -1
  120. package/lib/commonjs/utils/accessibleLabel.js +23 -0
  121. package/lib/commonjs/utils/accessibleLabel.js.map +1 -0
  122. package/lib/commonjs/utils/createPortal.web.js +21 -0
  123. package/lib/commonjs/utils/createPortal.web.js.map +1 -0
  124. package/lib/module/calendar/CalendarGrid.js +29 -0
  125. package/lib/module/calendar/CalendarGrid.js.map +1 -0
  126. package/lib/module/calendar/CalendarRoot.js +91 -0
  127. package/lib/module/calendar/CalendarRoot.js.map +1 -0
  128. package/lib/module/calendar/context.js +12 -0
  129. package/lib/module/calendar/context.js.map +1 -0
  130. package/lib/module/calendar/index.js +6 -0
  131. package/lib/module/calendar/index.js.map +1 -0
  132. package/lib/module/calendar/types.js +4 -0
  133. package/lib/module/calendar/types.js.map +1 -0
  134. package/lib/module/checkbox/CheckboxRoot.web.js +92 -29
  135. package/lib/module/checkbox/CheckboxRoot.web.js.map +1 -1
  136. package/lib/module/checkbox/useCheckboxRoot.js +34 -20
  137. package/lib/module/checkbox/useCheckboxRoot.js.map +1 -1
  138. package/lib/module/date-field/DateFieldHiddenInput.js +146 -0
  139. package/lib/module/date-field/DateFieldHiddenInput.js.map +1 -0
  140. package/lib/module/date-field/DateFieldInput.js +118 -0
  141. package/lib/module/date-field/DateFieldInput.js.map +1 -0
  142. package/lib/module/date-field/DateFieldRoot.js +81 -0
  143. package/lib/module/date-field/DateFieldRoot.js.map +1 -0
  144. package/lib/module/date-field/DateFieldSegment.js +88 -0
  145. package/lib/module/date-field/DateFieldSegment.js.map +1 -0
  146. package/lib/module/date-field/context.js +15 -0
  147. package/lib/module/date-field/context.js.map +1 -0
  148. package/lib/module/date-field/index.js +7 -0
  149. package/lib/module/date-field/index.js.map +1 -0
  150. package/lib/module/date-field/segmentIndex.js +18 -0
  151. package/lib/module/date-field/segmentIndex.js.map +1 -0
  152. package/lib/module/date-field/segmentKeyboard.js +157 -0
  153. package/lib/module/date-field/segmentKeyboard.js.map +1 -0
  154. package/lib/module/date-field/types.js +4 -0
  155. package/lib/module/date-field/types.js.map +1 -0
  156. package/lib/module/date-field/useDateFieldSegmentState.js +378 -0
  157. package/lib/module/date-field/useDateFieldSegmentState.js.map +1 -0
  158. package/lib/module/date-field/useRangeDateFieldBridge.js +63 -0
  159. package/lib/module/date-field/useRangeDateFieldBridge.js.map +1 -0
  160. package/lib/module/date-picker/DatePickerRoot.js +119 -0
  161. package/lib/module/date-picker/DatePickerRoot.js.map +1 -0
  162. package/lib/module/date-picker/context.js +12 -0
  163. package/lib/module/date-picker/context.js.map +1 -0
  164. package/lib/module/date-picker/index.js +5 -0
  165. package/lib/module/date-picker/index.js.map +1 -0
  166. package/lib/module/date-range-picker/DateRangePickerRoot.js +140 -0
  167. package/lib/module/date-range-picker/DateRangePickerRoot.js.map +1 -0
  168. package/lib/module/date-range-picker/context.js +19 -0
  169. package/lib/module/date-range-picker/context.js.map +1 -0
  170. package/lib/module/date-range-picker/index.js +5 -0
  171. package/lib/module/date-range-picker/index.js.map +1 -0
  172. package/lib/module/date-time-field/DateTimeFieldHiddenInput.js +148 -0
  173. package/lib/module/date-time-field/DateTimeFieldHiddenInput.js.map +1 -0
  174. package/lib/module/date-time-field/DateTimeFieldInput.js +100 -0
  175. package/lib/module/date-time-field/DateTimeFieldInput.js.map +1 -0
  176. package/lib/module/date-time-field/DateTimeFieldRoot.js +154 -0
  177. package/lib/module/date-time-field/DateTimeFieldRoot.js.map +1 -0
  178. package/lib/module/date-time-field/DateTimeFieldSegment.js +83 -0
  179. package/lib/module/date-time-field/DateTimeFieldSegment.js.map +1 -0
  180. package/lib/module/date-time-field/context.js +12 -0
  181. package/lib/module/date-time-field/context.js.map +1 -0
  182. package/lib/module/date-time-field/index.js +7 -0
  183. package/lib/module/date-time-field/index.js.map +1 -0
  184. package/lib/module/date-time-field/useDateTimeFieldSegmentState.js +561 -0
  185. package/lib/module/date-time-field/useDateTimeFieldSegmentState.js.map +1 -0
  186. package/lib/module/date-time-list/DateTimeListRoot.js +416 -0
  187. package/lib/module/date-time-list/DateTimeListRoot.js.map +1 -0
  188. package/lib/module/date-time-list/context.js +20 -0
  189. package/lib/module/date-time-list/context.js.map +1 -0
  190. package/lib/module/date-time-list/index.js +5 -0
  191. package/lib/module/date-time-list/index.js.map +1 -0
  192. package/lib/module/date-time-picker/DateTimePickerRoot.js +130 -0
  193. package/lib/module/date-time-picker/DateTimePickerRoot.js.map +1 -0
  194. package/lib/module/date-time-picker/context.js +12 -0
  195. package/lib/module/date-time-picker/context.js.map +1 -0
  196. package/lib/module/date-time-picker/index.js +5 -0
  197. package/lib/module/date-time-picker/index.js.map +1 -0
  198. package/lib/module/dialog/DialogRoot.js +1 -1
  199. package/lib/module/dialog/DialogRoot.js.map +1 -1
  200. package/lib/module/index.js +11 -2
  201. package/lib/module/index.js.map +1 -1
  202. package/lib/module/month-calendar/MonthCalendarCell.js +60 -0
  203. package/lib/module/month-calendar/MonthCalendarCell.js.map +1 -0
  204. package/lib/module/month-calendar/MonthCalendarRoot.js +99 -0
  205. package/lib/module/month-calendar/MonthCalendarRoot.js.map +1 -0
  206. package/lib/module/month-calendar/MonthCalendarYearCell.js +59 -0
  207. package/lib/module/month-calendar/MonthCalendarYearCell.js.map +1 -0
  208. package/lib/module/month-calendar/context.js +12 -0
  209. package/lib/module/month-calendar/context.js.map +1 -0
  210. package/lib/module/month-calendar/index.js +7 -0
  211. package/lib/module/month-calendar/index.js.map +1 -0
  212. package/lib/module/month-picker/MonthPickerRoot.js +114 -0
  213. package/lib/module/month-picker/MonthPickerRoot.js.map +1 -0
  214. package/lib/module/month-picker/context.js +12 -0
  215. package/lib/module/month-picker/context.js.map +1 -0
  216. package/lib/module/month-picker/index.js +5 -0
  217. package/lib/module/month-picker/index.js.map +1 -0
  218. package/lib/module/overlay/useAnchorPosition.js +27 -16
  219. package/lib/module/overlay/useAnchorPosition.js.map +1 -1
  220. package/lib/module/overlay/useDismissOverlay.web.js +9 -2
  221. package/lib/module/overlay/useDismissOverlay.web.js.map +1 -1
  222. package/lib/module/overlay/useOverlayPosition.js +5 -2
  223. package/lib/module/overlay/useOverlayPosition.js.map +1 -1
  224. package/lib/module/portal/portal.js +59 -2
  225. package/lib/module/portal/portal.js.map +1 -1
  226. package/lib/module/radio/RadioGroup.js +68 -19
  227. package/lib/module/radio/RadioGroup.js.map +1 -1
  228. package/lib/module/radio/RadioRoot.web.js +117 -29
  229. package/lib/module/radio/RadioRoot.web.js.map +1 -1
  230. package/lib/module/radio/context.js.map +1 -1
  231. package/lib/module/radio/useRadioGroupNavigation.js +74 -0
  232. package/lib/module/radio/useRadioGroupNavigation.js.map +1 -0
  233. package/lib/module/radio/useRadioRoot.js +14 -13
  234. package/lib/module/radio/useRadioRoot.js.map +1 -1
  235. package/lib/module/range-calendar/RangeCalendarRoot.js +144 -0
  236. package/lib/module/range-calendar/RangeCalendarRoot.js.map +1 -0
  237. package/lib/module/range-calendar/context.js +12 -0
  238. package/lib/module/range-calendar/context.js.map +1 -0
  239. package/lib/module/range-calendar/index.js +5 -0
  240. package/lib/module/range-calendar/index.js.map +1 -0
  241. package/lib/module/select/SelectRoot.js +1 -1
  242. package/lib/module/select/SelectRoot.js.map +1 -1
  243. package/lib/module/utils/accessibleLabel.js +18 -0
  244. package/lib/module/utils/accessibleLabel.js.map +1 -0
  245. package/lib/module/utils/createPortal.web.js +17 -0
  246. package/lib/module/utils/createPortal.web.js.map +1 -0
  247. package/lib/typescript/calendar/CalendarGrid.d.ts +7 -0
  248. package/lib/typescript/calendar/CalendarGrid.d.ts.map +1 -0
  249. package/lib/typescript/calendar/CalendarRoot.d.ts +10 -0
  250. package/lib/typescript/calendar/CalendarRoot.d.ts.map +1 -0
  251. package/lib/typescript/calendar/context.d.ts +18 -0
  252. package/lib/typescript/calendar/context.d.ts.map +1 -0
  253. package/lib/typescript/calendar/index.d.ts +5 -0
  254. package/lib/typescript/calendar/index.d.ts.map +1 -0
  255. package/lib/typescript/calendar/types.d.ts +29 -0
  256. package/lib/typescript/calendar/types.d.ts.map +1 -0
  257. package/lib/typescript/checkbox/CheckboxRoot.web.d.ts +8 -0
  258. package/lib/typescript/checkbox/CheckboxRoot.web.d.ts.map +1 -1
  259. package/lib/typescript/checkbox/useCheckboxRoot.d.ts +7 -18
  260. package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +1 -1
  261. package/lib/typescript/date-field/DateFieldHiddenInput.d.ts +4 -0
  262. package/lib/typescript/date-field/DateFieldHiddenInput.d.ts.map +1 -0
  263. package/lib/typescript/date-field/DateFieldInput.d.ts +8 -0
  264. package/lib/typescript/date-field/DateFieldInput.d.ts.map +1 -0
  265. package/lib/typescript/date-field/DateFieldRoot.d.ts +10 -0
  266. package/lib/typescript/date-field/DateFieldRoot.d.ts.map +1 -0
  267. package/lib/typescript/date-field/DateFieldSegment.d.ts +9 -0
  268. package/lib/typescript/date-field/DateFieldSegment.d.ts.map +1 -0
  269. package/lib/typescript/date-field/context.d.ts +33 -0
  270. package/lib/typescript/date-field/context.d.ts.map +1 -0
  271. package/lib/typescript/date-field/index.d.ts +9 -0
  272. package/lib/typescript/date-field/index.d.ts.map +1 -0
  273. package/lib/typescript/date-field/segmentIndex.d.ts +7 -0
  274. package/lib/typescript/date-field/segmentIndex.d.ts.map +1 -0
  275. package/lib/typescript/date-field/segmentKeyboard.d.ts +23 -0
  276. package/lib/typescript/date-field/segmentKeyboard.d.ts.map +1 -0
  277. package/lib/typescript/date-field/types.d.ts +38 -0
  278. package/lib/typescript/date-field/types.d.ts.map +1 -0
  279. package/lib/typescript/date-field/useDateFieldSegmentState.d.ts +26 -0
  280. package/lib/typescript/date-field/useDateFieldSegmentState.d.ts.map +1 -0
  281. package/lib/typescript/date-field/useRangeDateFieldBridge.d.ts +4 -0
  282. package/lib/typescript/date-field/useRangeDateFieldBridge.d.ts.map +1 -0
  283. package/lib/typescript/date-picker/DatePickerRoot.d.ts +28 -0
  284. package/lib/typescript/date-picker/DatePickerRoot.d.ts.map +1 -0
  285. package/lib/typescript/date-picker/context.d.ts +25 -0
  286. package/lib/typescript/date-picker/context.d.ts.map +1 -0
  287. package/lib/typescript/date-picker/index.d.ts +5 -0
  288. package/lib/typescript/date-picker/index.d.ts.map +1 -0
  289. package/lib/typescript/date-range-picker/DateRangePickerRoot.d.ts +43 -0
  290. package/lib/typescript/date-range-picker/DateRangePickerRoot.d.ts.map +1 -0
  291. package/lib/typescript/date-range-picker/context.d.ts +42 -0
  292. package/lib/typescript/date-range-picker/context.d.ts.map +1 -0
  293. package/lib/typescript/date-range-picker/index.d.ts +4 -0
  294. package/lib/typescript/date-range-picker/index.d.ts.map +1 -0
  295. package/lib/typescript/date-time-field/DateTimeFieldHiddenInput.d.ts +4 -0
  296. package/lib/typescript/date-time-field/DateTimeFieldHiddenInput.d.ts.map +1 -0
  297. package/lib/typescript/date-time-field/DateTimeFieldInput.d.ts +10 -0
  298. package/lib/typescript/date-time-field/DateTimeFieldInput.d.ts.map +1 -0
  299. package/lib/typescript/date-time-field/DateTimeFieldRoot.d.ts +24 -0
  300. package/lib/typescript/date-time-field/DateTimeFieldRoot.d.ts.map +1 -0
  301. package/lib/typescript/date-time-field/DateTimeFieldSegment.d.ts +10 -0
  302. package/lib/typescript/date-time-field/DateTimeFieldSegment.d.ts.map +1 -0
  303. package/lib/typescript/date-time-field/context.d.ts +27 -0
  304. package/lib/typescript/date-time-field/context.d.ts.map +1 -0
  305. package/lib/typescript/date-time-field/index.d.ts +8 -0
  306. package/lib/typescript/date-time-field/index.d.ts.map +1 -0
  307. package/lib/typescript/date-time-field/useDateTimeFieldSegmentState.d.ts +26 -0
  308. package/lib/typescript/date-time-field/useDateTimeFieldSegmentState.d.ts.map +1 -0
  309. package/lib/typescript/date-time-list/DateTimeListRoot.d.ts +42 -0
  310. package/lib/typescript/date-time-list/DateTimeListRoot.d.ts.map +1 -0
  311. package/lib/typescript/date-time-list/context.d.ts +29 -0
  312. package/lib/typescript/date-time-list/context.d.ts.map +1 -0
  313. package/lib/typescript/date-time-list/index.d.ts +4 -0
  314. package/lib/typescript/date-time-list/index.d.ts.map +1 -0
  315. package/lib/typescript/date-time-picker/DateTimePickerRoot.d.ts +36 -0
  316. package/lib/typescript/date-time-picker/DateTimePickerRoot.d.ts.map +1 -0
  317. package/lib/typescript/date-time-picker/context.d.ts +25 -0
  318. package/lib/typescript/date-time-picker/context.d.ts.map +1 -0
  319. package/lib/typescript/date-time-picker/index.d.ts +4 -0
  320. package/lib/typescript/date-time-picker/index.d.ts.map +1 -0
  321. package/lib/typescript/dialog/types.d.ts +2 -1
  322. package/lib/typescript/dialog/types.d.ts.map +1 -1
  323. package/lib/typescript/index.d.ts +11 -2
  324. package/lib/typescript/index.d.ts.map +1 -1
  325. package/lib/typescript/month-calendar/MonthCalendarCell.d.ts +9 -0
  326. package/lib/typescript/month-calendar/MonthCalendarCell.d.ts.map +1 -0
  327. package/lib/typescript/month-calendar/MonthCalendarRoot.d.ts +30 -0
  328. package/lib/typescript/month-calendar/MonthCalendarRoot.d.ts.map +1 -0
  329. package/lib/typescript/month-calendar/MonthCalendarYearCell.d.ts +9 -0
  330. package/lib/typescript/month-calendar/MonthCalendarYearCell.d.ts.map +1 -0
  331. package/lib/typescript/month-calendar/context.d.ts +20 -0
  332. package/lib/typescript/month-calendar/context.d.ts.map +1 -0
  333. package/lib/typescript/month-calendar/index.d.ts +7 -0
  334. package/lib/typescript/month-calendar/index.d.ts.map +1 -0
  335. package/lib/typescript/month-picker/MonthPickerRoot.d.ts +29 -0
  336. package/lib/typescript/month-picker/MonthPickerRoot.d.ts.map +1 -0
  337. package/lib/typescript/month-picker/context.d.ts +23 -0
  338. package/lib/typescript/month-picker/context.d.ts.map +1 -0
  339. package/lib/typescript/month-picker/index.d.ts +4 -0
  340. package/lib/typescript/month-picker/index.d.ts.map +1 -0
  341. package/lib/typescript/overlay/useAnchorPosition.d.ts.map +1 -1
  342. package/lib/typescript/overlay/useDismissOverlay.web.d.ts.map +1 -1
  343. package/lib/typescript/overlay/useOverlayPosition.d.ts.map +1 -1
  344. package/lib/typescript/portal/portal.d.ts.map +1 -1
  345. package/lib/typescript/radio/RadioGroup.d.ts.map +1 -1
  346. package/lib/typescript/radio/RadioRoot.web.d.ts +8 -0
  347. package/lib/typescript/radio/RadioRoot.web.d.ts.map +1 -1
  348. package/lib/typescript/radio/context.d.ts +6 -1
  349. package/lib/typescript/radio/context.d.ts.map +1 -1
  350. package/lib/typescript/radio/types.d.ts +7 -0
  351. package/lib/typescript/radio/types.d.ts.map +1 -1
  352. package/lib/typescript/radio/useRadioGroupNavigation.d.ts +17 -0
  353. package/lib/typescript/radio/useRadioGroupNavigation.d.ts.map +1 -0
  354. package/lib/typescript/radio/useRadioRoot.d.ts +4 -18
  355. package/lib/typescript/radio/useRadioRoot.d.ts.map +1 -1
  356. package/lib/typescript/range-calendar/RangeCalendarRoot.d.ts +34 -0
  357. package/lib/typescript/range-calendar/RangeCalendarRoot.d.ts.map +1 -0
  358. package/lib/typescript/range-calendar/context.d.ts +26 -0
  359. package/lib/typescript/range-calendar/context.d.ts.map +1 -0
  360. package/lib/typescript/range-calendar/index.d.ts +5 -0
  361. package/lib/typescript/range-calendar/index.d.ts.map +1 -0
  362. package/lib/typescript/select/types.d.ts +2 -1
  363. package/lib/typescript/select/types.d.ts.map +1 -1
  364. package/lib/typescript/utils/accessibleLabel.d.ts +13 -0
  365. package/lib/typescript/utils/accessibleLabel.d.ts.map +1 -0
  366. package/lib/typescript/utils/createPortal.web.d.ts +17 -0
  367. package/lib/typescript/utils/createPortal.web.d.ts.map +1 -0
  368. package/package.json +3 -2
  369. package/src/calendar/CalendarGrid.tsx +29 -0
  370. package/src/calendar/CalendarRoot.tsx +138 -0
  371. package/src/calendar/context.tsx +28 -0
  372. package/src/calendar/index.ts +4 -0
  373. package/src/calendar/types.ts +30 -0
  374. package/src/checkbox/CheckboxRoot.web.tsx +105 -29
  375. package/src/checkbox/useCheckboxRoot.ts +37 -15
  376. package/src/date-field/DateFieldHiddenInput.tsx +152 -0
  377. package/src/date-field/DateFieldInput.tsx +138 -0
  378. package/src/date-field/DateFieldRoot.tsx +117 -0
  379. package/src/date-field/DateFieldSegment.tsx +97 -0
  380. package/src/date-field/context.tsx +48 -0
  381. package/src/date-field/index.ts +8 -0
  382. package/src/date-field/segmentIndex.tsx +17 -0
  383. package/src/date-field/segmentKeyboard.ts +207 -0
  384. package/src/date-field/types.ts +40 -0
  385. package/src/date-field/useDateFieldSegmentState.ts +455 -0
  386. package/src/date-field/useRangeDateFieldBridge.ts +78 -0
  387. package/src/date-picker/DatePickerRoot.tsx +186 -0
  388. package/src/date-picker/context.tsx +34 -0
  389. package/src/date-picker/index.ts +4 -0
  390. package/src/date-range-picker/DateRangePickerRoot.tsx +236 -0
  391. package/src/date-range-picker/context.tsx +48 -0
  392. package/src/date-range-picker/index.ts +8 -0
  393. package/src/date-time-field/DateTimeFieldHiddenInput.tsx +156 -0
  394. package/src/date-time-field/DateTimeFieldInput.tsx +119 -0
  395. package/src/date-time-field/DateTimeFieldRoot.tsx +209 -0
  396. package/src/date-time-field/DateTimeFieldSegment.tsx +95 -0
  397. package/src/date-time-field/context.tsx +41 -0
  398. package/src/date-time-field/index.ts +7 -0
  399. package/src/date-time-field/useDateTimeFieldSegmentState.ts +672 -0
  400. package/src/date-time-list/DateTimeListRoot.tsx +530 -0
  401. package/src/date-time-list/context.tsx +45 -0
  402. package/src/date-time-list/index.ts +16 -0
  403. package/src/date-time-picker/DateTimePickerRoot.tsx +210 -0
  404. package/src/date-time-picker/context.tsx +33 -0
  405. package/src/date-time-picker/index.ts +7 -0
  406. package/src/dialog/DialogRoot.tsx +1 -1
  407. package/src/dialog/types.ts +2 -1
  408. package/src/index.ts +21 -2
  409. package/src/month-calendar/MonthCalendarCell.tsx +53 -0
  410. package/src/month-calendar/MonthCalendarRoot.tsx +153 -0
  411. package/src/month-calendar/MonthCalendarYearCell.tsx +54 -0
  412. package/src/month-calendar/context.tsx +30 -0
  413. package/src/month-calendar/index.ts +6 -0
  414. package/src/month-picker/MonthPickerRoot.tsx +183 -0
  415. package/src/month-picker/context.tsx +31 -0
  416. package/src/month-picker/index.ts +3 -0
  417. package/src/overlay/useAnchorPosition.ts +25 -11
  418. package/src/overlay/useDismissOverlay.web.ts +10 -2
  419. package/src/overlay/useOverlayPosition.ts +5 -2
  420. package/src/portal/portal.tsx +79 -2
  421. package/src/radio/RadioGroup.tsx +84 -20
  422. package/src/radio/RadioRoot.web.tsx +136 -31
  423. package/src/radio/context.tsx +6 -1
  424. package/src/radio/types.ts +6 -0
  425. package/src/radio/useRadioGroupNavigation.ts +104 -0
  426. package/src/radio/useRadioRoot.ts +18 -11
  427. package/src/range-calendar/RangeCalendarRoot.tsx +213 -0
  428. package/src/range-calendar/context.tsx +33 -0
  429. package/src/range-calendar/index.ts +4 -0
  430. package/src/select/SelectRoot.tsx +1 -1
  431. package/src/select/types.ts +2 -1
  432. package/src/utils/accessibleLabel.ts +22 -0
  433. package/src/utils/createPortal.web.ts +18 -0
@@ -0,0 +1,29 @@
1
+ import { forwardRef, type ComponentRef } from 'react';
2
+ import { View, type ViewProps } from 'react-native';
3
+ import { Slot } from '../slot';
4
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
5
+
6
+ export interface CalendarGridProps extends ViewProps {
7
+ asChild?: boolean;
8
+ className?: string;
9
+ }
10
+
11
+ export const CalendarGrid = forwardRef<ComponentRef<typeof View>, CalendarGridProps>(
12
+ ({ asChild, className, style, children, ...props }, ref) => {
13
+ const Comp = asChild ? Slot : View;
14
+ return (
15
+ <Comp
16
+ ref={ref}
17
+ className={className}
18
+ style={style}
19
+ accessibilityRole="none"
20
+ {...props}
21
+ {...mergeDataAttributes(props, dataAttributes({ slot: 'calendar-grid' }))}
22
+ >
23
+ {children}
24
+ </Comp>
25
+ );
26
+ },
27
+ );
28
+
29
+ CalendarGrid.displayName = 'CalendarGrid';
@@ -0,0 +1,138 @@
1
+ import {
2
+ forwardRef,
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ useState,
8
+ type ComponentRef,
9
+ type ReactNode,
10
+ } from 'react';
11
+ import { View, type ViewProps } from 'react-native';
12
+ import {
13
+ todayMonthId,
14
+ toMonthId,
15
+ resolveDateComponentLabels,
16
+ type DateId,
17
+ type MonthId,
18
+ } from '@cdx-ui/formatters';
19
+ import { useControllableState } from '@cdx-ui/utils';
20
+ import { Slot } from '../slot';
21
+ import { accessibleLabelAttributes, resolveAccessibleLabel } from '../utils/accessibleLabel';
22
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
23
+ import { CalendarContext, type CalendarView } from './context';
24
+ import type { ICalendarProps } from './types';
25
+
26
+ export interface CalendarRootProps extends ICalendarProps, Omit<ViewProps, 'children'> {
27
+ asChild?: boolean;
28
+ children?: ReactNode;
29
+ className?: string;
30
+ }
31
+
32
+ export const CalendarRoot = forwardRef<ComponentRef<typeof View>, CalendarRootProps>(
33
+ (
34
+ {
35
+ asChild,
36
+ children,
37
+ value: valueProp,
38
+ defaultValue,
39
+ onValueChange,
40
+ monthId: monthIdProp,
41
+ defaultMonthId,
42
+ onMonthIdChange,
43
+ minValue,
44
+ maxValue,
45
+ disabled = false,
46
+ locale = 'en-US',
47
+ labels: labelsProp,
48
+ accessibilityLabel: accessibilityLabelProp,
49
+ 'aria-label': ariaLabelProp,
50
+ ...props
51
+ },
52
+ ref,
53
+ ) => {
54
+ const labels = useMemo(() => resolveDateComponentLabels(labelsProp), [labelsProp]);
55
+ const accessibilityLabel = resolveAccessibleLabel({
56
+ accessibilityLabel: accessibilityLabelProp,
57
+ 'aria-label': ariaLabelProp,
58
+ });
59
+ const [value, setValue] = useControllableState<DateId | undefined>({
60
+ prop: valueProp,
61
+ defaultProp: defaultValue,
62
+ onChange: onValueChange,
63
+ });
64
+
65
+ const [monthId, setMonthId] = useControllableState<MonthId>({
66
+ prop: monthIdProp,
67
+ defaultProp: defaultMonthId ?? (value ? toMonthId(value) : todayMonthId()),
68
+ onChange: onMonthIdChange,
69
+ });
70
+
71
+ const prevValueRef = useRef(value);
72
+ useEffect(() => {
73
+ if (monthIdProp !== undefined) {
74
+ prevValueRef.current = value;
75
+ return;
76
+ }
77
+ if (value === undefined || prevValueRef.current === value) {
78
+ prevValueRef.current = value;
79
+ return;
80
+ }
81
+ prevValueRef.current = value;
82
+ setMonthId(toMonthId(value));
83
+ }, [monthIdProp, setMonthId, value]);
84
+
85
+ const [view, setViewState] = useState<CalendarView>('month');
86
+
87
+ const setView = useCallback((next: CalendarView) => {
88
+ setViewState(next);
89
+ }, []);
90
+
91
+ const contextValue = useMemo(
92
+ () => ({
93
+ value,
94
+ onValueChange: setValue,
95
+ monthId: monthId ?? todayMonthId(),
96
+ onMonthIdChange: setMonthId,
97
+ minValue,
98
+ maxValue,
99
+ disabled,
100
+ locale,
101
+ labels,
102
+ view,
103
+ setView,
104
+ }),
105
+ [
106
+ value,
107
+ setValue,
108
+ monthId,
109
+ setMonthId,
110
+ minValue,
111
+ maxValue,
112
+ disabled,
113
+ locale,
114
+ labels,
115
+ view,
116
+ setView,
117
+ ],
118
+ );
119
+
120
+ const Comp = asChild ? Slot : View;
121
+
122
+ return (
123
+ <CalendarContext.Provider value={contextValue}>
124
+ <Comp
125
+ ref={ref}
126
+ accessibilityRole="none"
127
+ {...props}
128
+ {...mergeDataAttributes(props, dataAttributes({ disabled }))}
129
+ {...accessibleLabelAttributes(accessibilityLabel)}
130
+ >
131
+ {children}
132
+ </Comp>
133
+ </CalendarContext.Provider>
134
+ );
135
+ },
136
+ );
137
+
138
+ CalendarRoot.displayName = 'CalendarRoot';
@@ -0,0 +1,28 @@
1
+ import { createContext, useContext } from 'react';
2
+ import type { DateComponentLabels, DateId, MonthId } from '@cdx-ui/formatters';
3
+
4
+ export type CalendarView = 'month' | 'year';
5
+
6
+ export interface CalendarContextValue {
7
+ value?: DateId;
8
+ onValueChange?: (value: DateId | undefined) => void;
9
+ monthId: MonthId;
10
+ onMonthIdChange: (monthId: MonthId) => void;
11
+ minValue?: DateId;
12
+ maxValue?: DateId;
13
+ disabled: boolean;
14
+ locale: string;
15
+ labels: DateComponentLabels;
16
+ view: CalendarView;
17
+ setView: (view: CalendarView) => void;
18
+ }
19
+
20
+ export const CalendarContext = createContext<CalendarContextValue | null>(null);
21
+
22
+ export function useCalendarContext(): CalendarContextValue {
23
+ const ctx = useContext(CalendarContext);
24
+ if (!ctx) {
25
+ throw new Error('Calendar compound components must be used within CalendarRoot');
26
+ }
27
+ return ctx;
28
+ }
@@ -0,0 +1,4 @@
1
+ export { CalendarRoot } from './CalendarRoot';
2
+ export { CalendarGrid } from './CalendarGrid';
3
+ export { useCalendarContext, type CalendarView } from './context';
4
+ export type * from './types';
@@ -0,0 +1,30 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { DateComponentLabels, DateId, MonthId } from '@cdx-ui/formatters';
3
+
4
+ export interface ICalendarProps {
5
+ /** Selected date as a `YYYY-MM-DD` string. */
6
+ value?: DateId;
7
+ /** Uncontrolled initial selection as a `YYYY-MM-DD` string. */
8
+ defaultValue?: DateId;
9
+ /** Called with the new selection, or `undefined` when the selection is cleared. */
10
+ onValueChange?: (value: DateId | undefined) => void;
11
+ /** Month shown in the grid as a `YYYY-MM-01` string. Follows the selected `value` unless controlled. */
12
+ monthId?: MonthId;
13
+ /** Uncontrolled initial month as a `YYYY-MM-01` string. */
14
+ defaultMonthId?: MonthId;
15
+ onMonthIdChange?: (monthId: MonthId) => void;
16
+ /** Earliest selectable date. Build with `dateId(...)` from `@cdx-ui/formatters`. */
17
+ minValue?: DateId;
18
+ /** Latest selectable date. Build with `dateId(...)` from `@cdx-ui/formatters`. */
19
+ maxValue?: DateId;
20
+ disabled?: boolean;
21
+ /** BCP 47 locale for weekday and month formatting. Defaults to `en-US`. */
22
+ locale?: string;
23
+ labels?: Partial<DateComponentLabels>;
24
+ /** Accessible name for the calendar region. */
25
+ accessibilityLabel?: string;
26
+ }
27
+
28
+ export interface ICalendarGridProps extends ViewProps {
29
+ className?: string;
30
+ }
@@ -1,6 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import { Pressable, type PressableProps } from 'react-native';
3
3
  import { VisuallyHidden } from '@react-aria/visually-hidden';
4
+ import { composeEventHandlers } from '@cdx-ui/utils';
4
5
  import { useFocusRing } from '@react-native-aria/focus';
5
6
  import { Slot } from '../slot';
6
7
  import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
@@ -12,6 +13,14 @@ export interface CheckboxRootProps extends ICheckboxProps {
12
13
  asChild?: boolean;
13
14
  }
14
15
 
16
+ /**
17
+ * Web Checkbox root.
18
+ *
19
+ * On web, `@react-native-aria/checkbox` re-exports `@react-aria/checkbox`'s
20
+ * `useCheckbox`, whose `inputProps` target a native `<input type="checkbox">`
21
+ * (selection via `onChange`). Toggle must be applied explicitly on the Pressable —
22
+ * `inputProps.onPress` does **not** call `toggleState.toggle()`.
23
+ */
15
24
  export const CheckboxRoot = forwardRef<React.ComponentRef<typeof Pressable>, CheckboxRootProps>(
16
25
  ({ asChild, children, ...props }, ref) => {
17
26
  const {
@@ -37,18 +46,55 @@ export const CheckboxRoot = forwardRef<React.ComponentRef<typeof Pressable>, Che
37
46
  isHovered,
38
47
  mergedRef,
39
48
  inputRef,
49
+ toggle,
40
50
  } = useCheckboxRoot(props, ref, { useInputRefForAria: true });
41
51
 
42
52
  const { focusProps, isFocusVisible } = useFocusRing();
43
53
 
54
+ // Strip native-input / internal props — they must not land on Pressable.
55
+ const {
56
+ onPress: _onPress,
57
+ onChange: _onChange,
58
+ role: _role,
59
+ tabIndex: _tabIndex,
60
+ disabled: _disabled,
61
+ checked: _checked,
62
+ value: _value,
63
+ type: _type,
64
+ name: _name,
65
+ form: _form,
66
+ required: _required,
67
+ ...inputAriaProps
68
+ } = groupItemInputProps;
69
+
70
+ const resolvedChecked = !!(isChecked || isCheckedProp);
71
+ const resolvedIndeterminate = !!(isIndeterminate || isIndeterminateProp);
72
+ const resolvedDisabled = !!(isDisabled || isDisabledProp);
73
+ const resolvedReadOnly = !!(isReadOnly || isReadOnlyProp);
74
+ const ariaChecked = resolvedIndeterminate ? 'mixed' : resolvedChecked;
75
+
76
+ const handleToggle = () => {
77
+ if (resolvedDisabled || resolvedReadOnly) {
78
+ return;
79
+ }
80
+ toggle();
81
+ };
82
+
83
+ const handleKeyDown = (event: { key: string; preventDefault: () => void }) => {
84
+ if (event.key === ' ' || event.key === 'Spacebar') {
85
+ event.preventDefault();
86
+ handleToggle();
87
+ }
88
+ };
89
+
44
90
  const contextValue: ICheckboxContextValue = {
45
- isChecked: isChecked || isCheckedProp,
46
- isDisabled: isDisabled || isDisabledProp,
91
+ isChecked: resolvedChecked,
92
+ isDisabled: resolvedDisabled,
47
93
  isFocusVisible: isFocusVisible || isFocusVisibleProp,
48
94
  isHovered: isHovered || isHoveredProp,
49
95
  isInvalid: isInvalid || isInvalidProp,
50
- isReadOnly: isReadOnly || isReadOnlyProp,
51
- isIndeterminate: isIndeterminate || isIndeterminateProp,
96
+ isReadOnly: resolvedReadOnly,
97
+ isIndeterminate: resolvedIndeterminate,
52
98
  isPressed,
53
99
  isFocused,
54
100
  };
@@ -57,33 +103,63 @@ export const CheckboxRoot = forwardRef<React.ComponentRef<typeof Pressable>, Che
57
103
 
58
104
  return (
59
105
  <CheckboxProvider value={contextValue}>
60
- <Comp
61
- {...(combinedProps as PressableProps)}
62
- ref={mergedRef}
63
- tabIndex={-1}
64
- role="label"
65
- // eslint-disable-next-line react-native-a11y/has-valid-accessibility-role
66
- accessibilityRole="label"
67
- {...mergeDataAttributes(
68
- props,
69
- dataAttributes({
70
- checked: isChecked || isCheckedProp,
71
- disabled: isDisabled || isDisabledProp,
72
- hover: isHovered || isHoveredProp,
73
- invalid: isInvalid || isInvalidProp,
74
- readonly: isReadOnly || isReadOnlyProp,
75
- active: isPressed,
76
- focus: isFocused,
77
- indeterminate: isIndeterminate || isIndeterminateProp,
78
- focusVisible: isFocusVisible,
79
- }),
80
- )}
81
- >
106
+ <>
82
107
  <VisuallyHidden>
83
- <input {...groupItemInputProps} {...focusProps} ref={inputRef} />
108
+ <input
109
+ ref={inputRef as React.RefObject<HTMLInputElement>}
110
+ type="checkbox"
111
+ value={combinedProps.value}
112
+ checked={resolvedChecked}
113
+ disabled={resolvedDisabled}
114
+ tabIndex={-1}
115
+ aria-hidden
116
+ readOnly
117
+ style={{ pointerEvents: 'none' }}
118
+ />
84
119
  </VisuallyHidden>
85
- {children}
86
- </Comp>
120
+ <Comp
121
+ {...(combinedProps as PressableProps)}
122
+ {...inputAriaProps}
123
+ ref={mergedRef}
124
+ role="checkbox"
125
+ aria-checked={ariaChecked}
126
+ aria-disabled={resolvedDisabled || undefined}
127
+ accessibilityRole="checkbox"
128
+ accessibilityState={{
129
+ checked: resolvedIndeterminate ? 'mixed' : resolvedChecked,
130
+ disabled: resolvedDisabled,
131
+ }}
132
+ tabIndex={resolvedDisabled ? -1 : 0}
133
+ disabled={resolvedDisabled}
134
+ {...focusProps}
135
+ onPress={handleToggle}
136
+ onClick={handleToggle}
137
+ onKeyDown={composeEventHandlers(
138
+ (
139
+ combinedProps as {
140
+ onKeyDown?: (e: { key: string; preventDefault: () => void }) => void;
141
+ }
142
+ ).onKeyDown,
143
+ handleKeyDown,
144
+ )}
145
+ {...mergeDataAttributes(
146
+ props,
147
+ dataAttributes({
148
+ checked: resolvedChecked,
149
+ disabled: resolvedDisabled,
150
+ hover: isHovered || isHoveredProp,
151
+ invalid: isInvalid || isInvalidProp,
152
+ readonly: resolvedReadOnly,
153
+ active: isPressed,
154
+ focus: isFocused,
155
+ indeterminate: resolvedIndeterminate,
156
+ focusVisible: isFocusVisible || isFocusVisibleProp,
157
+ }),
158
+ )}
159
+ >
160
+ {children}
161
+ </Comp>
162
+ </>
87
163
  </CheckboxProvider>
88
164
  );
89
165
  },
@@ -1,4 +1,4 @@
1
- import { useContext, useRef } from 'react';
1
+ import { useCallback, useContext, useRef } from 'react';
2
2
  import { mergeRefs, useFormControlContext } from '@cdx-ui/utils';
3
3
  import { useCheckbox } from '@react-native-aria/checkbox';
4
4
  import { useHover } from '@react-native-aria/interactions';
@@ -16,29 +16,43 @@ export function useCheckboxRoot(
16
16
  { useInputRefForAria = false }: UseCheckboxRootOptions = {},
17
17
  ) {
18
18
  const formControlContext = useFormControlContext();
19
+ const checkboxGroupContext = useContext(CheckboxGroupContext);
20
+
21
+ // Only pull field-state flags from FormControl — never spread the whole context
22
+ // (ids, setters, htmlProps) onto the host element.
23
+ const isInvalid = props.isInvalid ?? formControlContext.isInvalid;
24
+ const isReadOnly =
25
+ props.isReadOnly ?? formControlContext.isReadOnly ?? checkboxGroupContext?.state.isReadOnly;
26
+ const isDisabled =
27
+ props.isDisabled ?? formControlContext.isDisabled ?? checkboxGroupContext?.state.isDisabled;
28
+ const isIndeterminate = props.isIndeterminate;
19
29
 
20
- const { isInvalid, isReadOnly, isIndeterminate, ...combinedProps } = {
21
- ...formControlContext,
30
+ const combinedProps = {
22
31
  ...props,
32
+ isInvalid,
33
+ isReadOnly,
34
+ isDisabled,
35
+ isIndeterminate,
23
36
  };
24
37
 
25
- const checkboxGroupContext = useContext(CheckboxGroupContext);
26
-
27
38
  const state = useToggleState({
28
- ...combinedProps,
29
39
  defaultSelected: props.defaultIsChecked,
30
40
  isSelected: props.isChecked,
41
+ onChange: props.onChange,
42
+ isReadOnly,
43
+ isDisabled,
31
44
  });
32
45
 
33
46
  const rootRef = useRef(null);
34
47
  const inputRef = useRef<HTMLInputElement | null>(null);
35
48
  const mergedRootRef = mergeRefs(ref as any, rootRef as any);
36
- const ariaLabel = combinedProps['aria-label'] || combinedProps.value || 'Checkbox';
49
+ const ariaLabel = props['aria-label'] || props.value || 'Checkbox';
37
50
 
38
51
  const groupToggleState = useToggleState(
39
52
  checkboxGroupContext
40
53
  ? {
41
- isReadOnly: isReadOnly || checkboxGroupContext.state.isReadOnly,
54
+ isReadOnly: !!isReadOnly,
55
+ isDisabled: !!isDisabled,
42
56
  isSelected: checkboxGroupContext.state.isSelected(combinedProps.value),
43
57
  onChange(isSelected: boolean) {
44
58
  if (isSelected) {
@@ -52,23 +66,30 @@ export function useCheckboxRoot(
52
66
  : { isSelected: false },
53
67
  );
54
68
 
69
+ const toggleState = checkboxGroupContext ? groupToggleState : state;
70
+
55
71
  const { inputProps: groupItemInputProps } = useCheckbox(
56
72
  {
57
73
  ...combinedProps,
58
74
  'aria-label': ariaLabel,
59
- ...(checkboxGroupContext && {
60
- isReadOnly: isReadOnly || checkboxGroupContext.state.isReadOnly,
61
- isDisabled: combinedProps.isDisabled || checkboxGroupContext.state.isDisabled,
62
- }),
75
+ isReadOnly: !!isReadOnly,
76
+ isDisabled: !!isDisabled,
63
77
  } as any,
64
- checkboxGroupContext ? groupToggleState : state,
78
+ toggleState,
65
79
  (useInputRefForAria ? inputRef : rootRef) as any,
66
80
  );
67
81
 
68
- const { checked: isChecked, disabled: isDisabled } = groupItemInputProps;
82
+ const { checked: isChecked, disabled: isDisabledFromInput } = groupItemInputProps;
69
83
 
70
84
  const { hoverProps, isHovered } = useHover({}, rootRef);
71
85
 
86
+ const toggle = useCallback(() => {
87
+ if (isDisabled || isReadOnly) {
88
+ return;
89
+ }
90
+ toggleState.toggle();
91
+ }, [isDisabled, isReadOnly, toggleState]);
92
+
72
93
  return {
73
94
  combinedProps,
74
95
  isInvalid,
@@ -76,10 +97,11 @@ export function useCheckboxRoot(
76
97
  isIndeterminate,
77
98
  groupItemInputProps,
78
99
  isChecked,
79
- isDisabled,
100
+ isDisabled: isDisabledFromInput,
80
101
  isHovered,
81
102
  hoverProps,
82
103
  mergedRef: mergedRootRef,
83
104
  inputRef,
105
+ toggle,
84
106
  };
85
107
  }
@@ -0,0 +1,152 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { Platform, TextInput, type TextInputKeyPressEvent } from 'react-native';
3
+ import { useDateFieldContext } from './context';
4
+
5
+ /**
6
+ * Invisible input that owns keyboard focus while a segment is active.
7
+ * Kept always mounted (never conditionally unmounted) so focus/blur races
8
+ * cannot clear segment focus before keystrokes arrive.
9
+ *
10
+ * Value is synced to the segment draft so native backspace shortens the text
11
+ * via onChangeText (iOS number-pad has no delete key; phone-pad does).
12
+ */
13
+ const HIDDEN_INPUT_STYLE = {
14
+ position: 'absolute' as const,
15
+ opacity: 0.01,
16
+ width: '100%' as const,
17
+ height: '100%' as const,
18
+ left: 0,
19
+ top: 0,
20
+ zIndex: 0,
21
+ fontSize: 16,
22
+ };
23
+
24
+ const KEYBOARD_TYPE = Platform.select<'number-pad' | 'phone-pad'>({
25
+ ios: 'phone-pad',
26
+ default: 'number-pad',
27
+ });
28
+
29
+ export function DateFieldHiddenInput({ accessibilityLabel }: { accessibilityLabel: string }) {
30
+ const {
31
+ focusedSegmentIndex,
32
+ disabled,
33
+ readOnly,
34
+ segmentDraft,
35
+ handleSegmentInputChange,
36
+ handleSegmentBackspace,
37
+ focusNextEditableSegment,
38
+ focusPrevEditableSegment,
39
+ blurSegment,
40
+ } = useDateFieldContext();
41
+
42
+ const inputRef = useRef<TextInput>(null);
43
+ const suppressBlurRef = useRef(false);
44
+ const focusedIndexRef = useRef(focusedSegmentIndex);
45
+ focusedIndexRef.current = focusedSegmentIndex;
46
+
47
+ const isActive = focusedSegmentIndex != null && !disabled && !readOnly;
48
+ const draftDigits = segmentDraft.replace(/\D/g, '');
49
+
50
+ useEffect(() => {
51
+ if (!isActive) {
52
+ return;
53
+ }
54
+
55
+ suppressBlurRef.current = true;
56
+ const focusInput = () => {
57
+ inputRef.current?.focus();
58
+ };
59
+
60
+ const frame = requestAnimationFrame(focusInput);
61
+ const timer = setTimeout(() => {
62
+ focusInput();
63
+ suppressBlurRef.current = false;
64
+ }, 50);
65
+
66
+ return () => {
67
+ cancelAnimationFrame(frame);
68
+ clearTimeout(timer);
69
+ };
70
+ }, [isActive, focusedSegmentIndex]);
71
+
72
+ const onKeyPress = (event: TextInputKeyPressEvent) => {
73
+ if (!isActive) {
74
+ return;
75
+ }
76
+ const key = event.nativeEvent.key;
77
+ if (key === 'Backspace') {
78
+ // When draft still has digits, onChangeText mirrors the shortened value.
79
+ // Only handle empty-draft backspace here (move to previous / clear).
80
+ if (draftDigits.length === 0) {
81
+ handleSegmentBackspace();
82
+ }
83
+ return;
84
+ }
85
+ if (key === 'ArrowRight') {
86
+ focusNextEditableSegment();
87
+ return;
88
+ }
89
+ if (key === 'ArrowLeft') {
90
+ focusPrevEditableSegment();
91
+ }
92
+ };
93
+
94
+ return (
95
+ <TextInput
96
+ testID="date-field-keyboard-input"
97
+ accessibilityLabel={accessibilityLabel}
98
+ accessibilityElementsHidden
99
+ importantForAccessibility="no-hide-descendants"
100
+ ref={inputRef}
101
+ value={isActive ? draftDigits : ''}
102
+ editable={isActive}
103
+ showSoftInputOnFocus={isActive}
104
+ pointerEvents="none"
105
+ caretHidden
106
+ importantForAutofill="no"
107
+ autoComplete="off"
108
+ autoCorrect={false}
109
+ spellCheck={false}
110
+ keyboardType={KEYBOARD_TYPE}
111
+ inputMode="numeric"
112
+ style={HIDDEN_INPUT_STYLE}
113
+ onChangeText={(text) => {
114
+ if (!isActive) {
115
+ return;
116
+ }
117
+ handleSegmentInputChange(text);
118
+ }}
119
+ onKeyPress={onKeyPress}
120
+ onBlur={() => {
121
+ if (suppressBlurRef.current) {
122
+ return;
123
+ }
124
+ requestAnimationFrame(() => {
125
+ if (suppressBlurRef.current) {
126
+ return;
127
+ }
128
+ const index = focusedIndexRef.current;
129
+ if (index == null) {
130
+ return;
131
+ }
132
+ if (Platform.OS !== 'web') {
133
+ blurSegment(index);
134
+ return;
135
+ }
136
+ const node = inputRef.current as unknown as { isFocused?: () => boolean } | null;
137
+ if (node?.isFocused?.()) {
138
+ return;
139
+ }
140
+ const active = typeof document !== 'undefined' ? document.activeElement : null;
141
+ if (active && (active as HTMLElement).tagName === 'INPUT') {
142
+ const label = (active as HTMLElement).getAttribute('aria-label');
143
+ if (label === accessibilityLabel) {
144
+ return;
145
+ }
146
+ }
147
+ blurSegment(index);
148
+ });
149
+ }}
150
+ />
151
+ );
152
+ }