react-miui 0.33.0 → 0.35.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 (343) hide show
  1. package/.claude/settings.json +12 -0
  2. package/.claude/settings.local.json +5 -1
  3. package/.storybook/preview.tsx +10 -4
  4. package/CHANGELOG.md +22 -0
  5. package/dist/components/form/index.d.ts +1 -0
  6. package/dist/components/form/index.d.ts.map +1 -1
  7. package/dist/components/form/index.js +1 -0
  8. package/dist/components/form/index.js.map +1 -1
  9. package/dist/components/form/input/Input.d.ts.map +1 -1
  10. package/dist/components/form/input/Input.js +9 -5
  11. package/dist/components/form/input/Input.js.map +1 -1
  12. package/dist/components/form/timepicker/TimePicker.css.d.ts +99 -0
  13. package/dist/components/form/timepicker/TimePicker.css.d.ts.map +1 -0
  14. package/dist/components/form/timepicker/TimePicker.css.js +116 -0
  15. package/dist/components/form/timepicker/TimePicker.css.js.map +1 -0
  16. package/dist/components/form/timepicker/TimePicker.d.ts +22 -0
  17. package/dist/components/form/timepicker/TimePicker.d.ts.map +1 -0
  18. package/dist/components/form/timepicker/TimePicker.js +141 -0
  19. package/dist/components/form/timepicker/TimePicker.js.map +1 -0
  20. package/dist/components/form/timepicker/TimePicker.styled.d.ts +936 -0
  21. package/dist/components/form/timepicker/TimePicker.styled.d.ts.map +1 -0
  22. package/dist/components/form/timepicker/TimePicker.styled.js +29 -0
  23. package/dist/components/form/timepicker/TimePicker.styled.js.map +1 -0
  24. package/dist/components/form/timepicker/TimePickerModal.d.ts +17 -0
  25. package/dist/components/form/timepicker/TimePickerModal.d.ts.map +1 -0
  26. package/dist/components/form/timepicker/TimePickerModal.js +92 -0
  27. package/dist/components/form/timepicker/TimePickerModal.js.map +1 -0
  28. package/dist/components/form/timepicker/Wheel.d.ts +12 -0
  29. package/dist/components/form/timepicker/Wheel.d.ts.map +1 -0
  30. package/dist/components/form/timepicker/Wheel.js +187 -0
  31. package/dist/components/form/timepicker/Wheel.js.map +1 -0
  32. package/dist/components/form/timepicker/utils.d.ts +4 -0
  33. package/dist/components/form/timepicker/utils.d.ts.map +1 -0
  34. package/dist/components/form/timepicker/utils.js +62 -0
  35. package/dist/components/form/timepicker/utils.js.map +1 -0
  36. package/dist/components/icons/Clock.d.ts +7 -0
  37. package/dist/components/icons/Clock.d.ts.map +1 -0
  38. package/dist/components/icons/Clock.js +45 -0
  39. package/dist/components/icons/Clock.js.map +1 -0
  40. package/dist/components/icons/Icon.d.ts +2 -1
  41. package/dist/components/icons/Icon.d.ts.map +1 -1
  42. package/dist/components/icons/Icon.js +3 -0
  43. package/dist/components/icons/Icon.js.map +1 -1
  44. package/dist/components/ui/drawer/Drawer.d.ts +10 -1
  45. package/dist/components/ui/drawer/Drawer.d.ts.map +1 -1
  46. package/dist/components/ui/drawer/Drawer.js +135 -15
  47. package/dist/components/ui/drawer/Drawer.js.map +1 -1
  48. package/dist/components/ui/drawer/Drawer.styled.d.ts +86 -1
  49. package/dist/components/ui/drawer/Drawer.styled.d.ts.map +1 -1
  50. package/dist/components/ui/drawer/Drawer.styled.js +13 -1
  51. package/dist/components/ui/drawer/Drawer.styled.js.map +1 -1
  52. package/dist/components/ui/modal/Modal.d.ts +1 -2
  53. package/dist/components/ui/modal/Modal.d.ts.map +1 -1
  54. package/dist/components/ui/modal/Modal.js +114 -42
  55. package/dist/components/ui/modal/Modal.js.map +1 -1
  56. package/dist/components/ui/modal/Modal.styled.d.ts +1 -1
  57. package/dist/components/ui/modal/Modal.styled.d.ts.map +1 -1
  58. package/dist/components/ui/modal/Modal.styled.js +40 -25
  59. package/dist/components/ui/modal/Modal.styled.js.map +1 -1
  60. package/dist/components/ui/toaster/Toaster.d.ts.map +1 -1
  61. package/dist/components/ui/toaster/Toaster.js +7 -1
  62. package/dist/components/ui/toaster/Toaster.js.map +1 -1
  63. package/dist/components/ui/tooltip/Tooltip.d.ts +30 -0
  64. package/dist/components/ui/tooltip/Tooltip.d.ts.map +1 -0
  65. package/dist/components/ui/tooltip/Tooltip.js +81 -0
  66. package/dist/components/ui/tooltip/Tooltip.js.map +1 -0
  67. package/dist/components/ui/tooltip/Tooltip.styled.d.ts +173 -0
  68. package/dist/components/ui/tooltip/Tooltip.styled.d.ts.map +1 -0
  69. package/dist/components/ui/tooltip/Tooltip.styled.js +65 -0
  70. package/dist/components/ui/tooltip/Tooltip.styled.js.map +1 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +1 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/theme.css-global.d.ts.map +1 -1
  76. package/dist/theme.css-global.js +0 -1
  77. package/dist/theme.css-global.js.map +1 -1
  78. package/dist/utils/index.d.ts +1 -0
  79. package/dist/utils/index.d.ts.map +1 -1
  80. package/dist/utils/index.js +1 -0
  81. package/dist/utils/index.js.map +1 -1
  82. package/dist/utils/useNativeValidity.d.ts +11 -0
  83. package/dist/utils/useNativeValidity.d.ts.map +1 -0
  84. package/dist/utils/useNativeValidity.js +32 -0
  85. package/dist/utils/useNativeValidity.js.map +1 -0
  86. package/docs/assets/highlight.css +7 -0
  87. package/docs/assets/navigation.js +1 -1
  88. package/docs/assets/search.js +1 -1
  89. package/docs/classes/index.Pop.html +7 -7
  90. package/docs/documents/Test.html +2 -2
  91. package/docs/enums/index.ICON.html +3 -2
  92. package/docs/functions/index.Action.html +3 -3
  93. package/docs/functions/index.Button.html +4 -4
  94. package/docs/functions/index.Card.html +3 -3
  95. package/docs/functions/index.Checkbox.html +3 -3
  96. package/docs/functions/index.Choice.html +2 -2
  97. package/docs/functions/index.ColorPicker.html +3 -3
  98. package/docs/functions/index.CoveringLoader.html +3 -3
  99. package/docs/functions/index.DirectionPad.html +2 -2
  100. package/docs/functions/index.Drawer.html +2 -2
  101. package/docs/functions/index.EqualActions.html +2 -2
  102. package/docs/functions/index.FullLoader.html +3 -3
  103. package/docs/functions/index.Gap.html +3 -3
  104. package/docs/functions/index.HandleEsc.html +3 -3
  105. package/docs/functions/index.Header.html +3 -3
  106. package/docs/functions/index.HeaderIconAction.html +3 -3
  107. package/docs/functions/index.Icon-1.html +2 -2
  108. package/docs/functions/index.If.html +3 -3
  109. package/docs/functions/index.Input.html +1 -1
  110. package/docs/functions/index.KeyValue.html +2 -2
  111. package/docs/functions/index.Label.html +2 -2
  112. package/docs/functions/index.Line.html +4 -4
  113. package/docs/functions/index.List.html +2 -2
  114. package/docs/functions/index.Loader.html +3 -3
  115. package/docs/functions/index.Loading.html +3 -3
  116. package/docs/functions/index.Message.html +4 -4
  117. package/docs/functions/index.Modal.html +2 -2
  118. package/docs/functions/index.ModalButtons.html +3 -3
  119. package/docs/functions/index.PopLoader.html +3 -3
  120. package/docs/functions/index.PopOption.html +2 -2
  121. package/docs/functions/index.Progress.html +2 -2
  122. package/docs/functions/index.SearchContainer.html +3 -3
  123. package/docs/functions/index.Section.html +4 -4
  124. package/docs/functions/index.Select.html +3 -3
  125. package/docs/functions/index.Selector.html +2 -2
  126. package/docs/functions/index.Spacer.html +3 -3
  127. package/docs/functions/index.Stats.html +2 -2
  128. package/docs/functions/index.StickyHeader.html +4 -4
  129. package/docs/functions/index.Table.html +3 -3
  130. package/docs/functions/index.TextArea.html +2 -2
  131. package/docs/functions/index.TimePicker.html +10 -0
  132. package/docs/functions/index.ToasterProvider.html +3 -3
  133. package/docs/functions/index.Toggle.html +3 -3
  134. package/docs/functions/index.ToolButton.html +4 -4
  135. package/docs/functions/index.Tooltip.html +18 -0
  136. package/docs/functions/index.TooltipProvider.html +6 -0
  137. package/docs/functions/index.borderPxToRem.html +1 -1
  138. package/docs/functions/index.createTheme.html +1 -1
  139. package/docs/functions/index.css.html +1 -1
  140. package/docs/functions/index.dimensionsPxToRem.html +1 -1
  141. package/docs/functions/index.fontPxToRem.html +1 -1
  142. package/docs/functions/index.getCssText.html +1 -1
  143. package/docs/functions/index.globalCss.html +2 -2
  144. package/docs/functions/index.injectGlobalStyles.html +1 -1
  145. package/docs/functions/index.keyframes.html +1 -1
  146. package/docs/functions/index.pxToRem.html +1 -1
  147. package/docs/functions/index.styled.html +1 -1
  148. package/docs/functions/index.toast.html +2 -2
  149. package/docs/functions/index.useToaster.html +1 -1
  150. package/docs/index.html +2 -2
  151. package/docs/interfaces/index.IconProps.html +2 -2
  152. package/docs/interfaces/index.InputCustomProps.html +3 -3
  153. package/docs/interfaces/index.LoaderProps.html +6 -6
  154. package/docs/interfaces/index.StickyHeaderProps.html +4 -4
  155. package/docs/interfaces/index.ToasterProviderProps.html +3 -3
  156. package/docs/interfaces/index.TooltipProps.html +36 -0
  157. package/docs/interfaces/index.TooltipProviderProps.html +13 -0
  158. package/docs/modules/index.html +1 -1
  159. package/docs/modules.html +1 -1
  160. package/docs/types/index.ActionProps.html +1 -1
  161. package/docs/types/index.CardProps.html +1 -1
  162. package/docs/types/index.CheckboxProps.html +2 -2
  163. package/docs/types/index.ChoiceProps.html +1 -1
  164. package/docs/types/index.ColorPickerProps.html +1 -1
  165. package/docs/types/index.DirectionPadProps.html +1 -1
  166. package/docs/types/index.DrawerFrom.html +1 -0
  167. package/docs/types/index.DrawerProps.html +28 -1
  168. package/docs/types/index.EqualActionsProps.html +1 -1
  169. package/docs/types/index.HeaderProps.html +1 -1
  170. package/docs/types/index.InputProps.html +1 -1
  171. package/docs/types/index.KeyValueProps.html +1 -1
  172. package/docs/types/index.LabelProps.html +1 -1
  173. package/docs/types/index.OverwriteProps.html +1 -1
  174. package/docs/types/index.ProgressProps.html +2 -2
  175. package/docs/types/index.SelectProps.html +1 -1
  176. package/docs/types/index.SelectorProps.html +1 -1
  177. package/docs/types/index.Stat.html +1 -1
  178. package/docs/types/index.StatsProps.html +1 -1
  179. package/docs/types/index.TextAreaProps.html +1 -1
  180. package/docs/types/index.ThemeCSS.html +1 -1
  181. package/docs/types/index.TimePickerProps.html +1 -0
  182. package/docs/types/index.ToggleProps.html +2 -2
  183. package/docs/variables/index.ActionBadgeSelector.html +1 -1
  184. package/docs/variables/index.ActionCircleSelector.html +1 -1
  185. package/docs/variables/index.CheckboxCheckmarkWrapperSelector.html +1 -1
  186. package/docs/variables/index.CheckboxTextLabelSelector.html +1 -1
  187. package/docs/variables/index.ChoiceItemSelector.html +1 -1
  188. package/docs/variables/index.ColorPickerColorDisplaySelector.html +1 -1
  189. package/docs/variables/index.DirectionPadButtonDotSelector.html +1 -1
  190. package/docs/variables/index.DirectionPadButtonSelector.html +1 -1
  191. package/docs/variables/index.DirectionPadLineSelector.html +1 -1
  192. package/docs/variables/index.DirectionPadMiddleSelector.html +1 -1
  193. package/docs/variables/index.DrawerContentSelector.html +1 -1
  194. package/docs/variables/index.HeaderAfterSelector.html +1 -1
  195. package/docs/variables/index.HeaderBeforeSelector.html +1 -1
  196. package/docs/variables/index.HeaderContentsSelector.html +1 -1
  197. package/docs/variables/index.HeaderIconActionIconSelector.html +1 -1
  198. package/docs/variables/index.InputContainerSelector.html +1 -1
  199. package/docs/variables/index.InputInputSelector.html +1 -1
  200. package/docs/variables/index.InputLabelSelector.html +1 -1
  201. package/docs/variables/index.InputPrefixSelector.html +1 -1
  202. package/docs/variables/index.InputSuffixSelector.html +1 -1
  203. package/docs/variables/index.KeyValueIconSelector.html +1 -1
  204. package/docs/variables/index.KeyValueItemSelector.html +1 -1
  205. package/docs/variables/index.KeyValueKeySelector.html +1 -1
  206. package/docs/variables/index.KeyValuePairSelector.html +1 -1
  207. package/docs/variables/index.KeyValueValueSelector.html +1 -1
  208. package/docs/variables/index.LabelTextSelector.html +1 -1
  209. package/docs/variables/index.ListItemInnerContainerClassNameSelector.html +1 -1
  210. package/docs/variables/index.ModalContainerSelector.html +1 -1
  211. package/docs/variables/index.ModalRemovePaddingSelector.html +1 -1
  212. package/docs/variables/index.ModalTitleSelector.html +1 -1
  213. package/docs/variables/index.PopListSelector.html +1 -1
  214. package/docs/variables/index.PopOptionButtonSelector.html +1 -1
  215. package/docs/variables/index.PopOptionIconSelector.html +1 -1
  216. package/docs/variables/index.PopOverlaySelector.html +1 -1
  217. package/docs/variables/index.ProgressBackgroundSelector.html +1 -1
  218. package/docs/variables/index.ProgressValueSelector.html +1 -1
  219. package/docs/variables/index.SelectorItemSelector.html +1 -1
  220. package/docs/variables/index.StatsItemSelector.html +1 -1
  221. package/docs/variables/index.StatsLabelSelector.html +1 -1
  222. package/docs/variables/index.StatsSeparatorSelector.html +1 -1
  223. package/docs/variables/index.StatsValueSelector.html +1 -1
  224. package/docs/variables/index.TextAreaLabelSelector.html +1 -1
  225. package/docs/variables/index.TextAreaTextAreaSelector.html +1 -1
  226. package/docs/variables/index.TextAreaWrapperSelector.html +1 -1
  227. package/docs/variables/index.ToggleStyledToggleSelector.html +1 -1
  228. package/docs/variables/index.TooltipContentSelector.html +1 -0
  229. package/docs/variables/index.config.html +1 -1
  230. package/docs/variables/index.cssReset.html +2 -2
  231. package/docs/variables/index.darkTheme.html +1 -1
  232. package/docs/variables/index.miuiScrollbars.html +1 -1
  233. package/docs/variables/index.theme.html +1 -1
  234. package/esm/components/form/index.d.ts +1 -0
  235. package/esm/components/form/index.d.ts.map +1 -1
  236. package/esm/components/form/index.js +1 -0
  237. package/esm/components/form/index.js.map +1 -1
  238. package/esm/components/form/input/Input.d.ts.map +1 -1
  239. package/esm/components/form/input/Input.js +9 -5
  240. package/esm/components/form/input/Input.js.map +1 -1
  241. package/esm/components/form/timepicker/TimePicker.css.d.ts +99 -0
  242. package/esm/components/form/timepicker/TimePicker.css.d.ts.map +1 -0
  243. package/esm/components/form/timepicker/TimePicker.css.js +102 -0
  244. package/esm/components/form/timepicker/TimePicker.css.js.map +1 -0
  245. package/esm/components/form/timepicker/TimePicker.d.ts +22 -0
  246. package/esm/components/form/timepicker/TimePicker.d.ts.map +1 -0
  247. package/esm/components/form/timepicker/TimePicker.js +93 -0
  248. package/esm/components/form/timepicker/TimePicker.js.map +1 -0
  249. package/esm/components/form/timepicker/TimePicker.styled.d.ts +936 -0
  250. package/esm/components/form/timepicker/TimePicker.styled.d.ts.map +1 -0
  251. package/esm/components/form/timepicker/TimePicker.styled.js +20 -0
  252. package/esm/components/form/timepicker/TimePicker.styled.js.map +1 -0
  253. package/esm/components/form/timepicker/TimePickerModal.d.ts +17 -0
  254. package/esm/components/form/timepicker/TimePickerModal.d.ts.map +1 -0
  255. package/esm/components/form/timepicker/TimePickerModal.js +56 -0
  256. package/esm/components/form/timepicker/TimePickerModal.js.map +1 -0
  257. package/esm/components/form/timepicker/Wheel.d.ts +12 -0
  258. package/esm/components/form/timepicker/Wheel.d.ts.map +1 -0
  259. package/esm/components/form/timepicker/Wheel.js +151 -0
  260. package/esm/components/form/timepicker/Wheel.js.map +1 -0
  261. package/esm/components/form/timepicker/utils.d.ts +4 -0
  262. package/esm/components/form/timepicker/utils.d.ts.map +1 -0
  263. package/esm/components/form/timepicker/utils.js +58 -0
  264. package/esm/components/form/timepicker/utils.js.map +1 -0
  265. package/esm/components/icons/Clock.d.ts +7 -0
  266. package/esm/components/icons/Clock.d.ts.map +1 -0
  267. package/esm/components/icons/Clock.js +9 -0
  268. package/esm/components/icons/Clock.js.map +1 -0
  269. package/esm/components/icons/Icon.d.ts +2 -1
  270. package/esm/components/icons/Icon.d.ts.map +1 -1
  271. package/esm/components/icons/Icon.js +3 -0
  272. package/esm/components/icons/Icon.js.map +1 -1
  273. package/esm/components/ui/drawer/Drawer.d.ts +10 -1
  274. package/esm/components/ui/drawer/Drawer.d.ts.map +1 -1
  275. package/esm/components/ui/drawer/Drawer.js +139 -15
  276. package/esm/components/ui/drawer/Drawer.js.map +1 -1
  277. package/esm/components/ui/drawer/Drawer.styled.d.ts +86 -1
  278. package/esm/components/ui/drawer/Drawer.styled.d.ts.map +1 -1
  279. package/esm/components/ui/drawer/Drawer.styled.js +12 -1
  280. package/esm/components/ui/drawer/Drawer.styled.js.map +1 -1
  281. package/esm/components/ui/modal/Modal.d.ts +1 -2
  282. package/esm/components/ui/modal/Modal.d.ts.map +1 -1
  283. package/esm/components/ui/modal/Modal.js +103 -43
  284. package/esm/components/ui/modal/Modal.js.map +1 -1
  285. package/esm/components/ui/modal/Modal.styled.d.ts +1 -1
  286. package/esm/components/ui/modal/Modal.styled.d.ts.map +1 -1
  287. package/esm/components/ui/modal/Modal.styled.js +40 -25
  288. package/esm/components/ui/modal/Modal.styled.js.map +1 -1
  289. package/esm/components/ui/toaster/Toaster.d.ts.map +1 -1
  290. package/esm/components/ui/toaster/Toaster.js +8 -2
  291. package/esm/components/ui/toaster/Toaster.js.map +1 -1
  292. package/esm/components/ui/tooltip/Tooltip.d.ts +30 -0
  293. package/esm/components/ui/tooltip/Tooltip.d.ts.map +1 -0
  294. package/esm/components/ui/tooltip/Tooltip.js +43 -0
  295. package/esm/components/ui/tooltip/Tooltip.js.map +1 -0
  296. package/esm/components/ui/tooltip/Tooltip.styled.d.ts +173 -0
  297. package/esm/components/ui/tooltip/Tooltip.styled.d.ts.map +1 -0
  298. package/esm/components/ui/tooltip/Tooltip.styled.js +28 -0
  299. package/esm/components/ui/tooltip/Tooltip.styled.js.map +1 -0
  300. package/esm/index.d.ts +1 -0
  301. package/esm/index.d.ts.map +1 -1
  302. package/esm/index.js +1 -0
  303. package/esm/index.js.map +1 -1
  304. package/esm/theme.css-global.d.ts.map +1 -1
  305. package/esm/theme.css-global.js +0 -1
  306. package/esm/theme.css-global.js.map +1 -1
  307. package/esm/utils/index.d.ts +1 -0
  308. package/esm/utils/index.d.ts.map +1 -1
  309. package/esm/utils/index.js +1 -0
  310. package/esm/utils/index.js.map +1 -1
  311. package/esm/utils/useNativeValidity.d.ts +11 -0
  312. package/esm/utils/useNativeValidity.d.ts.map +1 -0
  313. package/esm/utils/useNativeValidity.js +29 -0
  314. package/esm/utils/useNativeValidity.js.map +1 -0
  315. package/package.json +2 -1
  316. package/pnpm-workspace.yaml +3 -0
  317. package/src/bugfixes/ToastsFromModal.stories.tsx +59 -0
  318. package/src/components/form/index.ts +1 -0
  319. package/src/components/form/input/Input.stories.tsx +47 -1
  320. package/src/components/form/input/Input.tsx +11 -5
  321. package/src/components/form/timepicker/TimePicker.css.ts +132 -0
  322. package/src/components/form/timepicker/TimePicker.stories.tsx +107 -0
  323. package/src/components/form/timepicker/TimePicker.styled.ts +52 -0
  324. package/src/components/form/timepicker/TimePicker.tsx +229 -0
  325. package/src/components/form/timepicker/TimePickerModal.tsx +131 -0
  326. package/src/components/form/timepicker/Wheel.tsx +201 -0
  327. package/src/components/form/timepicker/utils.ts +66 -0
  328. package/src/components/icons/Clock.tsx +38 -0
  329. package/src/components/icons/Icon.tsx +3 -0
  330. package/src/components/ui/drawer/Drawer.stories.tsx +143 -59
  331. package/src/components/ui/drawer/Drawer.styled.ts +13 -0
  332. package/src/components/ui/drawer/Drawer.tsx +214 -20
  333. package/src/components/ui/modal/Modal.stories.tsx +43 -7
  334. package/src/components/ui/modal/Modal.styled.ts +46 -25
  335. package/src/components/ui/modal/Modal.tsx +135 -52
  336. package/src/components/ui/toaster/Toaster.tsx +12 -2
  337. package/src/components/ui/tooltip/Tooltip.stories.tsx +285 -0
  338. package/src/components/ui/tooltip/Tooltip.styled.ts +36 -0
  339. package/src/components/ui/tooltip/Tooltip.tsx +195 -0
  340. package/src/index.ts +1 -0
  341. package/src/theme.css-global.ts +0 -1
  342. package/src/utils/index.ts +1 -0
  343. package/src/utils/useNativeValidity.ts +57 -0
@@ -0,0 +1,36 @@
1
+ import * as RadixTooltip from "@radix-ui/react-tooltip";
2
+
3
+ import { dimensionsPxToRem, fontPxToRem, keyframes, pxToRem, styled } from "../../../theme";
4
+
5
+ const fadeIn = keyframes({
6
+ from: { opacity: 0, transform: "scale(0.96)" },
7
+ to: { opacity: 1, transform: "scale(1)" },
8
+ });
9
+
10
+ const StyledContent = styled(RadixTooltip.Content, {
11
+ "zIndex": 10,
12
+ "background": "$text2",
13
+ "color": "$background",
14
+ "padding": `${dimensionsPxToRem(18)} ${dimensionsPxToRem(36)}`,
15
+ "borderRadius": dimensionsPxToRem(12),
16
+ "fontSize": fontPxToRem(24),
17
+ "lineHeight": 1.3,
18
+ "maxWidth": pxToRem(280),
19
+ "boxShadow": `0 ${pxToRem(2)} ${pxToRem(8)} rgba(0, 0, 0, 0.18)`,
20
+ "userSelect": "none",
21
+ "transformOrigin": "var(--radix-tooltip-content-transform-origin)",
22
+ "animation": `${fadeIn.toString()} 120ms ease-out`,
23
+
24
+ "&[data-state=\"closed\"]": {
25
+ animationDirection: "reverse",
26
+ },
27
+ });
28
+
29
+ const StyledArrow = styled(RadixTooltip.Arrow, {
30
+ fill: "$text2",
31
+ });
32
+
33
+ export {
34
+ StyledContent,
35
+ StyledArrow,
36
+ };
@@ -0,0 +1,195 @@
1
+ import React, { forwardRef } from "react";
2
+
3
+ import * as RadixTooltip from "@radix-ui/react-tooltip";
4
+
5
+ import { StyledArrow, StyledContent } from "./Tooltip.styled";
6
+
7
+ type Side = "top" | "right" | "bottom" | "left";
8
+ type Align = "start" | "center" | "end";
9
+
10
+ interface TooltipProviderProps {
11
+ /**
12
+ * The duration from when the pointer enters the trigger until the tooltip opens, in milliseconds.
13
+ * Default: `500`.
14
+ */
15
+ delayDuration?: number;
16
+ /**
17
+ * If a tooltip has opened, the duration during which other tooltips open instantly
18
+ * (without waiting for `delayDuration`), in milliseconds.
19
+ * Default: `300`.
20
+ */
21
+ skipDelayDuration?: number;
22
+ /**
23
+ * When `true`, the tooltip content stays open while the pointer is over it.
24
+ * Set to `false` for stricter "hover the trigger only" behavior.
25
+ * Default: `true`.
26
+ */
27
+ disableHoverableContent?: boolean;
28
+ children: React.ReactNode;
29
+ }
30
+
31
+ /**
32
+ * Required wrapper for `<Tooltip>`. Render it once near the root of your app — usually
33
+ * around (or just inside) your top-level layout. It enables group-delay behavior via
34
+ * `skipDelayDuration`: once one tooltip in the subtree has been seen, the next ones
35
+ * open without waiting for `delayDuration`.
36
+ *
37
+ * A single `<Tooltip>` without a `<TooltipProvider>` ancestor will throw at runtime.
38
+ */
39
+ const TooltipProvider = (props: TooltipProviderProps) => {
40
+ const radixProps: Omit<React.ComponentProps<typeof RadixTooltip.Provider>, "children"> = {};
41
+ if (props.delayDuration !== undefined) { radixProps.delayDuration = props.delayDuration; }
42
+ if (props.skipDelayDuration !== undefined) { radixProps.skipDelayDuration = props.skipDelayDuration; }
43
+ if (props.disableHoverableContent !== undefined) {
44
+ radixProps.disableHoverableContent = props.disableHoverableContent;
45
+ }
46
+
47
+ return (
48
+ <RadixTooltip.Provider {...radixProps}>
49
+ {props.children}
50
+ </RadixTooltip.Provider>
51
+ );
52
+ };
53
+
54
+ interface TooltipProps {
55
+ /**
56
+ * The content to render inside the tooltip.
57
+ */
58
+ content: React.ReactNode;
59
+ /**
60
+ * Preferred side of the trigger to render the tooltip against. Will be flipped
61
+ * automatically on collision unless `avoidCollisions` is `false`.
62
+ * Default: `"top"`.
63
+ */
64
+ side?: Side;
65
+ /**
66
+ * Distance in pixels between the trigger and the tooltip.
67
+ * Default: `6`.
68
+ */
69
+ sideOffset?: number;
70
+ /**
71
+ * Alignment along the chosen side.
72
+ * Default: `"center"`.
73
+ */
74
+ align?: Align;
75
+ /**
76
+ * Offset in pixels from the `align` edge.
77
+ * Default: `0`.
78
+ */
79
+ alignOffset?: number;
80
+ /**
81
+ * The duration from when the pointer enters the trigger until the tooltip opens.
82
+ * Overrides the provider's `delayDuration` for this tooltip only.
83
+ */
84
+ delayDuration?: number;
85
+ /**
86
+ * When `true`, the tooltip will not flip to the opposite side on collision.
87
+ * Default: `true` (collisions are avoided).
88
+ */
89
+ avoidCollisions?: boolean;
90
+ /**
91
+ * When `true`, renders an arrow pointing at the trigger.
92
+ * Default: `true`.
93
+ */
94
+ arrow?: boolean;
95
+ /**
96
+ * Controlled open state. If omitted, the tooltip is uncontrolled.
97
+ */
98
+ open?: boolean;
99
+ /**
100
+ * Initial open state for the uncontrolled mode.
101
+ */
102
+ defaultOpen?: boolean;
103
+ /**
104
+ * Called when the open state changes.
105
+ */
106
+ onOpenChange?: (open: boolean) => void;
107
+ /**
108
+ * Additional class name applied to the tooltip content.
109
+ */
110
+ className?: string;
111
+ /**
112
+ * The element that triggers the tooltip on hover/focus. Must be a single React element
113
+ * that can receive a ref and event handlers (a DOM element or a component using forwardRef).
114
+ */
115
+ children: React.ReactElement;
116
+ }
117
+
118
+ /**
119
+ * A tooltip that appears on hover or keyboard focus of its child trigger.
120
+ *
121
+ * Powered by Radix UI under the hood, so accessibility (ARIA, focus, escape, group delay)
122
+ * is handled. The content is portalled to `document.body`, so it escapes stacking contexts
123
+ * and renders above modals/drawers.
124
+ *
125
+ * Requires a `<TooltipProvider>` somewhere up the tree.
126
+ *
127
+ * @example
128
+ * ```tsx
129
+ * <TooltipProvider>
130
+ * <Tooltip content="Save changes" side="bottom">
131
+ * <Button>Save</Button>
132
+ * </Tooltip>
133
+ * </TooltipProvider>
134
+ * ```
135
+ */
136
+ // eslint-disable-next-line react/no-multi-comp
137
+ const Tooltip = forwardRef<HTMLDivElement, TooltipProps>((props, ref) => {
138
+ const {
139
+ content,
140
+ side = "top",
141
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
142
+ sideOffset = 6,
143
+ align = "center",
144
+ alignOffset = 0,
145
+ delayDuration,
146
+ avoidCollisions = true,
147
+ arrow = true,
148
+ open,
149
+ defaultOpen,
150
+ onOpenChange,
151
+ className,
152
+ children,
153
+ } = props;
154
+
155
+ const rootProps: React.ComponentProps<typeof RadixTooltip.Root> = {};
156
+ if (open !== undefined) { rootProps.open = open; }
157
+ if (defaultOpen !== undefined) { rootProps.defaultOpen = defaultOpen; }
158
+ if (onOpenChange !== undefined) { rootProps.onOpenChange = onOpenChange; }
159
+ if (delayDuration !== undefined) { rootProps.delayDuration = delayDuration; }
160
+
161
+ return (
162
+ <RadixTooltip.Root {...rootProps}>
163
+ <RadixTooltip.Trigger asChild={true}>
164
+ {children}
165
+ </RadixTooltip.Trigger>
166
+ <RadixTooltip.Portal>
167
+ <StyledContent
168
+ ref={ref}
169
+ side={side}
170
+ sideOffset={sideOffset}
171
+ align={align}
172
+ alignOffset={alignOffset}
173
+ avoidCollisions={avoidCollisions}
174
+ className={className}
175
+ >
176
+ {content}
177
+ {/* eslint-disable-next-line react/jsx-no-leaked-render */}
178
+ {arrow && <StyledArrow width={10} height={5} />}
179
+ </StyledContent>
180
+ </RadixTooltip.Portal>
181
+ </RadixTooltip.Root>
182
+ );
183
+ });
184
+
185
+ Tooltip.displayName = "Tooltip";
186
+ Tooltip.toString = () => StyledContent.toString();
187
+
188
+ const TooltipContentSelector = StyledContent.toString();
189
+
190
+ export {
191
+ Tooltip,
192
+ TooltipProvider,
193
+ TooltipContentSelector,
194
+ };
195
+ export type { TooltipProps, TooltipProviderProps };
package/src/index.ts CHANGED
@@ -42,6 +42,7 @@ export * from "./components/ui/stats/Stats";
42
42
  export * from "./components/ui/tabs/Selector";
43
43
  export * from "./components/ui/toaster/Toaster";
44
44
  export * from "./components/ui/toolButton/ToolButton";
45
+ export * from "./components/ui/tooltip/Tooltip";
45
46
 
46
47
  export * from "./components/utils/Gap";
47
48
  export * from "./components/utils/HandleEsc";
@@ -7,7 +7,6 @@ const injectGlobalStyles = globalCss({
7
7
  "*:focus-visible:focus-visible": {
8
8
  outline: "none !important",
9
9
  borderColor: "$focusColor",
10
- backgroundColor: "var(--focus-bg-set)",
11
10
  },
12
11
  "body": {
13
12
  color: "$text",
@@ -1,3 +1,4 @@
1
1
  export * from "./toObjectValue";
2
2
  export * from "./useKeyPress";
3
+ export * from "./useNativeValidity";
3
4
  export * from "./useTailSpin";
@@ -0,0 +1,57 @@
1
+ import { useCallback, useState } from "react";
2
+
3
+ import type React from "react";
4
+
5
+ interface UseNativeValidityResult {
6
+ /** Combined: the explicit `error` prop OR the input's native invalid state. Pass to your `error`/styling. */
7
+ finalError: boolean;
8
+ /** Re-checks validity. Call from your `onBlur`. */
9
+ onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
10
+ /** Clears the invalid flag if the value just became valid. Call from your `onChange`. */
11
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
+ /** Fires when the form tries to submit an invalid value. Call from your `onInvalid`. */
13
+ onInvalid: () => void;
14
+ /** Clears the invalid flag if the input is currently valid. Useful after programmatic value changes. */
15
+ revalidate: (input: HTMLInputElement | null) => void;
16
+ }
17
+
18
+ /**
19
+ * Tracks native HTML5 validity (pattern, required, type=email/url, etc.) and surfaces it
20
+ * as an `error` boolean — the rule mirrors the CSS `:user-invalid` pseudo-class:
21
+ * invalid is sticky after blur or a failed submit, and clears as soon as the value becomes valid.
22
+ *
23
+ * Compose the returned handlers with your component's own `onBlur` / `onChange` / `onInvalid`.
24
+ */
25
+ const useNativeValidity = (error: boolean | undefined): UseNativeValidityResult => {
26
+ const [nativeInvalid, setNativeInvalid] = useState(false);
27
+
28
+ const onBlur = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
29
+ setNativeInvalid(!e.currentTarget.checkValidity());
30
+ }, []);
31
+
32
+ const onChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
33
+ if (e.currentTarget.checkValidity()) {
34
+ setNativeInvalid(false);
35
+ }
36
+ }, []);
37
+
38
+ const onInvalid = useCallback(() => {
39
+ setNativeInvalid(true);
40
+ }, []);
41
+
42
+ const revalidate = useCallback((input: HTMLInputElement | null) => {
43
+ if (input?.checkValidity()) {
44
+ setNativeInvalid(false);
45
+ }
46
+ }, []);
47
+
48
+ return {
49
+ finalError: Boolean(error) || nativeInvalid,
50
+ onBlur,
51
+ onChange,
52
+ onInvalid,
53
+ revalidate,
54
+ };
55
+ };
56
+
57
+ export { useNativeValidity };