@cdx-ui/primitives 0.0.1-alpha.3 → 0.0.1-alpha.30

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 (462) hide show
  1. package/lib/commonjs/avatar/context.js +11 -0
  2. package/lib/commonjs/avatar/context.js.map +1 -0
  3. package/lib/commonjs/avatar/createAvatarBadge.js +20 -0
  4. package/lib/commonjs/avatar/createAvatarBadge.js.map +1 -0
  5. package/lib/commonjs/avatar/createAvatarIcon.js +30 -0
  6. package/lib/commonjs/avatar/createAvatarIcon.js.map +1 -0
  7. package/lib/commonjs/avatar/createAvatarImage.js +51 -0
  8. package/lib/commonjs/avatar/createAvatarImage.js.map +1 -0
  9. package/lib/commonjs/avatar/createAvatarRoot.js +34 -0
  10. package/lib/commonjs/avatar/createAvatarRoot.js.map +1 -0
  11. package/lib/commonjs/avatar/createAvatarText.js +42 -0
  12. package/lib/commonjs/avatar/createAvatarText.js.map +1 -0
  13. package/lib/commonjs/avatar/index.js +30 -0
  14. package/lib/commonjs/avatar/index.js.map +1 -0
  15. package/lib/commonjs/avatar/types.js +6 -0
  16. package/lib/commonjs/avatar/types.js.map +1 -0
  17. package/lib/commonjs/button/createButtonRoot.js +3 -3
  18. package/lib/commonjs/button/createButtonRoot.js.map +1 -1
  19. package/lib/commonjs/button/index.js +25 -19
  20. package/lib/commonjs/button/index.js.map +1 -1
  21. package/lib/commonjs/checkbox/context.js +14 -0
  22. package/lib/commonjs/checkbox/context.js.map +1 -0
  23. package/lib/commonjs/checkbox/createCheckboxGroup.js +44 -0
  24. package/lib/commonjs/checkbox/createCheckboxGroup.js.map +1 -0
  25. package/lib/commonjs/checkbox/createCheckboxIcon.js +29 -0
  26. package/lib/commonjs/checkbox/createCheckboxIcon.js.map +1 -0
  27. package/lib/commonjs/checkbox/createCheckboxIndicator.js +47 -0
  28. package/lib/commonjs/checkbox/createCheckboxIndicator.js.map +1 -0
  29. package/lib/commonjs/checkbox/createCheckboxLabel.js +46 -0
  30. package/lib/commonjs/checkbox/createCheckboxLabel.js.map +1 -0
  31. package/lib/commonjs/checkbox/createCheckboxRoot.js +99 -0
  32. package/lib/commonjs/checkbox/createCheckboxRoot.js.map +1 -0
  33. package/lib/commonjs/checkbox/createCheckboxRoot.web.js +90 -0
  34. package/lib/commonjs/checkbox/createCheckboxRoot.web.js.map +1 -0
  35. package/lib/commonjs/checkbox/index.js +30 -0
  36. package/lib/commonjs/checkbox/index.js.map +1 -0
  37. package/lib/commonjs/checkbox/types.js +6 -0
  38. package/lib/commonjs/checkbox/types.js.map +1 -0
  39. package/lib/commonjs/checkbox/useCheckboxRoot.js +82 -0
  40. package/lib/commonjs/checkbox/useCheckboxRoot.js.map +1 -0
  41. package/lib/commonjs/dialog/context.js +11 -0
  42. package/lib/commonjs/dialog/context.js.map +1 -0
  43. package/lib/commonjs/dialog/createDialogBody.js +21 -0
  44. package/lib/commonjs/dialog/createDialogBody.js.map +1 -0
  45. package/lib/commonjs/dialog/createDialogClose.js +37 -0
  46. package/lib/commonjs/dialog/createDialogClose.js.map +1 -0
  47. package/lib/commonjs/dialog/createDialogContent.js +141 -0
  48. package/lib/commonjs/dialog/createDialogContent.js.map +1 -0
  49. package/lib/commonjs/dialog/createDialogDescription.js +30 -0
  50. package/lib/commonjs/dialog/createDialogDescription.js.map +1 -0
  51. package/lib/commonjs/dialog/createDialogFooter.js +21 -0
  52. package/lib/commonjs/dialog/createDialogFooter.js.map +1 -0
  53. package/lib/commonjs/dialog/createDialogHeader.js +21 -0
  54. package/lib/commonjs/dialog/createDialogHeader.js.map +1 -0
  55. package/lib/commonjs/dialog/createDialogRoot.js +54 -0
  56. package/lib/commonjs/dialog/createDialogRoot.js.map +1 -0
  57. package/lib/commonjs/dialog/createDialogTitle.js +21 -0
  58. package/lib/commonjs/dialog/createDialogTitle.js.map +1 -0
  59. package/lib/commonjs/dialog/createDialogTrigger.js +37 -0
  60. package/lib/commonjs/dialog/createDialogTrigger.js.map +1 -0
  61. package/lib/commonjs/dialog/index.js +60 -0
  62. package/lib/commonjs/dialog/index.js.map +1 -0
  63. package/lib/commonjs/dialog/types.js +6 -0
  64. package/lib/commonjs/dialog/types.js.map +1 -0
  65. package/lib/commonjs/form-control/createFormError.js +41 -0
  66. package/lib/commonjs/form-control/createFormError.js.map +1 -0
  67. package/lib/commonjs/form-control/createFormErrorIcon.js +18 -0
  68. package/lib/commonjs/form-control/createFormErrorIcon.js.map +1 -0
  69. package/lib/commonjs/form-control/createFormErrorText.js +18 -0
  70. package/lib/commonjs/form-control/createFormErrorText.js.map +1 -0
  71. package/lib/commonjs/form-control/createFormField.js +35 -0
  72. package/lib/commonjs/form-control/createFormField.js.map +1 -0
  73. package/lib/commonjs/form-control/createFormHelper.js +41 -0
  74. package/lib/commonjs/form-control/createFormHelper.js.map +1 -0
  75. package/lib/commonjs/form-control/createFormHelperText.js +18 -0
  76. package/lib/commonjs/form-control/createFormHelperText.js.map +1 -0
  77. package/lib/commonjs/form-control/createFormLabel.js +38 -0
  78. package/lib/commonjs/form-control/createFormLabel.js.map +1 -0
  79. package/lib/commonjs/form-control/createFormRoot.js +21 -0
  80. package/lib/commonjs/form-control/createFormRoot.js.map +1 -0
  81. package/lib/commonjs/form-control/index.js +53 -0
  82. package/lib/commonjs/form-control/index.js.map +1 -0
  83. package/lib/commonjs/form-control/types.js +6 -0
  84. package/lib/commonjs/form-control/types.js.map +1 -0
  85. package/lib/commonjs/index.js +82 -2
  86. package/lib/commonjs/index.js.map +1 -1
  87. package/lib/commonjs/input/createInputField.js +7 -2
  88. package/lib/commonjs/input/createInputField.js.map +1 -1
  89. package/lib/commonjs/input/index.js +13 -19
  90. package/lib/commonjs/input/index.js.map +1 -1
  91. package/lib/commonjs/link/LinkProvider.js +28 -0
  92. package/lib/commonjs/link/LinkProvider.js.map +1 -0
  93. package/lib/commonjs/link/createLink.js +74 -0
  94. package/lib/commonjs/link/createLink.js.map +1 -0
  95. package/lib/commonjs/link/index.js +27 -0
  96. package/lib/commonjs/link/index.js.map +1 -0
  97. package/lib/commonjs/link/types.js +6 -0
  98. package/lib/commonjs/link/types.js.map +1 -0
  99. package/lib/commonjs/link/useLink.js +56 -0
  100. package/lib/commonjs/link/useLink.js.map +1 -0
  101. package/lib/commonjs/overlay/OverlayContainer.js +8 -11
  102. package/lib/commonjs/overlay/OverlayContainer.js.map +1 -1
  103. package/lib/commonjs/overlay/index.js +7 -0
  104. package/lib/commonjs/overlay/index.js.map +1 -1
  105. package/lib/commonjs/overlay/useEscapeKey.js +14 -0
  106. package/lib/commonjs/overlay/useEscapeKey.js.map +1 -0
  107. package/lib/commonjs/overlay/useEscapeKey.web.js +30 -0
  108. package/lib/commonjs/overlay/useEscapeKey.web.js.map +1 -0
  109. package/lib/commonjs/select/context.js +8 -43
  110. package/lib/commonjs/select/context.js.map +1 -1
  111. package/lib/commonjs/select/createSelectItem.js +1 -1
  112. package/lib/commonjs/select/createSelectItem.js.map +1 -1
  113. package/lib/commonjs/select/createSelectRoot.js +9 -6
  114. package/lib/commonjs/select/createSelectRoot.js.map +1 -1
  115. package/lib/commonjs/select/createSelectTrigger.js +53 -12
  116. package/lib/commonjs/select/createSelectTrigger.js.map +1 -1
  117. package/lib/commonjs/switch/createSwitchRoot.js +73 -0
  118. package/lib/commonjs/switch/createSwitchRoot.js.map +1 -0
  119. package/lib/commonjs/switch/index.js +15 -0
  120. package/lib/commonjs/switch/index.js.map +1 -0
  121. package/lib/commonjs/switch/types.js +6 -0
  122. package/lib/commonjs/switch/types.js.map +1 -0
  123. package/lib/commonjs/types.js +2 -0
  124. package/lib/commonjs/types.js.map +1 -0
  125. package/lib/commonjs/utils/createPortal.js +23 -0
  126. package/lib/commonjs/utils/createPortal.js.map +1 -0
  127. package/lib/commonjs/utils/dataAttributes.web.js +1 -4
  128. package/lib/commonjs/utils/dataAttributes.web.js.map +1 -1
  129. package/lib/module/avatar/context.js +5 -0
  130. package/lib/module/avatar/context.js.map +1 -0
  131. package/lib/module/{input/createInputIcon.js → avatar/createAvatarBadge.js} +3 -3
  132. package/lib/module/avatar/createAvatarBadge.js.map +1 -0
  133. package/lib/module/avatar/createAvatarIcon.js +25 -0
  134. package/lib/module/avatar/createAvatarIcon.js.map +1 -0
  135. package/lib/module/avatar/createAvatarImage.js +46 -0
  136. package/lib/module/avatar/createAvatarImage.js.map +1 -0
  137. package/lib/module/avatar/createAvatarRoot.js +29 -0
  138. package/lib/module/avatar/createAvatarRoot.js.map +1 -0
  139. package/lib/module/avatar/createAvatarText.js +37 -0
  140. package/lib/module/avatar/createAvatarText.js.map +1 -0
  141. package/lib/module/avatar/index.js +26 -0
  142. package/lib/module/avatar/index.js.map +1 -0
  143. package/lib/module/avatar/types.js +4 -0
  144. package/lib/module/avatar/types.js.map +1 -0
  145. package/lib/module/button/createButtonRoot.js +3 -3
  146. package/lib/module/button/createButtonRoot.js.map +1 -1
  147. package/lib/module/button/index.js +19 -19
  148. package/lib/module/button/index.js.map +1 -1
  149. package/lib/module/checkbox/context.js +7 -0
  150. package/lib/module/checkbox/context.js.map +1 -0
  151. package/lib/module/checkbox/createCheckboxGroup.js +39 -0
  152. package/lib/module/checkbox/createCheckboxGroup.js.map +1 -0
  153. package/lib/module/checkbox/createCheckboxIcon.js +24 -0
  154. package/lib/module/checkbox/createCheckboxIcon.js.map +1 -0
  155. package/lib/module/checkbox/createCheckboxIndicator.js +42 -0
  156. package/lib/module/checkbox/createCheckboxIndicator.js.map +1 -0
  157. package/lib/module/checkbox/createCheckboxLabel.js +41 -0
  158. package/lib/module/checkbox/createCheckboxLabel.js.map +1 -0
  159. package/lib/module/checkbox/createCheckboxRoot.js +94 -0
  160. package/lib/module/checkbox/createCheckboxRoot.js.map +1 -0
  161. package/lib/module/checkbox/createCheckboxRoot.web.js +85 -0
  162. package/lib/module/checkbox/createCheckboxRoot.web.js.map +1 -0
  163. package/lib/module/checkbox/index.js +26 -0
  164. package/lib/module/checkbox/index.js.map +1 -0
  165. package/lib/module/checkbox/types.js +4 -0
  166. package/lib/module/checkbox/types.js.map +1 -0
  167. package/lib/module/checkbox/useCheckboxRoot.js +78 -0
  168. package/lib/module/checkbox/useCheckboxRoot.js.map +1 -0
  169. package/lib/module/dialog/context.js +5 -0
  170. package/lib/module/dialog/context.js.map +1 -0
  171. package/lib/module/dialog/createDialogBody.js +15 -0
  172. package/lib/module/dialog/createDialogBody.js.map +1 -0
  173. package/lib/module/dialog/createDialogClose.js +31 -0
  174. package/lib/module/dialog/createDialogClose.js.map +1 -0
  175. package/lib/module/dialog/createDialogContent.js +136 -0
  176. package/lib/module/dialog/createDialogContent.js.map +1 -0
  177. package/lib/module/dialog/createDialogDescription.js +24 -0
  178. package/lib/module/dialog/createDialogDescription.js.map +1 -0
  179. package/lib/module/dialog/createDialogFooter.js +15 -0
  180. package/lib/module/dialog/createDialogFooter.js.map +1 -0
  181. package/lib/module/dialog/createDialogHeader.js +15 -0
  182. package/lib/module/dialog/createDialogHeader.js.map +1 -0
  183. package/lib/module/dialog/createDialogRoot.js +49 -0
  184. package/lib/module/dialog/createDialogRoot.js.map +1 -0
  185. package/lib/module/dialog/createDialogTitle.js +15 -0
  186. package/lib/module/dialog/createDialogTitle.js.map +1 -0
  187. package/lib/module/dialog/createDialogTrigger.js +31 -0
  188. package/lib/module/dialog/createDialogTrigger.js.map +1 -0
  189. package/lib/module/dialog/index.js +45 -0
  190. package/lib/module/dialog/index.js.map +1 -0
  191. package/lib/module/dialog/types.js +4 -0
  192. package/lib/module/dialog/types.js.map +1 -0
  193. package/lib/module/form-control/createFormError.js +35 -0
  194. package/lib/module/form-control/createFormError.js.map +1 -0
  195. package/lib/module/form-control/createFormErrorIcon.js +13 -0
  196. package/lib/module/form-control/createFormErrorIcon.js.map +1 -0
  197. package/lib/module/form-control/createFormErrorText.js +13 -0
  198. package/lib/module/form-control/createFormErrorText.js.map +1 -0
  199. package/lib/module/form-control/createFormField.js +29 -0
  200. package/lib/module/form-control/createFormField.js.map +1 -0
  201. package/lib/module/form-control/createFormHelper.js +35 -0
  202. package/lib/module/form-control/createFormHelper.js.map +1 -0
  203. package/lib/module/form-control/createFormHelperText.js +13 -0
  204. package/lib/module/form-control/createFormHelperText.js.map +1 -0
  205. package/lib/module/form-control/createFormLabel.js +33 -0
  206. package/lib/module/form-control/createFormLabel.js.map +1 -0
  207. package/lib/module/form-control/createFormRoot.js +15 -0
  208. package/lib/module/form-control/createFormRoot.js.map +1 -0
  209. package/lib/module/form-control/index.js +49 -0
  210. package/lib/module/form-control/index.js.map +1 -0
  211. package/lib/module/form-control/types.js +4 -0
  212. package/lib/module/form-control/types.js.map +1 -0
  213. package/lib/module/index.js +8 -1
  214. package/lib/module/index.js.map +1 -1
  215. package/lib/module/input/createInputField.js +8 -3
  216. package/lib/module/input/createInputField.js.map +1 -1
  217. package/lib/module/input/index.js +12 -17
  218. package/lib/module/input/index.js.map +1 -1
  219. package/lib/module/link/LinkProvider.js +23 -0
  220. package/lib/module/link/LinkProvider.js.map +1 -0
  221. package/lib/module/link/createLink.js +68 -0
  222. package/lib/module/link/createLink.js.map +1 -0
  223. package/lib/module/link/index.js +6 -0
  224. package/lib/module/link/index.js.map +1 -0
  225. package/lib/module/link/types.js +4 -0
  226. package/lib/module/link/types.js.map +1 -0
  227. package/lib/module/link/useLink.js +52 -0
  228. package/lib/module/link/useLink.js.map +1 -0
  229. package/lib/module/overlay/OverlayContainer.js +8 -11
  230. package/lib/module/overlay/OverlayContainer.js.map +1 -1
  231. package/lib/module/overlay/index.js +1 -0
  232. package/lib/module/overlay/index.js.map +1 -1
  233. package/lib/module/overlay/useEscapeKey.js +10 -0
  234. package/lib/module/overlay/useEscapeKey.js.map +1 -0
  235. package/lib/module/overlay/useEscapeKey.web.js +27 -0
  236. package/lib/module/overlay/useEscapeKey.web.js.map +1 -0
  237. package/lib/module/select/context.js +4 -42
  238. package/lib/module/select/context.js.map +1 -1
  239. package/lib/module/select/createSelectItem.js +2 -2
  240. package/lib/module/select/createSelectItem.js.map +1 -1
  241. package/lib/module/select/createSelectRoot.js +10 -7
  242. package/lib/module/select/createSelectRoot.js.map +1 -1
  243. package/lib/module/select/createSelectTrigger.js +56 -15
  244. package/lib/module/select/createSelectTrigger.js.map +1 -1
  245. package/lib/module/switch/createSwitchRoot.js +67 -0
  246. package/lib/module/switch/createSwitchRoot.js.map +1 -0
  247. package/lib/module/switch/index.js +11 -0
  248. package/lib/module/switch/index.js.map +1 -0
  249. package/lib/module/switch/types.js +4 -0
  250. package/lib/module/switch/types.js.map +1 -0
  251. package/lib/module/types.js +2 -0
  252. package/lib/module/types.js.map +1 -0
  253. package/lib/module/utils/createPortal.js +19 -0
  254. package/lib/module/utils/createPortal.js.map +1 -0
  255. package/lib/module/utils/dataAttributes.web.js +1 -4
  256. package/lib/module/utils/dataAttributes.web.js.map +1 -1
  257. package/lib/typescript/avatar/context.d.ts +6 -0
  258. package/lib/typescript/avatar/context.d.ts.map +1 -0
  259. package/lib/typescript/avatar/createAvatarBadge.d.ts +4 -0
  260. package/lib/typescript/avatar/createAvatarBadge.d.ts.map +1 -0
  261. package/lib/typescript/avatar/createAvatarIcon.d.ts +4 -0
  262. package/lib/typescript/avatar/createAvatarIcon.d.ts.map +1 -0
  263. package/lib/typescript/avatar/createAvatarImage.d.ts +4 -0
  264. package/lib/typescript/avatar/createAvatarImage.d.ts.map +1 -0
  265. package/lib/typescript/avatar/createAvatarRoot.d.ts +4 -0
  266. package/lib/typescript/avatar/createAvatarRoot.d.ts.map +1 -0
  267. package/lib/typescript/avatar/createAvatarText.d.ts +4 -0
  268. package/lib/typescript/avatar/createAvatarText.d.ts.map +1 -0
  269. package/lib/typescript/avatar/index.d.ts +11 -0
  270. package/lib/typescript/avatar/index.d.ts.map +1 -0
  271. package/lib/typescript/avatar/types.d.ts +33 -0
  272. package/lib/typescript/avatar/types.d.ts.map +1 -0
  273. package/lib/typescript/button/context.d.ts +1 -1
  274. package/lib/typescript/button/context.d.ts.map +1 -1
  275. package/lib/typescript/button/createButtonRoot.d.ts +1 -1
  276. package/lib/typescript/button/createButtonRoot.d.ts.map +1 -1
  277. package/lib/typescript/button/index.d.ts +2 -1
  278. package/lib/typescript/button/index.d.ts.map +1 -1
  279. package/lib/typescript/button/types.d.ts +0 -7
  280. package/lib/typescript/button/types.d.ts.map +1 -1
  281. package/lib/typescript/checkbox/context.d.ts +18 -0
  282. package/lib/typescript/checkbox/context.d.ts.map +1 -0
  283. package/lib/typescript/checkbox/createCheckboxGroup.d.ts +3 -0
  284. package/lib/typescript/checkbox/createCheckboxGroup.d.ts.map +1 -0
  285. package/lib/typescript/checkbox/createCheckboxIcon.d.ts +3 -0
  286. package/lib/typescript/checkbox/createCheckboxIcon.d.ts.map +1 -0
  287. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts +5 -0
  288. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts.map +1 -0
  289. package/lib/typescript/checkbox/createCheckboxLabel.d.ts +5 -0
  290. package/lib/typescript/checkbox/createCheckboxLabel.d.ts.map +1 -0
  291. package/lib/typescript/checkbox/createCheckboxRoot.d.ts +2 -0
  292. package/lib/typescript/checkbox/createCheckboxRoot.d.ts.map +1 -0
  293. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts +2 -0
  294. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts.map +1 -0
  295. package/lib/typescript/checkbox/index.d.ts +11 -0
  296. package/lib/typescript/checkbox/index.d.ts.map +1 -0
  297. package/lib/typescript/checkbox/types.d.ts +57 -0
  298. package/lib/typescript/checkbox/types.d.ts.map +1 -0
  299. package/lib/typescript/checkbox/useCheckboxRoot.d.ts +152 -0
  300. package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +1 -0
  301. package/lib/typescript/dialog/context.d.ts +6 -0
  302. package/lib/typescript/dialog/context.d.ts.map +1 -0
  303. package/lib/typescript/dialog/createDialogBody.d.ts +4 -0
  304. package/lib/typescript/dialog/createDialogBody.d.ts.map +1 -0
  305. package/lib/typescript/dialog/createDialogClose.d.ts +4 -0
  306. package/lib/typescript/dialog/createDialogClose.d.ts.map +1 -0
  307. package/lib/typescript/dialog/createDialogContent.d.ts +4 -0
  308. package/lib/typescript/dialog/createDialogContent.d.ts.map +1 -0
  309. package/lib/typescript/dialog/createDialogDescription.d.ts +4 -0
  310. package/lib/typescript/dialog/createDialogDescription.d.ts.map +1 -0
  311. package/lib/typescript/dialog/createDialogFooter.d.ts +4 -0
  312. package/lib/typescript/dialog/createDialogFooter.d.ts.map +1 -0
  313. package/lib/typescript/dialog/createDialogHeader.d.ts +4 -0
  314. package/lib/typescript/dialog/createDialogHeader.d.ts.map +1 -0
  315. package/lib/typescript/dialog/createDialogRoot.d.ts +4 -0
  316. package/lib/typescript/dialog/createDialogRoot.d.ts.map +1 -0
  317. package/lib/typescript/dialog/createDialogTitle.d.ts +4 -0
  318. package/lib/typescript/dialog/createDialogTitle.d.ts.map +1 -0
  319. package/lib/typescript/dialog/createDialogTrigger.d.ts +4 -0
  320. package/lib/typescript/dialog/createDialogTrigger.d.ts.map +1 -0
  321. package/lib/typescript/dialog/index.d.ts +18 -0
  322. package/lib/typescript/dialog/index.d.ts.map +1 -0
  323. package/lib/typescript/dialog/types.d.ts +52 -0
  324. package/lib/typescript/dialog/types.d.ts.map +1 -0
  325. package/lib/typescript/form-control/createFormError.d.ts +5 -0
  326. package/lib/typescript/form-control/createFormError.d.ts.map +1 -0
  327. package/lib/typescript/form-control/createFormErrorIcon.d.ts +5 -0
  328. package/lib/typescript/form-control/createFormErrorIcon.d.ts.map +1 -0
  329. package/lib/typescript/form-control/createFormErrorText.d.ts +5 -0
  330. package/lib/typescript/form-control/createFormErrorText.d.ts.map +1 -0
  331. package/lib/typescript/form-control/createFormField.d.ts +6 -0
  332. package/lib/typescript/form-control/createFormField.d.ts.map +1 -0
  333. package/lib/typescript/form-control/createFormHelper.d.ts +5 -0
  334. package/lib/typescript/form-control/createFormHelper.d.ts.map +1 -0
  335. package/lib/typescript/form-control/createFormHelperText.d.ts +5 -0
  336. package/lib/typescript/form-control/createFormHelperText.d.ts.map +1 -0
  337. package/lib/typescript/form-control/createFormLabel.d.ts +8 -0
  338. package/lib/typescript/form-control/createFormLabel.d.ts.map +1 -0
  339. package/lib/typescript/form-control/createFormRoot.d.ts +6 -0
  340. package/lib/typescript/form-control/createFormRoot.d.ts.map +1 -0
  341. package/lib/typescript/form-control/index.d.ts +14 -0
  342. package/lib/typescript/form-control/index.d.ts.map +1 -0
  343. package/lib/typescript/form-control/types.d.ts +73 -0
  344. package/lib/typescript/form-control/types.d.ts.map +1 -0
  345. package/lib/typescript/index.d.ts +9 -1
  346. package/lib/typescript/index.d.ts.map +1 -1
  347. package/lib/typescript/input/createInputField.d.ts.map +1 -1
  348. package/lib/typescript/input/index.d.ts +3 -3
  349. package/lib/typescript/input/index.d.ts.map +1 -1
  350. package/lib/typescript/input/types.d.ts +1 -2
  351. package/lib/typescript/input/types.d.ts.map +1 -1
  352. package/lib/typescript/link/LinkProvider.d.ts +36 -0
  353. package/lib/typescript/link/LinkProvider.d.ts.map +1 -0
  354. package/lib/typescript/link/createLink.d.ts +6 -0
  355. package/lib/typescript/link/createLink.d.ts.map +1 -0
  356. package/lib/typescript/link/index.d.ts +6 -0
  357. package/lib/typescript/link/index.d.ts.map +1 -0
  358. package/lib/typescript/link/types.d.ts +45 -0
  359. package/lib/typescript/link/types.d.ts.map +1 -0
  360. package/lib/typescript/link/useLink.d.ts +9 -0
  361. package/lib/typescript/link/useLink.d.ts.map +1 -0
  362. package/lib/typescript/overlay/OverlayContainer.d.ts +5 -1
  363. package/lib/typescript/overlay/OverlayContainer.d.ts.map +1 -1
  364. package/lib/typescript/overlay/index.d.ts +1 -0
  365. package/lib/typescript/overlay/index.d.ts.map +1 -1
  366. package/lib/typescript/overlay/useEscapeKey.d.ts +6 -0
  367. package/lib/typescript/overlay/useEscapeKey.d.ts.map +1 -0
  368. package/lib/typescript/overlay/useEscapeKey.web.d.ts +6 -0
  369. package/lib/typescript/overlay/useEscapeKey.web.d.ts.map +1 -0
  370. package/lib/typescript/select/context.d.ts +14 -7
  371. package/lib/typescript/select/context.d.ts.map +1 -1
  372. package/lib/typescript/select/createSelectRoot.d.ts.map +1 -1
  373. package/lib/typescript/select/createSelectTrigger.d.ts +2 -7
  374. package/lib/typescript/select/createSelectTrigger.d.ts.map +1 -1
  375. package/lib/typescript/select/types.d.ts +5 -7
  376. package/lib/typescript/select/types.d.ts.map +1 -1
  377. package/lib/typescript/switch/createSwitchRoot.d.ts +3 -0
  378. package/lib/typescript/switch/createSwitchRoot.d.ts.map +1 -0
  379. package/lib/typescript/switch/index.d.ts +7 -0
  380. package/lib/typescript/switch/index.d.ts.map +1 -0
  381. package/lib/typescript/switch/types.d.ts +38 -0
  382. package/lib/typescript/switch/types.d.ts.map +1 -0
  383. package/lib/typescript/types.d.ts +8 -0
  384. package/lib/typescript/types.d.ts.map +1 -0
  385. package/lib/typescript/utils/createPortal.d.ts +11 -0
  386. package/lib/typescript/utils/createPortal.d.ts.map +1 -0
  387. package/lib/typescript/utils/dataAttributes.web.d.ts.map +1 -1
  388. package/package.json +9 -9
  389. package/src/avatar/context.tsx +5 -0
  390. package/src/avatar/createAvatarBadge.tsx +12 -0
  391. package/src/avatar/createAvatarIcon.tsx +16 -0
  392. package/src/avatar/createAvatarImage.tsx +40 -0
  393. package/src/avatar/createAvatarRoot.tsx +23 -0
  394. package/src/avatar/createAvatarText.tsx +30 -0
  395. package/src/avatar/index.ts +43 -0
  396. package/src/avatar/types.ts +77 -0
  397. package/src/button/context.tsx +1 -1
  398. package/src/button/createButtonRoot.tsx +5 -4
  399. package/src/button/index.tsx +19 -19
  400. package/src/button/types.ts +0 -8
  401. package/src/checkbox/context.tsx +18 -0
  402. package/src/checkbox/createCheckboxGroup.tsx +32 -0
  403. package/src/checkbox/createCheckboxIcon.tsx +18 -0
  404. package/src/checkbox/createCheckboxIndicator.tsx +43 -0
  405. package/src/checkbox/createCheckboxLabel.tsx +42 -0
  406. package/src/checkbox/createCheckboxRoot.tsx +100 -0
  407. package/src/checkbox/createCheckboxRoot.web.tsx +79 -0
  408. package/src/checkbox/index.ts +43 -0
  409. package/src/checkbox/types.ts +74 -0
  410. package/src/checkbox/useCheckboxRoot.ts +85 -0
  411. package/src/dialog/context.tsx +4 -0
  412. package/src/dialog/createDialogBody.tsx +11 -0
  413. package/src/dialog/createDialogClose.tsx +27 -0
  414. package/src/dialog/createDialogContent.tsx +122 -0
  415. package/src/dialog/createDialogDescription.tsx +20 -0
  416. package/src/dialog/createDialogFooter.tsx +11 -0
  417. package/src/dialog/createDialogHeader.tsx +11 -0
  418. package/src/dialog/createDialogRoot.tsx +66 -0
  419. package/src/dialog/createDialogTitle.tsx +11 -0
  420. package/src/dialog/createDialogTrigger.tsx +27 -0
  421. package/src/dialog/index.tsx +93 -0
  422. package/src/dialog/types.ts +88 -0
  423. package/src/form-control/createFormError.tsx +32 -0
  424. package/src/form-control/createFormErrorIcon.tsx +9 -0
  425. package/src/form-control/createFormErrorText.tsx +9 -0
  426. package/src/form-control/createFormField.tsx +27 -0
  427. package/src/form-control/createFormHelper.tsx +28 -0
  428. package/src/form-control/createFormHelperText.tsx +9 -0
  429. package/src/form-control/createFormLabel.tsx +30 -0
  430. package/src/form-control/createFormRoot.tsx +13 -0
  431. package/src/form-control/index.tsx +71 -0
  432. package/src/form-control/types.tsx +92 -0
  433. package/src/index.ts +9 -1
  434. package/src/input/createInputField.tsx +13 -3
  435. package/src/input/index.tsx +15 -28
  436. package/src/input/types.ts +0 -4
  437. package/src/link/LinkProvider.tsx +50 -0
  438. package/src/link/createLink.tsx +71 -0
  439. package/src/link/index.tsx +5 -0
  440. package/src/link/types.ts +47 -0
  441. package/src/link/useLink.ts +54 -0
  442. package/src/overlay/OverlayContainer.tsx +9 -18
  443. package/src/overlay/index.ts +1 -0
  444. package/src/overlay/useEscapeKey.ts +7 -0
  445. package/src/overlay/useEscapeKey.web.ts +27 -0
  446. package/src/select/context.tsx +9 -44
  447. package/src/select/createSelectItem.tsx +3 -3
  448. package/src/select/createSelectRoot.tsx +10 -6
  449. package/src/select/createSelectTrigger.tsx +62 -36
  450. package/src/select/types.ts +5 -10
  451. package/src/switch/createSwitchRoot.tsx +72 -0
  452. package/src/switch/index.ts +16 -0
  453. package/src/switch/types.ts +42 -0
  454. package/src/types.ts +7 -0
  455. package/src/utils/createPortal.ts +20 -0
  456. package/src/utils/dataAttributes.web.ts +2 -4
  457. package/lib/commonjs/input/createInputIcon.js +0 -20
  458. package/lib/commonjs/input/createInputIcon.js.map +0 -1
  459. package/lib/module/input/createInputIcon.js.map +0 -1
  460. package/lib/typescript/input/createInputIcon.d.ts +0 -4
  461. package/lib/typescript/input/createInputIcon.d.ts.map +0 -1
  462. package/src/input/createInputIcon.tsx +0 -12
@@ -6,7 +6,7 @@ import {
6
6
  Platform,
7
7
  type TextInputKeyPressEvent,
8
8
  } from 'react-native';
9
- import { mergeRefs, useFormControl } from '@cdx-ui/utils';
9
+ import { mergeRefs, useFormControl, useFormControlContext } from '@cdx-ui/utils';
10
10
  import { dataAttributes } from '../utils/dataAttributes';
11
11
  import { useInputContext } from './context';
12
12
  import type { IInputProps } from './types';
@@ -18,7 +18,8 @@ export const createInputField = <T,>(BaseInputField: React.ComponentType<T>) =>
18
18
  children,
19
19
  onKeyPress,
20
20
  type = 'text',
21
- 'aria-label': ariaLabel = 'Input Field',
21
+ accessibilityLabel,
22
+ 'aria-label': ariaLabelProp,
22
23
  secureTextEntry,
23
24
  editable,
24
25
  disabled,
@@ -46,15 +47,22 @@ export const createInputField = <T,>(BaseInputField: React.ComponentType<T>) =>
46
47
  id: props.id,
47
48
  });
48
49
 
50
+ const field = useFormControlContext();
51
+
49
52
  const handleFocus = (focusState: boolean, callback: any) => {
50
53
  setIsFocused(focusState);
51
54
  callback();
52
55
  };
53
56
 
54
- const mergedRef = mergeRefs(ref, inputFieldRef);
57
+ const mergedRef =
58
+ Platform.OS === 'web'
59
+ ? mergeRefs(ref, inputFieldRef)
60
+ : mergeRefs(ref, inputFieldRef, field.inputRef);
55
61
 
56
62
  const isEffectivelyDisabled = isDisabled || inputProps.disabled;
57
63
 
64
+ const ariaLabel = accessibilityLabel ?? ariaLabelProp;
65
+
58
66
  const editableProp = useMemo(() => {
59
67
  if (editable !== undefined) {
60
68
  return editable;
@@ -64,6 +72,7 @@ export const createInputField = <T,>(BaseInputField: React.ComponentType<T>) =>
64
72
 
65
73
  return (
66
74
  <BaseInputField
75
+ {...inputProps}
67
76
  {...(props as T)}
68
77
  type={type}
69
78
  {...dataAttributes({
@@ -78,6 +87,7 @@ export const createInputField = <T,>(BaseInputField: React.ComponentType<T>) =>
78
87
  disabled={isEffectivelyDisabled}
79
88
  secureTextEntry={secureTextEntry || type === 'password'}
80
89
  accessible
90
+ accessibilityLabel={ariaLabel}
81
91
  aria-label={ariaLabel}
82
92
  aria-required={isRequired || inputProps.required}
83
93
  aria-invalid={isInvalid || inputProps['aria-invalid']}
@@ -1,5 +1,5 @@
1
+ import type React from 'react';
1
2
  import { createInputField } from './createInputField';
2
- import { createInputIcon } from './createInputIcon';
3
3
  import { createInputRoot } from './createInputRoot';
4
4
  import { createInputSlot } from './createInputSlot';
5
5
  import type { IInputComponentType } from './types';
@@ -12,40 +12,27 @@ export type {
12
12
  IInputSlotProps,
13
13
  } from './types';
14
14
 
15
- export const createInput = <
15
+ export function createInput<
16
16
  RootProps,
17
- IconProps,
18
17
  SlotProps,
19
18
  FieldProps,
20
19
  RootRef = unknown,
21
20
  FieldRef = unknown,
22
- >({
23
- Root,
24
- Icon,
25
- Slot,
26
- Field,
27
- }: {
21
+ >(BaseComponents: {
28
22
  Root: React.ComponentType<RootProps>;
29
- Icon: React.ComponentType<IconProps>;
30
23
  Slot: React.ComponentType<SlotProps>;
31
24
  Field: React.ComponentType<FieldProps>;
32
- }) => {
33
- const Input = createInputRoot(Root) as any;
34
- Input.Icon = createInputIcon(Icon);
35
- Input.Slot = createInputSlot(Slot);
36
- Input.Field = createInputField(Field);
25
+ }) {
26
+ const Input = createInputRoot(BaseComponents.Root);
27
+ const Slot = createInputSlot(BaseComponents.Slot);
28
+ const Field = createInputField(BaseComponents.Field);
37
29
 
38
- Input.displayName = 'Input';
39
- Input.Icon.displayName = 'Input.Icon';
40
- Input.Slot.displayName = 'Input.Slot';
41
- Input.Field.displayName = 'Input.Field';
30
+ Input.displayName = 'InputPrimitive';
31
+ Slot.displayName = 'InputPrimitive.Slot';
32
+ Field.displayName = 'InputPrimitive.Field';
42
33
 
43
- return Input as IInputComponentType<
44
- RootProps,
45
- IconProps,
46
- SlotProps,
47
- FieldProps,
48
- RootRef,
49
- FieldRef
50
- >;
51
- };
34
+ return Object.assign(Input, {
35
+ Slot,
36
+ Field,
37
+ }) as IInputComponentType<RootProps, SlotProps, FieldProps, RootRef, FieldRef>;
38
+ }
@@ -93,7 +93,6 @@ export interface IInputSlotProps extends ViewProps {
93
93
 
94
94
  export type IInputComponentType<
95
95
  RootProps,
96
- IconProps,
97
96
  SlotProps,
98
97
  FieldProps,
99
98
  RootRef = unknown,
@@ -101,9 +100,6 @@ export type IInputComponentType<
101
100
  > = React.ForwardRefExoticComponent<
102
101
  React.PropsWithoutRef<RootProps & IInputFieldProps> & React.RefAttributes<RootRef>
103
102
  > & {
104
- Icon: React.ForwardRefExoticComponent<
105
- React.PropsWithoutRef<IconProps> & React.RefAttributes<unknown>
106
- >;
107
103
  Slot: React.ForwardRefExoticComponent<
108
104
  React.PropsWithoutRef<SlotProps & IInputSlotProps> & React.RefAttributes<unknown>
109
105
  >;
@@ -0,0 +1,50 @@
1
+ import { createContext, useContext, type ReactNode } from 'react';
2
+ import type { LinkAction } from './types';
3
+
4
+ export interface LinkConfig {
5
+ /**
6
+ * Global navigation handler for `<Link>` instances whose `href` passes the
7
+ * `shouldNavigate` check. Called with the `href` and the per-instance `action`.
8
+ *
9
+ * @param href - The URL or path to navigate to.
10
+ * @param action - Navigation intent from the per-instance `action` prop:
11
+ * `'navigate'` (default) — smart navigation, avoids duplicates.
12
+ * `'push'` — always pushes a new entry onto the stack.
13
+ * `'replace'` — replaces the current entry without stacking.
14
+ */
15
+ navigate: (href: string, action: LinkAction) => void | Promise<void>;
16
+
17
+ /**
18
+ * Optional predicate evaluated at **render time** to decide whether the
19
+ * provider should handle a given `href`.
20
+ *
21
+ * - Returns `true` → the provider's `navigate` is called on press;
22
+ * on web the native `<a href>` is **removed** so the browser doesn't
23
+ * follow the link.
24
+ * - Returns `false` → the provider is bypassed; on web the `<a href>` is
25
+ * preserved (cmd-click, SEO, etc.); on native `Linking.openURL` is used.
26
+ *
27
+ * Defaults to `() => true` when omitted (all hrefs go through the provider).
28
+ */
29
+ shouldNavigate?: (href: string) => boolean;
30
+ }
31
+
32
+ const LinkConfigContext = createContext<LinkConfig | undefined>(undefined);
33
+
34
+ export function LinkProvider({
35
+ navigate,
36
+ shouldNavigate,
37
+ children,
38
+ }: LinkConfig & { children: ReactNode }) {
39
+ return (
40
+ <LinkConfigContext.Provider value={{ navigate, shouldNavigate }}>
41
+ {children}
42
+ </LinkConfigContext.Provider>
43
+ );
44
+ }
45
+
46
+ LinkProvider.displayName = 'LinkProvider';
47
+
48
+ export function useLinkConfig(): LinkConfig | undefined {
49
+ return useContext(LinkConfigContext);
50
+ }
@@ -0,0 +1,71 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { composeEventHandlers } from '@cdx-ui/utils';
3
+ import { useFocusRing, useFocus } from '@react-native-aria/focus';
4
+ import { useHover, usePress } from '@react-native-aria/interactions';
5
+ import { dataAttributes } from '../utils/dataAttributes';
6
+ import { useLink } from './useLink';
7
+ import type { ILinkProps } from './types';
8
+
9
+ export const createLink = <RootT, R = unknown>({ Root }: { Root: React.ComponentType<RootT> }) =>
10
+ forwardRef(
11
+ (
12
+ {
13
+ children,
14
+ isHovered: isHoveredProp,
15
+ isPressed: isPressedProp,
16
+ isFocused: isFocusedProp,
17
+ isFocusVisible: isFocusVisibleProp,
18
+ href,
19
+ onPress,
20
+ action,
21
+ webProps,
22
+ ...props
23
+ }: ILinkProps,
24
+ ref: React.ForwardedRef<R>,
25
+ ) => {
26
+ const { isFocused, focusProps } = useFocus();
27
+ const { isFocusVisible, focusProps: focusRingProps } = useFocusRing() as {
28
+ isFocusVisible: boolean;
29
+ focusProps: typeof focusProps;
30
+ };
31
+ const { pressProps, isPressed } = usePress({});
32
+ const { isHovered, hoverProps } = useHover();
33
+
34
+ const { linkProps } = useLink({
35
+ href,
36
+ onPress,
37
+ action,
38
+ webProps,
39
+ });
40
+
41
+ const interactionAttrs = dataAttributes({
42
+ hover: isHoveredProp || isHovered,
43
+ focus: isFocusedProp || isFocused,
44
+ active: isPressedProp || isPressed,
45
+ focusVisible: isFocusVisibleProp || isFocusVisible,
46
+ });
47
+
48
+ return (
49
+ <Root
50
+ ref={ref}
51
+ {...interactionAttrs}
52
+ {...linkProps}
53
+ {...(props as RootT)}
54
+ onPressIn={composeEventHandlers(props?.onPressIn, pressProps.onPressIn)}
55
+ onPressOut={composeEventHandlers(props?.onPressOut, pressProps.onPressOut)}
56
+ onHoverIn={composeEventHandlers(props?.onHoverIn, hoverProps.onHoverIn)}
57
+ onHoverOut={composeEventHandlers(props?.onHoverOut, hoverProps.onHoverOut)}
58
+ onFocus={composeEventHandlers(
59
+ composeEventHandlers(props?.onFocus, focusProps.onFocus),
60
+ focusRingProps.onFocus,
61
+ )}
62
+ onBlur={composeEventHandlers(
63
+ composeEventHandlers(props?.onBlur, focusProps.onBlur),
64
+ focusRingProps.onBlur,
65
+ )}
66
+ >
67
+ {children}
68
+ </Root>
69
+ );
70
+ },
71
+ );
@@ -0,0 +1,5 @@
1
+ export { createLink } from './createLink';
2
+ export { LinkProvider } from './LinkProvider';
3
+ export type { LinkConfig } from './LinkProvider';
4
+ export { useLink } from './useLink';
5
+ export type { ILinkProps, IUseLinkProp, LinkAction } from './types';
@@ -0,0 +1,47 @@
1
+ import type React from 'react';
2
+ import type { GestureResponderEvent, PressableProps } from 'react-native';
3
+
4
+ /**
5
+ * Navigation action forwarded to the `LinkProvider.navigate` callback.
6
+ *
7
+ * - `'navigate'` — (default) Smart navigation. In React Navigation this
8
+ * avoids duplicating a screen that is already in the stack. In expo-router
9
+ * it maps to `router.navigate()`.
10
+ * - `'push'` — Always pushes a new screen onto the navigation stack,
11
+ * even if the destination is already present.
12
+ * - `'replace'` — Replaces the current screen without adding to the stack.
13
+ * Useful for post-login redirects or wizard flows.
14
+ */
15
+ export type LinkAction = 'navigate' | 'push' | 'replace';
16
+
17
+ export interface ILinkProps extends PressableProps {
18
+ /**
19
+ * URL that should be opened on Link press
20
+ */
21
+ href?: string | undefined;
22
+ /**
23
+ * Callback that will be invoked on Link press
24
+ */
25
+ onPress?: ((event?: GestureResponderEvent) => void) | null | undefined;
26
+ /**
27
+ * Navigation action forwarded to the `LinkProvider`.
28
+ * Defaults to `'navigate'`.
29
+ */
30
+ action?: LinkAction;
31
+ isPressed?: boolean;
32
+ isHovered?: boolean;
33
+ isFocused?: boolean;
34
+ isFocusVisible?: boolean;
35
+ /**
36
+ * HTML anchor attributes applied only on web. Ignored on native platforms.
37
+ * `target`, `rel`, and `download` are forwarded via react-native-web's `hrefAttrs`.
38
+ */
39
+ webProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
40
+ }
41
+
42
+ export interface IUseLinkProp {
43
+ href?: string;
44
+ onPress: ((event?: GestureResponderEvent) => void) | null | undefined;
45
+ action?: LinkAction;
46
+ webProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
47
+ }
@@ -0,0 +1,54 @@
1
+ import { Linking, Platform } from 'react-native';
2
+ import type { AccessibilityRole, GestureResponderEvent } from 'react-native';
3
+ import { useLinkConfig } from './LinkProvider';
4
+ import type { IUseLinkProp } from './types';
5
+
6
+ function defaultNavigate(href: string): void {
7
+ Linking.canOpenURL(href)
8
+ .then((supported) => {
9
+ if (supported) return Linking.openURL(href);
10
+ console.warn(`Cannot open URL: ${href}`);
11
+ })
12
+ .catch((err: unknown) => console.error('Failed to open URL', err));
13
+ }
14
+
15
+ export function useLink(props: IUseLinkProp) {
16
+ const { href, onPress, action = 'navigate', webProps } = props;
17
+ const config = useLinkConfig();
18
+
19
+ const providerHandles = !!config && !!href && (config.shouldNavigate?.(href) ?? true);
20
+
21
+ let platformLinkProps = {};
22
+
23
+ if (Platform.OS === 'web') {
24
+ platformLinkProps = {
25
+ href: providerHandles ? undefined : href,
26
+ hrefAttrs: webProps,
27
+ onPress: (event: GestureResponderEvent) => {
28
+ onPress?.(event);
29
+ if (providerHandles) void config.navigate(href, action);
30
+ },
31
+ };
32
+ } else {
33
+ platformLinkProps = {
34
+ onPress: (event: GestureResponderEvent) => {
35
+ onPress?.(event);
36
+ if (href) {
37
+ if (providerHandles) {
38
+ void config.navigate(href, action);
39
+ } else {
40
+ defaultNavigate(href);
41
+ }
42
+ }
43
+ },
44
+ };
45
+ }
46
+
47
+ return {
48
+ linkProps: {
49
+ ...platformLinkProps,
50
+ role: 'link' as AccessibilityRole,
51
+ accessible: true,
52
+ },
53
+ };
54
+ }
@@ -3,20 +3,13 @@ import {
3
3
  Modal,
4
4
  Platform,
5
5
  Pressable,
6
- type StyleProp,
7
6
  StyleSheet,
7
+ View,
8
+ type StyleProp,
8
9
  type ViewStyle,
9
10
  } from 'react-native';
10
11
  import Animated, { type EntryOrExitLayoutType } from 'react-native-reanimated';
11
-
12
- let createPortalFn:
13
- | ((children: React.ReactNode, container: Element) => React.ReactPortal)
14
- | undefined;
15
- if (Platform.OS === 'web') {
16
- try {
17
- createPortalFn = require('react-dom').createPortal;
18
- } catch {}
19
- }
12
+ import { createPortalFn } from '../utils/createPortal';
20
13
 
21
14
  export interface OverlayContainerProps {
22
15
  onDismiss: () => void;
@@ -30,7 +23,11 @@ export interface OverlayContainerProps {
30
23
  * Cross-platform overlay container.
31
24
  *
32
25
  * - Web: renders children into a `createPortal` at `document.body` with
33
- * `position: fixed` and `zIndex: 50`.
26
+ * `position: fixed` and `zIndex: 50`. Uses a plain `View` rather than
27
+ * Reanimated's `Animated.View` because Reanimated's layout animations
28
+ * (`entering`/`exiting`) rely on `require()` calls that break silently
29
+ * in Vite production bundles, leaving elements stuck at opacity 0.
30
+ * See: https://github.com/software-mansion/react-native-reanimated/issues/6775
34
31
  * - Native: renders children inside a transparent `<Modal>` with a
35
32
  * backdrop `<Pressable>` that calls `onDismiss` on press.
36
33
  *
@@ -46,13 +43,7 @@ export function OverlayContainer({
46
43
  }: Readonly<OverlayContainerProps>) {
47
44
  if (Platform.OS === 'web' && createPortalFn) {
48
45
  return createPortalFn(
49
- <Animated.View
50
- entering={entering}
51
- exiting={exiting}
52
- style={[{ position: 'fixed' as any, zIndex: 50 }, style]}
53
- >
54
- {children}
55
- </Animated.View>,
46
+ <View style={[{ position: 'fixed' as any, zIndex: 50 }, style]}>{children}</View>,
56
47
  document.body,
57
48
  );
58
49
  }
@@ -2,6 +2,7 @@ export { OverlayContainer } from './OverlayContainer';
2
2
  export type { OverlayContainerProps } from './OverlayContainer';
3
3
  export { useAnchorPosition, type AnchorLayout } from './useAnchorPosition';
4
4
  export { useDismissOverlay } from './useDismissOverlay';
5
+ export { useEscapeKey } from './useEscapeKey';
5
6
  export {
6
7
  useOverlayPosition,
7
8
  type OverlayPosition,
@@ -0,0 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+
3
+ /**
4
+ * No-op on native — Escape key dismissal is not applicable.
5
+ * Native uses the system back gesture / hardware button via Modal.
6
+ */
7
+ export function useEscapeKey(_open: boolean, _onEscape: () => void) {}
@@ -0,0 +1,27 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ /**
4
+ * Closes an overlay when the user presses the Escape key.
5
+ * Web-only — native platforms use Modal's `onRequestClose` for back/dismiss.
6
+ */
7
+ export function useEscapeKey(open: boolean, onEscape: () => void) {
8
+ const onEscapeRef = useRef(onEscape);
9
+ onEscapeRef.current = onEscape;
10
+
11
+ useEffect(() => {
12
+ if (!open) {
13
+ return;
14
+ }
15
+
16
+ const handleKeyDown = (e: KeyboardEvent) => {
17
+ if (e.key === 'Escape') {
18
+ onEscapeRef.current();
19
+ }
20
+ };
21
+
22
+ document.addEventListener('keydown', handleKeyDown);
23
+ return () => {
24
+ document.removeEventListener('keydown', handleKeyDown);
25
+ };
26
+ }, [open]);
27
+ }
@@ -1,56 +1,21 @@
1
- import { createContext, useContext } from 'react';
2
- import type { InteractionState, SelectContextValue, SelectItemInteractionState } from './types';
1
+ import { createContext } from '@cdx-ui/utils';
2
+ import type { InteractionState } from '../types';
3
+ import type { SelectContextValue, SelectItemInteractionState } from './types';
3
4
 
4
- const defaultContextValue: SelectContextValue = {
5
- open: false,
6
- items: [],
7
- setOpen: () => {},
8
- value: undefined,
9
- onValueChange: () => {},
10
- disabled: false,
11
- required: false,
12
- invalid: false,
13
- readOnly: false,
14
- native: false,
15
- triggerRef: { current: null },
16
- contentId: '',
17
- triggerId: '',
18
- activeValue: undefined,
19
- setActiveValue: () => {}, // TODO: Is this needed? At the very least it could be moved to SelectContent
20
- accessibilityLabel: undefined,
21
- };
22
-
23
- export const SelectContext = createContext<SelectContextValue>(defaultContextValue);
24
-
25
- export const useSelectContext = () => useContext(SelectContext);
5
+ export const [SelectProvider, useSelectContext] =
6
+ createContext<SelectContextValue>('SelectContext');
26
7
 
27
8
  /**
28
9
  * Propagates the trigger's interaction state (hover, focus, active, etc.) to
29
10
  * child components like SelectValue and SelectIcon so they can apply matching
30
11
  * data-attribute styles.
31
12
  */
32
- export const SelectTriggerContext = createContext<InteractionState>({
33
- hover: false,
34
- focus: false,
35
- active: false,
36
- disabled: false,
37
- focusVisible: false,
38
- });
39
-
40
- export const useSelectTriggerContext = () => useContext(SelectTriggerContext);
13
+ export const [SelectTriggerProvider, useSelectTriggerContext] =
14
+ createContext<InteractionState>('SelectTriggerContext');
41
15
 
42
16
  /**
43
17
  * Propagates the item's interaction and selection state (hover, focus, active,
44
18
  * highlighted, checked, etc.) to child components like SelectItemLabel.
45
19
  */
46
- export const SelectItemContext = createContext<SelectItemInteractionState>({
47
- hover: false,
48
- focus: false,
49
- active: false,
50
- disabled: false,
51
- focusVisible: false,
52
- highlighted: false,
53
- checked: false,
54
- });
55
-
56
- export const useSelectItemContext = () => useContext(SelectItemContext);
20
+ export const [SelectItemProvider, useSelectItemContext] =
21
+ createContext<SelectItemInteractionState>('SelectItemContext');
@@ -4,7 +4,7 @@ import { composeEventHandlers } from '@cdx-ui/utils';
4
4
  import { useFocus, useFocusRing } from '@react-native-aria/focus';
5
5
  import { useHover, usePress } from '@react-native-aria/interactions';
6
6
  import { dataAttributes } from '../utils/dataAttributes';
7
- import { SelectItemContext, useSelectContext } from './context';
7
+ import { SelectItemProvider, useSelectContext } from './context';
8
8
  import type { ISelectItemProps } from './types';
9
9
 
10
10
  export const createSelectItem = <T,>(BaseItem: React.ComponentType<T>) =>
@@ -74,7 +74,7 @@ export const createSelectItem = <T,>(BaseItem: React.ComponentType<T>) =>
74
74
  );
75
75
 
76
76
  return (
77
- <SelectItemContext.Provider value={interactionState}>
77
+ <SelectItemProvider value={interactionState}>
78
78
  <BaseItem
79
79
  ref={ref}
80
80
  role="option"
@@ -115,7 +115,7 @@ export const createSelectItem = <T,>(BaseItem: React.ComponentType<T>) =>
115
115
  >
116
116
  {children}
117
117
  </BaseItem>
118
- </SelectItemContext.Provider>
118
+ </SelectItemProvider>
119
119
  );
120
120
  },
121
121
  );
@@ -2,7 +2,7 @@ import type React from 'react';
2
2
  import { forwardRef, useCallback, useId, useMemo, useRef, useState } from 'react';
3
3
  import { useControllableState, useFormControl } from '@cdx-ui/utils';
4
4
  import { dataAttributes } from '../utils/dataAttributes';
5
- import { SelectContext } from './context';
5
+ import { SelectProvider } from './context';
6
6
  import type { ISelectProps } from './types';
7
7
 
8
8
  export const createSelectRoot = <T,>(BaseRoot: React.ComponentType<T>) =>
@@ -68,9 +68,11 @@ export const createSelectRoot = <T,>(BaseRoot: React.ComponentType<T>) =>
68
68
  const [activeValue, setActiveValue] = useState<string | undefined>(undefined);
69
69
 
70
70
  const triggerRef = useRef<any>(null);
71
- const id = useId();
72
- const triggerId = `select-trigger-${id}`;
73
- const contentId = `select-content-${id}`;
71
+ const reactId = useId();
72
+ /** Align with `useFormControl` default id (`${field.id}-input`) when inside `Form.Field`. */
73
+ const triggerId = formControlProps.id ?? `select-trigger-${reactId}`;
74
+ const contentId = `select-content-${reactId}`;
75
+ const ariaDescribedBy = formControlProps['aria-describedby'];
74
76
 
75
77
  const contextValue = useMemo(
76
78
  () => ({
@@ -90,6 +92,7 @@ export const createSelectRoot = <T,>(BaseRoot: React.ComponentType<T>) =>
90
92
  activeValue,
91
93
  setActiveValue,
92
94
  accessibilityLabel,
95
+ ariaDescribedBy,
93
96
  }),
94
97
  [
95
98
  open,
@@ -106,11 +109,12 @@ export const createSelectRoot = <T,>(BaseRoot: React.ComponentType<T>) =>
106
109
  triggerId,
107
110
  activeValue,
108
111
  accessibilityLabel,
112
+ ariaDescribedBy,
109
113
  ],
110
114
  );
111
115
 
112
116
  return (
113
- <SelectContext.Provider value={contextValue}>
117
+ <SelectProvider value={contextValue}>
114
118
  <BaseRoot
115
119
  ref={ref}
116
120
  {...(props as T)}
@@ -124,7 +128,7 @@ export const createSelectRoot = <T,>(BaseRoot: React.ComponentType<T>) =>
124
128
  >
125
129
  {children}
126
130
  </BaseRoot>
127
- </SelectContext.Provider>
131
+ </SelectProvider>
128
132
  );
129
133
  },
130
134
  );