@react-md/core 6.5.1 → 7.0.0

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 (648) hide show
  1. package/dist/_utils.scss +3 -0
  2. package/dist/app-bar/AppBar.d.ts +3 -2
  3. package/dist/app-bar/AppBar.js +3 -4
  4. package/dist/app-bar/AppBar.js.map +1 -1
  5. package/dist/app-bar/AppBarTitle.d.ts +3 -1
  6. package/dist/app-bar/AppBarTitle.js +3 -4
  7. package/dist/app-bar/AppBarTitle.js.map +1 -1
  8. package/dist/autocomplete/AutocompleteChip.d.ts +2 -1
  9. package/dist/autocomplete/AutocompleteChip.js +3 -4
  10. package/dist/autocomplete/AutocompleteChip.js.map +1 -1
  11. package/dist/autocomplete/types.d.ts +1 -0
  12. package/dist/autocomplete/types.js.map +1 -1
  13. package/dist/autocomplete/utils.d.ts +4 -4
  14. package/dist/autocomplete/utils.js.map +1 -1
  15. package/dist/avatar/Avatar.d.ts +3 -2
  16. package/dist/avatar/Avatar.js +3 -4
  17. package/dist/avatar/Avatar.js.map +1 -1
  18. package/dist/badge/Badge.d.ts +3 -2
  19. package/dist/badge/Badge.js +3 -4
  20. package/dist/badge/Badge.js.map +1 -1
  21. package/dist/box/Box.d.ts +3 -2
  22. package/dist/box/Box.js +3 -4
  23. package/dist/box/Box.js.map +1 -1
  24. package/dist/button/AsyncButton.d.ts +3 -2
  25. package/dist/button/AsyncButton.js +3 -4
  26. package/dist/button/AsyncButton.js.map +1 -1
  27. package/dist/button/Button.d.ts +3 -2
  28. package/dist/button/Button.js +3 -4
  29. package/dist/button/Button.js.map +1 -1
  30. package/dist/button/ButtonUnstyled.d.ts +5 -3
  31. package/dist/button/ButtonUnstyled.js +3 -4
  32. package/dist/button/ButtonUnstyled.js.map +1 -1
  33. package/dist/button/FloatingActionButton.d.ts +3 -2
  34. package/dist/button/FloatingActionButton.js +3 -4
  35. package/dist/button/FloatingActionButton.js.map +1 -1
  36. package/dist/button/TooltippedButton.d.ts +3 -2
  37. package/dist/button/TooltippedButton.js +3 -4
  38. package/dist/button/TooltippedButton.js.map +1 -1
  39. package/dist/card/Card.d.ts +3 -2
  40. package/dist/card/Card.js +3 -4
  41. package/dist/card/Card.js.map +1 -1
  42. package/dist/card/CardContent.d.ts +3 -2
  43. package/dist/card/CardContent.js +3 -4
  44. package/dist/card/CardContent.js.map +1 -1
  45. package/dist/card/CardFooter.d.ts +3 -1
  46. package/dist/card/CardFooter.js +3 -4
  47. package/dist/card/CardFooter.js.map +1 -1
  48. package/dist/card/CardHeader.d.ts +3 -2
  49. package/dist/card/CardHeader.js +3 -4
  50. package/dist/card/CardHeader.js.map +1 -1
  51. package/dist/card/CardSubtitle.d.ts +3 -1
  52. package/dist/card/CardSubtitle.js +3 -4
  53. package/dist/card/CardSubtitle.js.map +1 -1
  54. package/dist/card/CardTitle.d.ts +3 -1
  55. package/dist/card/CardTitle.js +3 -4
  56. package/dist/card/CardTitle.js.map +1 -1
  57. package/dist/card/ClickableCard.d.ts +3 -2
  58. package/dist/card/ClickableCard.js +3 -4
  59. package/dist/card/ClickableCard.js.map +1 -1
  60. package/dist/chip/Chip.d.ts +4 -2
  61. package/dist/chip/Chip.js +4 -4
  62. package/dist/chip/Chip.js.map +1 -1
  63. package/dist/datetime/NativeDateField.d.ts +3 -1
  64. package/dist/datetime/NativeDateField.js +3 -4
  65. package/dist/datetime/NativeDateField.js.map +1 -1
  66. package/dist/datetime/NativeTimeField.d.ts +3 -1
  67. package/dist/datetime/NativeTimeField.js +3 -4
  68. package/dist/datetime/NativeTimeField.js.map +1 -1
  69. package/dist/dialog/Dialog.d.ts +3 -2
  70. package/dist/dialog/Dialog.js +4 -4
  71. package/dist/dialog/Dialog.js.map +1 -1
  72. package/dist/dialog/DialogContainer.d.ts +3 -2
  73. package/dist/dialog/DialogContainer.js +3 -4
  74. package/dist/dialog/DialogContainer.js.map +1 -1
  75. package/dist/dialog/DialogContent.d.ts +3 -2
  76. package/dist/dialog/DialogContent.js +3 -4
  77. package/dist/dialog/DialogContent.js.map +1 -1
  78. package/dist/dialog/DialogFooter.d.ts +3 -2
  79. package/dist/dialog/DialogFooter.js +3 -4
  80. package/dist/dialog/DialogFooter.js.map +1 -1
  81. package/dist/dialog/DialogHeader.d.ts +3 -1
  82. package/dist/dialog/DialogHeader.js +3 -4
  83. package/dist/dialog/DialogHeader.js.map +1 -1
  84. package/dist/dialog/DialogTitle.d.ts +3 -1
  85. package/dist/dialog/DialogTitle.js +3 -4
  86. package/dist/dialog/DialogTitle.js.map +1 -1
  87. package/dist/dialog/FixedDialog.d.ts +4 -3
  88. package/dist/dialog/FixedDialog.js +4 -4
  89. package/dist/dialog/FixedDialog.js.map +1 -1
  90. package/dist/divider/Divider.d.ts +3 -2
  91. package/dist/divider/Divider.js +3 -4
  92. package/dist/divider/Divider.js.map +1 -1
  93. package/dist/draggable/useDraggable.d.ts +3 -3
  94. package/dist/draggable/useDraggable.js.map +1 -1
  95. package/dist/draggable/utils.d.ts +1 -1
  96. package/dist/draggable/utils.js.map +1 -1
  97. package/dist/expansion-panel/ExpansionList.d.ts +3 -2
  98. package/dist/expansion-panel/ExpansionList.js +3 -4
  99. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  100. package/dist/expansion-panel/ExpansionPanel.d.ts +3 -2
  101. package/dist/expansion-panel/ExpansionPanel.js +3 -4
  102. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  103. package/dist/expansion-panel/ExpansionPanelHeader.d.ts +3 -2
  104. package/dist/expansion-panel/ExpansionPanelHeader.js +3 -4
  105. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  106. package/dist/files/FileInput.d.ts +3 -2
  107. package/dist/files/FileInput.js +3 -4
  108. package/dist/files/FileInput.js.map +1 -1
  109. package/dist/focus/useFocusContainer.d.ts +1 -1
  110. package/dist/focus/useFocusContainer.js.map +1 -1
  111. package/dist/form/Checkbox.d.ts +2 -1
  112. package/dist/form/Checkbox.js +4 -4
  113. package/dist/form/Checkbox.js.map +1 -1
  114. package/dist/form/Fieldset.d.ts +3 -2
  115. package/dist/form/Fieldset.js +3 -4
  116. package/dist/form/Fieldset.js.map +1 -1
  117. package/dist/form/Form.d.ts +3 -2
  118. package/dist/form/Form.js +3 -4
  119. package/dist/form/Form.js.map +1 -1
  120. package/dist/form/FormMessage.d.ts +8 -2
  121. package/dist/form/FormMessage.js +3 -4
  122. package/dist/form/FormMessage.js.map +1 -1
  123. package/dist/form/FormMessageContainer.d.ts +5 -4
  124. package/dist/form/FormMessageContainer.js +3 -4
  125. package/dist/form/FormMessageContainer.js.map +1 -1
  126. package/dist/form/FormMessageCounter.d.ts +3 -2
  127. package/dist/form/FormMessageCounter.js +3 -4
  128. package/dist/form/FormMessageCounter.js.map +1 -1
  129. package/dist/form/InputToggle.d.ts +3 -2
  130. package/dist/form/InputToggle.js +3 -4
  131. package/dist/form/InputToggle.js.map +1 -1
  132. package/dist/form/InputToggleIcon.d.ts +3 -2
  133. package/dist/form/InputToggleIcon.js +3 -4
  134. package/dist/form/InputToggleIcon.js.map +1 -1
  135. package/dist/form/Label.d.ts +2 -1
  136. package/dist/form/Label.js +3 -4
  137. package/dist/form/Label.js.map +1 -1
  138. package/dist/form/Legend.d.ts +3 -1
  139. package/dist/form/Legend.js +3 -4
  140. package/dist/form/Legend.js.map +1 -1
  141. package/dist/form/NativeSelect.d.ts +3 -2
  142. package/dist/form/NativeSelect.js +3 -4
  143. package/dist/form/NativeSelect.js.map +1 -1
  144. package/dist/form/OptGroup.d.ts +3 -2
  145. package/dist/form/OptGroup.js +3 -4
  146. package/dist/form/OptGroup.js.map +1 -1
  147. package/dist/form/Option.d.ts +3 -2
  148. package/dist/form/Option.js +4 -4
  149. package/dist/form/Option.js.map +1 -1
  150. package/dist/form/Password.d.ts +2 -2
  151. package/dist/form/Password.js +3 -4
  152. package/dist/form/Password.js.map +1 -1
  153. package/dist/form/Radio.d.ts +2 -1
  154. package/dist/form/Radio.js +4 -4
  155. package/dist/form/Radio.js.map +1 -1
  156. package/dist/form/ResizingTextAreaWrapper.d.ts +3 -2
  157. package/dist/form/ResizingTextAreaWrapper.js +3 -4
  158. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  159. package/dist/form/SliderContainer.d.ts +3 -2
  160. package/dist/form/SliderContainer.js +3 -4
  161. package/dist/form/SliderContainer.js.map +1 -1
  162. package/dist/form/SliderThumb.d.ts +3 -2
  163. package/dist/form/SliderThumb.js +4 -4
  164. package/dist/form/SliderThumb.js.map +1 -1
  165. package/dist/form/SliderTrack.d.ts +3 -2
  166. package/dist/form/SliderTrack.js +3 -4
  167. package/dist/form/SliderTrack.js.map +1 -1
  168. package/dist/form/Switch.d.ts +3 -2
  169. package/dist/form/Switch.js +3 -4
  170. package/dist/form/Switch.js.map +1 -1
  171. package/dist/form/SwitchTrack.d.ts +3 -2
  172. package/dist/form/SwitchTrack.js +3 -4
  173. package/dist/form/SwitchTrack.js.map +1 -1
  174. package/dist/form/TextArea.d.ts +3 -2
  175. package/dist/form/TextArea.js +3 -4
  176. package/dist/form/TextArea.js.map +1 -1
  177. package/dist/form/TextField.d.ts +3 -2
  178. package/dist/form/TextField.js +3 -4
  179. package/dist/form/TextField.js.map +1 -1
  180. package/dist/form/TextFieldAddon.d.ts +2 -1
  181. package/dist/form/TextFieldAddon.js +3 -4
  182. package/dist/form/TextFieldAddon.js.map +1 -1
  183. package/dist/form/TextFieldContainer.d.ts +3 -2
  184. package/dist/form/TextFieldContainer.js +3 -4
  185. package/dist/form/TextFieldContainer.js.map +1 -1
  186. package/dist/form/sliderUtils.d.ts +1 -1
  187. package/dist/form/sliderUtils.js.map +1 -1
  188. package/dist/form/types.d.ts +11 -5
  189. package/dist/form/types.js.map +1 -1
  190. package/dist/form/useCombobox.d.ts +6 -6
  191. package/dist/form/useCombobox.js.map +1 -1
  192. package/dist/form/useFormReset.d.ts +1 -1
  193. package/dist/form/useFormReset.js.map +1 -1
  194. package/dist/form/useTextField.d.ts +4 -4
  195. package/dist/form/useTextField.js.map +1 -1
  196. package/dist/hoverMode/useHoverMode.js +1 -1
  197. package/dist/hoverMode/useHoverMode.js.map +1 -1
  198. package/dist/hoverMode/useHoverModeProvider.d.ts +5 -5
  199. package/dist/hoverMode/useHoverModeProvider.js +1 -1
  200. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  201. package/dist/icon/FontIcon.d.ts +3 -2
  202. package/dist/icon/FontIcon.js +3 -4
  203. package/dist/icon/FontIcon.js.map +1 -1
  204. package/dist/icon/IconRotator.d.ts +3 -2
  205. package/dist/icon/IconRotator.js +4 -4
  206. package/dist/icon/IconRotator.js.map +1 -1
  207. package/dist/icon/MaterialIcon.d.ts +3 -2
  208. package/dist/icon/MaterialIcon.js +3 -4
  209. package/dist/icon/MaterialIcon.js.map +1 -1
  210. package/dist/icon/MaterialSymbol.d.ts +3 -2
  211. package/dist/icon/MaterialSymbol.js +3 -4
  212. package/dist/icon/MaterialSymbol.js.map +1 -1
  213. package/dist/icon/SVGIcon.d.ts +3 -2
  214. package/dist/icon/SVGIcon.js +3 -4
  215. package/dist/icon/SVGIcon.js.map +1 -1
  216. package/dist/layout/LayoutAppBar.d.ts +3 -1
  217. package/dist/layout/LayoutAppBar.js +3 -4
  218. package/dist/layout/LayoutAppBar.js.map +1 -1
  219. package/dist/layout/LayoutNav.d.ts +3 -2
  220. package/dist/layout/LayoutNav.js +3 -4
  221. package/dist/layout/LayoutNav.js.map +1 -1
  222. package/dist/layout/LayoutWindowSplitter.d.ts +4 -2
  223. package/dist/layout/LayoutWindowSplitter.js +4 -4
  224. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  225. package/dist/layout/Main.d.ts +4 -3
  226. package/dist/layout/Main.js +3 -4
  227. package/dist/layout/Main.js.map +1 -1
  228. package/dist/link/Link.d.ts +10 -2
  229. package/dist/link/Link.js +4 -4
  230. package/dist/link/Link.js.map +1 -1
  231. package/dist/link/SkipToMainContent.d.ts +3 -2
  232. package/dist/link/SkipToMainContent.js +4 -4
  233. package/dist/link/SkipToMainContent.js.map +1 -1
  234. package/dist/list/List.d.ts +3 -2
  235. package/dist/list/List.js +3 -4
  236. package/dist/list/List.js.map +1 -1
  237. package/dist/list/ListItem.d.ts +3 -2
  238. package/dist/list/ListItem.js +3 -4
  239. package/dist/list/ListItem.js.map +1 -1
  240. package/dist/list/ListItemLink.d.ts +3 -2
  241. package/dist/list/ListItemLink.js +3 -4
  242. package/dist/list/ListItemLink.js.map +1 -1
  243. package/dist/list/ListItemText.d.ts +3 -2
  244. package/dist/list/ListItemText.js +3 -4
  245. package/dist/list/ListItemText.js.map +1 -1
  246. package/dist/list/ListSubheader.d.ts +3 -2
  247. package/dist/list/ListSubheader.js +3 -4
  248. package/dist/list/ListSubheader.js.map +1 -1
  249. package/dist/menu/DropdownMenu.js.map +1 -1
  250. package/dist/menu/Menu.d.ts +4 -2
  251. package/dist/menu/Menu.js +5 -4
  252. package/dist/menu/Menu.js.map +1 -1
  253. package/dist/menu/MenuBar.d.ts +3 -1
  254. package/dist/menu/MenuBar.js +3 -4
  255. package/dist/menu/MenuBar.js.map +1 -1
  256. package/dist/menu/MenuButton.d.ts +2 -1
  257. package/dist/menu/MenuButton.js +3 -4
  258. package/dist/menu/MenuButton.js.map +1 -1
  259. package/dist/menu/MenuItem.d.ts +3 -1
  260. package/dist/menu/MenuItem.js +3 -4
  261. package/dist/menu/MenuItem.js.map +1 -1
  262. package/dist/menu/MenuItemButton.d.ts +2 -1
  263. package/dist/menu/MenuItemButton.js +4 -4
  264. package/dist/menu/MenuItemButton.js.map +1 -1
  265. package/dist/menu/MenuItemCheckbox.d.ts +2 -1
  266. package/dist/menu/MenuItemCheckbox.js +4 -4
  267. package/dist/menu/MenuItemCheckbox.js.map +1 -1
  268. package/dist/menu/MenuItemCircularProgress.d.ts +3 -2
  269. package/dist/menu/MenuItemCircularProgress.js +3 -4
  270. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  271. package/dist/menu/MenuItemFileInput.d.ts +2 -2
  272. package/dist/menu/MenuItemFileInput.js +3 -4
  273. package/dist/menu/MenuItemFileInput.js.map +1 -1
  274. package/dist/menu/MenuItemGroup.d.ts +3 -3
  275. package/dist/menu/MenuItemGroup.js +4 -4
  276. package/dist/menu/MenuItemGroup.js.map +1 -1
  277. package/dist/menu/MenuItemInputToggle.d.ts +3 -2
  278. package/dist/menu/MenuItemInputToggle.js +3 -4
  279. package/dist/menu/MenuItemInputToggle.js.map +1 -1
  280. package/dist/menu/MenuItemRadio.d.ts +3 -1
  281. package/dist/menu/MenuItemRadio.js +4 -4
  282. package/dist/menu/MenuItemRadio.js.map +1 -1
  283. package/dist/menu/MenuItemSeparator.d.ts +3 -2
  284. package/dist/menu/MenuItemSeparator.js +3 -4
  285. package/dist/menu/MenuItemSeparator.js.map +1 -1
  286. package/dist/menu/MenuItemSwitch.d.ts +2 -1
  287. package/dist/menu/MenuItemSwitch.js +4 -4
  288. package/dist/menu/MenuItemSwitch.js.map +1 -1
  289. package/dist/menu/MenuItemTextField.d.ts +2 -2
  290. package/dist/menu/MenuItemTextField.js +3 -4
  291. package/dist/menu/MenuItemTextField.js.map +1 -1
  292. package/dist/menu/MenuVisibilityProvider.d.ts +3 -3
  293. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  294. package/dist/menu/MenuWidget.d.ts +4 -4
  295. package/dist/menu/MenuWidget.js +4 -4
  296. package/dist/menu/MenuWidget.js.map +1 -1
  297. package/dist/menu/useContextMenu.d.ts +4 -4
  298. package/dist/menu/useContextMenu.js.map +1 -1
  299. package/dist/movement/types.d.ts +5 -5
  300. package/dist/movement/types.js.map +1 -1
  301. package/dist/navigation/CollapsibleNavGroup.d.ts +2 -2
  302. package/dist/navigation/CollapsibleNavGroup.js +3 -4
  303. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  304. package/dist/navigation/NavGroup.d.ts +3 -2
  305. package/dist/navigation/NavGroup.js +3 -4
  306. package/dist/navigation/NavGroup.js.map +1 -1
  307. package/dist/navigation/NavItem.d.ts +3 -2
  308. package/dist/navigation/NavItem.js +3 -4
  309. package/dist/navigation/NavItem.js.map +1 -1
  310. package/dist/navigation/NavItemButton.d.ts +2 -2
  311. package/dist/navigation/NavItemButton.js +3 -4
  312. package/dist/navigation/NavItemButton.js.map +1 -1
  313. package/dist/navigation/NavItemLink.d.ts +3 -2
  314. package/dist/navigation/NavItemLink.js +4 -4
  315. package/dist/navigation/NavItemLink.js.map +1 -1
  316. package/dist/navigation/NavSubheader.d.ts +2 -1
  317. package/dist/navigation/NavSubheader.js +3 -4
  318. package/dist/navigation/NavSubheader.js.map +1 -1
  319. package/dist/navigation/Navigation.d.ts +1 -1
  320. package/dist/navigation/Navigation.js +1 -1
  321. package/dist/navigation/Navigation.js.map +1 -1
  322. package/dist/navigation/types.d.ts +5 -2
  323. package/dist/navigation/types.js.map +1 -1
  324. package/dist/navigation/useActiveHeadingId.js +1 -1
  325. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  326. package/dist/overlay/Overlay.d.ts +3 -2
  327. package/dist/overlay/Overlay.js +3 -4
  328. package/dist/overlay/Overlay.js.map +1 -1
  329. package/dist/positioning/useFixedPositioning.d.ts +1 -1
  330. package/dist/positioning/useFixedPositioning.js.map +1 -1
  331. package/dist/progress/CircularProgress.d.ts +2 -2
  332. package/dist/progress/CircularProgress.js +4 -4
  333. package/dist/progress/CircularProgress.js.map +1 -1
  334. package/dist/progress/LinearProgress.d.ts +2 -2
  335. package/dist/progress/LinearProgress.js +4 -4
  336. package/dist/progress/LinearProgress.js.map +1 -1
  337. package/dist/progress/types.d.ts +2 -0
  338. package/dist/progress/types.js.map +1 -1
  339. package/dist/responsive-item/ResponsiveItem.d.ts +3 -2
  340. package/dist/responsive-item/ResponsiveItem.js +3 -4
  341. package/dist/responsive-item/ResponsiveItem.js.map +1 -1
  342. package/dist/responsive-item/ResponsiveItemOverlay.d.ts +3 -2
  343. package/dist/responsive-item/ResponsiveItemOverlay.js +3 -4
  344. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  345. package/dist/segmented-button/SegmentedButton.d.ts +3 -2
  346. package/dist/segmented-button/SegmentedButton.js +3 -4
  347. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  348. package/dist/segmented-button/SegmentedButtonContainer.d.ts +4 -3
  349. package/dist/segmented-button/SegmentedButtonContainer.js +4 -5
  350. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  351. package/dist/sheet/Sheet.d.ts +2 -1
  352. package/dist/sheet/Sheet.js +3 -4
  353. package/dist/sheet/Sheet.js.map +1 -1
  354. package/dist/snackbar/Snackbar.d.ts +3 -2
  355. package/dist/snackbar/Snackbar.js +3 -4
  356. package/dist/snackbar/Snackbar.js.map +1 -1
  357. package/dist/snackbar/Toast.d.ts +3 -2
  358. package/dist/snackbar/Toast.js +4 -4
  359. package/dist/snackbar/Toast.js.map +1 -1
  360. package/dist/snackbar/ToastActionButton.d.ts +2 -1
  361. package/dist/snackbar/ToastActionButton.js +3 -4
  362. package/dist/snackbar/ToastActionButton.js.map +1 -1
  363. package/dist/snackbar/ToastCloseButton.d.ts +2 -1
  364. package/dist/snackbar/ToastCloseButton.js +3 -4
  365. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  366. package/dist/snackbar/ToastContent.d.ts +3 -2
  367. package/dist/snackbar/ToastContent.js +4 -4
  368. package/dist/snackbar/ToastContent.js.map +1 -1
  369. package/dist/spinbutton/SpinButton.d.ts +4 -3
  370. package/dist/spinbutton/SpinButton.js +3 -4
  371. package/dist/spinbutton/SpinButton.js.map +1 -1
  372. package/dist/spinbutton/types.d.ts +1 -1
  373. package/dist/spinbutton/types.js.map +1 -1
  374. package/dist/table/StickyTableSection.d.ts +3 -2
  375. package/dist/table/StickyTableSection.js +3 -4
  376. package/dist/table/StickyTableSection.js.map +1 -1
  377. package/dist/table/Table.d.ts +3 -2
  378. package/dist/table/Table.js +4 -4
  379. package/dist/table/Table.js.map +1 -1
  380. package/dist/table/TableBody.d.ts +3 -2
  381. package/dist/table/TableBody.js +4 -4
  382. package/dist/table/TableBody.js.map +1 -1
  383. package/dist/table/TableCell.d.ts +3 -2
  384. package/dist/table/TableCell.js +3 -4
  385. package/dist/table/TableCell.js.map +1 -1
  386. package/dist/table/TableCellContent.d.ts +3 -2
  387. package/dist/table/TableCellContent.js +3 -4
  388. package/dist/table/TableCellContent.js.map +1 -1
  389. package/dist/table/TableCheckbox.d.ts +3 -2
  390. package/dist/table/TableCheckbox.js +3 -4
  391. package/dist/table/TableCheckbox.js.map +1 -1
  392. package/dist/table/TableContainer.d.ts +5 -3
  393. package/dist/table/TableContainer.js +4 -4
  394. package/dist/table/TableContainer.js.map +1 -1
  395. package/dist/table/TableContainerProvider.d.ts +1 -1
  396. package/dist/table/TableContainerProvider.js.map +1 -1
  397. package/dist/table/TableFooter.d.ts +3 -2
  398. package/dist/table/TableFooter.js +4 -5
  399. package/dist/table/TableFooter.js.map +1 -1
  400. package/dist/table/TableHeader.d.ts +3 -2
  401. package/dist/table/TableHeader.js +4 -5
  402. package/dist/table/TableHeader.js.map +1 -1
  403. package/dist/table/TableRadio.d.ts +3 -2
  404. package/dist/table/TableRadio.js +3 -4
  405. package/dist/table/TableRadio.js.map +1 -1
  406. package/dist/table/TableRow.d.ts +3 -2
  407. package/dist/table/TableRow.js +3 -4
  408. package/dist/table/TableRow.js.map +1 -1
  409. package/dist/tabs/SimpleTabPanel.d.ts +3 -2
  410. package/dist/tabs/SimpleTabPanel.js +3 -4
  411. package/dist/tabs/SimpleTabPanel.js.map +1 -1
  412. package/dist/tabs/SimpleTabPanels.d.ts +3 -2
  413. package/dist/tabs/SimpleTabPanels.js +3 -4
  414. package/dist/tabs/SimpleTabPanels.js.map +1 -1
  415. package/dist/tabs/TabList.d.ts +3 -2
  416. package/dist/tabs/TabList.js +4 -4
  417. package/dist/tabs/TabList.js.map +1 -1
  418. package/dist/tabs/TabListScrollButton.d.ts +3 -2
  419. package/dist/tabs/TabListScrollButton.js +4 -4
  420. package/dist/tabs/TabListScrollButton.js.map +1 -1
  421. package/dist/tabs/useTabList.d.ts +2 -2
  422. package/dist/tabs/useTabList.js.map +1 -1
  423. package/dist/theme/useCSSVariables.d.ts +1 -1
  424. package/dist/theme/useCSSVariables.js.map +1 -1
  425. package/dist/tooltip/Tooltip.d.ts +3 -2
  426. package/dist/tooltip/Tooltip.js +3 -4
  427. package/dist/tooltip/Tooltip.js.map +1 -1
  428. package/dist/tooltip/useTooltip.d.ts +3 -3
  429. package/dist/tooltip/useTooltip.js.map +1 -1
  430. package/dist/transition/SkeletonPlaceholder.d.ts +3 -2
  431. package/dist/transition/SkeletonPlaceholder.js +3 -4
  432. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  433. package/dist/transition/Slide.d.ts +3 -2
  434. package/dist/transition/Slide.js +3 -4
  435. package/dist/transition/Slide.js.map +1 -1
  436. package/dist/transition/SlideContainer.d.ts +3 -2
  437. package/dist/transition/SlideContainer.js +3 -4
  438. package/dist/transition/SlideContainer.js.map +1 -1
  439. package/dist/tree/TreeGroup.d.ts +2 -2
  440. package/dist/tree/TreeGroup.js +3 -4
  441. package/dist/tree/TreeGroup.js.map +1 -1
  442. package/dist/tree/TreeProvider.d.ts +2 -3
  443. package/dist/tree/TreeProvider.js.map +1 -1
  444. package/dist/tree/useTreeMovement.d.ts +6 -7
  445. package/dist/tree/useTreeMovement.js.map +1 -1
  446. package/dist/types.d.ts +1 -15
  447. package/dist/types.js.map +1 -1
  448. package/dist/typography/Mark.d.ts +3 -2
  449. package/dist/typography/Mark.js +3 -4
  450. package/dist/typography/Mark.js.map +1 -1
  451. package/dist/typography/SrOnly.d.ts +3 -2
  452. package/dist/typography/SrOnly.js +3 -4
  453. package/dist/typography/SrOnly.js.map +1 -1
  454. package/dist/typography/TextContainer.d.ts +3 -2
  455. package/dist/typography/TextContainer.js +3 -4
  456. package/dist/typography/TextContainer.js.map +1 -1
  457. package/dist/typography/Typography.d.ts +3 -2
  458. package/dist/typography/Typography.js +3 -4
  459. package/dist/typography/Typography.js.map +1 -1
  460. package/dist/useAsyncFunction.d.ts +3 -2
  461. package/dist/useAsyncFunction.js.map +1 -1
  462. package/dist/useDebouncedFunction.js +1 -1
  463. package/dist/useDebouncedFunction.js.map +1 -1
  464. package/dist/useDropzone.js +1 -1
  465. package/dist/useDropzone.js.map +1 -1
  466. package/dist/useEnsuredRef.d.ts +3 -3
  467. package/dist/useEnsuredRef.js +1 -1
  468. package/dist/useEnsuredRef.js.map +1 -1
  469. package/dist/useThrottledFunction.js +3 -3
  470. package/dist/useThrottledFunction.js.map +1 -1
  471. package/dist/useUnmounted.d.ts +2 -2
  472. package/dist/useUnmounted.js.map +1 -1
  473. package/dist/utils/applyRef.d.ts +1 -1
  474. package/dist/utils/applyRef.js.map +1 -1
  475. package/dist/window-splitter/WindowSplitter.d.ts +3 -2
  476. package/dist/window-splitter/WindowSplitter.js +3 -4
  477. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  478. package/package.json +9 -9
  479. package/src/app-bar/AppBar.tsx +54 -54
  480. package/src/app-bar/AppBarTitle.tsx +29 -27
  481. package/src/autocomplete/AutocompleteChip.tsx +4 -6
  482. package/src/autocomplete/types.ts +2 -0
  483. package/src/autocomplete/utils.ts +4 -4
  484. package/src/avatar/Avatar.tsx +47 -45
  485. package/src/badge/Badge.tsx +17 -11
  486. package/src/box/Box.tsx +51 -50
  487. package/src/button/AsyncButton.tsx +125 -119
  488. package/src/button/Button.tsx +74 -73
  489. package/src/button/ButtonUnstyled.tsx +9 -9
  490. package/src/button/FloatingActionButton.tsx +9 -7
  491. package/src/button/TooltippedButton.tsx +6 -6
  492. package/src/card/Card.tsx +36 -35
  493. package/src/card/CardContent.tsx +31 -28
  494. package/src/card/CardFooter.tsx +22 -16
  495. package/src/card/CardHeader.tsx +36 -30
  496. package/src/card/CardSubtitle.tsx +8 -6
  497. package/src/card/CardTitle.tsx +26 -25
  498. package/src/card/ClickableCard.tsx +57 -54
  499. package/src/chip/Chip.tsx +122 -120
  500. package/src/datetime/NativeDateField.tsx +7 -7
  501. package/src/datetime/NativeTimeField.tsx +7 -7
  502. package/src/dialog/Dialog.tsx +156 -150
  503. package/src/dialog/DialogContainer.tsx +35 -29
  504. package/src/dialog/DialogContent.tsx +26 -19
  505. package/src/dialog/DialogFooter.tsx +22 -19
  506. package/src/dialog/DialogHeader.tsx +24 -23
  507. package/src/dialog/DialogTitle.tsx +27 -26
  508. package/src/dialog/FixedDialog.tsx +70 -69
  509. package/src/divider/Divider.tsx +32 -26
  510. package/src/draggable/useDraggable.ts +3 -6
  511. package/src/draggable/utils.ts +1 -1
  512. package/src/expansion-panel/ExpansionList.tsx +24 -19
  513. package/src/expansion-panel/ExpansionPanel.tsx +11 -6
  514. package/src/expansion-panel/ExpansionPanelHeader.tsx +9 -6
  515. package/src/files/FileInput.tsx +79 -79
  516. package/src/focus/useFocusContainer.ts +1 -1
  517. package/src/form/Checkbox.tsx +6 -6
  518. package/src/form/Fieldset.tsx +33 -28
  519. package/src/form/Form.tsx +26 -25
  520. package/src/form/FormMessage.tsx +13 -7
  521. package/src/form/FormMessageContainer.tsx +12 -9
  522. package/src/form/FormMessageCounter.tsx +8 -7
  523. package/src/form/InputToggle.tsx +105 -107
  524. package/src/form/InputToggleIcon.tsx +12 -6
  525. package/src/form/Label.tsx +40 -41
  526. package/src/form/Legend.tsx +44 -43
  527. package/src/form/NativeSelect.tsx +116 -114
  528. package/src/form/OptGroup.tsx +15 -15
  529. package/src/form/Option.tsx +123 -122
  530. package/src/form/Password.tsx +66 -67
  531. package/src/form/Radio.tsx +6 -6
  532. package/src/form/ResizingTextAreaWrapper.tsx +7 -6
  533. package/src/form/SliderContainer.tsx +35 -29
  534. package/src/form/SliderThumb.tsx +8 -6
  535. package/src/form/SliderTrack.tsx +80 -80
  536. package/src/form/Switch.tsx +80 -79
  537. package/src/form/SwitchTrack.tsx +35 -34
  538. package/src/form/TextArea.tsx +167 -165
  539. package/src/form/TextField.tsx +106 -104
  540. package/src/form/TextFieldAddon.tsx +33 -32
  541. package/src/form/TextFieldContainer.tsx +8 -6
  542. package/src/form/sliderUtils.ts +1 -1
  543. package/src/form/types.ts +15 -5
  544. package/src/form/useCombobox.ts +6 -10
  545. package/src/form/useFormReset.ts +1 -1
  546. package/src/form/useTextField.ts +4 -4
  547. package/src/hoverMode/useHoverMode.ts +1 -1
  548. package/src/hoverMode/useHoverModeProvider.ts +13 -8
  549. package/src/icon/FontIcon.tsx +32 -30
  550. package/src/icon/IconRotator.tsx +30 -28
  551. package/src/icon/MaterialIcon.tsx +36 -30
  552. package/src/icon/MaterialSymbol.tsx +50 -44
  553. package/src/icon/SVGIcon.tsx +47 -41
  554. package/src/layout/LayoutAppBar.tsx +23 -28
  555. package/src/layout/LayoutNav.tsx +68 -62
  556. package/src/layout/LayoutWindowSplitter.tsx +9 -7
  557. package/src/layout/Main.tsx +30 -29
  558. package/src/link/Link.tsx +16 -11
  559. package/src/link/SkipToMainContent.tsx +6 -6
  560. package/src/list/List.tsx +31 -29
  561. package/src/list/ListItem.tsx +126 -125
  562. package/src/list/ListItemLink.tsx +128 -126
  563. package/src/list/ListItemText.tsx +42 -37
  564. package/src/list/ListSubheader.tsx +27 -26
  565. package/src/menu/DropdownMenu.tsx +2 -2
  566. package/src/menu/Menu.tsx +327 -326
  567. package/src/menu/MenuBar.tsx +51 -50
  568. package/src/menu/MenuButton.tsx +69 -70
  569. package/src/menu/MenuItem.tsx +37 -37
  570. package/src/menu/MenuItemButton.tsx +132 -133
  571. package/src/menu/MenuItemCheckbox.tsx +6 -7
  572. package/src/menu/MenuItemCircularProgress.tsx +13 -6
  573. package/src/menu/MenuItemFileInput.tsx +4 -6
  574. package/src/menu/MenuItemGroup.tsx +18 -18
  575. package/src/menu/MenuItemInputToggle.tsx +8 -6
  576. package/src/menu/MenuItemRadio.tsx +6 -6
  577. package/src/menu/MenuItemSeparator.tsx +7 -7
  578. package/src/menu/MenuItemSwitch.tsx +6 -6
  579. package/src/menu/MenuItemTextField.tsx +5 -7
  580. package/src/menu/MenuVisibilityProvider.tsx +3 -2
  581. package/src/menu/MenuWidget.tsx +123 -119
  582. package/src/menu/useContextMenu.ts +7 -4
  583. package/src/movement/types.ts +5 -9
  584. package/src/navigation/CollapsibleNavGroup.tsx +10 -6
  585. package/src/navigation/NavGroup.tsx +18 -19
  586. package/src/navigation/NavItem.tsx +16 -11
  587. package/src/navigation/NavItemButton.tsx +69 -66
  588. package/src/navigation/NavItemLink.tsx +102 -100
  589. package/src/navigation/NavSubheader.tsx +14 -16
  590. package/src/navigation/Navigation.tsx +1 -1
  591. package/src/navigation/types.ts +13 -4
  592. package/src/navigation/useActiveHeadingId.ts +1 -1
  593. package/src/overlay/Overlay.tsx +66 -65
  594. package/src/positioning/useFixedPositioning.ts +1 -1
  595. package/src/progress/CircularProgress.tsx +6 -6
  596. package/src/progress/LinearProgress.tsx +6 -6
  597. package/src/progress/types.ts +4 -0
  598. package/src/responsive-item/ResponsiveItem.tsx +29 -28
  599. package/src/responsive-item/ResponsiveItemOverlay.tsx +9 -8
  600. package/src/segmented-button/SegmentedButton.tsx +11 -6
  601. package/src/segmented-button/SegmentedButtonContainer.tsx +14 -8
  602. package/src/sheet/Sheet.tsx +42 -43
  603. package/src/snackbar/Snackbar.tsx +44 -38
  604. package/src/snackbar/Toast.tsx +110 -109
  605. package/src/snackbar/ToastActionButton.tsx +6 -6
  606. package/src/snackbar/ToastCloseButton.tsx +4 -6
  607. package/src/snackbar/ToastContent.tsx +56 -49
  608. package/src/spinbutton/SpinButton.tsx +9 -8
  609. package/src/spinbutton/types.ts +1 -1
  610. package/src/table/StickyTableSection.tsx +8 -6
  611. package/src/table/Table.tsx +47 -41
  612. package/src/table/TableBody.tsx +46 -42
  613. package/src/table/TableCell.tsx +83 -81
  614. package/src/table/TableCellContent.tsx +11 -6
  615. package/src/table/TableCheckbox.tsx +6 -6
  616. package/src/table/TableContainer.tsx +31 -26
  617. package/src/table/TableContainerProvider.ts +1 -1
  618. package/src/table/TableFooter.tsx +7 -12
  619. package/src/table/TableHeader.tsx +15 -9
  620. package/src/table/TableRadio.tsx +59 -58
  621. package/src/table/TableRow.tsx +34 -33
  622. package/src/tabs/SimpleTabPanel.tsx +18 -13
  623. package/src/tabs/SimpleTabPanels.tsx +11 -7
  624. package/src/tabs/TabList.tsx +106 -105
  625. package/src/tabs/TabListScrollButton.tsx +9 -6
  626. package/src/tabs/useTabList.ts +2 -2
  627. package/src/theme/useCSSVariables.ts +1 -1
  628. package/src/tooltip/Tooltip.tsx +61 -61
  629. package/src/tooltip/useTooltip.ts +2 -3
  630. package/src/transition/SkeletonPlaceholder.tsx +8 -6
  631. package/src/transition/Slide.tsx +54 -48
  632. package/src/transition/SlideContainer.tsx +16 -16
  633. package/src/tree/TreeGroup.tsx +54 -55
  634. package/src/tree/TreeProvider.tsx +2 -2
  635. package/src/tree/useTreeMovement.ts +6 -6
  636. package/src/types.ts +1 -16
  637. package/src/typography/Mark.tsx +16 -11
  638. package/src/typography/SrOnly.tsx +41 -35
  639. package/src/typography/TextContainer.tsx +12 -12
  640. package/src/typography/Typography.tsx +42 -41
  641. package/src/useAsyncFunction.ts +3 -3
  642. package/src/useDebouncedFunction.ts +1 -1
  643. package/src/useDropzone.ts +1 -1
  644. package/src/useEnsuredRef.ts +3 -3
  645. package/src/useThrottledFunction.ts +3 -3
  646. package/src/useUnmounted.ts +2 -4
  647. package/src/utils/applyRef.ts +2 -2
  648. package/src/window-splitter/WindowSplitter.tsx +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/focus/useFocusContainer.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEventHandler,\n type Ref,\n type RefObject,\n useEffect,\n useRef,\n} from \"react\";\n\nimport { getTransitionCallbacks } from \"../transition/getTransitionCallbacks.js\";\nimport { type TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport {\n type FocusElementWithinType,\n focusElementWithin,\n getFocusableElements,\n} from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * `\"mount\"` - this will attempt to focus the container element if:\n * - there is no `document.activeElement`\n * - the container element does not contain the `document.activeElement`\n *\n * `\"unmount\"` - attempts to re-focus the element that was focused before the\n * focus container became active. The previous focus element is captured\n * whenever the `activate` option on the `useFocusContainer` hook is set to\n * `true`. This is normally when an element becomes `visible`.\n *\n * `\"keyboard\"` - refocuses the first focusable element if pressing `Tab` would\n * move the focus outside of the container element. If `Shift + Tab` was used,\n * the last focusable element will be used instead.\n *\n * @since 6.0.0\n */\nexport type FocusType = \"mount\" | \"unmount\" | \"keyboard\";\n\n/**\n * @since 6.0.0\n * @deprecated Use `TransitionCallbacks` instead.\n */\nexport type FocusContainerTransitionCallbacks = TransitionCallbacks;\n\n/**\n * @since 6.0.0\n * @since 6.3.2 Fixed by extending `TransitionCallbacks` after the\n * `onEnteredOnce` and `onExitedOnce` support was added to CSS transitions.\n */\nexport interface FocusContainerTransitionOptions<\n E extends HTMLElement,\n> extends TransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link FocusContainerImplementation.nodeRef}\n */\n nodeRef?: Ref<E>;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerEventHandlers<E extends HTMLElement> {\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type IsFocusTypeDisabled = (type: FocusType) => boolean;\n\nexport interface FocusContainerComponentProps {\n /**\n * @defaultValue `() => false`\n */\n isFocusTypeDisabled?: IsFocusTypeDisabled;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerOptions<E extends HTMLElement>\n extends FocusContainerTransitionOptions<E>, FocusContainerComponentProps {\n onKeyDown?: KeyboardEventHandler<E>;\n /**\n * This to `true` will capture the current focused element as a focus target\n * once the `onExited` hook is fired. This should usually be set to the\n * `transitionIn` prop for `useTransition`.\n */\n activate: boolean;\n\n /**\n * Set this to true if elements that can be programmatically focused should be\n * included. These would be elements with a `tabIndex={-1}`.\n *\n * @defaultValue `false`\n */\n programmatic?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerImplementation<E extends HTMLElement> {\n nodeRef: RefObject<E>;\n eventHandlers: Required<FocusContainerEventHandlers<E>>;\n transitionOptions: Required<FocusContainerTransitionOptions<E>>;\n}\n\n/**\n * This hook is mostly for internal use only for dialog accessibility behavior\n * to prevent the focus from moving outside of the dialog while it is visible.\n * This API was developed to be used with the `useCSSTransition`/`useTransition`\n * hooks as well.\n *\n * @example Main Usage\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\"\n * import { useFocusContainer } from \"@react-md/core/focus/useFocusContainer\"\n * import { useScaleTransition } from \"@react-md/core/transition/useScaleTransition\"\n * import { useToggle } from \"@react-md/core/useToggle\"\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggled, enable, disable } = useToggle(false);\n *\n * const { eventHandlers, transitionOptions } = useFocusContainer({\n * activate: toggled,\n * });\n * const { elementProps, rendered } = useScaleTransition({\n * transitionIn: toggled,\n * temporary: true,\n * ...transitionOptions,\n * });\n *\n * return (\n * <>\n * <Button onClick={enable}>Toggle</Button>\n * {rendered && (\n * <div {...eventHandlers} {...elementProps}>\n * <Button onClick={disable}>Button 1</Button>\n * <Button onClick={disable}>Button 2</Button>\n * <Button onClick={disable}>Button 3</Button>\n * <Button onClick={disable}>Button 4</Button>\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport function useFocusContainer<E extends HTMLElement>(\n options: FocusContainerOptions<E>\n): FocusContainerImplementation<E> {\n const {\n nodeRef,\n activate,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n onKeyDown = noop,\n programmatic = false,\n disableTransition = false,\n isFocusTypeDisabled = noop,\n } = options;\n\n const [ref, refCallback] = useEnsuredRef(nodeRef);\n const prevFocus = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!activate || !(document.activeElement instanceof HTMLElement)) {\n return;\n }\n\n prevFocus.current = document.activeElement;\n }, [activate]);\n\n return {\n nodeRef: ref,\n transitionOptions: {\n nodeRef: refCallback,\n ...getTransitionCallbacks({\n onEnter,\n onEnterOnce: () => {\n const instance = ref.current;\n if (\n instance &&\n !isFocusTypeDisabled(\"mount\") &&\n (!document.activeElement ||\n !instance.contains(document.activeElement))\n ) {\n instance.focus();\n }\n },\n onEntering,\n onEntered,\n onExitOnce: () => {\n if (isFocusTypeDisabled(\"unmount\")) {\n return;\n }\n\n // For some reason, the `\"Enter\"` keydown event fires at a different timing\n // than the Space keydown event.\n globalThis.requestAnimationFrame(() => {\n prevFocus.current?.focus();\n });\n },\n onExit,\n onExiting,\n onExited,\n disableTransition,\n }),\n },\n eventHandlers: {\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n event.key !== \"Tab\" ||\n isFocusTypeDisabled(\"keyboard\")\n ) {\n return;\n }\n\n const { target, shiftKey, currentTarget } = event;\n const elements = getFocusableElements(currentTarget, programmatic);\n const count = elements.length;\n if (count === 0) {\n event.preventDefault();\n return;\n }\n\n // if the container element is the current focus, need to either focus\n // the first or last element so focus doesn't escape\n let type: FocusElementWithinType | undefined;\n if (\n count === 1 ||\n (!shiftKey &&\n (target === currentTarget || target === elements[count - 1]))\n ) {\n type = \"first\";\n } else if (\n shiftKey &&\n (target === currentTarget || target === elements[0])\n ) {\n type = \"last\";\n }\n\n if (type) {\n event.preventDefault();\n focusElementWithin({\n type,\n elements,\n container: currentTarget,\n });\n }\n },\n },\n };\n}\n"],"names":["useEffect","useRef","getTransitionCallbacks","useEnsuredRef","focusElementWithin","getFocusableElements","noop","useFocusContainer","options","nodeRef","activate","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","programmatic","disableTransition","isFocusTypeDisabled","ref","refCallback","prevFocus","document","activeElement","HTMLElement","current","transitionOptions","onEnterOnce","instance","contains","focus","onExitOnce","globalThis","requestAnimationFrame","eventHandlers","event","isPropagationStopped","key","target","shiftKey","currentTarget","elements","count","length","preventDefault","type","container"],"mappings":"AAAA;AAEA,SAIEA,SAAS,EACTC,MAAM,QACD,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,0CAA0C;AAEjF,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAEEC,kBAAkB,EAClBC,oBAAoB,QACf,aAAa;AAEpB,MAAMC,OAAO;AACX,aAAa;AACf;AA0FA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GACD,OAAO,SAASC,kBACdC,OAAiC;IAEjC,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,YAAYX,IAAI,EAChBY,eAAe,KAAK,EACpBC,oBAAoB,KAAK,EACzBC,sBAAsBd,IAAI,EAC3B,GAAGE;IAEJ,MAAM,CAACa,KAAKC,YAAY,GAAGnB,cAAcM;IACzC,MAAMc,YAAYtB,OAA2B;IAE7CD,UAAU;QACR,IAAI,CAACU,YAAY,CAAEc,CAAAA,SAASC,aAAa,YAAYC,WAAU,GAAI;YACjE;QACF;QAEAH,UAAUI,OAAO,GAAGH,SAASC,aAAa;IAC5C,GAAG;QAACf;KAAS;IAEb,OAAO;QACLD,SAASY;QACTO,mBAAmB;YACjBnB,SAASa;YACT,GAAGpB,uBAAuB;gBACxBS;gBACAkB,aAAa;oBACX,MAAMC,WAAWT,IAAIM,OAAO;oBAC5B,IACEG,YACA,CAACV,oBAAoB,YACpB,CAAA,CAACI,SAASC,aAAa,IACtB,CAACK,SAASC,QAAQ,CAACP,SAASC,aAAa,CAAA,GAC3C;wBACAK,SAASE,KAAK;oBAChB;gBACF;gBACApB;gBACAC;gBACAoB,YAAY;oBACV,IAAIb,oBAAoB,YAAY;wBAClC;oBACF;oBAEA,2EAA2E;oBAC3E,iCAAiC;oBACjCc,WAAWC,qBAAqB,CAAC;wBAC/BZ,UAAUI,OAAO,EAAEK;oBACrB;gBACF;gBACAlB;gBACAC;gBACAC;gBACAG;YACF,EAAE;QACJ;QACAiB,eAAe;YACbnB,WAAUoB,KAAK;gBACbpB,UAAUoB;gBACV,IACEA,MAAMC,oBAAoB,MAC1BD,MAAME,GAAG,KAAK,SACdnB,oBAAoB,aACpB;oBACA;gBACF;gBAEA,MAAM,EAAEoB,MAAM,EAAEC,QAAQ,EAAEC,aAAa,EAAE,GAAGL;gBAC5C,MAAMM,WAAWtC,qBAAqBqC,eAAexB;gBACrD,MAAM0B,QAAQD,SAASE,MAAM;gBAC7B,IAAID,UAAU,GAAG;oBACfP,MAAMS,cAAc;oBACpB;gBACF;gBAEA,sEAAsE;gBACtE,oDAAoD;gBACpD,IAAIC;gBACJ,IACEH,UAAU,KACT,CAACH,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAACC,QAAQ,EAAE,AAAD,GAC5D;oBACAG,OAAO;gBACT,OAAO,IACLN,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAAC,EAAE,AAAD,GAClD;oBACAI,OAAO;gBACT;gBAEA,IAAIA,MAAM;oBACRV,MAAMS,cAAc;oBACpB1C,mBAAmB;wBACjB2C;wBACAJ;wBACAK,WAAWN;oBACb;gBACF;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/focus/useFocusContainer.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEventHandler,\n type Ref,\n type RefObject,\n useEffect,\n useRef,\n} from \"react\";\n\nimport { getTransitionCallbacks } from \"../transition/getTransitionCallbacks.js\";\nimport { type TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport {\n type FocusElementWithinType,\n focusElementWithin,\n getFocusableElements,\n} from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * `\"mount\"` - this will attempt to focus the container element if:\n * - there is no `document.activeElement`\n * - the container element does not contain the `document.activeElement`\n *\n * `\"unmount\"` - attempts to re-focus the element that was focused before the\n * focus container became active. The previous focus element is captured\n * whenever the `activate` option on the `useFocusContainer` hook is set to\n * `true`. This is normally when an element becomes `visible`.\n *\n * `\"keyboard\"` - refocuses the first focusable element if pressing `Tab` would\n * move the focus outside of the container element. If `Shift + Tab` was used,\n * the last focusable element will be used instead.\n *\n * @since 6.0.0\n */\nexport type FocusType = \"mount\" | \"unmount\" | \"keyboard\";\n\n/**\n * @since 6.0.0\n * @deprecated Use `TransitionCallbacks` instead.\n */\nexport type FocusContainerTransitionCallbacks = TransitionCallbacks;\n\n/**\n * @since 6.0.0\n * @since 6.3.2 Fixed by extending `TransitionCallbacks` after the\n * `onEnteredOnce` and `onExitedOnce` support was added to CSS transitions.\n */\nexport interface FocusContainerTransitionOptions<\n E extends HTMLElement,\n> extends TransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link FocusContainerImplementation.nodeRef}\n */\n nodeRef?: Ref<E>;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerEventHandlers<E extends HTMLElement> {\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type IsFocusTypeDisabled = (type: FocusType) => boolean;\n\nexport interface FocusContainerComponentProps {\n /**\n * @defaultValue `() => false`\n */\n isFocusTypeDisabled?: IsFocusTypeDisabled;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerOptions<E extends HTMLElement>\n extends FocusContainerTransitionOptions<E>, FocusContainerComponentProps {\n onKeyDown?: KeyboardEventHandler<E>;\n /**\n * This to `true` will capture the current focused element as a focus target\n * once the `onExited` hook is fired. This should usually be set to the\n * `transitionIn` prop for `useTransition`.\n */\n activate: boolean;\n\n /**\n * Set this to true if elements that can be programmatically focused should be\n * included. These would be elements with a `tabIndex={-1}`.\n *\n * @defaultValue `false`\n */\n programmatic?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface FocusContainerImplementation<E extends HTMLElement> {\n nodeRef: RefObject<E | null>;\n eventHandlers: Required<FocusContainerEventHandlers<E>>;\n transitionOptions: Required<FocusContainerTransitionOptions<E>>;\n}\n\n/**\n * This hook is mostly for internal use only for dialog accessibility behavior\n * to prevent the focus from moving outside of the dialog while it is visible.\n * This API was developed to be used with the `useCSSTransition`/`useTransition`\n * hooks as well.\n *\n * @example Main Usage\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\"\n * import { useFocusContainer } from \"@react-md/core/focus/useFocusContainer\"\n * import { useScaleTransition } from \"@react-md/core/transition/useScaleTransition\"\n * import { useToggle } from \"@react-md/core/useToggle\"\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggled, enable, disable } = useToggle(false);\n *\n * const { eventHandlers, transitionOptions } = useFocusContainer({\n * activate: toggled,\n * });\n * const { elementProps, rendered } = useScaleTransition({\n * transitionIn: toggled,\n * temporary: true,\n * ...transitionOptions,\n * });\n *\n * return (\n * <>\n * <Button onClick={enable}>Toggle</Button>\n * {rendered && (\n * <div {...eventHandlers} {...elementProps}>\n * <Button onClick={disable}>Button 1</Button>\n * <Button onClick={disable}>Button 2</Button>\n * <Button onClick={disable}>Button 3</Button>\n * <Button onClick={disable}>Button 4</Button>\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport function useFocusContainer<E extends HTMLElement>(\n options: FocusContainerOptions<E>\n): FocusContainerImplementation<E> {\n const {\n nodeRef,\n activate,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n onKeyDown = noop,\n programmatic = false,\n disableTransition = false,\n isFocusTypeDisabled = noop,\n } = options;\n\n const [ref, refCallback] = useEnsuredRef(nodeRef);\n const prevFocus = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!activate || !(document.activeElement instanceof HTMLElement)) {\n return;\n }\n\n prevFocus.current = document.activeElement;\n }, [activate]);\n\n return {\n nodeRef: ref,\n transitionOptions: {\n nodeRef: refCallback,\n ...getTransitionCallbacks({\n onEnter,\n onEnterOnce: () => {\n const instance = ref.current;\n if (\n instance &&\n !isFocusTypeDisabled(\"mount\") &&\n (!document.activeElement ||\n !instance.contains(document.activeElement))\n ) {\n instance.focus();\n }\n },\n onEntering,\n onEntered,\n onExitOnce: () => {\n if (isFocusTypeDisabled(\"unmount\")) {\n return;\n }\n\n // For some reason, the `\"Enter\"` keydown event fires at a different timing\n // than the Space keydown event.\n globalThis.requestAnimationFrame(() => {\n prevFocus.current?.focus();\n });\n },\n onExit,\n onExiting,\n onExited,\n disableTransition,\n }),\n },\n eventHandlers: {\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n event.key !== \"Tab\" ||\n isFocusTypeDisabled(\"keyboard\")\n ) {\n return;\n }\n\n const { target, shiftKey, currentTarget } = event;\n const elements = getFocusableElements(currentTarget, programmatic);\n const count = elements.length;\n if (count === 0) {\n event.preventDefault();\n return;\n }\n\n // if the container element is the current focus, need to either focus\n // the first or last element so focus doesn't escape\n let type: FocusElementWithinType | undefined;\n if (\n count === 1 ||\n (!shiftKey &&\n (target === currentTarget || target === elements[count - 1]))\n ) {\n type = \"first\";\n } else if (\n shiftKey &&\n (target === currentTarget || target === elements[0])\n ) {\n type = \"last\";\n }\n\n if (type) {\n event.preventDefault();\n focusElementWithin({\n type,\n elements,\n container: currentTarget,\n });\n }\n },\n },\n };\n}\n"],"names":["useEffect","useRef","getTransitionCallbacks","useEnsuredRef","focusElementWithin","getFocusableElements","noop","useFocusContainer","options","nodeRef","activate","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","programmatic","disableTransition","isFocusTypeDisabled","ref","refCallback","prevFocus","document","activeElement","HTMLElement","current","transitionOptions","onEnterOnce","instance","contains","focus","onExitOnce","globalThis","requestAnimationFrame","eventHandlers","event","isPropagationStopped","key","target","shiftKey","currentTarget","elements","count","length","preventDefault","type","container"],"mappings":"AAAA;AAEA,SAIEA,SAAS,EACTC,MAAM,QACD,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,0CAA0C;AAEjF,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAEEC,kBAAkB,EAClBC,oBAAoB,QACf,aAAa;AAEpB,MAAMC,OAAO;AACX,aAAa;AACf;AA0FA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GACD,OAAO,SAASC,kBACdC,OAAiC;IAEjC,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,YAAYX,IAAI,EAChBY,eAAe,KAAK,EACpBC,oBAAoB,KAAK,EACzBC,sBAAsBd,IAAI,EAC3B,GAAGE;IAEJ,MAAM,CAACa,KAAKC,YAAY,GAAGnB,cAAcM;IACzC,MAAMc,YAAYtB,OAA2B;IAE7CD,UAAU;QACR,IAAI,CAACU,YAAY,CAAEc,CAAAA,SAASC,aAAa,YAAYC,WAAU,GAAI;YACjE;QACF;QAEAH,UAAUI,OAAO,GAAGH,SAASC,aAAa;IAC5C,GAAG;QAACf;KAAS;IAEb,OAAO;QACLD,SAASY;QACTO,mBAAmB;YACjBnB,SAASa;YACT,GAAGpB,uBAAuB;gBACxBS;gBACAkB,aAAa;oBACX,MAAMC,WAAWT,IAAIM,OAAO;oBAC5B,IACEG,YACA,CAACV,oBAAoB,YACpB,CAAA,CAACI,SAASC,aAAa,IACtB,CAACK,SAASC,QAAQ,CAACP,SAASC,aAAa,CAAA,GAC3C;wBACAK,SAASE,KAAK;oBAChB;gBACF;gBACApB;gBACAC;gBACAoB,YAAY;oBACV,IAAIb,oBAAoB,YAAY;wBAClC;oBACF;oBAEA,2EAA2E;oBAC3E,iCAAiC;oBACjCc,WAAWC,qBAAqB,CAAC;wBAC/BZ,UAAUI,OAAO,EAAEK;oBACrB;gBACF;gBACAlB;gBACAC;gBACAC;gBACAG;YACF,EAAE;QACJ;QACAiB,eAAe;YACbnB,WAAUoB,KAAK;gBACbpB,UAAUoB;gBACV,IACEA,MAAMC,oBAAoB,MAC1BD,MAAME,GAAG,KAAK,SACdnB,oBAAoB,aACpB;oBACA;gBACF;gBAEA,MAAM,EAAEoB,MAAM,EAAEC,QAAQ,EAAEC,aAAa,EAAE,GAAGL;gBAC5C,MAAMM,WAAWtC,qBAAqBqC,eAAexB;gBACrD,MAAM0B,QAAQD,SAASE,MAAM;gBAC7B,IAAID,UAAU,GAAG;oBACfP,MAAMS,cAAc;oBACpB;gBACF;gBAEA,sEAAsE;gBACtE,oDAAoD;gBACpD,IAAIC;gBACJ,IACEH,UAAU,KACT,CAACH,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAACC,QAAQ,EAAE,AAAD,GAC5D;oBACAG,OAAO;gBACT,OAAO,IACLN,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAAC,EAAE,AAAD,GAClD;oBACAI,OAAO;gBACT;gBAEA,IAAIA,MAAM;oBACRV,MAAMS,cAAc;oBACpB1C,mBAAmB;wBACjB2C;wBACAJ;wBACAK,WAAWN;oBACb;gBACF;YACF;QACF;IACF;AACF"}
@@ -1,3 +1,4 @@
1
+ import { type ReactElement } from "react";
1
2
  import { type CheckboxProps } from "./InputToggle.js";
2
3
  /**
3
4
  * **Client Component**
@@ -17,4 +18,4 @@ import { type CheckboxProps } from "./InputToggle.js";
17
18
  *
18
19
  * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}
19
20
  */
20
- export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
21
+ export declare function Checkbox(props: CheckboxProps): ReactElement;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import { InputToggle } from "./InputToggle.js";
4
3
  /**
5
4
  * **Client Component**
@@ -18,12 +17,13 @@ import { InputToggle } from "./InputToggle.js";
18
17
  * ```
19
18
  *
20
19
  * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}
21
- */ export const Checkbox = /*#__PURE__*/ forwardRef(function Checkbox(props, ref) {
20
+ */ export function Checkbox(props) {
21
+ const { ref, ...remaining } = props;
22
22
  return /*#__PURE__*/ _jsx(InputToggle, {
23
- ...props,
23
+ ...remaining,
24
24
  ref: ref,
25
25
  type: "checkbox"
26
26
  });
27
- });
27
+ }
28
28
 
29
29
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { type CheckboxProps, InputToggle } from \"./InputToggle.js\";\n\n/**\n * **Client Component**\n *\n * You'll generally want to use the `useCheckboxGroup` hook for managing the\n * checked state for groups of checkboxes and indeterminate checkbox behavior.\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { Checkbox } from \"@react-md/core/form/Checkbox\";\n *\n * function Example(): ReactElement {\n * return <Checkbox label=\"Checkbox\" value=\"a\" />;\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}\n */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n function Checkbox(props, ref) {\n return <InputToggle {...props} ref={ref} type=\"checkbox\" />;\n }\n);\n"],"names":["forwardRef","InputToggle","Checkbox","props","ref","type"],"mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAA6BC,WAAW,QAAQ,mBAAmB;AAEnE;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMC,yBAAWF,WACtB,SAASE,SAASC,KAAK,EAAEC,GAAG;IAC1B,qBAAO,KAACH;QAAa,GAAGE,KAAK;QAAEC,KAAKA;QAAKC,MAAK;;AAChD,GACA"}
1
+ {"version":3,"sources":["../../src/form/Checkbox.tsx"],"sourcesContent":["import { type ReactElement } from \"react\";\n\nimport { type CheckboxProps, InputToggle } from \"./InputToggle.js\";\n\n/**\n * **Client Component**\n *\n * You'll generally want to use the `useCheckboxGroup` hook for managing the\n * checked state for groups of checkboxes and indeterminate checkbox behavior.\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { Checkbox } from \"@react-md/core/form/Checkbox\";\n *\n * function Example(): ReactElement {\n * return <Checkbox label=\"Checkbox\" value=\"a\" />;\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}\n */\nexport function Checkbox(props: CheckboxProps): ReactElement {\n const { ref, ...remaining } = props;\n\n return <InputToggle {...remaining} ref={ref} type=\"checkbox\" />;\n}\n"],"names":["InputToggle","Checkbox","props","ref","remaining","type"],"mappings":";AAEA,SAA6BA,WAAW,QAAQ,mBAAmB;AAEnE;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EAAEC,GAAG,EAAE,GAAGC,WAAW,GAAGF;IAE9B,qBAAO,KAACF;QAAa,GAAGI,SAAS;QAAED,KAAKA;QAAKE,MAAK;;AACpD"}
@@ -1,4 +1,4 @@
1
- import { type FieldsetHTMLAttributes } from "react";
1
+ import { type FieldsetHTMLAttributes, type ReactElement, type Ref } from "react";
2
2
  import { type FieldsetClassNameOptions } from "./fieldsetStyles.js";
3
3
  /**
4
4
  * @since 6.0.0 Removed the `legend`, `legendStyle`,
@@ -6,6 +6,7 @@ import { type FieldsetClassNameOptions } from "./fieldsetStyles.js";
6
6
  * yourself manually instead of using a prop.
7
7
  */
8
8
  export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement>, FieldsetClassNameOptions {
9
+ ref?: Ref<HTMLFieldSetElement>;
9
10
  }
10
11
  /**
11
12
  * @example Simple Example
@@ -47,4 +48,4 @@ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElemen
47
48
  *
48
49
  * @see {@link https://react-md.dev/components/fieldset | Fieldset Demos}
49
50
  */
50
- export declare const Fieldset: import("react").ForwardRefExoticComponent<FieldsetProps & import("react").RefAttributes<HTMLFieldSetElement>>;
51
+ export declare function Fieldset(props: FieldsetProps): ReactElement;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import { fieldset } from "./fieldsetStyles.js";
4
3
  /**
5
4
  * @example Simple Example
@@ -40,8 +39,8 @@ import { fieldset } from "./fieldsetStyles.js";
40
39
  * ```
41
40
  *
42
41
  * @see {@link https://react-md.dev/components/fieldset | Fieldset Demos}
43
- */ export const Fieldset = /*#__PURE__*/ forwardRef(function Fieldset(props, ref) {
44
- const { className, fullWidth, browserStyles, floatingLegend, children, ...remaining } = props;
42
+ */ export function Fieldset(props) {
43
+ const { ref, className, fullWidth, browserStyles, floatingLegend, children, ...remaining } = props;
45
44
  return /*#__PURE__*/ _jsx("fieldset", {
46
45
  ...remaining,
47
46
  ref: ref,
@@ -53,6 +52,6 @@ import { fieldset } from "./fieldsetStyles.js";
53
52
  }),
54
53
  children: children
55
54
  });
56
- });
55
+ }
57
56
 
58
57
  //# sourceMappingURL=Fieldset.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Fieldset.tsx"],"sourcesContent":["import { type FieldsetHTMLAttributes, forwardRef } from \"react\";\n\nimport { type FieldsetClassNameOptions, fieldset } from \"./fieldsetStyles.js\";\n\n/**\n * @since 6.0.0 Removed the `legend`, `legendStyle`,\n * `legendClassName`, and `legendSROnly` props. You must provide a `Legend`\n * yourself manually instead of using a prop.\n */\nexport interface FieldsetProps\n extends\n FieldsetHTMLAttributes<HTMLFieldSetElement>,\n FieldsetClassNameOptions {}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n *\n * @example Floating Legend Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset floatingLegend>\n * <Legend floating>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n * ```\n *\n * @see {@link https://react-md.dev/components/fieldset | Fieldset Demos}\n */\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(\n function Fieldset(props, ref) {\n const {\n className,\n fullWidth,\n browserStyles,\n floatingLegend,\n children,\n ...remaining\n } = props;\n\n return (\n <fieldset\n {...remaining}\n ref={ref}\n className={fieldset({\n className,\n fullWidth,\n browserStyles,\n floatingLegend,\n })}\n >\n {children}\n </fieldset>\n );\n }\n);\n"],"names":["forwardRef","fieldset","Fieldset","props","ref","className","fullWidth","browserStyles","floatingLegend","children","remaining"],"mappings":";AAAA,SAAsCA,UAAU,QAAQ,QAAQ;AAEhE,SAAwCC,QAAQ,QAAQ,sBAAsB;AAY9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,MAAMC,yBAAWF,WACtB,SAASE,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,qBACE,KAACF;QACE,GAAGS,SAAS;QACbN,KAAKA;QACLC,WAAWJ,SAAS;YAClBI;YACAC;YACAC;YACAC;QACF;kBAECC;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/form/Fieldset.tsx"],"sourcesContent":["import {\n type FieldsetHTMLAttributes,\n type ReactElement,\n type Ref,\n} from \"react\";\n\nimport { type FieldsetClassNameOptions, fieldset } from \"./fieldsetStyles.js\";\n\n/**\n * @since 6.0.0 Removed the `legend`, `legendStyle`,\n * `legendClassName`, and `legendSROnly` props. You must provide a `Legend`\n * yourself manually instead of using a prop.\n */\nexport interface FieldsetProps\n extends\n FieldsetHTMLAttributes<HTMLFieldSetElement>,\n FieldsetClassNameOptions {\n ref?: Ref<HTMLFieldSetElement>;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n *\n * @example Floating Legend Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset floatingLegend>\n * <Legend floating>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n * ```\n *\n * @see {@link https://react-md.dev/components/fieldset | Fieldset Demos}\n */\nexport function Fieldset(props: FieldsetProps): ReactElement {\n const {\n ref,\n className,\n fullWidth,\n browserStyles,\n floatingLegend,\n children,\n ...remaining\n } = props;\n\n return (\n <fieldset\n {...remaining}\n ref={ref}\n className={fieldset({\n className,\n fullWidth,\n browserStyles,\n floatingLegend,\n })}\n >\n {children}\n </fieldset>\n );\n}\n"],"names":["fieldset","Fieldset","props","ref","className","fullWidth","browserStyles","floatingLegend","children","remaining"],"mappings":";AAMA,SAAwCA,QAAQ,QAAQ,sBAAsB;AAc9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EACJC,GAAG,EACHC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,qBACE,KAACF;QACE,GAAGS,SAAS;QACbN,KAAKA;QACLC,WAAWJ,SAAS;YAClBI;YACAC;YACAC;YACAC;QACF;kBAECC;;AAGP"}
@@ -1,5 +1,6 @@
1
- import { type FormHTMLAttributes } from "react";
1
+ import { type FormHTMLAttributes, type ReactElement, type Ref } from "react";
2
2
  export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
3
+ ref?: Ref<HTMLFormElement>;
3
4
  /**
4
5
  * Boolean if the form should no longer prevent default submit behavior. If
5
6
  * you enable this prop you should honestly just use a `<form>` element
@@ -18,4 +19,4 @@ export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
18
19
  *
19
20
  * @see {@link https://react-md.dev/components/form | Form Demos}
20
21
  */
21
- export declare const Form: import("react").ForwardRefExoticComponent<FormProps & import("react").RefAttributes<HTMLFormElement>>;
22
+ export declare function Form(props: FormProps): ReactElement;
package/dist/form/Form.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef } from "react";
4
3
  const noop = ()=>{
5
4
  // do nothing
6
5
  };
@@ -12,8 +11,8 @@ const noop = ()=>{
12
11
  * behavior and prevent the default form submit behavior.
13
12
  *
14
13
  * @see {@link https://react-md.dev/components/form | Form Demos}
15
- */ export const Form = /*#__PURE__*/ forwardRef(function Form(props, ref) {
16
- const { children, onSubmit = noop, disablePreventDefault = false, ...remaining } = props;
14
+ */ export function Form(props) {
15
+ const { ref, children, onSubmit = noop, disablePreventDefault = false, ...remaining } = props;
17
16
  return /*#__PURE__*/ _jsx("form", {
18
17
  ...remaining,
19
18
  onSubmit: (event)=>{
@@ -25,6 +24,6 @@ const noop = ()=>{
25
24
  ref: ref,
26
25
  children: children
27
26
  });
28
- });
27
+ }
29
28
 
30
29
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Form.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FormHTMLAttributes, forwardRef } from \"react\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nexport interface FormProps extends FormHTMLAttributes<HTMLFormElement> {\n /**\n * Boolean if the form should no longer prevent default submit behavior. If\n * you enable this prop you should honestly just use a `<form>` element\n * instead\n *\n * @defaultValue `false`\n */\n disablePreventDefault?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This is probably one of the least useful components available as it doesn't\n * do much styling or logic. All this form component will do is add basic flex\n * behavior and prevent the default form submit behavior.\n *\n * @see {@link https://react-md.dev/components/form | Form Demos}\n */\nexport const Form = forwardRef<HTMLFormElement, FormProps>(\n function Form(props, ref) {\n const {\n children,\n onSubmit = noop,\n disablePreventDefault = false,\n ...remaining\n } = props;\n\n return (\n <form\n {...remaining}\n onSubmit={(event) => {\n if (!disablePreventDefault) {\n event.preventDefault();\n }\n\n onSubmit(event);\n }}\n ref={ref}\n >\n {children}\n </form>\n );\n }\n);\n"],"names":["forwardRef","noop","Form","props","ref","children","onSubmit","disablePreventDefault","remaining","form","event","preventDefault"],"mappings":"AAAA;;AAEA,SAAkCA,UAAU,QAAQ,QAAQ;AAE5D,MAAMC,OAAO;AACX,aAAa;AACf;AAaA;;;;;;;;CAQC,GACD,OAAO,MAAMC,qBAAOF,WAClB,SAASE,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJC,QAAQ,EACRC,WAAWL,IAAI,EACfM,wBAAwB,KAAK,EAC7B,GAAGC,WACJ,GAAGL;IAEJ,qBACE,KAACM;QACE,GAAGD,SAAS;QACbF,UAAU,CAACI;YACT,IAAI,CAACH,uBAAuB;gBAC1BG,MAAMC,cAAc;YACtB;YAEAL,SAASI;QACX;QACAN,KAAKA;kBAEJC;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/form/Form.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FormHTMLAttributes, type ReactElement, type Ref } from \"react\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nexport interface FormProps extends FormHTMLAttributes<HTMLFormElement> {\n ref?: Ref<HTMLFormElement>;\n\n /**\n * Boolean if the form should no longer prevent default submit behavior. If\n * you enable this prop you should honestly just use a `<form>` element\n * instead\n *\n * @defaultValue `false`\n */\n disablePreventDefault?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This is probably one of the least useful components available as it doesn't\n * do much styling or logic. All this form component will do is add basic flex\n * behavior and prevent the default form submit behavior.\n *\n * @see {@link https://react-md.dev/components/form | Form Demos}\n */\nexport function Form(props: FormProps): ReactElement {\n const {\n ref,\n children,\n onSubmit = noop,\n disablePreventDefault = false,\n ...remaining\n } = props;\n\n return (\n <form\n {...remaining}\n onSubmit={(event) => {\n if (!disablePreventDefault) {\n event.preventDefault();\n }\n\n onSubmit(event);\n }}\n ref={ref}\n >\n {children}\n </form>\n );\n}\n"],"names":["noop","Form","props","ref","children","onSubmit","disablePreventDefault","remaining","form","event","preventDefault"],"mappings":"AAAA;;AAIA,MAAMA,OAAO;AACX,aAAa;AACf;AAeA;;;;;;;;CAQC,GACD,OAAO,SAASC,KAAKC,KAAgB;IACnC,MAAM,EACJC,GAAG,EACHC,QAAQ,EACRC,WAAWL,IAAI,EACfM,wBAAwB,KAAK,EAC7B,GAAGC,WACJ,GAAGL;IAEJ,qBACE,KAACM;QACE,GAAGD,SAAS;QACbF,UAAU,CAACI;YACT,IAAI,CAACH,uBAAuB;gBAC1BG,MAAMC,cAAc;YACtB;YAEAL,SAASI;QACX;QACAN,KAAKA;kBAEJC;;AAGP"}
@@ -1,4 +1,10 @@
1
- import { type FormMessageInputLengthCounterProps, type FormMessageProps } from "./types.js";
1
+ import { type ReactElement } from "react";
2
+ import { type ConfigurableFormMessageProps, type FormMessageInputLengthCounterProps } from "./types.js";
3
+ /**
4
+ * @since 7.0.0 This was defined inline
5
+ */
6
+ export interface FormMessageProps extends ConfigurableFormMessageProps, Partial<FormMessageInputLengthCounterProps> {
7
+ }
2
8
  /**
3
9
  * The `FormMessage` component is used to create additional helper messages or
4
10
  * error messages and generally placed below the related `TextField`. If a
@@ -10,4 +16,4 @@ import { type FormMessageInputLengthCounterProps, type FormMessageProps } from "
10
16
  *
11
17
  * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}
12
18
  */
13
- export declare const FormMessage: import("react").ForwardRefExoticComponent<FormMessageProps & Partial<FormMessageInputLengthCounterProps> & import("react").RefAttributes<HTMLDivElement>>;
19
+ export declare function FormMessage(props: FormMessageProps): ReactElement;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import { useEnsuredId } from "../useEnsuredId.js";
4
3
  import { FormMessageCounter } from "./FormMessageCounter.js";
5
4
  import { getFormConfig } from "./formConfig.js";
@@ -14,8 +13,8 @@ import { formMessage, formMessageText } from "./formMessageStyles.js";
14
13
  * setting the `role` prop to `"alert"`.
15
14
  *
16
15
  * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}
17
- */ export const FormMessage = /*#__PURE__*/ forwardRef(function FormMessage(props, ref) {
18
- const { id: propId, role, className, counterStyle, counterClassName, messageStyle, messageClassName, error = false, disableWrap = false, theme: propTheme, children, length, maxLength, counterProps, messageProps, ...remaining } = props;
16
+ */ export function FormMessage(props) {
17
+ const { ref, id: propId, role, className, counterStyle, counterClassName, messageStyle, messageClassName, error = false, disableWrap = false, theme: propTheme, children, length, maxLength, counterProps, messageProps, ...remaining } = props;
19
18
  const id = useEnsuredId(propId, "form-message");
20
19
  const theme = getFormConfig("theme", propTheme);
21
20
  let message = children;
@@ -52,6 +51,6 @@ import { formMessage, formMessageText } from "./formMessageStyles.js";
52
51
  })
53
52
  ]
54
53
  });
55
- });
54
+ }
56
55
 
57
56
  //# sourceMappingURL=FormMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/FormMessage.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageCounter } from \"./FormMessageCounter.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { formMessage, formMessageText } from \"./formMessageStyles.js\";\nimport {\n type FormMessageInputLengthCounterProps,\n type FormMessageProps,\n} from \"./types.js\";\n\n/**\n * The `FormMessage` component is used to create additional helper messages or\n * error messages and generally placed below the related `TextField`. If a\n * `length` (of the `value`) and `maxLength` are provided, a counter will also\n * be displayed to the right of the `children`.\n *\n * This component can also be used to create form-level validation messages by\n * setting the `role` prop to `\"alert\"`.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n */\nexport const FormMessage = forwardRef<\n HTMLDivElement,\n FormMessageProps & Partial<FormMessageInputLengthCounterProps>\n>(function FormMessage(props, ref) {\n const {\n id: propId,\n role,\n className,\n counterStyle,\n counterClassName,\n messageStyle,\n messageClassName,\n error = false,\n disableWrap = false,\n theme: propTheme,\n children,\n length,\n maxLength,\n counterProps,\n messageProps,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"form-message\");\n const theme = getFormConfig(\"theme\", propTheme);\n\n let message = children;\n if (!disableWrap && children) {\n message = (\n <p\n id={`${id}-message`}\n {...messageProps}\n style={messageStyle}\n className={formMessageText({ className: messageClassName })}\n >\n {children}\n </p>\n );\n }\n\n return (\n <div\n {...remaining}\n id={id}\n ref={ref}\n aria-live={role !== \"alert\" ? \"polite\" : undefined}\n role={role}\n className={formMessage({ error, theme, className })}\n >\n {message}\n {typeof length === \"number\" && typeof maxLength === \"number\" && (\n <FormMessageCounter\n id={`${id}-counter`}\n {...counterProps}\n style={counterStyle}\n className={counterClassName}\n >\n {`${length} / ${maxLength}`}\n </FormMessageCounter>\n )}\n </div>\n );\n});\n"],"names":["forwardRef","useEnsuredId","FormMessageCounter","getFormConfig","formMessage","formMessageText","FormMessage","props","ref","id","propId","role","className","counterStyle","counterClassName","messageStyle","messageClassName","error","disableWrap","theme","propTheme","children","length","maxLength","counterProps","messageProps","remaining","message","p","style","div","aria-live","undefined"],"mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,WAAW,EAAEC,eAAe,QAAQ,yBAAyB;AAMtE;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,4BAAcN,WAGzB,SAASM,YAAYC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,IAAIC,MAAM,EACVC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,gBAAgB,EAChBC,YAAY,EACZC,gBAAgB,EAChBC,QAAQ,KAAK,EACbC,cAAc,KAAK,EACnBC,OAAOC,SAAS,EAChBC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZ,GAAGC,WACJ,GAAGnB;IACJ,MAAME,KAAKR,aAAaS,QAAQ;IAChC,MAAMS,QAAQhB,cAAc,SAASiB;IAErC,IAAIO,UAAUN;IACd,IAAI,CAACH,eAAeG,UAAU;QAC5BM,wBACE,KAACC;YACCnB,IAAI,GAAGA,GAAG,QAAQ,CAAC;YAClB,GAAGgB,YAAY;YAChBI,OAAOd;YACPH,WAAWP,gBAAgB;gBAAEO,WAAWI;YAAiB;sBAExDK;;IAGP;IAEA,qBACE,MAACS;QACE,GAAGJ,SAAS;QACbjB,IAAIA;QACJD,KAAKA;QACLuB,aAAWpB,SAAS,UAAU,WAAWqB;QACzCrB,MAAMA;QACNC,WAAWR,YAAY;YAAEa;YAAOE;YAAOP;QAAU;;YAEhDe;YACA,OAAOL,WAAW,YAAY,OAAOC,cAAc,0BAClD,KAACrB;gBACCO,IAAI,GAAGA,GAAG,QAAQ,CAAC;gBAClB,GAAGe,YAAY;gBAChBK,OAAOhB;gBACPD,WAAWE;0BAEV,GAAGQ,OAAO,GAAG,EAAEC,WAAW;;;;AAKrC,GAAG"}
1
+ {"version":3,"sources":["../../src/form/FormMessage.tsx"],"sourcesContent":["import { type ReactElement } from \"react\";\n\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageCounter } from \"./FormMessageCounter.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { formMessage, formMessageText } from \"./formMessageStyles.js\";\nimport {\n type ConfigurableFormMessageProps,\n type FormMessageInputLengthCounterProps,\n} from \"./types.js\";\n\n/**\n * @since 7.0.0 This was defined inline\n */\nexport interface FormMessageProps\n extends\n ConfigurableFormMessageProps,\n Partial<FormMessageInputLengthCounterProps> {}\n\n/**\n * The `FormMessage` component is used to create additional helper messages or\n * error messages and generally placed below the related `TextField`. If a\n * `length` (of the `value`) and `maxLength` are provided, a counter will also\n * be displayed to the right of the `children`.\n *\n * This component can also be used to create form-level validation messages by\n * setting the `role` prop to `\"alert\"`.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n */\nexport function FormMessage(props: FormMessageProps): ReactElement {\n const {\n ref,\n id: propId,\n role,\n className,\n counterStyle,\n counterClassName,\n messageStyle,\n messageClassName,\n error = false,\n disableWrap = false,\n theme: propTheme,\n children,\n length,\n maxLength,\n counterProps,\n messageProps,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"form-message\");\n const theme = getFormConfig(\"theme\", propTheme);\n\n let message = children;\n if (!disableWrap && children) {\n message = (\n <p\n id={`${id}-message`}\n {...messageProps}\n style={messageStyle}\n className={formMessageText({ className: messageClassName })}\n >\n {children}\n </p>\n );\n }\n\n return (\n <div\n {...remaining}\n id={id}\n ref={ref}\n aria-live={role !== \"alert\" ? \"polite\" : undefined}\n role={role}\n className={formMessage({ error, theme, className })}\n >\n {message}\n {typeof length === \"number\" && typeof maxLength === \"number\" && (\n <FormMessageCounter\n id={`${id}-counter`}\n {...counterProps}\n style={counterStyle}\n className={counterClassName}\n >\n {`${length} / ${maxLength}`}\n </FormMessageCounter>\n )}\n </div>\n );\n}\n"],"names":["useEnsuredId","FormMessageCounter","getFormConfig","formMessage","formMessageText","FormMessage","props","ref","id","propId","role","className","counterStyle","counterClassName","messageStyle","messageClassName","error","disableWrap","theme","propTheme","children","length","maxLength","counterProps","messageProps","remaining","message","p","style","div","aria-live","undefined"],"mappings":";AAEA,SAASA,YAAY,QAAQ,qBAAqB;AAClD,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,WAAW,EAAEC,eAAe,QAAQ,yBAAyB;AActE;;;;;;;;;;CAUC,GACD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EACJC,GAAG,EACHC,IAAIC,MAAM,EACVC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,gBAAgB,EAChBC,YAAY,EACZC,gBAAgB,EAChBC,QAAQ,KAAK,EACbC,cAAc,KAAK,EACnBC,OAAOC,SAAS,EAChBC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZ,GAAGC,WACJ,GAAGnB;IACJ,MAAME,KAAKR,aAAaS,QAAQ;IAChC,MAAMS,QAAQhB,cAAc,SAASiB;IAErC,IAAIO,UAAUN;IACd,IAAI,CAACH,eAAeG,UAAU;QAC5BM,wBACE,KAACC;YACCnB,IAAI,GAAGA,GAAG,QAAQ,CAAC;YAClB,GAAGgB,YAAY;YAChBI,OAAOd;YACPH,WAAWP,gBAAgB;gBAAEO,WAAWI;YAAiB;sBAExDK;;IAGP;IAEA,qBACE,MAACS;QACE,GAAGJ,SAAS;QACbjB,IAAIA;QACJD,KAAKA;QACLuB,aAAWpB,SAAS,UAAU,WAAWqB;QACzCrB,MAAMA;QACNC,WAAWR,YAAY;YAAEa;YAAOE;YAAOP;QAAU;;YAEhDe;YACA,OAAOL,WAAW,YAAY,OAAOC,cAAc,0BAClD,KAACrB;gBACCO,IAAI,GAAGA,GAAG,QAAQ,CAAC;gBAClB,GAAGe,YAAY;gBAChBK,OAAOhB;gBACPD,WAAWE;0BAEV,GAAGQ,OAAO,GAAG,EAAEC,WAAW;;;;AAKrC"}
@@ -1,17 +1,18 @@
1
- import { type HTMLAttributes } from "react";
1
+ import { type HTMLAttributes, type ReactElement, type Ref } from "react";
2
2
  import { type PropsWithRef } from "../types.js";
3
3
  import { type FormMessageContainerClassNameOptions } from "./formMessageContainerStyles.js";
4
- import { type FormMessageProps } from "./types.js";
4
+ import { type ConfigurableFormMessageProps } from "./types.js";
5
5
  /**
6
6
  * @since 2.5.0
7
7
  */
8
8
  export interface FormMessageContainerProps extends HTMLAttributes<HTMLDivElement>, FormMessageContainerClassNameOptions {
9
+ ref?: Ref<HTMLDivElement>;
9
10
  /**
10
11
  * If the extension doesn't actually want to render the `FormMessage`
11
12
  * component, these props are optional. It kind of eliminates the whole
12
13
  * purpose of this component though.
13
14
  */
14
- messageProps?: PropsWithRef<FormMessageProps>;
15
+ messageProps?: PropsWithRef<ConfigurableFormMessageProps>;
15
16
  }
16
17
  /**
17
18
  * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper
@@ -20,4 +21,4 @@ export interface FormMessageContainerProps extends HTMLAttributes<HTMLDivElement
20
21
  * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}
21
22
  * @since 2.5.0
22
23
  */
23
- export declare const FormMessageContainer: import("react").ForwardRefExoticComponent<FormMessageContainerProps & import("react").RefAttributes<HTMLDivElement>>;
24
+ export declare function FormMessageContainer(props: FormMessageContainerProps): ReactElement;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import { FormMessage } from "./FormMessage.js";
4
3
  import { formMessageContainer } from "./formMessageContainerStyles.js";
5
4
  /**
@@ -8,8 +7,8 @@ import { formMessageContainer } from "./formMessageContainerStyles.js";
8
7
  *
9
8
  * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}
10
9
  * @since 2.5.0
11
- */ export const FormMessageContainer = /*#__PURE__*/ forwardRef(function FormMessageContainer(props, ref) {
12
- const { className, children, inline, messageProps, ...remaining } = props;
10
+ */ export function FormMessageContainer(props) {
11
+ const { ref, className, children, inline, messageProps, ...remaining } = props;
13
12
  if (!messageProps) {
14
13
  return /*#__PURE__*/ _jsx(_Fragment, {
15
14
  children: children
@@ -29,6 +28,6 @@ import { formMessageContainer } from "./formMessageContainerStyles.js";
29
28
  })
30
29
  ]
31
30
  });
32
- });
31
+ }
33
32
 
34
33
  //# sourceMappingURL=FormMessageContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/FormMessageContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { FormMessage } from \"./FormMessage.js\";\nimport {\n type FormMessageContainerClassNameOptions,\n formMessageContainer,\n} from \"./formMessageContainerStyles.js\";\nimport { type FormMessageProps } from \"./types.js\";\n\n/**\n * @since 2.5.0\n */\nexport interface FormMessageContainerProps\n extends HTMLAttributes<HTMLDivElement>, FormMessageContainerClassNameOptions {\n /**\n * If the extension doesn't actually want to render the `FormMessage`\n * component, these props are optional. It kind of eliminates the whole\n * purpose of this component though.\n */\n messageProps?: PropsWithRef<FormMessageProps>;\n}\n\n/**\n * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper\n * and renders the {@link FormMessage} component.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @since 2.5.0\n */\nexport const FormMessageContainer = forwardRef<\n HTMLDivElement,\n FormMessageContainerProps\n>(function FormMessageContainer(props, ref) {\n const { className, children, inline, messageProps, ...remaining } = props;\n if (!messageProps) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={formMessageContainer({ className, inline })}\n >\n {children}\n <FormMessage {...messageProps} />\n </div>\n );\n});\n"],"names":["forwardRef","FormMessage","formMessageContainer","FormMessageContainer","props","ref","className","children","inline","messageProps","remaining","div"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAGxD,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAEEC,oBAAoB,QACf,kCAAkC;AAgBzC;;;;;;CAMC,GACD,OAAO,MAAMC,qCAAuBH,WAGlC,SAASG,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAE,GAAGC,WAAW,GAAGN;IACpE,IAAI,CAACK,cAAc;QACjB,qBAAO;sBAAGF;;IACZ;IAEA,qBACE,MAACI;QACE,GAAGD,SAAS;QACbL,KAAKA;QACLC,WAAWJ,qBAAqB;YAAEI;YAAWE;QAAO;;YAEnDD;0BACD,KAACN;gBAAa,GAAGQ,YAAY;;;;AAGnC,GAAG"}
1
+ {"version":3,"sources":["../../src/form/FormMessageContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactElement, type Ref } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { FormMessage } from \"./FormMessage.js\";\nimport {\n type FormMessageContainerClassNameOptions,\n formMessageContainer,\n} from \"./formMessageContainerStyles.js\";\nimport { type ConfigurableFormMessageProps } from \"./types.js\";\n\n/**\n * @since 2.5.0\n */\nexport interface FormMessageContainerProps\n extends HTMLAttributes<HTMLDivElement>, FormMessageContainerClassNameOptions {\n ref?: Ref<HTMLDivElement>;\n\n /**\n * If the extension doesn't actually want to render the `FormMessage`\n * component, these props are optional. It kind of eliminates the whole\n * purpose of this component though.\n */\n messageProps?: PropsWithRef<ConfigurableFormMessageProps>;\n}\n\n/**\n * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper\n * and renders the {@link FormMessage} component.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @since 2.5.0\n */\nexport function FormMessageContainer(\n props: FormMessageContainerProps\n): ReactElement {\n const { ref, className, children, inline, messageProps, ...remaining } =\n props;\n\n if (!messageProps) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={formMessageContainer({ className, inline })}\n >\n {children}\n <FormMessage {...messageProps} />\n </div>\n );\n}\n"],"names":["FormMessage","formMessageContainer","FormMessageContainer","props","ref","className","children","inline","messageProps","remaining","div"],"mappings":";AAGA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAEEC,oBAAoB,QACf,kCAAkC;AAkBzC;;;;;;CAMC,GACD,OAAO,SAASC,qBACdC,KAAgC;IAEhC,MAAM,EAAEC,GAAG,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAE,GAAGC,WAAW,GACpEN;IAEF,IAAI,CAACK,cAAc;QACjB,qBAAO;sBAAGF;;IACZ;IAEA,qBACE,MAACI;QACE,GAAGD,SAAS;QACbL,KAAKA;QACLC,WAAWJ,qBAAqB;YAAEI;YAAWE;QAAO;;YAEnDD;0BACD,KAACN;gBAAa,GAAGQ,YAAY;;;;AAGnC"}
@@ -1,6 +1,7 @@
1
- import { type HTMLAttributes, type ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
2
2
  /** @since 2.9.0 */
3
3
  export interface FormMessageCounterProps extends HTMLAttributes<HTMLSpanElement> {
4
+ ref?: Ref<HTMLSpanElement>;
4
5
  /**
5
6
  * The children to display in the counter. This is normally a string like:
6
7
  *
@@ -41,4 +42,4 @@ export interface FormMessageCounterProps extends HTMLAttributes<HTMLSpanElement>
41
42
  * @since 2.9.0
42
43
  * @since 6.3.0 Supports refs.
43
44
  */
44
- export declare const FormMessageCounter: import("react").ForwardRefExoticComponent<FormMessageCounterProps & import("react").RefAttributes<HTMLSpanElement>>;
45
+ export declare function FormMessageCounter(props: FormMessageCounterProps): ReactElement;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import { formMessageCounter } from "./formMessageStyles.js";
4
3
  /**
5
4
  * This component can be used to create a "counter" within the
@@ -30,8 +29,8 @@ import { formMessageCounter } from "./formMessageStyles.js";
30
29
  * @see {@link https://react-md.dev/components/text-field | TextField Demos}
31
30
  * @since 2.9.0
32
31
  * @since 6.3.0 Supports refs.
33
- */ export const FormMessageCounter = /*#__PURE__*/ forwardRef(function FormMessageCounter(props, ref) {
34
- const { children, className, ...remaining } = props;
32
+ */ export function FormMessageCounter(props) {
33
+ const { ref, children, className, ...remaining } = props;
35
34
  return /*#__PURE__*/ _jsx("span", {
36
35
  ref: ref,
37
36
  ...remaining,
@@ -40,6 +39,6 @@ import { formMessageCounter } from "./formMessageStyles.js";
40
39
  }),
41
40
  children: children
42
41
  });
43
- });
42
+ }
44
43
 
45
44
  //# sourceMappingURL=FormMessageCounter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/FormMessageCounter.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { formMessageCounter } from \"./formMessageStyles.js\";\n\n/** @since 2.9.0 */\nexport interface FormMessageCounterProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * The children to display in the counter. This is normally a string like:\n *\n * @example String Example\n * ```ts\n * `${min} / ${max}`\n * ```\n */\n children: ReactNode;\n}\n\n/**\n * This component can be used to create a \"counter\" within the\n * {@link FormMessage} component.\n *\n * Note: This is really only useful when using the {@link FormMessage} component\n * without a {@link TextField}.\n *\n * @example Example Usage\n * ```ts\n * interface ExampleProps {\n * min: number;\n * max: number;\n * }\n *\n * function Example({ min, max }: ExampleProps) {\n * return (\n * <FormMessage disableWrap>\n * <FormMessageCounter>\n * {`${min} / ${max}`}\n * </FormMessageCounter>\n * </FormMessage>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @see {@link https://react-md.dev/components/text-field | TextField Demos}\n * @since 2.9.0\n * @since 6.3.0 Supports refs.\n */\nexport const FormMessageCounter = forwardRef<\n HTMLSpanElement,\n FormMessageCounterProps\n>(function FormMessageCounter(props, ref): ReactElement {\n const { children, className, ...remaining } = props;\n\n return (\n <span\n ref={ref}\n {...remaining}\n className={formMessageCounter({ className })}\n >\n {children}\n </span>\n );\n});\n"],"names":["forwardRef","formMessageCounter","FormMessageCounter","props","ref","children","className","remaining","span"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAEf,SAASC,kBAAkB,QAAQ,yBAAyB;AAe5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,MAAMC,mCAAqBF,WAGhC,SAASE,mBAAmBC,KAAK,EAAEC,GAAG;IACtC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGJ;IAE9C,qBACE,KAACK;QACCJ,KAAKA;QACJ,GAAGG,SAAS;QACbD,WAAWL,mBAAmB;YAAEK;QAAU;kBAEzCD;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/form/FormMessageCounter.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { formMessageCounter } from \"./formMessageStyles.js\";\n\n/** @since 2.9.0 */\nexport interface FormMessageCounterProps extends HTMLAttributes<HTMLSpanElement> {\n ref?: Ref<HTMLSpanElement>;\n\n /**\n * The children to display in the counter. This is normally a string like:\n *\n * @example String Example\n * ```ts\n * `${min} / ${max}`\n * ```\n */\n children: ReactNode;\n}\n\n/**\n * This component can be used to create a \"counter\" within the\n * {@link FormMessage} component.\n *\n * Note: This is really only useful when using the {@link FormMessage} component\n * without a {@link TextField}.\n *\n * @example Example Usage\n * ```ts\n * interface ExampleProps {\n * min: number;\n * max: number;\n * }\n *\n * function Example({ min, max }: ExampleProps) {\n * return (\n * <FormMessage disableWrap>\n * <FormMessageCounter>\n * {`${min} / ${max}`}\n * </FormMessageCounter>\n * </FormMessage>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @see {@link https://react-md.dev/components/text-field | TextField Demos}\n * @since 2.9.0\n * @since 6.3.0 Supports refs.\n */\nexport function FormMessageCounter(\n props: FormMessageCounterProps\n): ReactElement {\n const { ref, children, className, ...remaining } = props;\n\n return (\n <span\n ref={ref}\n {...remaining}\n className={formMessageCounter({ className })}\n >\n {children}\n </span>\n );\n}\n"],"names":["formMessageCounter","FormMessageCounter","props","ref","children","className","remaining","span"],"mappings":";AAOA,SAASA,kBAAkB,QAAQ,yBAAyB;AAiB5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC,mBACdC,KAA8B;IAE9B,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGJ;IAEnD,qBACE,KAACK;QACCJ,KAAKA;QACJ,GAAGG,SAAS;QACbD,WAAWL,mBAAmB;YAAEK;QAAU;kBAEzCD;;AAGP"}
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, type HTMLAttributes, type InputHTMLAttributes, type LabelHTMLAttributes, type ReactNode } from "react";
1
+ import { type CSSProperties, type HTMLAttributes, type InputHTMLAttributes, type LabelHTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
2
2
  import { type ComponentWithRippleProps } from "../interaction/types.js";
3
3
  import { type PropsWithRef } from "../types.js";
4
4
  import { type InputToggleSize } from "./inputToggleStyles.js";
@@ -116,6 +116,7 @@ export interface InputToggleLabelProps {
116
116
  * @since 6.0.0
117
117
  */
118
118
  export interface BaseInputToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">, FormMessageContainerExtension, FormComponentStates, ConfigurableInputToggleIconProps, InputToggleLabelProps, ComponentWithRippleProps {
119
+ ref?: Ref<HTMLInputElement>;
119
120
  /**
120
121
  * @see https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing
121
122
  * @defaultValue `type === "checkbox" ? "off" : undefined`
@@ -183,4 +184,4 @@ export type InputToggleProps = CheckboxInputToggleProps | RadioInputToggleProps;
183
184
  * @since 6.0.0 Now supports the `FormMessage` behavior and requires
184
185
  * different icons for each checked state.
185
186
  */
186
- export declare const InputToggle: import("react").ForwardRefExoticComponent<InputToggleProps & import("react").RefAttributes<HTMLInputElement>>;
187
+ export declare function InputToggle(props: InputToggleProps): ReactElement;
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cnb } from "cnbuilder";
4
- import { forwardRef } from "react";
5
4
  import { useElementInteraction } from "../interaction/useElementInteraction.js";
6
5
  import { useEnsuredId } from "../useEnsuredId.js";
7
6
  import { FormMessageContainer } from "./FormMessageContainer.js";
@@ -14,8 +13,8 @@ import { Label } from "./Label.js";
14
13
  * @see {@link https://react-md.dev/components/radio | Radio Demos}
15
14
  * @since 6.0.0 Now supports the `FormMessage` behavior and requires
16
15
  * different icons for each checked state.
17
- */ export const InputToggle = /*#__PURE__*/ forwardRef(function InputToggle(props, ref) {
18
- const { id: propId, type, label, labelProps, style, className, autoComplete = type === "checkbox" ? "off" : undefined, disableLabelGap = false, stacked = false, iconAfter = false, size = "normal", error = false, active = false, indeterminate = false, messageProps, messageContainerProps, icon, checkedIcon, indeterminateIcon, iconProps, iconStyle, iconClassName, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseLeave, onDragStart, onMouseUp, onTouchEnd, onTouchMove, onTouchStart, disableRipple, ...remaining } = props;
16
+ */ export function InputToggle(props) {
17
+ const { id: propId, ref, type, label, labelProps, style, className, autoComplete = type === "checkbox" ? "off" : undefined, disableLabelGap = false, stacked = false, iconAfter = false, size = "normal", error = false, active = false, indeterminate = false, messageProps, messageContainerProps, icon, checkedIcon, indeterminateIcon, iconProps, iconStyle, iconClassName, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseLeave, onDragStart, onMouseUp, onTouchEnd, onTouchMove, onTouchStart, disableRipple, ...remaining } = props;
19
18
  const { disabled = false, checked } = props;
20
19
  const id = useEnsuredId(propId, type);
21
20
  const { pressedClassName, ripples, handlers } = useElementInteraction({
@@ -80,6 +79,6 @@ import { Label } from "./Label.js";
80
79
  ]
81
80
  })
82
81
  });
83
- });
82
+ }
84
83
 
85
84
  //# sourceMappingURL=InputToggle.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/InputToggle.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type LabelHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { InputToggleIcon } from \"./InputToggleIcon.js\";\nimport { Label } from \"./Label.js\";\nimport { type InputToggleSize } from \"./inputToggleStyles.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type LabelClassNameOptions } from \"./types.js\";\nimport {\n type FormComponentStates,\n type FormMessageContainerExtension,\n} from \"./types.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableInputToggleIconProps {\n /**\n * @see {@link InputToggleSize}\n * @defaultValue `\"normal\"`\n */\n size?: InputToggleSize;\n\n /**\n * The icon to use while unchecked. This defaults to the unchecked\n * checkbox/radio icon from the `ICON_CONFIG`.\n *\n * @defaultValue `getIcon(props.type)`\n */\n icon?: ReactNode;\n\n /**\n * The icon to use while unchecked. This defaults to the unchecked\n * checkbox/radio icon from the `ICON_CONFIG`.\n *\n * @defaultValue `getIcon(``${props.type}Checked``)`\n */\n checkedIcon?: ReactNode;\n\n /**\n * Any props that should be passed to the `<span>` that surrounds the current\n * icon element.\n */\n iconProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * Optional style to set on the `<span>` that surrounds the current icon\n * element.\n */\n iconStyle?: CSSProperties;\n\n /**\n * Optional className to set on the `<span>` that surrounds the current icon\n * element.\n */\n iconClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface InputToggleLabelProps {\n /**\n * An optional label to display with the checkbox. If this is omitted, it is\n * recommended to provide an `aria-label` for accessibility.\n */\n label?: ReactNode;\n\n /**\n * Any props that should be passed to the `<Label>` component.\n *\n * Note: If `style` or `className` are provided in this object, they will be\n * ignored. Use the top-level `style` and `className` props instead.\n *\n * @example\n * ```\n * // bad\n * labelProps={{\n * \"aria-label\": \"checkbox\",\n * style: { color: \"red\" },\n * className: \"custom\"\n * }}\n *\n * // good\n * style={{ color: \"red\" }}\n * className=\"custom\"\n * labelProps={{\n * \"aria-label\": \"checkbox\",\n * }}\n * ```\n */\n labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>>;\n\n /**\n * @see {@link LabelClassNameOptions.gap}\n * @defaultValue `false`\n */\n disableLabelGap?: boolean;\n\n /**\n * Set this to `true` to swap the position of the {@link label} and the current\n * icon. This prop can be used with the {@link stacked} prop to change the\n * position if the icon and label:\n *\n * ____________________________________\n * | stacked | iconAfter | position |\n * ____________________________________\n * | | | icon label |\n * ____________________________________\n * | | X | label icon |\n * ____________________________________\n * | X | | icon |\n * | | | label |\n * ____________________________________\n * | X | X | label |\n * | | | icon |\n * ____________________________________\n *\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Set this to `true` if the label should be stacked instead of inline with\n * the current icon.\n *\n * @see {@link iconAfter}\n * @defaultValue `false`\n */\n stacked?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BaseInputToggleProps\n extends\n Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n FormMessageContainerExtension,\n FormComponentStates,\n ConfigurableInputToggleIconProps,\n InputToggleLabelProps,\n ComponentWithRippleProps {\n /**\n * @see https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing\n * @defaultValue `type === \"checkbox\" ? \"off\" : undefined`\n */\n autoComplete?: string;\n}\n\n/**\n * @since 2.8.5\n * @since 6.0.0 Removed the `aria-controls` prop and added the\n * `indeterminateIcon` prop.\n */\nexport interface IndeterminateCheckboxProps {\n /**\n * Set this value to `true` if the checkbox is in an \"indeterminate\" state:\n *\n * - this checkbox controls the select all/select none behavior of other\n * checkboxes in a group\n * - at least one of the checkboxes have been checked\n * - the `checked` prop for this Checkbox should also be `true`\n *\n * You should normally use the `useCheckboxGroup` hook to handle this\n * behavior.\n *\n * @defaultValue `false`\n */\n indeterminate?: boolean;\n\n /**\n * The icon to display when the checkbox is checked and the\n * {@link indeterminate} prop is `true`.\n *\n * @defaultValue `getIcon(\"checkboxIndeterminate\")`\n * @since 6.0.0\n */\n indeterminateIcon?: ReactNode;\n}\n\nexport interface CheckboxProps\n extends BaseInputToggleProps, IndeterminateCheckboxProps {}\n\n/** @since 6.0.0 */\nexport interface CheckboxInputToggleProps extends CheckboxProps {\n type: \"checkbox\";\n}\n\nexport interface RadioProps extends BaseInputToggleProps {\n /**\n * The value for the radio button.\n *\n * @since 6.0.0 This is now optional and no longer supports\n * `string[]` since there isn't much of a use case for array values.\n */\n value?: string | number;\n}\n\n/** @since 6.0.0 */\nexport interface RadioInputToggleProps extends RadioProps {\n type: \"radio\";\n}\n\n/**\n * @since 6.0.0 Updated to be a union between\n * `CheckboxInputToggleProps` and `RadioInputToggleProps`\n */\nexport type InputToggleProps = CheckboxInputToggleProps | RadioInputToggleProps;\n\n/**\n * **Client Component**\n *\n * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}\n * @see {@link https://react-md.dev/components/radio | Radio Demos}\n * @since 6.0.0 Now supports the `FormMessage` behavior and requires\n * different icons for each checked state.\n */\nexport const InputToggle = forwardRef<HTMLInputElement, InputToggleProps>(\n function InputToggle(props, ref) {\n const {\n id: propId,\n type,\n label,\n labelProps,\n style,\n className,\n autoComplete = type === \"checkbox\" ? \"off\" : undefined,\n disableLabelGap = false,\n stacked = false,\n iconAfter = false,\n size = \"normal\",\n error = false,\n active = false,\n indeterminate = false,\n messageProps,\n messageContainerProps,\n icon,\n checkedIcon,\n indeterminateIcon,\n iconProps,\n iconStyle,\n iconClassName,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onDragStart,\n onMouseUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n disableRipple,\n ...remaining\n } = props as CheckboxInputToggleProps;\n const { disabled = false, checked } = props;\n\n const id = useEnsuredId(propId, type);\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n disabled,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onDragStart,\n onMouseUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n });\n\n // set on the `remaining` object to bypass the eslint rule about\n // aria-checked not being valid for textbox role\n remaining[\"aria-checked\"] =\n (remaining[\"aria-checked\"] ?? indeterminate) ? \"mixed\" : undefined;\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <Label\n {...labelProps}\n gap={!disableLabelGap}\n style={style}\n stacked={stacked}\n reversed={!iconAfter}\n active={active}\n error={error}\n disabled={disabled}\n className={className}\n >\n {label}\n <InputToggleIcon\n style={iconStyle}\n {...iconProps}\n className={cnb(\n pressedClassName,\n iconClassName,\n iconProps?.className\n )}\n error={error}\n checked={checked}\n disabled={disabled}\n size={size}\n type={type}\n icon={icon}\n checkedIcon={checkedIcon}\n indeterminate={indeterminate}\n indeterminateIcon={indeterminateIcon}\n >\n <input\n {...remaining}\n {...handlers}\n autoComplete={autoComplete}\n id={id}\n ref={ref}\n type={type}\n className=\"rmd-hidden-input\"\n />\n {ripples}\n </InputToggleIcon>\n </Label>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["cnb","forwardRef","useElementInteraction","useEnsuredId","FormMessageContainer","InputToggleIcon","Label","InputToggle","props","ref","id","propId","type","label","labelProps","style","className","autoComplete","undefined","disableLabelGap","stacked","iconAfter","size","error","active","indeterminate","messageProps","messageContainerProps","icon","checkedIcon","indeterminateIcon","iconProps","iconStyle","iconClassName","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onDragStart","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","disableRipple","remaining","disabled","checked","pressedClassName","ripples","handlers","mode","gap","reversed","input"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAMEC,UAAU,QACL,QAAQ;AAGf,SAASC,qBAAqB,QAAQ,0CAA0C;AAEhF,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,QAAQ,aAAa;AA+MnC;;;;;;;CAOC,GACD,OAAO,MAAMC,4BAAcN,WACzB,SAASM,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,IAAIC,MAAM,EACVC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,eAAeL,SAAS,aAAa,QAAQM,SAAS,EACtDC,kBAAkB,KAAK,EACvBC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,OAAO,QAAQ,EACfC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,gBAAgB,KAAK,EACrBC,YAAY,EACZC,qBAAqB,EACrBC,IAAI,EACJC,WAAW,EACXC,iBAAiB,EACjBC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,aAAa,EACb,GAAGC,WACJ,GAAGtC;IACJ,MAAM,EAAEuC,WAAW,KAAK,EAAEC,OAAO,EAAE,GAAGxC;IAEtC,MAAME,KAAKP,aAAaQ,QAAQC;IAChC,MAAM,EAAEqC,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGjD,sBAAsB;QACpEkD,MAAMP,gBAAgB,SAAS3B;QAC/B6B;QACAb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,gEAAgE;IAChE,gDAAgD;IAChDE,SAAS,CAAC,eAAe,GACvB,AAACA,SAAS,CAAC,eAAe,IAAIrB,gBAAiB,UAAUP;IAE3D,qBACE,KAACd;QACE,GAAGuB,qBAAqB;QACzBD,cAAcA;kBAEd,cAAA,MAACpB;YACE,GAAGQ,UAAU;YACduC,KAAK,CAAClC;YACNJ,OAAOA;YACPK,SAASA;YACTkC,UAAU,CAACjC;YACXG,QAAQA;YACRD,OAAOA;YACPwB,UAAUA;YACV/B,WAAWA;;gBAEVH;8BACD,MAACR;oBACCU,OAAOiB;oBACN,GAAGD,SAAS;oBACbf,WAAWhB,IACTiD,kBACAhB,eACAF,WAAWf;oBAEbO,OAAOA;oBACPyB,SAASA;oBACTD,UAAUA;oBACVzB,MAAMA;oBACNV,MAAMA;oBACNgB,MAAMA;oBACNC,aAAaA;oBACbJ,eAAeA;oBACfK,mBAAmBA;;sCAEnB,KAACyB;4BACE,GAAGT,SAAS;4BACZ,GAAGK,QAAQ;4BACZlC,cAAcA;4BACdP,IAAIA;4BACJD,KAAKA;4BACLG,MAAMA;4BACNI,WAAU;;wBAEXkC;;;;;;AAKX,GACA"}
1
+ {"version":3,"sources":["../../src/form/InputToggle.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type LabelHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { InputToggleIcon } from \"./InputToggleIcon.js\";\nimport { Label } from \"./Label.js\";\nimport { type InputToggleSize } from \"./inputToggleStyles.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type LabelClassNameOptions } from \"./types.js\";\nimport {\n type FormComponentStates,\n type FormMessageContainerExtension,\n} from \"./types.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableInputToggleIconProps {\n /**\n * @see {@link InputToggleSize}\n * @defaultValue `\"normal\"`\n */\n size?: InputToggleSize;\n\n /**\n * The icon to use while unchecked. This defaults to the unchecked\n * checkbox/radio icon from the `ICON_CONFIG`.\n *\n * @defaultValue `getIcon(props.type)`\n */\n icon?: ReactNode;\n\n /**\n * The icon to use while unchecked. This defaults to the unchecked\n * checkbox/radio icon from the `ICON_CONFIG`.\n *\n * @defaultValue `getIcon(``${props.type}Checked``)`\n */\n checkedIcon?: ReactNode;\n\n /**\n * Any props that should be passed to the `<span>` that surrounds the current\n * icon element.\n */\n iconProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * Optional style to set on the `<span>` that surrounds the current icon\n * element.\n */\n iconStyle?: CSSProperties;\n\n /**\n * Optional className to set on the `<span>` that surrounds the current icon\n * element.\n */\n iconClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface InputToggleLabelProps {\n /**\n * An optional label to display with the checkbox. If this is omitted, it is\n * recommended to provide an `aria-label` for accessibility.\n */\n label?: ReactNode;\n\n /**\n * Any props that should be passed to the `<Label>` component.\n *\n * Note: If `style` or `className` are provided in this object, they will be\n * ignored. Use the top-level `style` and `className` props instead.\n *\n * @example\n * ```\n * // bad\n * labelProps={{\n * \"aria-label\": \"checkbox\",\n * style: { color: \"red\" },\n * className: \"custom\"\n * }}\n *\n * // good\n * style={{ color: \"red\" }}\n * className=\"custom\"\n * labelProps={{\n * \"aria-label\": \"checkbox\",\n * }}\n * ```\n */\n labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>>;\n\n /**\n * @see {@link LabelClassNameOptions.gap}\n * @defaultValue `false`\n */\n disableLabelGap?: boolean;\n\n /**\n * Set this to `true` to swap the position of the {@link label} and the current\n * icon. This prop can be used with the {@link stacked} prop to change the\n * position if the icon and label:\n *\n * ____________________________________\n * | stacked | iconAfter | position |\n * ____________________________________\n * | | | icon label |\n * ____________________________________\n * | | X | label icon |\n * ____________________________________\n * | X | | icon |\n * | | | label |\n * ____________________________________\n * | X | X | label |\n * | | | icon |\n * ____________________________________\n *\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Set this to `true` if the label should be stacked instead of inline with\n * the current icon.\n *\n * @see {@link iconAfter}\n * @defaultValue `false`\n */\n stacked?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BaseInputToggleProps\n extends\n Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n FormMessageContainerExtension,\n FormComponentStates,\n ConfigurableInputToggleIconProps,\n InputToggleLabelProps,\n ComponentWithRippleProps {\n ref?: Ref<HTMLInputElement>;\n\n /**\n * @see https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing\n * @defaultValue `type === \"checkbox\" ? \"off\" : undefined`\n */\n autoComplete?: string;\n}\n\n/**\n * @since 2.8.5\n * @since 6.0.0 Removed the `aria-controls` prop and added the\n * `indeterminateIcon` prop.\n */\nexport interface IndeterminateCheckboxProps {\n /**\n * Set this value to `true` if the checkbox is in an \"indeterminate\" state:\n *\n * - this checkbox controls the select all/select none behavior of other\n * checkboxes in a group\n * - at least one of the checkboxes have been checked\n * - the `checked` prop for this Checkbox should also be `true`\n *\n * You should normally use the `useCheckboxGroup` hook to handle this\n * behavior.\n *\n * @defaultValue `false`\n */\n indeterminate?: boolean;\n\n /**\n * The icon to display when the checkbox is checked and the\n * {@link indeterminate} prop is `true`.\n *\n * @defaultValue `getIcon(\"checkboxIndeterminate\")`\n * @since 6.0.0\n */\n indeterminateIcon?: ReactNode;\n}\n\nexport interface CheckboxProps\n extends BaseInputToggleProps, IndeterminateCheckboxProps {}\n\n/** @since 6.0.0 */\nexport interface CheckboxInputToggleProps extends CheckboxProps {\n type: \"checkbox\";\n}\n\nexport interface RadioProps extends BaseInputToggleProps {\n /**\n * The value for the radio button.\n *\n * @since 6.0.0 This is now optional and no longer supports\n * `string[]` since there isn't much of a use case for array values.\n */\n value?: string | number;\n}\n\n/** @since 6.0.0 */\nexport interface RadioInputToggleProps extends RadioProps {\n type: \"radio\";\n}\n\n/**\n * @since 6.0.0 Updated to be a union between\n * `CheckboxInputToggleProps` and `RadioInputToggleProps`\n */\nexport type InputToggleProps = CheckboxInputToggleProps | RadioInputToggleProps;\n\n/**\n * **Client Component**\n *\n * @see {@link https://react-md.dev/components/checkbox | Checkbox Demos}\n * @see {@link https://react-md.dev/components/radio | Radio Demos}\n * @since 6.0.0 Now supports the `FormMessage` behavior and requires\n * different icons for each checked state.\n */\nexport function InputToggle(props: InputToggleProps): ReactElement {\n const {\n id: propId,\n ref,\n type,\n label,\n labelProps,\n style,\n className,\n autoComplete = type === \"checkbox\" ? \"off\" : undefined,\n disableLabelGap = false,\n stacked = false,\n iconAfter = false,\n size = \"normal\",\n error = false,\n active = false,\n indeterminate = false,\n messageProps,\n messageContainerProps,\n icon,\n checkedIcon,\n indeterminateIcon,\n iconProps,\n iconStyle,\n iconClassName,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onDragStart,\n onMouseUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n disableRipple,\n ...remaining\n } = props as CheckboxInputToggleProps;\n const { disabled = false, checked } = props;\n\n const id = useEnsuredId(propId, type);\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n disabled,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onDragStart,\n onMouseUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n });\n\n // set on the `remaining` object to bypass the eslint rule about\n // aria-checked not being valid for textbox role\n remaining[\"aria-checked\"] =\n (remaining[\"aria-checked\"] ?? indeterminate) ? \"mixed\" : undefined;\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <Label\n {...labelProps}\n gap={!disableLabelGap}\n style={style}\n stacked={stacked}\n reversed={!iconAfter}\n active={active}\n error={error}\n disabled={disabled}\n className={className}\n >\n {label}\n <InputToggleIcon\n style={iconStyle}\n {...iconProps}\n className={cnb(pressedClassName, iconClassName, iconProps?.className)}\n error={error}\n checked={checked}\n disabled={disabled}\n size={size}\n type={type}\n icon={icon}\n checkedIcon={checkedIcon}\n indeterminate={indeterminate}\n indeterminateIcon={indeterminateIcon}\n >\n <input\n {...remaining}\n {...handlers}\n autoComplete={autoComplete}\n id={id}\n ref={ref}\n type={type}\n className=\"rmd-hidden-input\"\n />\n {ripples}\n </InputToggleIcon>\n </Label>\n </FormMessageContainer>\n );\n}\n"],"names":["cnb","useElementInteraction","useEnsuredId","FormMessageContainer","InputToggleIcon","Label","InputToggle","props","id","propId","ref","type","label","labelProps","style","className","autoComplete","undefined","disableLabelGap","stacked","iconAfter","size","error","active","indeterminate","messageProps","messageContainerProps","icon","checkedIcon","indeterminateIcon","iconProps","iconStyle","iconClassName","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onDragStart","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","disableRipple","remaining","disabled","checked","pressedClassName","ripples","handlers","mode","gap","reversed","input"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAYhC,SAASC,qBAAqB,QAAQ,0CAA0C;AAEhF,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,QAAQ,aAAa;AAiNnC;;;;;;;CAOC,GACD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EACJC,IAAIC,MAAM,EACVC,GAAG,EACHC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,eAAeL,SAAS,aAAa,QAAQM,SAAS,EACtDC,kBAAkB,KAAK,EACvBC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,OAAO,QAAQ,EACfC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,gBAAgB,KAAK,EACrBC,YAAY,EACZC,qBAAqB,EACrBC,IAAI,EACJC,WAAW,EACXC,iBAAiB,EACjBC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,aAAa,EACb,GAAGC,WACJ,GAAGtC;IACJ,MAAM,EAAEuC,WAAW,KAAK,EAAEC,OAAO,EAAE,GAAGxC;IAEtC,MAAMC,KAAKN,aAAaO,QAAQE;IAChC,MAAM,EAAEqC,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGjD,sBAAsB;QACpEkD,MAAMP,gBAAgB,SAAS3B;QAC/B6B;QACAb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,gEAAgE;IAChE,gDAAgD;IAChDE,SAAS,CAAC,eAAe,GACvB,AAACA,SAAS,CAAC,eAAe,IAAIrB,gBAAiB,UAAUP;IAE3D,qBACE,KAACd;QACE,GAAGuB,qBAAqB;QACzBD,cAAcA;kBAEd,cAAA,MAACpB;YACE,GAAGQ,UAAU;YACduC,KAAK,CAAClC;YACNJ,OAAOA;YACPK,SAASA;YACTkC,UAAU,CAACjC;YACXG,QAAQA;YACRD,OAAOA;YACPwB,UAAUA;YACV/B,WAAWA;;gBAEVH;8BACD,MAACR;oBACCU,OAAOiB;oBACN,GAAGD,SAAS;oBACbf,WAAWf,IAAIgD,kBAAkBhB,eAAeF,WAAWf;oBAC3DO,OAAOA;oBACPyB,SAASA;oBACTD,UAAUA;oBACVzB,MAAMA;oBACNV,MAAMA;oBACNgB,MAAMA;oBACNC,aAAaA;oBACbJ,eAAeA;oBACfK,mBAAmBA;;sCAEnB,KAACyB;4BACE,GAAGT,SAAS;4BACZ,GAAGK,QAAQ;4BACZlC,cAAcA;4BACdR,IAAIA;4BACJE,KAAKA;4BACLC,MAAMA;4BACNI,WAAU;;wBAEXkC;;;;;;AAKX"}
@@ -1,4 +1,4 @@
1
- import { type HTMLAttributes, type ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
2
2
  import { type InputToggleSize } from "./inputToggleStyles.js";
3
3
  /**
4
4
  * @since 2.8.0
@@ -8,6 +8,7 @@ import { type InputToggleSize } from "./inputToggleStyles.js";
8
8
  * @internal
9
9
  */
10
10
  export interface InputToggleIconProps extends HTMLAttributes<HTMLSpanElement> {
11
+ ref?: Ref<HTMLSpanElement>;
11
12
  type: "checkbox" | "radio";
12
13
  /**
13
14
  * Note: If this is `undefined` and the {@link FORM_CONFIG.uncontrolledToggles} is `false`,
@@ -45,4 +46,4 @@ export interface InputToggleIconProps extends HTMLAttributes<HTMLSpanElement> {
45
46
  * of a css overlay hack.
46
47
  * @internal
47
48
  */
48
- export declare const InputToggleIcon: import("react").ForwardRefExoticComponent<InputToggleIconProps & import("react").RefAttributes<HTMLSpanElement>>;
49
+ export declare function InputToggleIcon(props: InputToggleIconProps): ReactElement;
@@ -1,6 +1,5 @@
1
1
  import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cnb } from "cnbuilder";
3
- import { forwardRef } from "react";
4
3
  import { getIcon } from "../icon/config.js";
5
4
  import { FORM_CONFIG } from "./formConfig.js";
6
5
  import { inputToggle } from "./inputToggleStyles.js";
@@ -9,8 +8,8 @@ import { inputToggle } from "./inputToggleStyles.js";
9
8
  * @since 6.0.0 Updated to use different icons for each checked state instead
10
9
  * of a css overlay hack.
11
10
  * @internal
12
- */ export const InputToggleIcon = /*#__PURE__*/ forwardRef(function InputToggleIcon(props, ref) {
13
- const { type, size = "normal", icon: propIcon, error, checked, children, disabled, indeterminate, className, disableEm = false, checkedIcon: propCheckedIcon, indeterminateIcon: propIndeterminateIcon, ...remaining } = props;
11
+ */ export function InputToggleIcon(props) {
12
+ const { ref, type, size = "normal", icon: propIcon, error, checked, children, disabled, indeterminate, className, disableEm = false, checkedIcon: propCheckedIcon, indeterminateIcon: propIndeterminateIcon, ...remaining } = props;
14
13
  const uncheckedIcon = getIcon(type, propIcon);
15
14
  const checkedIcon = getIcon(`${type}Checked`, propCheckedIcon);
16
15
  const indeterminateIcon = getIcon("checkboxIndeterminate", propIndeterminateIcon);
@@ -50,6 +49,6 @@ import { inputToggle } from "./inputToggleStyles.js";
50
49
  icon
51
50
  ]
52
51
  });
53
- });
52
+ }
54
53
 
55
54
  //# sourceMappingURL=InputToggleIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/InputToggleIcon.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { getIcon } from \"../icon/config.js\";\nimport { FORM_CONFIG } from \"./formConfig.js\";\nimport { type InputToggleSize, inputToggle } from \"./inputToggleStyles.js\";\n\n/**\n * @since 2.8.0\n * @since 6.0.0 Removed the `circle` and `overlay` props since they are no\n * longer needed. Added the `icon`, `disableEm`, `checkedIcon` and\n * `indeterminateIcon` props.\n * @internal\n */\nexport interface InputToggleIconProps extends HTMLAttributes<HTMLSpanElement> {\n type: \"checkbox\" | \"radio\";\n /**\n * Note: If this is `undefined` and the {@link FORM_CONFIG.uncontrolledToggles} is `false`,\n * the icon state won't work.\n */\n checked?: boolean;\n\n /**\n * The icon to display while {@link checked} is `false`.\n */\n icon?: ReactNode;\n\n /**\n * The icon to display while {@link checked} is `true` and\n * {@link indeterminate} is `false`.\n */\n checkedIcon?: ReactNode;\n\n /**\n * The icon to display while both {@link checked} and {@link indeterminate}\n * are `true`.\n */\n indeterminateIcon?: ReactNode;\n\n /** @defaultValue `\"normal\"` */\n size?: InputToggleSize;\n\n /** @defaultValue `false` */\n error?: boolean;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /** @defaultValue `false` */\n disableEm?: boolean;\n\n /** @defaultValue `false` */\n indeterminate?: boolean;\n}\n\n/**\n * @since 2.8.0\n * @since 6.0.0 Updated to use different icons for each checked state instead\n * of a css overlay hack.\n * @internal\n */\nexport const InputToggleIcon = forwardRef<\n HTMLSpanElement,\n InputToggleIconProps\n>(function InputToggleIcon(props, ref) {\n const {\n type,\n size = \"normal\",\n icon: propIcon,\n error,\n checked,\n children,\n disabled,\n indeterminate,\n className,\n disableEm = false,\n checkedIcon: propCheckedIcon,\n indeterminateIcon: propIndeterminateIcon,\n ...remaining\n } = props;\n const uncheckedIcon = getIcon(type, propIcon);\n const checkedIcon = getIcon(`${type}Checked`, propCheckedIcon);\n const indeterminateIcon = getIcon(\n \"checkboxIndeterminate\",\n propIndeterminateIcon\n );\n\n let icon: ReactNode;\n let active = false;\n const uncontrolled = typeof checked !== \"boolean\";\n if (!uncontrolled || !FORM_CONFIG.uncontrolledToggles) {\n active = !!checked && !error;\n if (checked) {\n icon = indeterminate ? indeterminateIcon : checkedIcon;\n } else {\n icon = uncheckedIcon;\n }\n } else {\n icon = (\n <>\n {uncheckedIcon}\n {indeterminate ? indeterminateIcon : checkedIcon}\n </>\n );\n }\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={cnb(\n inputToggle({\n em: !disableEm,\n size,\n type,\n error,\n active,\n disabled,\n uncontrolled,\n className,\n })\n )}\n >\n {children}\n {icon}\n </span>\n );\n});\n"],"names":["cnb","forwardRef","getIcon","FORM_CONFIG","inputToggle","InputToggleIcon","props","ref","type","size","icon","propIcon","error","checked","children","disabled","indeterminate","className","disableEm","checkedIcon","propCheckedIcon","indeterminateIcon","propIndeterminateIcon","remaining","uncheckedIcon","active","uncontrolled","uncontrolledToggles","span","em"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8CC,UAAU,QAAQ,QAAQ;AAExE,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAA+BC,WAAW,QAAQ,yBAAyB;AAkD3E;;;;;CAKC,GACD,OAAO,MAAMC,gCAAkBJ,WAG7B,SAASI,gBAAgBC,KAAK,EAAEC,GAAG;IACnC,MAAM,EACJC,IAAI,EACJC,OAAO,QAAQ,EACfC,MAAMC,QAAQ,EACdC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,SAAS,EACTC,YAAY,KAAK,EACjBC,aAAaC,eAAe,EAC5BC,mBAAmBC,qBAAqB,EACxC,GAAGC,WACJ,GAAGjB;IACJ,MAAMkB,gBAAgBtB,QAAQM,MAAMG;IACpC,MAAMQ,cAAcjB,QAAQ,GAAGM,KAAK,OAAO,CAAC,EAAEY;IAC9C,MAAMC,oBAAoBnB,QACxB,yBACAoB;IAGF,IAAIZ;IACJ,IAAIe,SAAS;IACb,MAAMC,eAAe,OAAOb,YAAY;IACxC,IAAI,CAACa,gBAAgB,CAACvB,YAAYwB,mBAAmB,EAAE;QACrDF,SAAS,CAAC,CAACZ,WAAW,CAACD;QACvB,IAAIC,SAAS;YACXH,OAAOM,gBAAgBK,oBAAoBF;QAC7C,OAAO;YACLT,OAAOc;QACT;IACF,OAAO;QACLd,qBACE;;gBACGc;gBACAR,gBAAgBK,oBAAoBF;;;IAG3C;IAEA,qBACE,MAACS;QACE,GAAGL,SAAS;QACbhB,KAAKA;QACLU,WAAWjB,IACTI,YAAY;YACVyB,IAAI,CAACX;YACLT;YACAD;YACAI;YACAa;YACAV;YACAW;YACAT;QACF;;YAGDH;YACAJ;;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/form/InputToggleIcon.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { getIcon } from \"../icon/config.js\";\nimport { FORM_CONFIG } from \"./formConfig.js\";\nimport { type InputToggleSize, inputToggle } from \"./inputToggleStyles.js\";\n\n/**\n * @since 2.8.0\n * @since 6.0.0 Removed the `circle` and `overlay` props since they are no\n * longer needed. Added the `icon`, `disableEm`, `checkedIcon` and\n * `indeterminateIcon` props.\n * @internal\n */\nexport interface InputToggleIconProps extends HTMLAttributes<HTMLSpanElement> {\n ref?: Ref<HTMLSpanElement>;\n\n type: \"checkbox\" | \"radio\";\n\n /**\n * Note: If this is `undefined` and the {@link FORM_CONFIG.uncontrolledToggles} is `false`,\n * the icon state won't work.\n */\n checked?: boolean;\n\n /**\n * The icon to display while {@link checked} is `false`.\n */\n icon?: ReactNode;\n\n /**\n * The icon to display while {@link checked} is `true` and\n * {@link indeterminate} is `false`.\n */\n checkedIcon?: ReactNode;\n\n /**\n * The icon to display while both {@link checked} and {@link indeterminate}\n * are `true`.\n */\n indeterminateIcon?: ReactNode;\n\n /** @defaultValue `\"normal\"` */\n size?: InputToggleSize;\n\n /** @defaultValue `false` */\n error?: boolean;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /** @defaultValue `false` */\n disableEm?: boolean;\n\n /** @defaultValue `false` */\n indeterminate?: boolean;\n}\n\n/**\n * @since 2.8.0\n * @since 6.0.0 Updated to use different icons for each checked state instead\n * of a css overlay hack.\n * @internal\n */\nexport function InputToggleIcon(props: InputToggleIconProps): ReactElement {\n const {\n ref,\n type,\n size = \"normal\",\n icon: propIcon,\n error,\n checked,\n children,\n disabled,\n indeterminate,\n className,\n disableEm = false,\n checkedIcon: propCheckedIcon,\n indeterminateIcon: propIndeterminateIcon,\n ...remaining\n } = props;\n const uncheckedIcon = getIcon(type, propIcon);\n const checkedIcon = getIcon(`${type}Checked`, propCheckedIcon);\n const indeterminateIcon = getIcon(\n \"checkboxIndeterminate\",\n propIndeterminateIcon\n );\n\n let icon: ReactNode;\n let active = false;\n const uncontrolled = typeof checked !== \"boolean\";\n if (!uncontrolled || !FORM_CONFIG.uncontrolledToggles) {\n active = !!checked && !error;\n if (checked) {\n icon = indeterminate ? indeterminateIcon : checkedIcon;\n } else {\n icon = uncheckedIcon;\n }\n } else {\n icon = (\n <>\n {uncheckedIcon}\n {indeterminate ? indeterminateIcon : checkedIcon}\n </>\n );\n }\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={cnb(\n inputToggle({\n em: !disableEm,\n size,\n type,\n error,\n active,\n disabled,\n uncontrolled,\n className,\n })\n )}\n >\n {children}\n {icon}\n </span>\n );\n}\n"],"names":["cnb","getIcon","FORM_CONFIG","inputToggle","InputToggleIcon","props","ref","type","size","icon","propIcon","error","checked","children","disabled","indeterminate","className","disableEm","checkedIcon","propCheckedIcon","indeterminateIcon","propIndeterminateIcon","remaining","uncheckedIcon","active","uncontrolled","uncontrolledToggles","span","em"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAQhC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAA+BC,WAAW,QAAQ,yBAAyB;AAqD3E;;;;;CAKC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EACJC,GAAG,EACHC,IAAI,EACJC,OAAO,QAAQ,EACfC,MAAMC,QAAQ,EACdC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,SAAS,EACTC,YAAY,KAAK,EACjBC,aAAaC,eAAe,EAC5BC,mBAAmBC,qBAAqB,EACxC,GAAGC,WACJ,GAAGjB;IACJ,MAAMkB,gBAAgBtB,QAAQM,MAAMG;IACpC,MAAMQ,cAAcjB,QAAQ,GAAGM,KAAK,OAAO,CAAC,EAAEY;IAC9C,MAAMC,oBAAoBnB,QACxB,yBACAoB;IAGF,IAAIZ;IACJ,IAAIe,SAAS;IACb,MAAMC,eAAe,OAAOb,YAAY;IACxC,IAAI,CAACa,gBAAgB,CAACvB,YAAYwB,mBAAmB,EAAE;QACrDF,SAAS,CAAC,CAACZ,WAAW,CAACD;QACvB,IAAIC,SAAS;YACXH,OAAOM,gBAAgBK,oBAAoBF;QAC7C,OAAO;YACLT,OAAOc;QACT;IACF,OAAO;QACLd,qBACE;;gBACGc;gBACAR,gBAAgBK,oBAAoBF;;;IAG3C;IAEA,qBACE,MAACS;QACE,GAAGL,SAAS;QACbhB,KAAKA;QACLU,WAAWhB,IACTG,YAAY;YACVyB,IAAI,CAACX;YACLT;YACAD;YACAI;YACAa;YACAV;YACAW;YACAT;QACF;;YAGDH;YACAJ;;;AAGP"}