@cdx-ui/primitives 0.0.1-beta.7 → 0.0.1-beta.70

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 (978) hide show
  1. package/README.md +52 -26
  2. package/lib/commonjs/CLAUDE.md +84 -0
  3. package/lib/commonjs/avatar/AvatarRoot.js +38 -0
  4. package/lib/commonjs/avatar/AvatarRoot.js.map +1 -0
  5. package/lib/commonjs/avatar/index.js +14 -24
  6. package/lib/commonjs/avatar/index.js.map +1 -1
  7. package/lib/commonjs/button/ButtonRoot.js +85 -0
  8. package/lib/commonjs/button/ButtonRoot.js.map +1 -0
  9. package/lib/commonjs/button/index.js +7 -24
  10. package/lib/commonjs/button/index.js.map +1 -1
  11. package/lib/commonjs/checkbox/CheckboxGroup.js +52 -0
  12. package/lib/commonjs/checkbox/CheckboxGroup.js.map +1 -0
  13. package/lib/commonjs/checkbox/CheckboxRoot.js +103 -0
  14. package/lib/commonjs/checkbox/CheckboxRoot.js.map +1 -0
  15. package/lib/commonjs/checkbox/CheckboxRoot.web.js +94 -0
  16. package/lib/commonjs/checkbox/CheckboxRoot.web.js.map +1 -0
  17. package/lib/commonjs/checkbox/index.js +21 -24
  18. package/lib/commonjs/checkbox/index.js.map +1 -1
  19. package/lib/commonjs/chip/ChipRoot.js +147 -0
  20. package/lib/commonjs/chip/ChipRoot.js.map +1 -0
  21. package/lib/commonjs/chip/context.js +11 -0
  22. package/lib/commonjs/chip/context.js.map +1 -0
  23. package/lib/commonjs/chip/index.js +20 -0
  24. package/lib/commonjs/chip/index.js.map +1 -0
  25. package/lib/commonjs/chip/types.js.map +1 -0
  26. package/lib/commonjs/dialog/DialogClose.js +32 -0
  27. package/lib/commonjs/dialog/DialogClose.js.map +1 -0
  28. package/lib/commonjs/dialog/DialogPopup.js +161 -0
  29. package/lib/commonjs/dialog/DialogPopup.js.map +1 -0
  30. package/lib/commonjs/dialog/DialogRoot.js +57 -0
  31. package/lib/commonjs/dialog/DialogRoot.js.map +1 -0
  32. package/lib/commonjs/dialog/DialogTrigger.js +32 -0
  33. package/lib/commonjs/dialog/DialogTrigger.js.map +1 -0
  34. package/lib/commonjs/dialog/index.js +28 -41
  35. package/lib/commonjs/dialog/index.js.map +1 -1
  36. package/lib/commonjs/field/FieldLabel.js +48 -0
  37. package/lib/commonjs/field/FieldLabel.js.map +1 -0
  38. package/lib/commonjs/field/FieldLabel.web.js +60 -0
  39. package/lib/commonjs/field/FieldLabel.web.js.map +1 -0
  40. package/lib/commonjs/field/FieldRoot.js +38 -0
  41. package/lib/commonjs/field/FieldRoot.js.map +1 -0
  42. package/lib/commonjs/field/index.js +14 -40
  43. package/lib/commonjs/field/index.js.map +1 -1
  44. package/lib/commonjs/form/FormRoot.js +25 -0
  45. package/lib/commonjs/form/FormRoot.js.map +1 -0
  46. package/lib/commonjs/form/FormRoot.web.js +27 -0
  47. package/lib/commonjs/form/FormRoot.web.js.map +1 -0
  48. package/lib/commonjs/form/index.js +7 -9
  49. package/lib/commonjs/form/index.js.map +1 -1
  50. package/lib/commonjs/index.js +86 -5
  51. package/lib/commonjs/index.js.map +1 -1
  52. package/lib/commonjs/input/InputField.android.js +98 -0
  53. package/lib/commonjs/input/InputField.android.js.map +1 -0
  54. package/lib/commonjs/input/InputField.js +92 -0
  55. package/lib/commonjs/input/InputField.js.map +1 -0
  56. package/lib/commonjs/input/InputField.web.js +131 -0
  57. package/lib/commonjs/input/InputField.web.js.map +1 -0
  58. package/lib/commonjs/input/InputRoot.js +84 -0
  59. package/lib/commonjs/input/InputRoot.js.map +1 -0
  60. package/lib/commonjs/input/index.js +21 -16
  61. package/lib/commonjs/input/index.js.map +1 -1
  62. package/lib/commonjs/link/LinkRoot.js +88 -0
  63. package/lib/commonjs/link/LinkRoot.js.map +1 -0
  64. package/lib/commonjs/link/context.js +11 -0
  65. package/lib/commonjs/link/context.js.map +1 -0
  66. package/lib/commonjs/link/index.js +16 -3
  67. package/lib/commonjs/link/index.js.map +1 -1
  68. package/lib/commonjs/list-item/ListItemRoot.js +149 -0
  69. package/lib/commonjs/list-item/ListItemRoot.js.map +1 -0
  70. package/lib/commonjs/list-item/context.js.map +1 -1
  71. package/lib/commonjs/list-item/index.js +7 -36
  72. package/lib/commonjs/list-item/index.js.map +1 -1
  73. package/lib/commonjs/otp-input/OtpInputField.js +120 -0
  74. package/lib/commonjs/otp-input/OtpInputField.js.map +1 -0
  75. package/lib/commonjs/otp-input/index.js +39 -16
  76. package/lib/commonjs/otp-input/index.js.map +1 -1
  77. package/lib/commonjs/otp-input/useOtpInput.js +120 -0
  78. package/lib/commonjs/otp-input/useOtpInput.js.map +1 -0
  79. package/lib/commonjs/overlay/useDismissOverlay.js +0 -2
  80. package/lib/commonjs/overlay/useDismissOverlay.js.map +1 -1
  81. package/lib/commonjs/overlay/useEscapeKey.js +0 -2
  82. package/lib/commonjs/overlay/useEscapeKey.js.map +1 -1
  83. package/lib/commonjs/progress-bar/ProgressBarIndicator.js +45 -0
  84. package/lib/commonjs/progress-bar/ProgressBarIndicator.js.map +1 -0
  85. package/lib/commonjs/progress-bar/ProgressBarRoot.js +100 -0
  86. package/lib/commonjs/progress-bar/ProgressBarRoot.js.map +1 -0
  87. package/lib/commonjs/progress-bar/context.js.map +1 -0
  88. package/lib/commonjs/progress-bar/index.js +27 -0
  89. package/lib/commonjs/progress-bar/index.js.map +1 -0
  90. package/lib/commonjs/progress-bar/types.js +6 -0
  91. package/lib/commonjs/progress-bar/types.js.map +1 -0
  92. package/lib/commonjs/radio/RadioGroup.js +74 -0
  93. package/lib/commonjs/radio/RadioGroup.js.map +1 -0
  94. package/lib/commonjs/radio/RadioRoot.js +99 -0
  95. package/lib/commonjs/radio/RadioRoot.js.map +1 -0
  96. package/lib/commonjs/radio/RadioRoot.web.js +91 -0
  97. package/lib/commonjs/radio/RadioRoot.web.js.map +1 -0
  98. package/lib/commonjs/radio/context.js +14 -0
  99. package/lib/commonjs/radio/context.js.map +1 -0
  100. package/lib/commonjs/radio/index.js +27 -0
  101. package/lib/commonjs/radio/index.js.map +1 -0
  102. package/lib/commonjs/radio/types.js +6 -0
  103. package/lib/commonjs/radio/types.js.map +1 -0
  104. package/lib/commonjs/radio/useRadioRoot.js +64 -0
  105. package/lib/commonjs/radio/useRadioRoot.js.map +1 -0
  106. package/lib/commonjs/select/SelectContent.js +105 -0
  107. package/lib/commonjs/select/SelectContent.js.map +1 -0
  108. package/lib/commonjs/select/SelectItem.js +104 -0
  109. package/lib/commonjs/select/SelectItem.js.map +1 -0
  110. package/lib/commonjs/select/SelectRoot.js +105 -0
  111. package/lib/commonjs/select/SelectRoot.js.map +1 -0
  112. package/lib/commonjs/select/SelectTrigger.js +72 -0
  113. package/lib/commonjs/select/SelectTrigger.js.map +1 -0
  114. package/lib/commonjs/select/SelectTrigger.web.js +175 -0
  115. package/lib/commonjs/select/SelectTrigger.web.js.map +1 -0
  116. package/lib/commonjs/select/context.js +3 -12
  117. package/lib/commonjs/select/context.js.map +1 -1
  118. package/lib/commonjs/select/index.js +41 -32
  119. package/lib/commonjs/select/index.js.map +1 -1
  120. package/lib/commonjs/select/useContentFocus.js +1 -1
  121. package/lib/commonjs/select/useSelectTrigger.js +206 -0
  122. package/lib/commonjs/select/useSelectTrigger.js.map +1 -0
  123. package/lib/commonjs/select/useSelectTrigger.web.js +192 -0
  124. package/lib/commonjs/select/useSelectTrigger.web.js.map +1 -0
  125. package/lib/commonjs/slot/index.js +19 -0
  126. package/lib/commonjs/slot/index.js.map +1 -0
  127. package/lib/commonjs/switch/index.js +7 -9
  128. package/lib/commonjs/switch/index.js.map +1 -1
  129. package/lib/commonjs/switch/useSwitch.js +81 -0
  130. package/lib/commonjs/switch/useSwitch.js.map +1 -0
  131. package/lib/commonjs/tile/TileGroup.js +111 -0
  132. package/lib/commonjs/tile/TileGroup.js.map +1 -0
  133. package/lib/commonjs/tile/TileRoot.js +129 -0
  134. package/lib/commonjs/tile/TileRoot.js.map +1 -0
  135. package/lib/commonjs/tile/context.js +30 -0
  136. package/lib/commonjs/tile/context.js.map +1 -0
  137. package/lib/commonjs/tile/index.js +33 -0
  138. package/lib/commonjs/tile/index.js.map +1 -0
  139. package/lib/commonjs/tile/types.js +6 -0
  140. package/lib/commonjs/tile/types.js.map +1 -0
  141. package/lib/commonjs/utils/dataAttributes.js +12 -25
  142. package/lib/commonjs/utils/dataAttributes.js.map +1 -1
  143. package/lib/commonjs/utils/dataAttributes.web.js +25 -0
  144. package/lib/commonjs/utils/dataAttributes.web.js.map +1 -1
  145. package/lib/commonjs/utils/domDataAttributes.js +64 -0
  146. package/lib/commonjs/utils/domDataAttributes.js.map +1 -0
  147. package/lib/module/CLAUDE.md +84 -0
  148. package/lib/module/avatar/AvatarRoot.js +34 -0
  149. package/lib/module/avatar/AvatarRoot.js.map +1 -0
  150. package/lib/module/avatar/index.js +2 -23
  151. package/lib/module/avatar/index.js.map +1 -1
  152. package/lib/module/button/ButtonRoot.js +81 -0
  153. package/lib/module/button/ButtonRoot.js.map +1 -0
  154. package/lib/module/button/index.js +1 -23
  155. package/lib/module/button/index.js.map +1 -1
  156. package/lib/module/checkbox/CheckboxGroup.js +48 -0
  157. package/lib/module/checkbox/CheckboxGroup.js.map +1 -0
  158. package/lib/module/checkbox/CheckboxRoot.js +99 -0
  159. package/lib/module/checkbox/CheckboxRoot.js.map +1 -0
  160. package/lib/module/checkbox/CheckboxRoot.web.js +90 -0
  161. package/lib/module/checkbox/CheckboxRoot.web.js.map +1 -0
  162. package/lib/module/checkbox/index.js +3 -23
  163. package/lib/module/checkbox/index.js.map +1 -1
  164. package/lib/module/chip/ChipRoot.js +142 -0
  165. package/lib/module/chip/ChipRoot.js.map +1 -0
  166. package/lib/module/chip/context.js +5 -0
  167. package/lib/module/chip/context.js.map +1 -0
  168. package/lib/module/chip/index.js +5 -0
  169. package/lib/module/chip/index.js.map +1 -0
  170. package/lib/module/chip/types.js.map +1 -0
  171. package/lib/module/dialog/DialogClose.js +28 -0
  172. package/lib/module/dialog/DialogClose.js.map +1 -0
  173. package/lib/module/dialog/DialogPopup.js +157 -0
  174. package/lib/module/dialog/DialogPopup.js.map +1 -0
  175. package/lib/module/dialog/DialogRoot.js +53 -0
  176. package/lib/module/dialog/DialogRoot.js.map +1 -0
  177. package/lib/module/dialog/DialogTrigger.js +28 -0
  178. package/lib/module/dialog/DialogTrigger.js.map +1 -0
  179. package/lib/module/dialog/index.js +5 -42
  180. package/lib/module/dialog/index.js.map +1 -1
  181. package/lib/module/field/FieldLabel.js +44 -0
  182. package/lib/module/field/FieldLabel.js.map +1 -0
  183. package/lib/module/field/FieldLabel.web.js +55 -0
  184. package/lib/module/field/FieldLabel.web.js.map +1 -0
  185. package/lib/module/field/FieldRoot.js +34 -0
  186. package/lib/module/field/FieldRoot.js.map +1 -0
  187. package/lib/module/field/index.js +2 -39
  188. package/lib/module/field/index.js.map +1 -1
  189. package/lib/module/form/FormRoot.js +21 -0
  190. package/lib/module/form/FormRoot.js.map +1 -0
  191. package/lib/module/form/FormRoot.web.js +22 -0
  192. package/lib/module/form/FormRoot.web.js.map +1 -0
  193. package/lib/module/form/index.js +1 -8
  194. package/lib/module/form/index.js.map +1 -1
  195. package/lib/module/index.js +8 -2
  196. package/lib/module/index.js.map +1 -1
  197. package/lib/module/input/InputField.android.js +94 -0
  198. package/lib/module/input/InputField.android.js.map +1 -0
  199. package/lib/module/input/InputField.js +88 -0
  200. package/lib/module/input/InputField.js.map +1 -0
  201. package/lib/module/input/InputField.web.js +126 -0
  202. package/lib/module/input/InputField.web.js.map +1 -0
  203. package/lib/module/input/InputRoot.js +80 -0
  204. package/lib/module/input/InputRoot.js.map +1 -0
  205. package/lib/module/input/index.js +3 -15
  206. package/lib/module/input/index.js.map +1 -1
  207. package/lib/module/link/LinkRoot.js +84 -0
  208. package/lib/module/link/LinkRoot.js.map +1 -0
  209. package/lib/module/link/context.js +5 -0
  210. package/lib/module/link/context.js.map +1 -0
  211. package/lib/module/link/index.js +2 -1
  212. package/lib/module/link/index.js.map +1 -1
  213. package/lib/module/list-item/ListItemRoot.js +144 -0
  214. package/lib/module/list-item/ListItemRoot.js.map +1 -0
  215. package/lib/module/list-item/context.js.map +1 -1
  216. package/lib/module/list-item/index.js +1 -35
  217. package/lib/module/list-item/index.js.map +1 -1
  218. package/lib/module/otp-input/OtpInputField.js +116 -0
  219. package/lib/module/otp-input/OtpInputField.js.map +1 -0
  220. package/lib/module/otp-input/index.js +3 -15
  221. package/lib/module/otp-input/index.js.map +1 -1
  222. package/lib/module/otp-input/useOtpInput.js +116 -0
  223. package/lib/module/otp-input/useOtpInput.js.map +1 -0
  224. package/lib/module/overlay/useDismissOverlay.js +0 -2
  225. package/lib/module/overlay/useDismissOverlay.js.map +1 -1
  226. package/lib/module/overlay/useEscapeKey.js +0 -2
  227. package/lib/module/overlay/useEscapeKey.js.map +1 -1
  228. package/lib/module/progress-bar/ProgressBarIndicator.js +41 -0
  229. package/lib/module/progress-bar/ProgressBarIndicator.js.map +1 -0
  230. package/lib/module/progress-bar/ProgressBarRoot.js +96 -0
  231. package/lib/module/progress-bar/ProgressBarRoot.js.map +1 -0
  232. package/lib/module/progress-bar/context.js.map +1 -0
  233. package/lib/module/progress-bar/index.js +6 -0
  234. package/lib/module/progress-bar/index.js.map +1 -0
  235. package/lib/module/progress-bar/types.js +4 -0
  236. package/lib/module/progress-bar/types.js.map +1 -0
  237. package/lib/module/radio/RadioGroup.js +70 -0
  238. package/lib/module/radio/RadioGroup.js.map +1 -0
  239. package/lib/module/radio/RadioRoot.js +95 -0
  240. package/lib/module/radio/RadioRoot.js.map +1 -0
  241. package/lib/module/radio/RadioRoot.web.js +87 -0
  242. package/lib/module/radio/RadioRoot.web.js.map +1 -0
  243. package/lib/module/radio/context.js +7 -0
  244. package/lib/module/radio/context.js.map +1 -0
  245. package/lib/module/radio/index.js +6 -0
  246. package/lib/module/radio/index.js.map +1 -0
  247. package/lib/module/radio/types.js +4 -0
  248. package/lib/module/radio/types.js.map +1 -0
  249. package/lib/module/radio/useRadioRoot.js +60 -0
  250. package/lib/module/radio/useRadioRoot.js.map +1 -0
  251. package/lib/module/select/SelectContent.js +100 -0
  252. package/lib/module/select/SelectContent.js.map +1 -0
  253. package/lib/module/select/SelectItem.js +100 -0
  254. package/lib/module/select/SelectItem.js.map +1 -0
  255. package/lib/module/select/SelectRoot.js +101 -0
  256. package/lib/module/select/SelectRoot.js.map +1 -0
  257. package/lib/module/select/SelectTrigger.js +67 -0
  258. package/lib/module/select/SelectTrigger.js.map +1 -0
  259. package/lib/module/select/SelectTrigger.web.js +170 -0
  260. package/lib/module/select/SelectTrigger.web.js.map +1 -0
  261. package/lib/module/select/context.js +1 -8
  262. package/lib/module/select/context.js.map +1 -1
  263. package/lib/module/select/index.js +5 -31
  264. package/lib/module/select/index.js.map +1 -1
  265. package/lib/module/select/useContentFocus.js +1 -1
  266. package/lib/module/select/useSelectTrigger.js +202 -0
  267. package/lib/module/select/useSelectTrigger.js.map +1 -0
  268. package/lib/module/select/useSelectTrigger.web.js +188 -0
  269. package/lib/module/select/useSelectTrigger.web.js.map +1 -0
  270. package/lib/module/slot/index.js +4 -0
  271. package/lib/module/slot/index.js.map +1 -0
  272. package/lib/module/switch/index.js +1 -8
  273. package/lib/module/switch/index.js.map +1 -1
  274. package/lib/module/switch/useSwitch.js +77 -0
  275. package/lib/module/switch/useSwitch.js.map +1 -0
  276. package/lib/module/tile/TileGroup.js +107 -0
  277. package/lib/module/tile/TileGroup.js.map +1 -0
  278. package/lib/module/tile/TileRoot.js +125 -0
  279. package/lib/module/tile/TileRoot.js.map +1 -0
  280. package/lib/module/tile/context.js +21 -0
  281. package/lib/module/tile/context.js.map +1 -0
  282. package/lib/module/tile/index.js +6 -0
  283. package/lib/module/tile/index.js.map +1 -0
  284. package/lib/module/tile/types.js +4 -0
  285. package/lib/module/tile/types.js.map +1 -0
  286. package/lib/module/utils/dataAttributes.js +4 -22
  287. package/lib/module/utils/dataAttributes.js.map +1 -1
  288. package/lib/module/utils/dataAttributes.web.js +24 -0
  289. package/lib/module/utils/dataAttributes.web.js.map +1 -1
  290. package/lib/module/utils/domDataAttributes.js +59 -0
  291. package/lib/module/utils/domDataAttributes.js.map +1 -0
  292. package/lib/typescript/avatar/AvatarRoot.d.ts +8 -0
  293. package/lib/typescript/avatar/AvatarRoot.d.ts.map +1 -0
  294. package/lib/typescript/avatar/index.d.ts +3 -10
  295. package/lib/typescript/avatar/index.d.ts.map +1 -1
  296. package/lib/typescript/avatar/types.d.ts +1 -17
  297. package/lib/typescript/avatar/types.d.ts.map +1 -1
  298. package/lib/typescript/button/ButtonRoot.d.ts +9 -0
  299. package/lib/typescript/button/ButtonRoot.d.ts.map +1 -0
  300. package/lib/typescript/button/index.d.ts +2 -10
  301. package/lib/typescript/button/index.d.ts.map +1 -1
  302. package/lib/typescript/button/types.d.ts +1 -34
  303. package/lib/typescript/button/types.d.ts.map +1 -1
  304. package/lib/typescript/checkbox/CheckboxGroup.d.ts +9 -0
  305. package/lib/typescript/checkbox/CheckboxGroup.d.ts.map +1 -0
  306. package/lib/typescript/checkbox/CheckboxRoot.d.ts +6 -0
  307. package/lib/typescript/checkbox/CheckboxRoot.d.ts.map +1 -0
  308. package/lib/typescript/checkbox/CheckboxRoot.web.d.ts +6 -0
  309. package/lib/typescript/checkbox/CheckboxRoot.web.d.ts.map +1 -0
  310. package/lib/typescript/checkbox/index.d.ts +4 -10
  311. package/lib/typescript/checkbox/index.d.ts.map +1 -1
  312. package/lib/typescript/checkbox/types.d.ts +0 -17
  313. package/lib/typescript/checkbox/types.d.ts.map +1 -1
  314. package/lib/typescript/checkbox/useCheckboxRoot.d.ts +3 -1
  315. package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +1 -1
  316. package/lib/typescript/chip/ChipRoot.d.ts +7 -0
  317. package/lib/typescript/chip/ChipRoot.d.ts.map +1 -0
  318. package/lib/typescript/chip/context.d.ts +6 -0
  319. package/lib/typescript/chip/context.d.ts.map +1 -0
  320. package/lib/typescript/chip/index.d.ts +4 -0
  321. package/lib/typescript/chip/index.d.ts.map +1 -0
  322. package/lib/typescript/chip/types.d.ts +16 -0
  323. package/lib/typescript/chip/types.d.ts.map +1 -0
  324. package/lib/typescript/dialog/DialogClose.d.ts +5 -0
  325. package/lib/typescript/dialog/DialogClose.d.ts.map +1 -0
  326. package/lib/typescript/dialog/DialogPopup.d.ts +14 -0
  327. package/lib/typescript/dialog/DialogPopup.d.ts.map +1 -0
  328. package/lib/typescript/dialog/DialogRoot.d.ts +7 -0
  329. package/lib/typescript/dialog/DialogRoot.d.ts.map +1 -0
  330. package/lib/typescript/dialog/DialogTrigger.d.ts +5 -0
  331. package/lib/typescript/dialog/DialogTrigger.d.ts.map +1 -0
  332. package/lib/typescript/dialog/index.d.ts +6 -17
  333. package/lib/typescript/dialog/index.d.ts.map +1 -1
  334. package/lib/typescript/dialog/types.d.ts +14 -25
  335. package/lib/typescript/dialog/types.d.ts.map +1 -1
  336. package/lib/typescript/field/FieldLabel.d.ts +12 -0
  337. package/lib/typescript/field/FieldLabel.d.ts.map +1 -0
  338. package/lib/typescript/field/FieldLabel.web.d.ts +24 -0
  339. package/lib/typescript/field/FieldLabel.web.d.ts.map +1 -0
  340. package/lib/typescript/field/FieldRoot.d.ts +8 -0
  341. package/lib/typescript/field/FieldRoot.d.ts.map +1 -0
  342. package/lib/typescript/field/index.d.ts +3 -12
  343. package/lib/typescript/field/index.d.ts.map +1 -1
  344. package/lib/typescript/field/types.d.ts +0 -20
  345. package/lib/typescript/field/types.d.ts.map +1 -1
  346. package/lib/typescript/form/FormRoot.d.ts +8 -0
  347. package/lib/typescript/form/FormRoot.d.ts.map +1 -0
  348. package/lib/typescript/form/FormRoot.web.d.ts +8 -0
  349. package/lib/typescript/form/FormRoot.web.d.ts.map +1 -0
  350. package/lib/typescript/form/index.d.ts +2 -5
  351. package/lib/typescript/form/index.d.ts.map +1 -1
  352. package/lib/typescript/form/types.d.ts +8 -9
  353. package/lib/typescript/form/types.d.ts.map +1 -1
  354. package/lib/typescript/index.d.ts +8 -2
  355. package/lib/typescript/index.d.ts.map +1 -1
  356. package/lib/typescript/input/InputField.android.d.ts +5 -0
  357. package/lib/typescript/input/InputField.android.d.ts.map +1 -0
  358. package/lib/typescript/input/InputField.d.ts +5 -0
  359. package/lib/typescript/input/InputField.d.ts.map +1 -0
  360. package/lib/typescript/input/InputField.web.d.ts +6 -0
  361. package/lib/typescript/input/InputField.web.d.ts.map +1 -0
  362. package/lib/typescript/input/InputRoot.d.ts +5 -0
  363. package/lib/typescript/input/InputRoot.d.ts.map +1 -0
  364. package/lib/typescript/input/index.d.ts +4 -8
  365. package/lib/typescript/input/index.d.ts.map +1 -1
  366. package/lib/typescript/input/types.d.ts +20 -39
  367. package/lib/typescript/input/types.d.ts.map +1 -1
  368. package/lib/typescript/link/LinkRoot.d.ts +9 -0
  369. package/lib/typescript/link/LinkRoot.d.ts.map +1 -0
  370. package/lib/typescript/link/context.d.ts +10 -0
  371. package/lib/typescript/link/context.d.ts.map +1 -0
  372. package/lib/typescript/link/index.d.ts +3 -1
  373. package/lib/typescript/link/index.d.ts.map +1 -1
  374. package/lib/typescript/link/types.d.ts +1 -0
  375. package/lib/typescript/link/types.d.ts.map +1 -1
  376. package/lib/typescript/list-item/ListItemRoot.d.ts +7 -0
  377. package/lib/typescript/list-item/ListItemRoot.d.ts.map +1 -0
  378. package/lib/typescript/list-item/context.d.ts +3 -3
  379. package/lib/typescript/list-item/context.d.ts.map +1 -1
  380. package/lib/typescript/list-item/index.d.ts +2 -14
  381. package/lib/typescript/list-item/index.d.ts.map +1 -1
  382. package/lib/typescript/list-item/types.d.ts +5 -59
  383. package/lib/typescript/list-item/types.d.ts.map +1 -1
  384. package/lib/typescript/otp-input/OtpInputField.d.ts +19 -0
  385. package/lib/typescript/otp-input/OtpInputField.d.ts.map +1 -0
  386. package/lib/typescript/otp-input/index.d.ts +4 -8
  387. package/lib/typescript/otp-input/index.d.ts.map +1 -1
  388. package/lib/typescript/otp-input/types.d.ts +0 -9
  389. package/lib/typescript/otp-input/types.d.ts.map +1 -1
  390. package/lib/typescript/otp-input/useOtpInput.d.ts +19 -0
  391. package/lib/typescript/otp-input/useOtpInput.d.ts.map +1 -0
  392. package/lib/typescript/overlay/useDismissOverlay.d.ts.map +1 -1
  393. package/lib/typescript/overlay/useEscapeKey.d.ts.map +1 -1
  394. package/lib/typescript/progress-bar/ProgressBarIndicator.d.ts +6 -0
  395. package/lib/typescript/progress-bar/ProgressBarIndicator.d.ts.map +1 -0
  396. package/lib/typescript/progress-bar/ProgressBarRoot.d.ts +6 -0
  397. package/lib/typescript/progress-bar/ProgressBarRoot.d.ts.map +1 -0
  398. package/lib/typescript/progress-bar/context.d.ts.map +1 -0
  399. package/lib/typescript/progress-bar/index.d.ts +6 -0
  400. package/lib/typescript/progress-bar/index.d.ts.map +1 -0
  401. package/lib/typescript/progress-bar/types.d.ts +22 -0
  402. package/lib/typescript/progress-bar/types.d.ts.map +1 -0
  403. package/lib/typescript/radio/RadioGroup.d.ts +9 -0
  404. package/lib/typescript/radio/RadioGroup.d.ts.map +1 -0
  405. package/lib/typescript/radio/RadioRoot.d.ts +6 -0
  406. package/lib/typescript/radio/RadioRoot.d.ts.map +1 -0
  407. package/lib/typescript/radio/RadioRoot.web.d.ts +6 -0
  408. package/lib/typescript/radio/RadioRoot.web.d.ts.map +1 -0
  409. package/lib/typescript/radio/context.d.ts +21 -0
  410. package/lib/typescript/radio/context.d.ts.map +1 -0
  411. package/lib/typescript/radio/index.d.ts +5 -0
  412. package/lib/typescript/radio/index.d.ts.map +1 -0
  413. package/lib/typescript/radio/types.d.ts +43 -0
  414. package/lib/typescript/radio/types.d.ts.map +1 -0
  415. package/lib/typescript/radio/useRadioRoot.d.ts +151 -0
  416. package/lib/typescript/radio/useRadioRoot.d.ts.map +1 -0
  417. package/lib/typescript/select/SelectContent.d.ts +9 -0
  418. package/lib/typescript/select/SelectContent.d.ts.map +1 -0
  419. package/lib/typescript/select/SelectItem.d.ts +8 -0
  420. package/lib/typescript/select/SelectItem.d.ts.map +1 -0
  421. package/lib/typescript/select/SelectRoot.d.ts +8 -0
  422. package/lib/typescript/select/SelectRoot.d.ts.map +1 -0
  423. package/lib/typescript/select/SelectTrigger.d.ts +9 -0
  424. package/lib/typescript/select/SelectTrigger.d.ts.map +1 -0
  425. package/lib/typescript/select/SelectTrigger.web.d.ts +13 -0
  426. package/lib/typescript/select/SelectTrigger.web.d.ts.map +1 -0
  427. package/lib/typescript/select/context.d.ts +1 -11
  428. package/lib/typescript/select/context.d.ts.map +1 -1
  429. package/lib/typescript/select/index.d.ts +6 -12
  430. package/lib/typescript/select/index.d.ts.map +1 -1
  431. package/lib/typescript/select/types.d.ts +1 -9
  432. package/lib/typescript/select/types.d.ts.map +1 -1
  433. package/lib/typescript/select/useContentFocus.d.ts +1 -1
  434. package/lib/typescript/select/useSelectTrigger.d.ts +77 -0
  435. package/lib/typescript/select/useSelectTrigger.d.ts.map +1 -0
  436. package/lib/typescript/select/useSelectTrigger.web.d.ts +16 -0
  437. package/lib/typescript/select/useSelectTrigger.web.d.ts.map +1 -0
  438. package/lib/typescript/slot/index.d.ts +2 -0
  439. package/lib/typescript/slot/index.d.ts.map +1 -0
  440. package/lib/typescript/switch/index.d.ts +2 -6
  441. package/lib/typescript/switch/index.d.ts.map +1 -1
  442. package/lib/typescript/switch/types.d.ts +35 -6
  443. package/lib/typescript/switch/types.d.ts.map +1 -1
  444. package/lib/typescript/switch/useSwitch.d.ts +20 -0
  445. package/lib/typescript/switch/useSwitch.d.ts.map +1 -0
  446. package/lib/typescript/tile/TileGroup.d.ts +5 -0
  447. package/lib/typescript/tile/TileGroup.d.ts.map +1 -0
  448. package/lib/typescript/tile/TileRoot.d.ts +5 -0
  449. package/lib/typescript/tile/TileRoot.d.ts.map +1 -0
  450. package/lib/typescript/tile/context.d.ts +9 -0
  451. package/lib/typescript/tile/context.d.ts.map +1 -0
  452. package/lib/typescript/tile/index.d.ts +5 -0
  453. package/lib/typescript/tile/index.d.ts.map +1 -0
  454. package/lib/typescript/tile/types.d.ts +108 -0
  455. package/lib/typescript/tile/types.d.ts.map +1 -0
  456. package/lib/typescript/utils/dataAttributes.d.ts +4 -10
  457. package/lib/typescript/utils/dataAttributes.d.ts.map +1 -1
  458. package/lib/typescript/utils/dataAttributes.web.d.ts +16 -0
  459. package/lib/typescript/utils/dataAttributes.web.d.ts.map +1 -1
  460. package/lib/typescript/utils/domDataAttributes.d.ts +28 -0
  461. package/lib/typescript/utils/domDataAttributes.d.ts.map +1 -0
  462. package/package.json +6 -2
  463. package/src/CLAUDE.md +84 -0
  464. package/src/avatar/AvatarRoot.tsx +39 -0
  465. package/src/avatar/index.ts +3 -43
  466. package/src/avatar/types.ts +1 -47
  467. package/src/button/ButtonRoot.tsx +115 -0
  468. package/src/button/index.ts +3 -0
  469. package/src/button/types.ts +1 -52
  470. package/src/checkbox/CheckboxGroup.tsx +50 -0
  471. package/src/checkbox/CheckboxRoot.tsx +102 -0
  472. package/src/checkbox/CheckboxRoot.web.tsx +92 -0
  473. package/src/checkbox/index.ts +4 -42
  474. package/src/checkbox/types.ts +1 -32
  475. package/src/chip/ChipRoot.tsx +168 -0
  476. package/src/chip/context.tsx +4 -0
  477. package/src/chip/index.ts +3 -0
  478. package/src/chip/types.ts +20 -0
  479. package/src/dialog/DialogClose.tsx +26 -0
  480. package/src/dialog/DialogPopup.tsx +162 -0
  481. package/src/dialog/DialogRoot.tsx +72 -0
  482. package/src/dialog/DialogTrigger.tsx +26 -0
  483. package/src/dialog/index.tsx +6 -87
  484. package/src/dialog/types.ts +14 -57
  485. package/src/field/FieldLabel.tsx +43 -0
  486. package/src/field/FieldLabel.web.tsx +71 -0
  487. package/src/field/FieldRoot.tsx +39 -0
  488. package/src/field/index.tsx +3 -68
  489. package/src/field/types.tsx +0 -34
  490. package/src/form/FormRoot.tsx +18 -0
  491. package/src/form/FormRoot.web.tsx +17 -0
  492. package/src/form/index.tsx +2 -12
  493. package/src/form/types.tsx +9 -11
  494. package/src/index.ts +12 -2
  495. package/src/input/InputField.android.tsx +107 -0
  496. package/src/input/InputField.tsx +100 -0
  497. package/src/input/InputField.web.tsx +141 -0
  498. package/src/input/InputRoot.tsx +104 -0
  499. package/src/input/index.tsx +4 -38
  500. package/src/input/types.ts +21 -53
  501. package/src/link/LinkRoot.tsx +108 -0
  502. package/src/link/context.tsx +10 -0
  503. package/src/link/index.tsx +3 -1
  504. package/src/link/types.ts +1 -0
  505. package/src/list-item/ListItemRoot.tsx +183 -0
  506. package/src/list-item/context.tsx +2 -2
  507. package/src/list-item/index.ts +2 -80
  508. package/src/list-item/types.ts +5 -89
  509. package/src/otp-input/OtpInputField.tsx +122 -0
  510. package/src/otp-input/index.ts +16 -0
  511. package/src/otp-input/types.ts +0 -23
  512. package/src/otp-input/useOtpInput.ts +156 -0
  513. package/src/overlay/useDismissOverlay.ts +0 -2
  514. package/src/overlay/useEscapeKey.ts +0 -2
  515. package/src/progress-bar/ProgressBarIndicator.tsx +34 -0
  516. package/src/progress-bar/ProgressBarRoot.tsx +117 -0
  517. package/src/progress-bar/index.ts +5 -0
  518. package/src/progress-bar/types.ts +24 -0
  519. package/src/radio/RadioGroup.tsx +85 -0
  520. package/src/radio/RadioRoot.tsx +98 -0
  521. package/src/radio/RadioRoot.web.tsx +90 -0
  522. package/src/radio/context.tsx +21 -0
  523. package/src/radio/index.ts +5 -0
  524. package/src/radio/types.ts +45 -0
  525. package/src/radio/useRadioRoot.ts +69 -0
  526. package/src/select/SelectContent.tsx +120 -0
  527. package/src/select/SelectItem.tsx +139 -0
  528. package/src/select/SelectRoot.tsx +154 -0
  529. package/src/select/SelectTrigger.tsx +82 -0
  530. package/src/select/SelectTrigger.web.tsx +238 -0
  531. package/src/select/context.tsx +1 -10
  532. package/src/select/index.ts +17 -0
  533. package/src/select/types.ts +1 -32
  534. package/src/select/useContentFocus.ts +1 -1
  535. package/src/select/useSelectTrigger.ts +345 -0
  536. package/src/select/useSelectTrigger.web.ts +267 -0
  537. package/src/slot/index.ts +1 -0
  538. package/src/switch/index.ts +7 -16
  539. package/src/switch/types.ts +35 -10
  540. package/src/switch/useSwitch.ts +75 -0
  541. package/src/tile/TileGroup.tsx +137 -0
  542. package/src/tile/TileRoot.tsx +137 -0
  543. package/src/tile/context.tsx +23 -0
  544. package/src/tile/index.ts +18 -0
  545. package/src/tile/types.ts +121 -0
  546. package/src/utils/dataAttributes.ts +7 -25
  547. package/src/utils/dataAttributes.web.ts +24 -0
  548. package/src/utils/domDataAttributes.ts +63 -0
  549. package/lib/commonjs/avatar/createAvatarBadge.js +0 -20
  550. package/lib/commonjs/avatar/createAvatarBadge.js.map +0 -1
  551. package/lib/commonjs/avatar/createAvatarIcon.js +0 -30
  552. package/lib/commonjs/avatar/createAvatarIcon.js.map +0 -1
  553. package/lib/commonjs/avatar/createAvatarImage.js +0 -51
  554. package/lib/commonjs/avatar/createAvatarImage.js.map +0 -1
  555. package/lib/commonjs/avatar/createAvatarRoot.js +0 -34
  556. package/lib/commonjs/avatar/createAvatarRoot.js.map +0 -1
  557. package/lib/commonjs/avatar/createAvatarText.js +0 -42
  558. package/lib/commonjs/avatar/createAvatarText.js.map +0 -1
  559. package/lib/commonjs/button/createButtonGroup.js +0 -80
  560. package/lib/commonjs/button/createButtonGroup.js.map +0 -1
  561. package/lib/commonjs/button/createButtonIcon.js +0 -18
  562. package/lib/commonjs/button/createButtonIcon.js.map +0 -1
  563. package/lib/commonjs/button/createButtonRoot.js +0 -81
  564. package/lib/commonjs/button/createButtonRoot.js.map +0 -1
  565. package/lib/commonjs/button/createButtonSpinner.js +0 -34
  566. package/lib/commonjs/button/createButtonSpinner.js.map +0 -1
  567. package/lib/commonjs/button/createButtonText.js +0 -38
  568. package/lib/commonjs/button/createButtonText.js.map +0 -1
  569. package/lib/commonjs/checkbox/createCheckboxGroup.js +0 -44
  570. package/lib/commonjs/checkbox/createCheckboxGroup.js.map +0 -1
  571. package/lib/commonjs/checkbox/createCheckboxIcon.js +0 -29
  572. package/lib/commonjs/checkbox/createCheckboxIcon.js.map +0 -1
  573. package/lib/commonjs/checkbox/createCheckboxIndicator.js +0 -47
  574. package/lib/commonjs/checkbox/createCheckboxIndicator.js.map +0 -1
  575. package/lib/commonjs/checkbox/createCheckboxLabel.js +0 -46
  576. package/lib/commonjs/checkbox/createCheckboxLabel.js.map +0 -1
  577. package/lib/commonjs/checkbox/createCheckboxRoot.js +0 -99
  578. package/lib/commonjs/checkbox/createCheckboxRoot.js.map +0 -1
  579. package/lib/commonjs/checkbox/createCheckboxRoot.web.js +0 -90
  580. package/lib/commonjs/checkbox/createCheckboxRoot.web.js.map +0 -1
  581. package/lib/commonjs/dialog/createDialogBody.js +0 -21
  582. package/lib/commonjs/dialog/createDialogBody.js.map +0 -1
  583. package/lib/commonjs/dialog/createDialogClose.js +0 -37
  584. package/lib/commonjs/dialog/createDialogClose.js.map +0 -1
  585. package/lib/commonjs/dialog/createDialogContent.js +0 -141
  586. package/lib/commonjs/dialog/createDialogContent.js.map +0 -1
  587. package/lib/commonjs/dialog/createDialogDescription.js +0 -30
  588. package/lib/commonjs/dialog/createDialogDescription.js.map +0 -1
  589. package/lib/commonjs/dialog/createDialogFooter.js +0 -21
  590. package/lib/commonjs/dialog/createDialogFooter.js.map +0 -1
  591. package/lib/commonjs/dialog/createDialogHeader.js +0 -21
  592. package/lib/commonjs/dialog/createDialogHeader.js.map +0 -1
  593. package/lib/commonjs/dialog/createDialogRoot.js +0 -54
  594. package/lib/commonjs/dialog/createDialogRoot.js.map +0 -1
  595. package/lib/commonjs/dialog/createDialogTitle.js +0 -21
  596. package/lib/commonjs/dialog/createDialogTitle.js.map +0 -1
  597. package/lib/commonjs/dialog/createDialogTrigger.js +0 -37
  598. package/lib/commonjs/dialog/createDialogTrigger.js.map +0 -1
  599. package/lib/commonjs/field/createFieldError.js +0 -41
  600. package/lib/commonjs/field/createFieldError.js.map +0 -1
  601. package/lib/commonjs/field/createFieldErrorIcon.js +0 -18
  602. package/lib/commonjs/field/createFieldErrorIcon.js.map +0 -1
  603. package/lib/commonjs/field/createFieldErrorText.js +0 -18
  604. package/lib/commonjs/field/createFieldErrorText.js.map +0 -1
  605. package/lib/commonjs/field/createFieldHelper.js +0 -41
  606. package/lib/commonjs/field/createFieldHelper.js.map +0 -1
  607. package/lib/commonjs/field/createFieldHelperText.js +0 -18
  608. package/lib/commonjs/field/createFieldHelperText.js.map +0 -1
  609. package/lib/commonjs/field/createFieldLabel.js +0 -36
  610. package/lib/commonjs/field/createFieldLabel.js.map +0 -1
  611. package/lib/commonjs/field/createFieldRoot.js +0 -35
  612. package/lib/commonjs/field/createFieldRoot.js.map +0 -1
  613. package/lib/commonjs/form/createFormRoot.js +0 -21
  614. package/lib/commonjs/form/createFormRoot.js.map +0 -1
  615. package/lib/commonjs/input/createInputField.js +0 -95
  616. package/lib/commonjs/input/createInputField.js.map +0 -1
  617. package/lib/commonjs/input/createInputRoot.js +0 -82
  618. package/lib/commonjs/input/createInputRoot.js.map +0 -1
  619. package/lib/commonjs/input/createInputSlot.js +0 -44
  620. package/lib/commonjs/input/createInputSlot.js.map +0 -1
  621. package/lib/commonjs/link/createLink.js +0 -74
  622. package/lib/commonjs/link/createLink.js.map +0 -1
  623. package/lib/commonjs/list-item/createListItemContent.js +0 -30
  624. package/lib/commonjs/list-item/createListItemContent.js.map +0 -1
  625. package/lib/commonjs/list-item/createListItemDescription.js +0 -25
  626. package/lib/commonjs/list-item/createListItemDescription.js.map +0 -1
  627. package/lib/commonjs/list-item/createListItemLeadingSlot.js +0 -34
  628. package/lib/commonjs/list-item/createListItemLeadingSlot.js.map +0 -1
  629. package/lib/commonjs/list-item/createListItemMeta.js +0 -25
  630. package/lib/commonjs/list-item/createListItemMeta.js.map +0 -1
  631. package/lib/commonjs/list-item/createListItemRoot.js +0 -142
  632. package/lib/commonjs/list-item/createListItemRoot.js.map +0 -1
  633. package/lib/commonjs/list-item/createListItemSectionHeader.js +0 -54
  634. package/lib/commonjs/list-item/createListItemSectionHeader.js.map +0 -1
  635. package/lib/commonjs/list-item/createListItemTitle.js +0 -25
  636. package/lib/commonjs/list-item/createListItemTitle.js.map +0 -1
  637. package/lib/commonjs/list-item/createListItemTrailingSlot.js +0 -28
  638. package/lib/commonjs/list-item/createListItemTrailingSlot.js.map +0 -1
  639. package/lib/commonjs/otp-input/createOtpInputCell.js +0 -29
  640. package/lib/commonjs/otp-input/createOtpInputCell.js.map +0 -1
  641. package/lib/commonjs/otp-input/createOtpInputField.js +0 -104
  642. package/lib/commonjs/otp-input/createOtpInputField.js.map +0 -1
  643. package/lib/commonjs/otp-input/createOtpInputRoot.js +0 -136
  644. package/lib/commonjs/otp-input/createOtpInputRoot.js.map +0 -1
  645. package/lib/commonjs/progress/context.js.map +0 -1
  646. package/lib/commonjs/progress/createProgressIndicator.js +0 -42
  647. package/lib/commonjs/progress/createProgressIndicator.js.map +0 -1
  648. package/lib/commonjs/progress/createProgressRoot.js +0 -96
  649. package/lib/commonjs/progress/createProgressRoot.js.map +0 -1
  650. package/lib/commonjs/progress/index.js +0 -25
  651. package/lib/commonjs/progress/index.js.map +0 -1
  652. package/lib/commonjs/progress/types.js.map +0 -1
  653. package/lib/commonjs/select/createSelectContent.js +0 -102
  654. package/lib/commonjs/select/createSelectContent.js.map +0 -1
  655. package/lib/commonjs/select/createSelectIcon.js +0 -41
  656. package/lib/commonjs/select/createSelectIcon.js.map +0 -1
  657. package/lib/commonjs/select/createSelectItem.js +0 -101
  658. package/lib/commonjs/select/createSelectItem.js.map +0 -1
  659. package/lib/commonjs/select/createSelectItemLabel.js +0 -41
  660. package/lib/commonjs/select/createSelectItemLabel.js.map +0 -1
  661. package/lib/commonjs/select/createSelectRoot.js +0 -102
  662. package/lib/commonjs/select/createSelectRoot.js.map +0 -1
  663. package/lib/commonjs/select/createSelectTrigger.js +0 -179
  664. package/lib/commonjs/select/createSelectTrigger.js.map +0 -1
  665. package/lib/commonjs/select/createSelectValue.js +0 -53
  666. package/lib/commonjs/select/createSelectValue.js.map +0 -1
  667. package/lib/commonjs/switch/createSwitchRoot.js +0 -73
  668. package/lib/commonjs/switch/createSwitchRoot.js.map +0 -1
  669. package/lib/module/avatar/createAvatarBadge.js +0 -15
  670. package/lib/module/avatar/createAvatarBadge.js.map +0 -1
  671. package/lib/module/avatar/createAvatarIcon.js +0 -25
  672. package/lib/module/avatar/createAvatarIcon.js.map +0 -1
  673. package/lib/module/avatar/createAvatarImage.js +0 -46
  674. package/lib/module/avatar/createAvatarImage.js.map +0 -1
  675. package/lib/module/avatar/createAvatarRoot.js +0 -29
  676. package/lib/module/avatar/createAvatarRoot.js.map +0 -1
  677. package/lib/module/avatar/createAvatarText.js +0 -37
  678. package/lib/module/avatar/createAvatarText.js.map +0 -1
  679. package/lib/module/button/createButtonGroup.js +0 -74
  680. package/lib/module/button/createButtonGroup.js.map +0 -1
  681. package/lib/module/button/createButtonIcon.js +0 -13
  682. package/lib/module/button/createButtonIcon.js.map +0 -1
  683. package/lib/module/button/createButtonRoot.js +0 -76
  684. package/lib/module/button/createButtonRoot.js.map +0 -1
  685. package/lib/module/button/createButtonSpinner.js +0 -29
  686. package/lib/module/button/createButtonSpinner.js.map +0 -1
  687. package/lib/module/button/createButtonText.js +0 -33
  688. package/lib/module/button/createButtonText.js.map +0 -1
  689. package/lib/module/checkbox/createCheckboxGroup.js +0 -39
  690. package/lib/module/checkbox/createCheckboxGroup.js.map +0 -1
  691. package/lib/module/checkbox/createCheckboxIcon.js +0 -24
  692. package/lib/module/checkbox/createCheckboxIcon.js.map +0 -1
  693. package/lib/module/checkbox/createCheckboxIndicator.js +0 -42
  694. package/lib/module/checkbox/createCheckboxIndicator.js.map +0 -1
  695. package/lib/module/checkbox/createCheckboxLabel.js +0 -41
  696. package/lib/module/checkbox/createCheckboxLabel.js.map +0 -1
  697. package/lib/module/checkbox/createCheckboxRoot.js +0 -94
  698. package/lib/module/checkbox/createCheckboxRoot.js.map +0 -1
  699. package/lib/module/checkbox/createCheckboxRoot.web.js +0 -85
  700. package/lib/module/checkbox/createCheckboxRoot.web.js.map +0 -1
  701. package/lib/module/dialog/createDialogBody.js +0 -15
  702. package/lib/module/dialog/createDialogBody.js.map +0 -1
  703. package/lib/module/dialog/createDialogClose.js +0 -31
  704. package/lib/module/dialog/createDialogClose.js.map +0 -1
  705. package/lib/module/dialog/createDialogContent.js +0 -136
  706. package/lib/module/dialog/createDialogContent.js.map +0 -1
  707. package/lib/module/dialog/createDialogDescription.js +0 -24
  708. package/lib/module/dialog/createDialogDescription.js.map +0 -1
  709. package/lib/module/dialog/createDialogFooter.js +0 -15
  710. package/lib/module/dialog/createDialogFooter.js.map +0 -1
  711. package/lib/module/dialog/createDialogHeader.js +0 -15
  712. package/lib/module/dialog/createDialogHeader.js.map +0 -1
  713. package/lib/module/dialog/createDialogRoot.js +0 -49
  714. package/lib/module/dialog/createDialogRoot.js.map +0 -1
  715. package/lib/module/dialog/createDialogTitle.js +0 -15
  716. package/lib/module/dialog/createDialogTitle.js.map +0 -1
  717. package/lib/module/dialog/createDialogTrigger.js +0 -31
  718. package/lib/module/dialog/createDialogTrigger.js.map +0 -1
  719. package/lib/module/field/createFieldError.js +0 -35
  720. package/lib/module/field/createFieldError.js.map +0 -1
  721. package/lib/module/field/createFieldErrorIcon.js +0 -13
  722. package/lib/module/field/createFieldErrorIcon.js.map +0 -1
  723. package/lib/module/field/createFieldErrorText.js +0 -13
  724. package/lib/module/field/createFieldErrorText.js.map +0 -1
  725. package/lib/module/field/createFieldHelper.js +0 -35
  726. package/lib/module/field/createFieldHelper.js.map +0 -1
  727. package/lib/module/field/createFieldHelperText.js +0 -13
  728. package/lib/module/field/createFieldHelperText.js.map +0 -1
  729. package/lib/module/field/createFieldLabel.js +0 -31
  730. package/lib/module/field/createFieldLabel.js.map +0 -1
  731. package/lib/module/field/createFieldRoot.js +0 -29
  732. package/lib/module/field/createFieldRoot.js.map +0 -1
  733. package/lib/module/form/createFormRoot.js +0 -15
  734. package/lib/module/form/createFormRoot.js.map +0 -1
  735. package/lib/module/input/createInputField.js +0 -90
  736. package/lib/module/input/createInputField.js.map +0 -1
  737. package/lib/module/input/createInputRoot.js +0 -76
  738. package/lib/module/input/createInputRoot.js.map +0 -1
  739. package/lib/module/input/createInputSlot.js +0 -39
  740. package/lib/module/input/createInputSlot.js.map +0 -1
  741. package/lib/module/link/createLink.js +0 -68
  742. package/lib/module/link/createLink.js.map +0 -1
  743. package/lib/module/list-item/createListItemContent.js +0 -24
  744. package/lib/module/list-item/createListItemContent.js.map +0 -1
  745. package/lib/module/list-item/createListItemDescription.js +0 -19
  746. package/lib/module/list-item/createListItemDescription.js.map +0 -1
  747. package/lib/module/list-item/createListItemLeadingSlot.js +0 -28
  748. package/lib/module/list-item/createListItemLeadingSlot.js.map +0 -1
  749. package/lib/module/list-item/createListItemMeta.js +0 -19
  750. package/lib/module/list-item/createListItemMeta.js.map +0 -1
  751. package/lib/module/list-item/createListItemRoot.js +0 -136
  752. package/lib/module/list-item/createListItemRoot.js.map +0 -1
  753. package/lib/module/list-item/createListItemSectionHeader.js +0 -48
  754. package/lib/module/list-item/createListItemSectionHeader.js.map +0 -1
  755. package/lib/module/list-item/createListItemTitle.js +0 -19
  756. package/lib/module/list-item/createListItemTitle.js.map +0 -1
  757. package/lib/module/list-item/createListItemTrailingSlot.js +0 -22
  758. package/lib/module/list-item/createListItemTrailingSlot.js.map +0 -1
  759. package/lib/module/otp-input/createOtpInputCell.js +0 -24
  760. package/lib/module/otp-input/createOtpInputCell.js.map +0 -1
  761. package/lib/module/otp-input/createOtpInputField.js +0 -99
  762. package/lib/module/otp-input/createOtpInputField.js.map +0 -1
  763. package/lib/module/otp-input/createOtpInputRoot.js +0 -131
  764. package/lib/module/otp-input/createOtpInputRoot.js.map +0 -1
  765. package/lib/module/progress/context.js.map +0 -1
  766. package/lib/module/progress/createProgressIndicator.js +0 -37
  767. package/lib/module/progress/createProgressIndicator.js.map +0 -1
  768. package/lib/module/progress/createProgressRoot.js +0 -91
  769. package/lib/module/progress/createProgressRoot.js.map +0 -1
  770. package/lib/module/progress/index.js +0 -15
  771. package/lib/module/progress/index.js.map +0 -1
  772. package/lib/module/progress/types.js.map +0 -1
  773. package/lib/module/select/createSelectContent.js +0 -97
  774. package/lib/module/select/createSelectContent.js.map +0 -1
  775. package/lib/module/select/createSelectIcon.js +0 -36
  776. package/lib/module/select/createSelectIcon.js.map +0 -1
  777. package/lib/module/select/createSelectItem.js +0 -96
  778. package/lib/module/select/createSelectItem.js.map +0 -1
  779. package/lib/module/select/createSelectItemLabel.js +0 -36
  780. package/lib/module/select/createSelectItemLabel.js.map +0 -1
  781. package/lib/module/select/createSelectRoot.js +0 -97
  782. package/lib/module/select/createSelectRoot.js.map +0 -1
  783. package/lib/module/select/createSelectTrigger.js +0 -174
  784. package/lib/module/select/createSelectTrigger.js.map +0 -1
  785. package/lib/module/select/createSelectValue.js +0 -48
  786. package/lib/module/select/createSelectValue.js.map +0 -1
  787. package/lib/module/switch/createSwitchRoot.js +0 -67
  788. package/lib/module/switch/createSwitchRoot.js.map +0 -1
  789. package/lib/typescript/avatar/createAvatarBadge.d.ts +0 -4
  790. package/lib/typescript/avatar/createAvatarBadge.d.ts.map +0 -1
  791. package/lib/typescript/avatar/createAvatarIcon.d.ts +0 -4
  792. package/lib/typescript/avatar/createAvatarIcon.d.ts.map +0 -1
  793. package/lib/typescript/avatar/createAvatarImage.d.ts +0 -4
  794. package/lib/typescript/avatar/createAvatarImage.d.ts.map +0 -1
  795. package/lib/typescript/avatar/createAvatarRoot.d.ts +0 -4
  796. package/lib/typescript/avatar/createAvatarRoot.d.ts.map +0 -1
  797. package/lib/typescript/avatar/createAvatarText.d.ts +0 -4
  798. package/lib/typescript/avatar/createAvatarText.d.ts.map +0 -1
  799. package/lib/typescript/button/createButtonGroup.d.ts +0 -4
  800. package/lib/typescript/button/createButtonGroup.d.ts.map +0 -1
  801. package/lib/typescript/button/createButtonIcon.d.ts +0 -2
  802. package/lib/typescript/button/createButtonIcon.d.ts.map +0 -1
  803. package/lib/typescript/button/createButtonRoot.d.ts +0 -6
  804. package/lib/typescript/button/createButtonRoot.d.ts.map +0 -1
  805. package/lib/typescript/button/createButtonSpinner.d.ts +0 -4
  806. package/lib/typescript/button/createButtonSpinner.d.ts.map +0 -1
  807. package/lib/typescript/button/createButtonText.d.ts +0 -4
  808. package/lib/typescript/button/createButtonText.d.ts.map +0 -1
  809. package/lib/typescript/checkbox/createCheckboxGroup.d.ts +0 -3
  810. package/lib/typescript/checkbox/createCheckboxGroup.d.ts.map +0 -1
  811. package/lib/typescript/checkbox/createCheckboxIcon.d.ts +0 -3
  812. package/lib/typescript/checkbox/createCheckboxIcon.d.ts.map +0 -1
  813. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts +0 -5
  814. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts.map +0 -1
  815. package/lib/typescript/checkbox/createCheckboxLabel.d.ts +0 -5
  816. package/lib/typescript/checkbox/createCheckboxLabel.d.ts.map +0 -1
  817. package/lib/typescript/checkbox/createCheckboxRoot.d.ts +0 -2
  818. package/lib/typescript/checkbox/createCheckboxRoot.d.ts.map +0 -1
  819. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts +0 -2
  820. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts.map +0 -1
  821. package/lib/typescript/dialog/createDialogBody.d.ts +0 -4
  822. package/lib/typescript/dialog/createDialogBody.d.ts.map +0 -1
  823. package/lib/typescript/dialog/createDialogClose.d.ts +0 -4
  824. package/lib/typescript/dialog/createDialogClose.d.ts.map +0 -1
  825. package/lib/typescript/dialog/createDialogContent.d.ts +0 -4
  826. package/lib/typescript/dialog/createDialogContent.d.ts.map +0 -1
  827. package/lib/typescript/dialog/createDialogDescription.d.ts +0 -4
  828. package/lib/typescript/dialog/createDialogDescription.d.ts.map +0 -1
  829. package/lib/typescript/dialog/createDialogFooter.d.ts +0 -4
  830. package/lib/typescript/dialog/createDialogFooter.d.ts.map +0 -1
  831. package/lib/typescript/dialog/createDialogHeader.d.ts +0 -4
  832. package/lib/typescript/dialog/createDialogHeader.d.ts.map +0 -1
  833. package/lib/typescript/dialog/createDialogRoot.d.ts +0 -4
  834. package/lib/typescript/dialog/createDialogRoot.d.ts.map +0 -1
  835. package/lib/typescript/dialog/createDialogTitle.d.ts +0 -4
  836. package/lib/typescript/dialog/createDialogTitle.d.ts.map +0 -1
  837. package/lib/typescript/dialog/createDialogTrigger.d.ts +0 -4
  838. package/lib/typescript/dialog/createDialogTrigger.d.ts.map +0 -1
  839. package/lib/typescript/field/createFieldError.d.ts +0 -5
  840. package/lib/typescript/field/createFieldError.d.ts.map +0 -1
  841. package/lib/typescript/field/createFieldErrorIcon.d.ts +0 -5
  842. package/lib/typescript/field/createFieldErrorIcon.d.ts.map +0 -1
  843. package/lib/typescript/field/createFieldErrorText.d.ts +0 -5
  844. package/lib/typescript/field/createFieldErrorText.d.ts.map +0 -1
  845. package/lib/typescript/field/createFieldHelper.d.ts +0 -5
  846. package/lib/typescript/field/createFieldHelper.d.ts.map +0 -1
  847. package/lib/typescript/field/createFieldHelperText.d.ts +0 -5
  848. package/lib/typescript/field/createFieldHelperText.d.ts.map +0 -1
  849. package/lib/typescript/field/createFieldLabel.d.ts +0 -6
  850. package/lib/typescript/field/createFieldLabel.d.ts.map +0 -1
  851. package/lib/typescript/field/createFieldRoot.d.ts +0 -6
  852. package/lib/typescript/field/createFieldRoot.d.ts.map +0 -1
  853. package/lib/typescript/form/createFormRoot.d.ts +0 -4
  854. package/lib/typescript/form/createFormRoot.d.ts.map +0 -1
  855. package/lib/typescript/input/createInputField.d.ts +0 -4
  856. package/lib/typescript/input/createInputField.d.ts.map +0 -1
  857. package/lib/typescript/input/createInputRoot.d.ts +0 -4
  858. package/lib/typescript/input/createInputRoot.d.ts.map +0 -1
  859. package/lib/typescript/input/createInputSlot.d.ts +0 -4
  860. package/lib/typescript/input/createInputSlot.d.ts.map +0 -1
  861. package/lib/typescript/link/createLink.d.ts +0 -6
  862. package/lib/typescript/link/createLink.d.ts.map +0 -1
  863. package/lib/typescript/list-item/createListItemContent.d.ts +0 -3
  864. package/lib/typescript/list-item/createListItemContent.d.ts.map +0 -1
  865. package/lib/typescript/list-item/createListItemDescription.d.ts +0 -3
  866. package/lib/typescript/list-item/createListItemDescription.d.ts.map +0 -1
  867. package/lib/typescript/list-item/createListItemLeadingSlot.d.ts +0 -4
  868. package/lib/typescript/list-item/createListItemLeadingSlot.d.ts.map +0 -1
  869. package/lib/typescript/list-item/createListItemMeta.d.ts +0 -3
  870. package/lib/typescript/list-item/createListItemMeta.d.ts.map +0 -1
  871. package/lib/typescript/list-item/createListItemRoot.d.ts +0 -4
  872. package/lib/typescript/list-item/createListItemRoot.d.ts.map +0 -1
  873. package/lib/typescript/list-item/createListItemSectionHeader.d.ts +0 -4
  874. package/lib/typescript/list-item/createListItemSectionHeader.d.ts.map +0 -1
  875. package/lib/typescript/list-item/createListItemTitle.d.ts +0 -3
  876. package/lib/typescript/list-item/createListItemTitle.d.ts.map +0 -1
  877. package/lib/typescript/list-item/createListItemTrailingSlot.d.ts +0 -3
  878. package/lib/typescript/list-item/createListItemTrailingSlot.d.ts.map +0 -1
  879. package/lib/typescript/otp-input/createOtpInputCell.d.ts +0 -4
  880. package/lib/typescript/otp-input/createOtpInputCell.d.ts.map +0 -1
  881. package/lib/typescript/otp-input/createOtpInputField.d.ts +0 -4
  882. package/lib/typescript/otp-input/createOtpInputField.d.ts.map +0 -1
  883. package/lib/typescript/otp-input/createOtpInputRoot.d.ts +0 -4
  884. package/lib/typescript/otp-input/createOtpInputRoot.d.ts.map +0 -1
  885. package/lib/typescript/progress/context.d.ts.map +0 -1
  886. package/lib/typescript/progress/createProgressIndicator.d.ts +0 -3
  887. package/lib/typescript/progress/createProgressIndicator.d.ts.map +0 -1
  888. package/lib/typescript/progress/createProgressRoot.d.ts +0 -4
  889. package/lib/typescript/progress/createProgressRoot.d.ts.map +0 -1
  890. package/lib/typescript/progress/index.d.ts +0 -10
  891. package/lib/typescript/progress/index.d.ts.map +0 -1
  892. package/lib/typescript/progress/types.d.ts +0 -25
  893. package/lib/typescript/progress/types.d.ts.map +0 -1
  894. package/lib/typescript/select/createSelectContent.d.ts +0 -4
  895. package/lib/typescript/select/createSelectContent.d.ts.map +0 -1
  896. package/lib/typescript/select/createSelectIcon.d.ts +0 -2
  897. package/lib/typescript/select/createSelectIcon.d.ts.map +0 -1
  898. package/lib/typescript/select/createSelectItem.d.ts +0 -6
  899. package/lib/typescript/select/createSelectItem.d.ts.map +0 -1
  900. package/lib/typescript/select/createSelectItemLabel.d.ts +0 -4
  901. package/lib/typescript/select/createSelectItemLabel.d.ts.map +0 -1
  902. package/lib/typescript/select/createSelectRoot.d.ts +0 -4
  903. package/lib/typescript/select/createSelectRoot.d.ts.map +0 -1
  904. package/lib/typescript/select/createSelectTrigger.d.ts +0 -7
  905. package/lib/typescript/select/createSelectTrigger.d.ts.map +0 -1
  906. package/lib/typescript/select/createSelectValue.d.ts +0 -4
  907. package/lib/typescript/select/createSelectValue.d.ts.map +0 -1
  908. package/lib/typescript/switch/createSwitchRoot.d.ts +0 -3
  909. package/lib/typescript/switch/createSwitchRoot.d.ts.map +0 -1
  910. package/src/avatar/createAvatarBadge.tsx +0 -12
  911. package/src/avatar/createAvatarIcon.tsx +0 -16
  912. package/src/avatar/createAvatarImage.tsx +0 -40
  913. package/src/avatar/createAvatarRoot.tsx +0 -23
  914. package/src/avatar/createAvatarText.tsx +0 -30
  915. package/src/button/createButtonGroup.tsx +0 -88
  916. package/src/button/createButtonIcon.tsx +0 -8
  917. package/src/button/createButtonRoot.tsx +0 -102
  918. package/src/button/createButtonSpinner.tsx +0 -20
  919. package/src/button/createButtonText.tsx +0 -22
  920. package/src/button/index.tsx +0 -53
  921. package/src/checkbox/createCheckboxGroup.tsx +0 -32
  922. package/src/checkbox/createCheckboxIcon.tsx +0 -18
  923. package/src/checkbox/createCheckboxIndicator.tsx +0 -43
  924. package/src/checkbox/createCheckboxLabel.tsx +0 -42
  925. package/src/checkbox/createCheckboxRoot.tsx +0 -100
  926. package/src/checkbox/createCheckboxRoot.web.tsx +0 -79
  927. package/src/dialog/createDialogBody.tsx +0 -11
  928. package/src/dialog/createDialogClose.tsx +0 -27
  929. package/src/dialog/createDialogContent.tsx +0 -122
  930. package/src/dialog/createDialogDescription.tsx +0 -20
  931. package/src/dialog/createDialogFooter.tsx +0 -11
  932. package/src/dialog/createDialogHeader.tsx +0 -11
  933. package/src/dialog/createDialogRoot.tsx +0 -66
  934. package/src/dialog/createDialogTitle.tsx +0 -11
  935. package/src/dialog/createDialogTrigger.tsx +0 -27
  936. package/src/field/createFieldError.tsx +0 -32
  937. package/src/field/createFieldErrorIcon.tsx +0 -9
  938. package/src/field/createFieldErrorText.tsx +0 -9
  939. package/src/field/createFieldHelper.tsx +0 -28
  940. package/src/field/createFieldHelperText.tsx +0 -9
  941. package/src/field/createFieldLabel.tsx +0 -30
  942. package/src/field/createFieldRoot.tsx +0 -27
  943. package/src/form/createFormRoot.tsx +0 -13
  944. package/src/input/createInputField.tsx +0 -114
  945. package/src/input/createInputRoot.tsx +0 -92
  946. package/src/input/createInputSlot.tsx +0 -39
  947. package/src/link/createLink.tsx +0 -71
  948. package/src/list-item/createListItemContent.tsx +0 -23
  949. package/src/list-item/createListItemDescription.tsx +0 -19
  950. package/src/list-item/createListItemLeadingSlot.tsx +0 -30
  951. package/src/list-item/createListItemMeta.tsx +0 -17
  952. package/src/list-item/createListItemRoot.tsx +0 -163
  953. package/src/list-item/createListItemSectionHeader.tsx +0 -53
  954. package/src/list-item/createListItemTitle.tsx +0 -17
  955. package/src/list-item/createListItemTrailingSlot.tsx +0 -21
  956. package/src/otp-input/createOtpInputCell.tsx +0 -22
  957. package/src/otp-input/createOtpInputField.tsx +0 -98
  958. package/src/otp-input/createOtpInputRoot.tsx +0 -179
  959. package/src/otp-input/index.tsx +0 -34
  960. package/src/progress/createProgressIndicator.tsx +0 -35
  961. package/src/progress/createProgressRoot.tsx +0 -109
  962. package/src/progress/index.ts +0 -28
  963. package/src/progress/types.ts +0 -37
  964. package/src/select/createSelectContent.tsx +0 -115
  965. package/src/select/createSelectIcon.tsx +0 -27
  966. package/src/select/createSelectItem.tsx +0 -121
  967. package/src/select/createSelectItemLabel.tsx +0 -30
  968. package/src/select/createSelectRoot.tsx +0 -134
  969. package/src/select/createSelectTrigger.tsx +0 -218
  970. package/src/select/createSelectValue.tsx +0 -38
  971. package/src/select/index.tsx +0 -73
  972. package/src/switch/createSwitchRoot.tsx +0 -72
  973. /package/lib/commonjs/{progress → chip}/types.js +0 -0
  974. /package/lib/commonjs/{progress → progress-bar}/context.js +0 -0
  975. /package/lib/module/{progress → chip}/types.js +0 -0
  976. /package/lib/module/{progress → progress-bar}/context.js +0 -0
  977. /package/lib/typescript/{progress → progress-bar}/context.d.ts +0 -0
  978. /package/src/{progress → progress-bar}/context.tsx +0 -0
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
4
+ import { composeEventHandlers, mergeRefs, useFormControlContext, useReportFormControlLabelFocus } from '@cdx-ui/utils';
5
+ import { useFocus, useFocusRing } from '@react-native-aria/focus';
6
+ import { useHover, usePress } from '@react-native-aria/interactions';
7
+ import { useSelectContext } from './context';
8
+ /**
9
+ * Shared logic for `Select.Trigger` across native and web. Each platform file is
10
+ * a thin host-element wrapper that spreads this hook's output. The hook composes
11
+ * interaction-state hooks, ARIA props, keyboard intent, press-to-toggle, the
12
+ * merged ref, and (where appropriate) the label-focus bridge.
13
+ *
14
+ * Native variant — Pressable is not natively labelable, so the label-focus
15
+ * bridge is always registered on `field.inputRef`.
16
+ */
17
+ export function useSelectTrigger(forwardedRef, options) {
18
+ /**
19
+ * `asChild` is part of the symmetric options shape for parity with the web variant,
20
+ * but the native hook always mounts the label-focus bridge (Pressable is never
21
+ * natively labelable) and Slot/Pressable share the same Pressable-shaped surface,
22
+ * so the option is intentionally unused here.
23
+ */
24
+ const {
25
+ isHovered: isHoveredProp,
26
+ isActive: isActiveProp,
27
+ isFocused: isFocusedProp,
28
+ isFocusVisible: isFocusVisibleProp,
29
+ isDisabled: isDisabledProp,
30
+ ariaDescribedBy: ariaDescribedByProp,
31
+ onPress: consumerOnPress,
32
+ onPressIn: consumerOnPressIn,
33
+ onPressOut: consumerOnPressOut,
34
+ onHoverIn: consumerOnHoverIn,
35
+ onHoverOut: consumerOnHoverOut,
36
+ onFocus: consumerOnFocus,
37
+ onBlur: consumerOnBlur,
38
+ onKeyDown: consumerOnKeyDown
39
+ } = options;
40
+ const {
41
+ open,
42
+ setOpen,
43
+ disabled: contextDisabled,
44
+ required: contextRequired,
45
+ invalid: contextInvalid,
46
+ readOnly: contextReadOnly,
47
+ triggerId,
48
+ contentId,
49
+ triggerRef,
50
+ activeValue,
51
+ accessibilityLabel,
52
+ ariaDescribedBy: ariaDescribedByFromField
53
+ } = useSelectContext();
54
+ const field = useFormControlContext();
55
+ const disabled = contextDisabled || !!isDisabledProp;
56
+ const {
57
+ isFocusVisible,
58
+ focusProps: focusRingProps
59
+ } = useFocusRing();
60
+ const {
61
+ pressProps,
62
+ isPressed: isActive
63
+ } = usePress({
64
+ isDisabled: disabled
65
+ });
66
+ const {
67
+ isFocused,
68
+ focusProps
69
+ } = useFocus();
70
+ const {
71
+ isHovered,
72
+ hoverProps
73
+ } = useHover();
74
+ const [triggerFocused, setTriggerFocused] = useState(false);
75
+ const handlePress = useCallback(_e => {
76
+ if (!disabled) {
77
+ setOpen(!open);
78
+ }
79
+ }, [disabled, open, setOpen]);
80
+ const handleKeyDown = useCallback(e => {
81
+ if (disabled) {
82
+ return;
83
+ }
84
+ switch (e.key) {
85
+ case 'Enter':
86
+ case ' ':
87
+ case 'ArrowDown':
88
+ case 'ArrowUp':
89
+ {
90
+ e.preventDefault();
91
+ setOpen(true);
92
+ break;
93
+ }
94
+ }
95
+ }, [disabled, setOpen]);
96
+
97
+ /** `useFocus()` on Pressable can stay true on native after blur; use explicit focus/blur handlers. */
98
+ const isLabelActive = Boolean((open || triggerFocused) && !disabled);
99
+ useReportFormControlLabelFocus(isLabelActive);
100
+ useLayoutEffect(() => {
101
+ if (!open) {
102
+ setTriggerFocused(false);
103
+ }
104
+ }, [open]);
105
+ const interactionState = useMemo(() => ({
106
+ hover: !!(isHoveredProp || isHovered),
107
+ focus: !!(isFocusedProp || isFocused || open),
108
+ active: !!(isActiveProp || isActive),
109
+ disabled: !!disabled,
110
+ focusVisible: !!(isFocusVisibleProp || isFocusVisible)
111
+ }), [isHoveredProp, isHovered, isFocusedProp, isFocused, isActiveProp, isActive, disabled, isFocusVisibleProp, isFocusVisible, open]);
112
+
113
+ /**
114
+ * Native: `Pressable` has no usable programmatic `.focus()` (unlike `TextInput`).
115
+ * `Form.Label` calls `focusInput()` → we register a bridge on `field.inputRef` that tries
116
+ * native focus, then opens the list (expected "tap label" behavior for a select).
117
+ */
118
+ const labelFocusGateRef = useRef({
119
+ disabled: false,
120
+ readOnly: false
121
+ });
122
+ labelFocusGateRef.current = {
123
+ disabled: !!disabled,
124
+ readOnly: !!contextReadOnly
125
+ };
126
+ const labelFocusBridge = useMemo(() => ({
127
+ focus() {
128
+ const {
129
+ disabled: isOff,
130
+ readOnly: isRO
131
+ } = labelFocusGateRef.current;
132
+ if (isOff || isRO) {
133
+ return;
134
+ }
135
+ const node = triggerRef.current;
136
+ if (node != null && typeof node.focus === 'function') {
137
+ node.focus();
138
+ }
139
+ setOpen(true);
140
+ }
141
+ }), [setOpen, triggerRef]);
142
+ useLayoutEffect(() => {
143
+ if (!field.inputRef) {
144
+ return;
145
+ }
146
+ const r = field.inputRef;
147
+ r.current = labelFocusBridge;
148
+ return () => {
149
+ if (r.current === labelFocusBridge) {
150
+ r.current = null;
151
+ }
152
+ };
153
+ }, [field.inputRef, labelFocusBridge]);
154
+ const mergedRef = mergeRefs(forwardedRef, triggerRef);
155
+ const ariaDescribedBy = [ariaDescribedByFromField, ariaDescribedByProp].filter(Boolean).join(' ');
156
+ const ariaProps = {
157
+ role: 'combobox',
158
+ 'aria-label': accessibilityLabel,
159
+ 'aria-haspopup': 'listbox',
160
+ 'aria-expanded': open,
161
+ 'aria-controls': contentId,
162
+ 'aria-activedescendant': open && activeValue ? `${contentId}-option-${activeValue}` : undefined,
163
+ 'aria-required': contextRequired || undefined,
164
+ 'aria-invalid': contextInvalid || undefined,
165
+ 'aria-readonly': contextReadOnly || undefined,
166
+ 'aria-describedby': ariaDescribedBy || undefined,
167
+ id: triggerId,
168
+ disabled
169
+ };
170
+ const dataAttrValues = {
171
+ hover: interactionState.hover,
172
+ focus: interactionState.focus,
173
+ active: interactionState.active,
174
+ disabled: interactionState.disabled,
175
+ focusVisible: interactionState.focusVisible,
176
+ required: !!contextRequired,
177
+ invalid: !!contextInvalid,
178
+ readonly: !!contextReadOnly,
179
+ state: open ? 'open' : 'closed'
180
+ };
181
+ const handlers = {
182
+ onPress: composeEventHandlers(consumerOnPress, handlePress),
183
+ onPressIn: composeEventHandlers(consumerOnPressIn, pressProps.onPressIn),
184
+ onPressOut: composeEventHandlers(consumerOnPressOut, pressProps.onPressOut),
185
+ onHoverIn: composeEventHandlers(consumerOnHoverIn, hoverProps.onHoverIn),
186
+ onHoverOut: composeEventHandlers(consumerOnHoverOut, hoverProps.onHoverOut),
187
+ onFocus: composeEventHandlers(composeEventHandlers(composeEventHandlers(consumerOnFocus, focusProps.onFocus), focusRingProps.onFocus), () => setTriggerFocused(true)),
188
+ onBlur: composeEventHandlers(composeEventHandlers(composeEventHandlers(consumerOnBlur, focusProps.onBlur), focusRingProps.onBlur), () => setTriggerFocused(false)),
189
+ onKeyDown: composeEventHandlers(consumerOnKeyDown, handleKeyDown)
190
+ };
191
+ return {
192
+ ariaProps,
193
+ dataAttrValues,
194
+ interactionState,
195
+ mergedRef,
196
+ handlers,
197
+ isLabelActive,
198
+ open,
199
+ labelFocusBridge
200
+ };
201
+ }
202
+ //# sourceMappingURL=useSelectTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useLayoutEffect","useMemo","useRef","useState","composeEventHandlers","mergeRefs","useFormControlContext","useReportFormControlLabelFocus","useFocus","useFocusRing","useHover","usePress","useSelectContext","useSelectTrigger","forwardedRef","options","isHovered","isHoveredProp","isActive","isActiveProp","isFocused","isFocusedProp","isFocusVisible","isFocusVisibleProp","isDisabled","isDisabledProp","ariaDescribedBy","ariaDescribedByProp","onPress","consumerOnPress","onPressIn","consumerOnPressIn","onPressOut","consumerOnPressOut","onHoverIn","consumerOnHoverIn","onHoverOut","consumerOnHoverOut","onFocus","consumerOnFocus","onBlur","consumerOnBlur","onKeyDown","consumerOnKeyDown","open","setOpen","disabled","contextDisabled","required","contextRequired","invalid","contextInvalid","readOnly","contextReadOnly","triggerId","contentId","triggerRef","activeValue","accessibilityLabel","ariaDescribedByFromField","field","focusProps","focusRingProps","pressProps","isPressed","hoverProps","triggerFocused","setTriggerFocused","handlePress","_e","handleKeyDown","e","key","preventDefault","isLabelActive","Boolean","interactionState","hover","focus","active","focusVisible","labelFocusGateRef","current","labelFocusBridge","isOff","isRO","node","inputRef","r","mergedRef","filter","join","ariaProps","role","undefined","id","dataAttrValues","readonly","state","handlers"],"sourceRoot":"../../../src","sources":["select/useSelectTrigger.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AAEd,SACEC,oBAAoB,EACpBC,SAAS,EACTC,qBAAqB,EACrBC,8BAA8B,QAEzB,eAAe;AACtB,SAASC,QAAQ,EAAEC,YAAY,QAAQ,0BAA0B;AACjE,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,iCAAiC;AAEpE,SAASC,gBAAgB,QAAQ,WAAW;AAqE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,YAAmC,EACnCC,OAAgC,EACR;EACxB;AACF;AACA;AACA;AACA;AACA;EACE,MAAM;IACJC,SAAS,EAAEC,aAAa;IACxBC,QAAQ,EAA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5B,oBAAoB,CAC9B6B,kBAAkB,EAClB8B,UAAU,CAAC/B,UACb,CAAwC;IACxCE,SAAS,EAAE9B,oBAAoB,CAC7B+B,iBAAiB,EACjB8B,UAAU,CAAC/B,SACb,CAAuC;IACvCE,UAAU,EAAEhC,oBAAoB,CAC9BiC,kBAAkB,EAClB4B,UAAU,CAAC7B,UACb,CAAwC;IACxCE,OAAO,EAAElC,oBAAoB,CAC3BA,oBAAoB,CAClBA,oBAAoB,CAACmC,eAAe,EAAEsB,UAAU,CAACvB,OAAO,CAAC,EACzDwB,cAAc,CAACxB,OACjB,CAAC,EACD,MAAM6B,iBAAiB,CAAC,IAAI,CAC9B,CAAC;IACD3B,MAAM,EAAEpC,oBAAoB,CAC1BA,oBAAoB,CAClBA,oBAAoB,CAACqC,cAAc,EAAEoB,UAAU,CAACrB,MAAM,CAAC,EACvDsB,cAAc,CAACtB,MACjB,CAAC,EACD,MAAM2B,iBAAiB,CAAC,KAAK,CAC/B,CAAC;IACDzB,SAAS,EAAEtC,oBAAoB,CAC7BuC,iBAAiB,EACjB2B,aACF;EACF,CAAC;EAED,OAAO;IACLsB,SAAS;IACTI,cAAc;IACdpB,gBAAgB;IAChBa,SAAS;IACTU,QAAQ;IACRzB,aAAa;IACb9B,IAAI;IACJuC;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
4
+ import { composeEventHandlers, mergeRefs, useFormControlContext, useReportFormControlLabelFocus } from '@cdx-ui/utils';
5
+ import { useFocus } from '@react-native-aria/focus';
6
+ import { usePress } from '@react-native-aria/interactions';
7
+ import { useSelectContext } from './context';
8
+ /**
9
+ * Web variant — drops `useHover` and `useFocusRing` per the trigger-prune todo:
10
+ * neither emitted attribute has a consumer in `selectTriggerVariants`, and the
11
+ * web `useHover` re-renders on every pointer enter/leave. Hover is expressed via
12
+ * CSS `:hover` chains in CVA, not a JS tracker.
13
+ *
14
+ * The label-focus bridge is only registered when the host loses native
15
+ * label association — i.e. when `asChild` substitutes the rendered `<button>`
16
+ * with a non-labelable element. Otherwise `<label htmlFor>` handles the focus
17
+ * relationship natively.
18
+ */
19
+ export function useSelectTrigger(forwardedRef, options) {
20
+ const {
21
+ asChild,
22
+ isHovered: isHoveredProp,
23
+ isActive: isActiveProp,
24
+ isFocused: isFocusedProp,
25
+ isFocusVisible: isFocusVisibleProp,
26
+ isDisabled: isDisabledProp,
27
+ ariaDescribedBy: ariaDescribedByProp,
28
+ onPress: consumerOnPress,
29
+ onPressIn: consumerOnPressIn,
30
+ onPressOut: consumerOnPressOut,
31
+ onHoverIn: consumerOnHoverIn,
32
+ onHoverOut: consumerOnHoverOut,
33
+ onFocus: consumerOnFocus,
34
+ onBlur: consumerOnBlur,
35
+ onKeyDown: consumerOnKeyDown
36
+ } = options;
37
+ const {
38
+ open,
39
+ setOpen,
40
+ disabled: contextDisabled,
41
+ required: contextRequired,
42
+ invalid: contextInvalid,
43
+ readOnly: contextReadOnly,
44
+ triggerId,
45
+ contentId,
46
+ triggerRef,
47
+ activeValue,
48
+ accessibilityLabel,
49
+ ariaDescribedBy: ariaDescribedByFromField
50
+ } = useSelectContext();
51
+ const field = useFormControlContext();
52
+ const disabled = contextDisabled || !!isDisabledProp;
53
+ const {
54
+ pressProps,
55
+ isPressed: isActive
56
+ } = usePress({
57
+ isDisabled: disabled
58
+ });
59
+ const {
60
+ isFocused,
61
+ focusProps
62
+ } = useFocus();
63
+ const [triggerFocused, setTriggerFocused] = useState(false);
64
+ const handlePress = useCallback(_e => {
65
+ if (!disabled) {
66
+ setOpen(!open);
67
+ }
68
+ }, [disabled, open, setOpen]);
69
+ const handleKeyDown = useCallback(e => {
70
+ if (disabled) {
71
+ return;
72
+ }
73
+ switch (e.key) {
74
+ case 'Enter':
75
+ case ' ':
76
+ case 'ArrowDown':
77
+ case 'ArrowUp':
78
+ {
79
+ e.preventDefault();
80
+ setOpen(true);
81
+ break;
82
+ }
83
+ }
84
+ }, [disabled, setOpen]);
85
+ const isLabelActive = Boolean((isFocusedProp || isFocused || triggerFocused || open) && !disabled);
86
+ useReportFormControlLabelFocus(isLabelActive);
87
+ useLayoutEffect(() => {
88
+ if (!open) {
89
+ setTriggerFocused(false);
90
+ }
91
+ }, [open]);
92
+ const interactionState = useMemo(() => ({
93
+ hover: !!isHoveredProp,
94
+ focus: !!(isFocusedProp || isFocused || open),
95
+ active: !!(isActiveProp || isActive),
96
+ disabled: !!disabled,
97
+ focusVisible: !!isFocusVisibleProp
98
+ }), [isHoveredProp, isFocusedProp, isFocused, isActiveProp, isActive, disabled, isFocusVisibleProp, open]);
99
+
100
+ /**
101
+ * `<button>` is HTML-labelable so `<label htmlFor>` works natively — no JS bridge needed.
102
+ * When `asChild` substitutes the host with a non-labelable element (e.g. `<div role="button">`),
103
+ * the bridge fills the gap so `Form.Label` can still focus the trigger via `field.inputRef`.
104
+ */
105
+ const labelFocusGateRef = useRef({
106
+ disabled: false,
107
+ readOnly: false
108
+ });
109
+ labelFocusGateRef.current = {
110
+ disabled: !!disabled,
111
+ readOnly: !!contextReadOnly
112
+ };
113
+ const labelFocusBridge = useMemo(() => ({
114
+ focus() {
115
+ const {
116
+ disabled: isOff,
117
+ readOnly: isRO
118
+ } = labelFocusGateRef.current;
119
+ if (isOff || isRO) {
120
+ return;
121
+ }
122
+ const node = triggerRef.current;
123
+ if (node != null && typeof node.focus === 'function') {
124
+ node.focus();
125
+ }
126
+ setOpen(true);
127
+ }
128
+ }), [setOpen, triggerRef]);
129
+ const shouldMountLabelFocusBridge = !!asChild;
130
+ useLayoutEffect(() => {
131
+ if (!shouldMountLabelFocusBridge || !field.inputRef) {
132
+ return;
133
+ }
134
+ const r = field.inputRef;
135
+ r.current = labelFocusBridge;
136
+ return () => {
137
+ if (r.current === labelFocusBridge) {
138
+ r.current = null;
139
+ }
140
+ };
141
+ }, [shouldMountLabelFocusBridge, field.inputRef, labelFocusBridge]);
142
+ const mergedRef = mergeRefs(forwardedRef, triggerRef);
143
+ const ariaDescribedBy = [ariaDescribedByFromField, ariaDescribedByProp].filter(Boolean).join(' ');
144
+ const ariaProps = {
145
+ role: 'combobox',
146
+ 'aria-label': accessibilityLabel,
147
+ 'aria-haspopup': 'listbox',
148
+ 'aria-expanded': open,
149
+ 'aria-controls': contentId,
150
+ 'aria-activedescendant': open && activeValue ? `${contentId}-option-${activeValue}` : undefined,
151
+ 'aria-required': contextRequired || undefined,
152
+ 'aria-invalid': contextInvalid || undefined,
153
+ 'aria-readonly': contextReadOnly || undefined,
154
+ 'aria-describedby': ariaDescribedBy || undefined,
155
+ id: triggerId,
156
+ disabled
157
+ };
158
+ const dataAttrValues = {
159
+ focus: interactionState.focus,
160
+ active: interactionState.active,
161
+ disabled: interactionState.disabled,
162
+ required: !!contextRequired,
163
+ invalid: !!contextInvalid,
164
+ readonly: !!contextReadOnly,
165
+ state: open ? 'open' : 'closed'
166
+ };
167
+ const handlers = {
168
+ onPress: composeEventHandlers(consumerOnPress, handlePress),
169
+ onPressIn: composeEventHandlers(consumerOnPressIn, pressProps.onPressIn),
170
+ onPressOut: composeEventHandlers(consumerOnPressOut, pressProps.onPressOut),
171
+ onHoverIn: consumerOnHoverIn ?? (() => undefined),
172
+ onHoverOut: consumerOnHoverOut ?? (() => undefined),
173
+ onFocus: composeEventHandlers(composeEventHandlers(consumerOnFocus, focusProps.onFocus), () => setTriggerFocused(true)),
174
+ onBlur: composeEventHandlers(composeEventHandlers(consumerOnBlur, focusProps.onBlur), () => setTriggerFocused(false)),
175
+ onKeyDown: composeEventHandlers(consumerOnKeyDown, handleKeyDown)
176
+ };
177
+ return {
178
+ ariaProps,
179
+ dataAttrValues,
180
+ interactionState,
181
+ mergedRef,
182
+ handlers,
183
+ isLabelActive,
184
+ open,
185
+ labelFocusBridge
186
+ };
187
+ }
188
+ //# sourceMappingURL=useSelectTrigger.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useLayoutEffect","useMemo","useRef","useState","composeEventHandlers","mergeRefs","useFormControlContext","useReportFormControlLabelFocus","useFocus","usePress","useSelectContext","useSelectTrigger","forwardedRef","options","asChild","isHovered","isHoveredProp","isActive","isActiveProp","isFocused","isFocusedProp","isFocusVisible","isFocusVisibleProp","isDisabled","isDisabledProp","ariaDescribedBy","ariaDescribedByProp","onPress","consumerOnPress","onPressIn","consumerOnPressIn","onPressOut","consumerOnPressOut","onHoverIn","consumerOnHoverIn","onHoverOut","consumerOnHoverOut","onFocus","consumerOnFocus","onBlur","consumerOnBlur","onKeyDown","consumerOnKeyDown","open","setOpen","disabled","contextDisabled","required","contextRequired","invalid","contextInvalid","readOnly","contextReadOnly","triggerId","contentId","triggerRef","activeValue","accessibilityLabel","ariaDescribedByFromField","field","pressProps","isPressed","focusProps","triggerFocused","setTriggerFocused","handlePress","_e","handleKeyDown","e","key","preventDefault","isLabelActive","Boolean","interactionState","hover","focus","active","focusVisible","labelFocusGateRef","current","labelFocusBridge","isOff","isRO","node","shouldMountLabelFocusBridge","inputRef","r","mergedRef","filter","join","ariaProps","role","undefined","id","dataAttrValues","readonly","state","handlers"],"sourceRoot":"../../../src","sources":["select/useSelectTrigger.web.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AAEd,SACEC,oBAAoB,EACpBC,SAAS,EACTC,qBAAqB,EACrBC,8BAA8B,QAEzB,eAAe;AACtB,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,QAAQ,QAAQ,iCAAiC;AAE1D,SAASC,gBAAgB,QAAQ,WAAW;AAS5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,YAAmC,EACnCC,OAAgC,EACR;EACxB,MAAM;IACJC,OAAO;IACPC,SAAS,EAAEC,aAAa;IACxBC,QAAQ,EAAEC,YAAY;IACtBC,SAAS,EAAEC,aAAa;IACx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zB,OAAO,CAAC,EAAE,MACvF2B,iBAAiB,CAAC,IAAI,CACxB,CAAC;IACDzB,MAAM,EAAEnC,oBAAoB,CAACA,oBAAoB,CAACoC,cAAc,EAAEsB,UAAU,CAACvB,MAAM,CAAC,EAAE,MACpFyB,iBAAiB,CAAC,KAAK,CACzB,CAAC;IACDvB,SAAS,EAAErC,oBAAoB,CAC7BsC,iBAAiB,EACjByB,aACF;EACF,CAAC;EAED,OAAO;IACLuB,SAAS;IACTI,cAAc;IACdrB,gBAAgB;IAChBc,SAAS;IACTU,QAAQ;IACR1B,aAAa;IACb5B,IAAI;IACJqC;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { Slot, isTextChildren } from '@rn-primitives/slot';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Slot","isTextChildren"],"sourceRoot":"../../../src","sources":["slot/index.ts"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,cAAc,QAAQ,qBAAqB","ignoreList":[]}
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
2
 
3
- import { createSwitchRoot } from './createSwitchRoot';
4
- export function createSwitch({
5
- Root
6
- }) {
7
- const Switch = createSwitchRoot(Root);
8
- Switch.displayName = 'Switch';
9
- return Switch;
10
- }
3
+ export { useSwitch } from './useSwitch';
11
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createSwitchRoot","createSwitch","Root","Switch","displayName"],"sourceRoot":"../../../src","sources":["switch/index.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AAKrD,OAAO,SAASC,YAAYA,CAAiB;EAC3CC;AAGF,CAAC,EAA8B;EAC7B,MAAMC,MAAM,GAAGH,gBAAgB,CAACE,IAAI,CAAC;EAErCC,MAAM,CAACC,WAAW,GAAG,QAAQ;EAC7B,OAAOD,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"names":["useSwitch"],"sourceRoot":"../../../src","sources":["switch/index.ts"],"mappings":";;AAMA,SAASA,SAAS,QAAQ,aAAa","ignoreList":[]}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useRef } from 'react';
4
+ import { useFocusRing } from '@react-native-aria/focus';
5
+ import { useHover } from '@react-native-aria/interactions';
6
+ import { useToggleState } from '@react-stately/toggle';
7
+ import { useFormControlContext } from '@cdx-ui/utils';
8
+ import { dataAttributes } from '../utils/dataAttributes';
9
+ /**
10
+ * Headless behavioral primitive for `Switch`.
11
+ *
12
+ * Owns the controlled/uncontrolled toggle state, ARIA `role="switch"` semantics
13
+ * (consumers must wire `aria-checked`/`accessibilityRole` to the host element they
14
+ * render), and interaction tracking (hover, focus-visible). Surfaces a
15
+ * platform-aware `dataAttrs` object so the styled layer can emit interaction-state
16
+ * `data-*` attributes (Standard 1) without re-implementing the toggle machinery.
17
+ *
18
+ * Standards mapping (per `.cursor/plans/primitive_design_standards_0d0ca4b1.plan.md`):
19
+ * - Standard 3 #1 — controlled state via `useToggleState`.
20
+ * - Standard 3 #2 — `role="switch"` semantics (consumer wires to host).
21
+ *
22
+ * The styled layer renders the host element (`RNSwitch` on native, a custom
23
+ * `Pressable` + `View` toggle on web) and is the sole owner of className/styling
24
+ * machinery — primitives never carry Uniwind className passthrough.
25
+ */
26
+ export function useSwitch(props = {}) {
27
+ const {
28
+ disabled,
29
+ isDisabled,
30
+ isChecked,
31
+ isInvalid,
32
+ defaultValue,
33
+ value,
34
+ onValueChange
35
+ } = props;
36
+ const formControlContext = useFormControlContext();
37
+ const controlledValue = value ?? isChecked;
38
+ const state = useToggleState({
39
+ defaultSelected: defaultValue ?? false,
40
+ isSelected: controlledValue,
41
+ onChange: onValueChange
42
+ });
43
+ const checked = controlledValue ?? state.isSelected;
44
+ const hostRef = useRef(null);
45
+ const {
46
+ isHovered,
47
+ hoverProps
48
+ } = useHover({}, hostRef);
49
+ const {
50
+ isFocusVisible,
51
+ focusProps
52
+ } = useFocusRing();
53
+ const isDisabledResolved = Boolean(disabled || isDisabled || formControlContext.isDisabled);
54
+ const isInvalidResolved = Boolean(isInvalid || formControlContext.isInvalid);
55
+ const setChecked = useCallback(next => {
56
+ state.setSelected(next);
57
+ }, [state]);
58
+ return {
59
+ checked,
60
+ isDisabled: isDisabledResolved,
61
+ isInvalid: isInvalidResolved,
62
+ isHovered,
63
+ isFocusVisible,
64
+ setChecked,
65
+ hoverProps,
66
+ focusProps,
67
+ dataAttrs: dataAttributes({
68
+ hover: isHovered,
69
+ disabled: isDisabledResolved,
70
+ invalid: isInvalidResolved,
71
+ checked,
72
+ focusVisible: isFocusVisible
73
+ }),
74
+ hostRef
75
+ };
76
+ }
77
+ //# sourceMappingURL=useSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useRef","useFocusRing","useHover","useToggleState","useFormControlContext","dataAttributes","useSwitch","props","disabled","isDisabled","isChecked","isInvalid","defaultValue","value","onValueChange","formControlContext","controlledValue","state","defaultSelected","isSelected","onChange","checked","hostRef","isHovered","hoverProps","isFocusVisible","focusProps","isDisabledResolved","Boolean","isInvalidResolved","setChecked","next","setSelected","dataAttrs","hover","invalid","focusVisible"],"sourceRoot":"../../../src","sources":["switch/useSwitch.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,QAAQ,QAAQ,iCAAiC;AAC1D,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,cAAc,QAAQ,yBAAyB;AAGxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,KAAmB,GAAG,CAAC,CAAC,EAAoB;EACpE,MAAM;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,SAAS;IAAEC,SAAS;IAAEC,YAAY;IAAE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","ignoreList":[]}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useCallback, useMemo } from 'react';
4
+ import { View } from 'react-native';
5
+ import { useControllableState } from '@cdx-ui/utils';
6
+ import { Slot } from '../slot';
7
+ import { TileGroupContextProvider } from './context';
8
+
9
+ /**
10
+ * Internal widening of the public discriminated union: the runtime accepts any value
11
+ * shape and reads `type` to decide branch behavior. The public API stays narrow.
12
+ */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ export const TileGroup = /*#__PURE__*/forwardRef((props, ref) => {
15
+ const {
16
+ asChild = false,
17
+ children,
18
+ type,
19
+ value: valueProp,
20
+ defaultValue,
21
+ onValueChange,
22
+ max: maxProp,
23
+ isDisabled = false,
24
+ 'aria-label': ariaLabel,
25
+ ...rest
26
+ } = props;
27
+ const max = maxProp ?? Number.POSITIVE_INFINITY;
28
+ const defaultProp = defaultValue !== undefined ? defaultValue : type === 'multiple' ? [] : undefined;
29
+ const [state, setState] = useControllableState({
30
+ prop: valueProp,
31
+ defaultProp,
32
+ onChange: next => {
33
+ if (next !== undefined) {
34
+ onValueChange?.(next);
35
+ }
36
+ }
37
+ });
38
+ const isSelected = useCallback(tileValue => {
39
+ if (type === 'single') {
40
+ return state === tileValue;
41
+ }
42
+ return Array.isArray(state) && state.includes(tileValue);
43
+ }, [type, state]);
44
+ const isTileDisabledByGroup = useCallback(tileValue => {
45
+ if (isDisabled) {
46
+ return true;
47
+ }
48
+ if (type !== 'multiple') {
49
+ return false;
50
+ }
51
+ const arr = Array.isArray(state) ? state : [];
52
+ if (arr.length < max) {
53
+ return false;
54
+ }
55
+ return !arr.includes(tileValue);
56
+ }, [isDisabled, type, state, max]);
57
+ const toggleValue = useCallback(tileValue => {
58
+ if (isDisabled) {
59
+ return;
60
+ }
61
+ if (type === 'single') {
62
+ if (state === tileValue) {
63
+ return;
64
+ }
65
+ setState(tileValue);
66
+ return;
67
+ }
68
+ const arr = Array.isArray(state) ? [...state] : [];
69
+ const idx = arr.indexOf(tileValue);
70
+ if (idx >= 0) {
71
+ arr.splice(idx, 1);
72
+ setState(arr);
73
+ } else if (arr.length < max) {
74
+ arr.push(tileValue);
75
+ setState(arr);
76
+ }
77
+ }, [isDisabled, type, state, setState, max]);
78
+ const contextValue = useMemo(() => ({
79
+ type,
80
+ value: state,
81
+ toggleValue,
82
+ isSelected,
83
+ isTileDisabledByGroup,
84
+ isGroupDisabled: isDisabled,
85
+ max
86
+ }), [type, state, toggleValue, isSelected, isTileDisabledByGroup, isDisabled, max]);
87
+ const role = type === 'single' ? 'radiogroup' : 'group';
88
+ const Comp = asChild ? Slot : View;
89
+ return /*#__PURE__*/_jsx(TileGroupContextProvider, {
90
+ value: contextValue,
91
+ children: /*#__PURE__*/_jsx(Comp, {
92
+ ref: ref,
93
+ role: role,
94
+ ...(type === 'single' ? {
95
+ accessibilityRole: 'radiogroup'
96
+ } : {}),
97
+ ...(ariaLabel ? {
98
+ 'aria-label': ariaLabel,
99
+ accessibilityLabel: ariaLabel
100
+ } : {}),
101
+ ...rest,
102
+ children: children
103
+ })
104
+ });
105
+ });
106
+ TileGroup.displayName = 'TileGroup';
107
+ //# sourceMappingURL=TileGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useCallback","useMemo","View","useControllableState","Slot","TileGroupContextProvider","jsx","_jsx","TileGroup","props","ref","asChild","children","type","value","valueProp","defaultValue","onValueChange","max","maxProp","isDisabled","ariaLabel","rest","Number","POSITIVE_INFINITY","defaultProp","undefined","state","setState","prop","onChange","next","isSelected","tileValue","Array","isArray","includes","isTileDisabledByGroup","arr","length","toggleValue","idx","indexOf","splice","push","contextValue","isGroupDisabled","role","Comp","accessibilityRole","accessibilityLabel","displayName"],"sourceRoot":"../../../src","sources":["tile/TileGroup.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAA2B,OAAO;AAC3E,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,oBAAoB,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