rsuite 6.0.0-canary-20241227 → 6.0.0-canary-20250103

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 (313) hide show
  1. package/AutoComplete/styles/index.css +8 -16
  2. package/Badge/styles/index.css +83 -17
  3. package/Badge/styles/index.less +68 -9
  4. package/Button/styles/index.css +5 -10
  5. package/Button/styles/mixin.less +1 -2
  6. package/CHANGELOG.md +18 -0
  7. package/Calendar/styles/index.css +6 -12
  8. package/Cascader/styles/index.css +8 -16
  9. package/CheckPicker/styles/index.css +8 -16
  10. package/CheckTree/styles/index.css +8 -16
  11. package/CheckTreePicker/styles/index.css +8 -16
  12. package/DatePicker/styles/index.css +9 -18
  13. package/DateRangePicker/styles/index.css +9 -18
  14. package/Dropdown/styles/index.css +5 -10
  15. package/IconButton/styles/index.css +7 -14
  16. package/InputGroup/styles/index.css +6 -12
  17. package/InputNumber/styles/index.css +6 -12
  18. package/InputPicker/styles/index.css +8 -16
  19. package/MultiCascadeTree/styles/index.css +8 -16
  20. package/MultiCascader/styles/index.css +8 -16
  21. package/Nav/styles/index.css +5 -10
  22. package/Navbar/styles/index.css +5 -10
  23. package/Pagination/styles/index.css +11 -22
  24. package/Rate/styles/index.css +16 -8
  25. package/Rate/styles/index.less +6 -2
  26. package/SelectPicker/styles/index.css +8 -16
  27. package/Stat/styles/index.css +7 -14
  28. package/Table/styles/index.css +2 -2
  29. package/Tabs/styles/index.css +5 -10
  30. package/Tag/styles/index.css +29 -21
  31. package/Tag/styles/index.less +6 -3
  32. package/TagInput/styles/index.css +8 -16
  33. package/TagPicker/styles/index.css +8 -16
  34. package/TimePicker/styles/index.css +9 -18
  35. package/TimeRangePicker/styles/index.css +9 -18
  36. package/Tree/styles/index.css +8 -16
  37. package/TreePicker/styles/index.css +8 -16
  38. package/Uploader/styles/index.css +7 -14
  39. package/cjs/Accordion/Accordion.js +1 -1
  40. package/cjs/AutoComplete/AutoComplete.d.ts +2 -2
  41. package/cjs/AutoComplete/Combobox.js +1 -1
  42. package/cjs/Badge/Badge.d.ts +40 -5
  43. package/cjs/Badge/Badge.js +30 -19
  44. package/cjs/Breadcrumb/Breadcrumb.js +1 -1
  45. package/cjs/Button/Button.d.ts +5 -1
  46. package/cjs/Button/Button.js +17 -3
  47. package/cjs/Card/Card.js +1 -1
  48. package/cjs/CascadeTree/utils.js +1 -1
  49. package/cjs/CustomProvider/CustomProvider.d.ts +12 -4
  50. package/cjs/CustomProvider/CustomProvider.js +4 -3
  51. package/cjs/DateInput/hooks/useDateInputState.js +10 -8
  52. package/cjs/DateInput/hooks/useKeyboardInputEvent.js +1 -0
  53. package/cjs/DatePicker/PredefinedRanges.js +1 -1
  54. package/cjs/DateRangePicker/DateRangePicker.js +1 -1
  55. package/cjs/Drawer/Drawer.d.ts +2 -2
  56. package/cjs/Drawer/Drawer.js +1 -1
  57. package/cjs/Drawer/DrawerBody.js +7 -5
  58. package/cjs/Drawer/DrawerFooter.js +7 -5
  59. package/cjs/Drawer/DrawerHeader.js +7 -5
  60. package/cjs/Drawer/DrawerTitle.js +7 -5
  61. package/cjs/Dropdown/Dropdown.d.ts +2 -2
  62. package/cjs/Dropdown/Dropdown.js +1 -1
  63. package/cjs/Dropdown/DropdownContext.d.ts +1 -1
  64. package/cjs/Dropdown/DropdownMenu.d.ts +2 -2
  65. package/cjs/Dropdown/DropdownToggle.d.ts +2 -2
  66. package/cjs/FlexboxGrid/FlexboxGrid.js +1 -1
  67. package/cjs/Form/Form.js +1 -1
  68. package/cjs/FormControl/FormControl.d.ts +2 -2
  69. package/cjs/FormErrorMessage/FormErrorMessage.d.ts +2 -2
  70. package/cjs/InlineEdit/EditableControls.js +1 -1
  71. package/cjs/InputGroup/InputGroup.js +1 -1
  72. package/cjs/InputNumber/InputNumber.js +1 -1
  73. package/cjs/InputPicker/InputPicker.js +0 -1
  74. package/cjs/InputPicker/TagList.js +1 -0
  75. package/cjs/InputPicker/TextBox.js +1 -0
  76. package/cjs/InputPicker/hooks/useMaxWidth.js +0 -1
  77. package/cjs/List/List.js +1 -1
  78. package/cjs/MaskedInput/MaskedInput.js +1 -0
  79. package/cjs/MaskedInput/conformToMask.js +0 -1
  80. package/cjs/Modal/Modal.js +1 -1
  81. package/cjs/Modal/utils.js +0 -1
  82. package/cjs/Nav/Nav.js +1 -1
  83. package/cjs/Nav/NavDropdown.d.ts +2 -2
  84. package/cjs/Nav/NavDropdown.js +1 -1
  85. package/cjs/Nav/NavDropdownToggle.d.ts +2 -2
  86. package/cjs/Navbar/Navbar.js +1 -1
  87. package/cjs/Navbar/NavbarDropdown.d.ts +2 -2
  88. package/cjs/Navbar/NavbarDropdown.js +1 -1
  89. package/cjs/Navbar/NavbarDropdownToggle.d.ts +2 -2
  90. package/cjs/Navbar/index.js +0 -0
  91. package/cjs/RangeSlider/RangeSlider.js +4 -4
  92. package/cjs/Rate/Character.js +6 -6
  93. package/cjs/Rate/Rate.d.ts +4 -4
  94. package/cjs/Rate/Rate.js +16 -15
  95. package/cjs/Sidenav/ExpandedSidenavDropdown.d.ts +2 -2
  96. package/cjs/Sidenav/Sidenav.js +1 -1
  97. package/cjs/Sidenav/SidenavDropdown.d.ts +2 -2
  98. package/cjs/Sidenav/SidenavDropdown.js +1 -1
  99. package/cjs/Sidenav/SidenavDropdownToggle.d.ts +2 -2
  100. package/cjs/Stack/HStack.js +1 -1
  101. package/cjs/Stack/Stack.js +1 -1
  102. package/cjs/Stack/VStack.js +1 -1
  103. package/cjs/Stat/Stat.js +1 -1
  104. package/cjs/Steps/Steps.js +1 -1
  105. package/cjs/Table/Table.js +2 -2
  106. package/cjs/Tabs/Tabs.js +8 -9
  107. package/cjs/Tag/Tag.d.ts +2 -2
  108. package/cjs/Tag/Tag.js +12 -6
  109. package/cjs/Timeline/Timeline.js +8 -5
  110. package/cjs/Tooltip/Tooltip.d.ts +2 -2
  111. package/cjs/Tree/hooks/useFlattenTree.js +1 -3
  112. package/cjs/Tree/hooks/useFocusTree.js +0 -1
  113. package/cjs/Tree/hooks/useTreeSearch.js +0 -1
  114. package/cjs/Uploader/UploadTrigger.js +13 -28
  115. package/cjs/Uploader/utils/ajaxUpload.js +1 -1
  116. package/cjs/internals/Disclosure/Disclosure.js +1 -0
  117. package/cjs/internals/Menu/useMenu.js +51 -49
  118. package/cjs/internals/Overlay/Overlay.d.ts +2 -2
  119. package/cjs/internals/Overlay/OverlayTrigger.d.ts +2 -2
  120. package/cjs/internals/Overlay/Position.d.ts +2 -2
  121. package/cjs/internals/Overlay/positionUtils.d.ts +2 -2
  122. package/cjs/internals/Picker/PickerToggle.d.ts +2 -2
  123. package/cjs/internals/Picker/PickerToggleTrigger.d.ts +2 -2
  124. package/cjs/internals/Picker/hooks/useFocusItemValue.js +1 -1
  125. package/cjs/internals/Picker/hooks/usePickerClassName.d.ts +2 -2
  126. package/cjs/internals/ScrollView/hooks/useScrollState.d.ts +1 -1
  127. package/cjs/internals/Tree/TreeView.js +2 -1
  128. package/cjs/internals/Tree/utils/getPathTowardsItem.js +1 -1
  129. package/cjs/internals/Windowing/AutoSizer.js +1 -0
  130. package/cjs/internals/Windowing/List.js +2 -1
  131. package/cjs/internals/hooks/useClassNames.d.ts +1 -2
  132. package/cjs/internals/hooks/useClassNames.js +0 -2
  133. package/cjs/internals/hooks/usePortal.js +1 -1
  134. package/cjs/internals/hooks/useToggleCaret.d.ts +2 -2
  135. package/cjs/internals/hooks/useToggleCaret.js +1 -1
  136. package/cjs/internals/hooks/useUpdateEffect.js +0 -1
  137. package/cjs/internals/hooks/useWillUnmount.js +0 -2
  138. package/cjs/internals/symbols.d.ts +1 -0
  139. package/cjs/internals/symbols.js +3 -2
  140. package/cjs/internals/types/colours.d.ts +10 -0
  141. package/cjs/internals/types/colours.js +15 -0
  142. package/cjs/internals/types/index.d.ts +6 -7
  143. package/cjs/internals/types/index.js +13 -1
  144. package/cjs/internals/types/placement.d.ts +5 -0
  145. package/cjs/internals/types/placement.js +4 -0
  146. package/cjs/internals/utils/BrowserDetection.d.ts +0 -2
  147. package/cjs/internals/utils/BrowserDetection.js +2 -12
  148. package/cjs/internals/utils/ReactChildren.js +0 -2
  149. package/cjs/internals/utils/colours.d.ts +21 -0
  150. package/cjs/internals/utils/colours.js +86 -0
  151. package/cjs/internals/utils/css.d.ts +13 -1
  152. package/cjs/internals/utils/css.js +42 -3
  153. package/cjs/internals/utils/getDOMNode.js +2 -2
  154. package/cjs/internals/utils/getSafeRegExpString.js +2 -1
  155. package/cjs/internals/utils/index.d.ts +2 -2
  156. package/cjs/internals/utils/index.js +17 -9
  157. package/cjs/toaster/ToastContainer.d.ts +8 -8
  158. package/cjs/toaster/ToastContainer.js +39 -36
  159. package/cjs/toaster/render.d.ts +2 -0
  160. package/cjs/toaster/render.js +25 -0
  161. package/cjs/toaster/toaster.js +29 -19
  162. package/cjs/useMediaQuery/useMediaQuery.js +1 -3
  163. package/cjs/useToaster/useToaster.js +10 -5
  164. package/dist/rsuite-no-reset-rtl.css +143 -74
  165. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  166. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  167. package/dist/rsuite-no-reset.css +143 -74
  168. package/dist/rsuite-no-reset.min.css +1 -1
  169. package/dist/rsuite-no-reset.min.css.map +1 -1
  170. package/dist/rsuite-rtl.css +143 -74
  171. package/dist/rsuite-rtl.min.css +1 -1
  172. package/dist/rsuite-rtl.min.css.map +1 -1
  173. package/dist/rsuite.css +143 -74
  174. package/dist/rsuite.js +113 -91
  175. package/dist/rsuite.js.map +1 -1
  176. package/dist/rsuite.min.css +1 -1
  177. package/dist/rsuite.min.css.map +1 -1
  178. package/dist/rsuite.min.js +1 -1
  179. package/dist/rsuite.min.js.map +1 -1
  180. package/esm/Accordion/Accordion.js +1 -1
  181. package/esm/AutoComplete/AutoComplete.d.ts +2 -2
  182. package/esm/AutoComplete/Combobox.js +1 -1
  183. package/esm/Badge/Badge.d.ts +40 -5
  184. package/esm/Badge/Badge.js +28 -19
  185. package/esm/Breadcrumb/Breadcrumb.js +1 -1
  186. package/esm/Button/Button.d.ts +5 -1
  187. package/esm/Button/Button.js +18 -4
  188. package/esm/Card/Card.js +1 -1
  189. package/esm/CascadeTree/utils.js +1 -1
  190. package/esm/CustomProvider/CustomProvider.d.ts +12 -4
  191. package/esm/CustomProvider/CustomProvider.js +5 -4
  192. package/esm/DateInput/hooks/useDateInputState.js +10 -8
  193. package/esm/DateInput/hooks/useKeyboardInputEvent.js +1 -0
  194. package/esm/DatePicker/PredefinedRanges.js +1 -1
  195. package/esm/DateRangePicker/DateRangePicker.js +1 -1
  196. package/esm/Drawer/Drawer.d.ts +2 -2
  197. package/esm/Drawer/Drawer.js +1 -1
  198. package/esm/Drawer/DrawerBody.js +7 -5
  199. package/esm/Drawer/DrawerFooter.js +7 -5
  200. package/esm/Drawer/DrawerHeader.js +7 -5
  201. package/esm/Drawer/DrawerTitle.js +7 -5
  202. package/esm/Dropdown/Dropdown.d.ts +2 -2
  203. package/esm/Dropdown/Dropdown.js +1 -1
  204. package/esm/Dropdown/DropdownContext.d.ts +1 -1
  205. package/esm/Dropdown/DropdownMenu.d.ts +2 -2
  206. package/esm/Dropdown/DropdownToggle.d.ts +2 -2
  207. package/esm/FlexboxGrid/FlexboxGrid.js +1 -1
  208. package/esm/Form/Form.js +1 -1
  209. package/esm/FormControl/FormControl.d.ts +2 -2
  210. package/esm/FormErrorMessage/FormErrorMessage.d.ts +2 -2
  211. package/esm/InlineEdit/EditableControls.js +1 -1
  212. package/esm/InputGroup/InputGroup.js +1 -1
  213. package/esm/InputNumber/InputNumber.js +1 -1
  214. package/esm/InputPicker/InputPicker.js +0 -1
  215. package/esm/InputPicker/TagList.js +1 -0
  216. package/esm/InputPicker/TextBox.js +1 -0
  217. package/esm/InputPicker/hooks/useMaxWidth.js +0 -1
  218. package/esm/List/List.js +1 -1
  219. package/esm/MaskedInput/MaskedInput.js +1 -0
  220. package/esm/MaskedInput/conformToMask.js +0 -1
  221. package/esm/Modal/Modal.js +1 -1
  222. package/esm/Modal/utils.js +0 -1
  223. package/esm/Nav/Nav.js +1 -1
  224. package/esm/Nav/NavDropdown.d.ts +2 -2
  225. package/esm/Nav/NavDropdown.js +1 -1
  226. package/esm/Nav/NavDropdownToggle.d.ts +2 -2
  227. package/esm/Navbar/Navbar.js +1 -1
  228. package/esm/Navbar/NavbarDropdown.d.ts +2 -2
  229. package/esm/Navbar/NavbarDropdown.js +1 -1
  230. package/esm/Navbar/NavbarDropdownToggle.d.ts +2 -2
  231. package/esm/Navbar/index.js +0 -0
  232. package/esm/RangeSlider/RangeSlider.js +4 -4
  233. package/esm/Rate/Character.js +8 -8
  234. package/esm/Rate/Rate.d.ts +4 -4
  235. package/esm/Rate/Rate.js +19 -18
  236. package/esm/Sidenav/ExpandedSidenavDropdown.d.ts +2 -2
  237. package/esm/Sidenav/Sidenav.js +1 -1
  238. package/esm/Sidenav/SidenavDropdown.d.ts +2 -2
  239. package/esm/Sidenav/SidenavDropdown.js +1 -1
  240. package/esm/Sidenav/SidenavDropdownToggle.d.ts +2 -2
  241. package/esm/Stack/HStack.js +1 -1
  242. package/esm/Stack/Stack.js +1 -1
  243. package/esm/Stack/VStack.js +1 -1
  244. package/esm/Stat/Stat.js +1 -1
  245. package/esm/Steps/Steps.js +1 -1
  246. package/esm/Table/Table.js +2 -2
  247. package/esm/Tabs/Tabs.js +8 -9
  248. package/esm/Tag/Tag.d.ts +2 -2
  249. package/esm/Tag/Tag.js +10 -6
  250. package/esm/Timeline/Timeline.js +8 -5
  251. package/esm/Tooltip/Tooltip.d.ts +2 -2
  252. package/esm/Tree/hooks/useFlattenTree.js +1 -3
  253. package/esm/Tree/hooks/useFocusTree.js +0 -1
  254. package/esm/Tree/hooks/useTreeSearch.js +0 -1
  255. package/esm/Uploader/UploadTrigger.js +15 -30
  256. package/esm/Uploader/utils/ajaxUpload.js +1 -1
  257. package/esm/internals/Disclosure/Disclosure.js +1 -0
  258. package/esm/internals/Menu/useMenu.js +51 -49
  259. package/esm/internals/Overlay/Overlay.d.ts +2 -2
  260. package/esm/internals/Overlay/OverlayTrigger.d.ts +2 -2
  261. package/esm/internals/Overlay/Position.d.ts +2 -2
  262. package/esm/internals/Overlay/positionUtils.d.ts +2 -2
  263. package/esm/internals/Picker/PickerToggle.d.ts +2 -2
  264. package/esm/internals/Picker/PickerToggleTrigger.d.ts +2 -2
  265. package/esm/internals/Picker/hooks/useFocusItemValue.js +1 -1
  266. package/esm/internals/Picker/hooks/usePickerClassName.d.ts +2 -2
  267. package/esm/internals/ScrollView/hooks/useScrollState.d.ts +1 -1
  268. package/esm/internals/Tree/TreeView.js +2 -1
  269. package/esm/internals/Tree/utils/getPathTowardsItem.js +1 -1
  270. package/esm/internals/Windowing/AutoSizer.js +1 -0
  271. package/esm/internals/Windowing/List.js +2 -1
  272. package/esm/internals/hooks/useClassNames.d.ts +1 -2
  273. package/esm/internals/hooks/useClassNames.js +0 -2
  274. package/esm/internals/hooks/usePortal.js +1 -1
  275. package/esm/internals/hooks/useToggleCaret.d.ts +2 -2
  276. package/esm/internals/hooks/useToggleCaret.js +1 -1
  277. package/esm/internals/hooks/useUpdateEffect.js +0 -1
  278. package/esm/internals/hooks/useWillUnmount.js +0 -2
  279. package/esm/internals/symbols.d.ts +1 -0
  280. package/esm/internals/symbols.js +2 -1
  281. package/esm/internals/types/colours.d.ts +10 -0
  282. package/esm/internals/types/colours.js +11 -0
  283. package/esm/internals/types/index.d.ts +6 -7
  284. package/esm/internals/types/index.js +6 -0
  285. package/esm/internals/types/placement.d.ts +5 -0
  286. package/esm/internals/types/placement.js +2 -0
  287. package/esm/internals/utils/BrowserDetection.d.ts +0 -2
  288. package/esm/internals/utils/BrowserDetection.js +1 -9
  289. package/esm/internals/utils/ReactChildren.js +0 -2
  290. package/esm/internals/utils/colours.d.ts +21 -0
  291. package/esm/internals/utils/colours.js +77 -0
  292. package/esm/internals/utils/css.d.ts +13 -1
  293. package/esm/internals/utils/css.js +40 -3
  294. package/esm/internals/utils/getDOMNode.js +1 -2
  295. package/esm/internals/utils/getSafeRegExpString.js +2 -1
  296. package/esm/internals/utils/index.d.ts +2 -2
  297. package/esm/internals/utils/index.js +3 -3
  298. package/esm/toaster/ToastContainer.d.ts +8 -8
  299. package/esm/toaster/ToastContainer.js +39 -37
  300. package/esm/toaster/render.d.ts +2 -0
  301. package/esm/toaster/render.js +21 -0
  302. package/esm/toaster/toaster.js +27 -18
  303. package/esm/useMediaQuery/useMediaQuery.js +1 -3
  304. package/esm/useToaster/useToaster.js +10 -5
  305. package/package.json +1 -1
  306. package/styles/color-modes/dark.less +1 -0
  307. package/styles/color-modes/high-contrast.less +1 -0
  308. package/styles/color-modes/light.less +1 -0
  309. package/styles/variables.less +1 -1
  310. package/cjs/internals/utils/render.d.ts +0 -7
  311. package/cjs/internals/utils/render.js +0 -26
  312. package/esm/internals/utils/render.d.ts +0 -7
  313. package/esm/internals/utils/render.js +0 -22
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ export let Colours = /*#__PURE__*/function (Colours) {
3
+ Colours["Red"] = "red";
4
+ Colours["Orange"] = "orange";
5
+ Colours["Yellow"] = "yellow";
6
+ Colours["Green"] = "green";
7
+ Colours["Cyan"] = "cyan";
8
+ Colours["Blue"] = "blue";
9
+ Colours["Violet"] = "violet";
10
+ return Colours;
11
+ }({});
@@ -1,5 +1,9 @@
1
1
  import { ReactNode, CSSProperties, ElementType, InputHTMLAttributes, SyntheticEvent, FocusEventHandler } from 'react';
2
2
  import { ReplaceProps } from './utils';
3
+ import { Placement } from './placement';
4
+ import { Colours } from './colours';
5
+ export * from './placement';
6
+ export * from './colours';
3
7
  export interface StandardProps {
4
8
  /** The prefix of the component CSS class */
5
9
  classPrefix?: string;
@@ -20,7 +24,6 @@ export interface WithAsPropsWithoutChildren<As extends ElementType | string = El
20
24
  }
21
25
  export interface RsRefForwardingComponent<T extends ElementType, P = unknown, ExcludeChildren extends boolean = false> {
22
26
  <As extends ElementType = T>(props: ReplaceProps<As, ExcludeChildren extends true ? WithAsPropsWithoutChildren<As> & P : WithAsProps<As> & P>, context?: any): any;
23
- propTypes?: any;
24
27
  contextTypes?: any;
25
28
  displayName?: string;
26
29
  }
@@ -66,7 +69,7 @@ export interface PickerBaseProps<L = any> extends WithAsProps, AnimationEventPro
66
69
  /** Placeholder text */
67
70
  placeholder?: ReactNode;
68
71
  /** The placement of picker */
69
- placement?: TypeAttributes.Placement;
72
+ placement?: Placement;
70
73
  /** Prevent floating element overflow */
71
74
  preventOverflow?: boolean;
72
75
  /** Open the menu and control it */
@@ -169,12 +172,8 @@ export interface FormControlPickerProps<T = any, L = any, D = Record<string, any
169
172
  export declare namespace TypeAttributes {
170
173
  type Size = 'lg' | 'md' | 'sm' | 'xs';
171
174
  type Status = 'success' | 'warning' | 'error' | 'info';
172
- type Color = 'red' | 'orange' | 'yellow' | 'green' | 'cyan' | 'blue' | 'violet';
175
+ type Color = `${Colours}`;
173
176
  type Appearance = 'default' | 'primary' | 'link' | 'subtle' | 'ghost';
174
- type Placement4 = 'top' | 'bottom' | 'right' | 'left';
175
- type Placement8 = 'bottomStart' | 'bottomEnd' | 'topStart' | 'topEnd' | 'leftStart' | 'rightStart' | 'leftEnd' | 'rightEnd';
176
- type PlacementAuto = 'auto' | 'autoVertical' | 'autoVerticalStart' | 'autoVerticalEnd' | 'autoHorizontal' | 'autoHorizontalStart' | 'autoHorizontalEnd';
177
- type Placement = Placement4 | Placement8 | PlacementAuto;
178
177
  type CheckTrigger = 'change' | 'blur' | 'none' | null;
179
178
  type DisplayState = 'show' | 'hide' | 'hiding';
180
179
  }
@@ -1,2 +1,8 @@
1
1
  'use client';
2
+ export * from "./placement.js";
3
+ export * from "./colours.js";
4
+
5
+ /**
6
+ * Represents the data properties for a component.
7
+ */
2
8
  export {};
@@ -0,0 +1,5 @@
1
+ export type PlacementCardinal = 'top' | 'bottom' | 'right' | 'left';
2
+ export type PlacementCornersPolyfill = 'leftStart' | 'rightStart' | 'leftEnd' | 'rightEnd';
3
+ export type PlacementCorners = 'topStart' | 'topEnd' | 'bottomStart' | 'bottomEnd' | PlacementCornersPolyfill;
4
+ export type PlacementAuto = 'auto' | 'autoVertical' | 'autoVerticalStart' | 'autoVerticalEnd' | 'autoHorizontal' | 'autoHorizontalStart' | 'autoHorizontalEnd';
5
+ export type Placement = PlacementCardinal | PlacementCorners | PlacementAuto;
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export {};
@@ -1,4 +1,2 @@
1
1
  export declare const isIE: () => boolean;
2
- export declare const isIE11: () => boolean;
3
2
  export declare const isAndroid: () => boolean;
4
- export declare const getChromeVersion: () => number | false;
@@ -5,12 +5,4 @@ import canUseDOM from 'dom-lib/canUseDOM';
5
5
 
6
6
  // Internet Explorer 6-11
7
7
  export const isIE = () => canUseDOM && /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent);
8
- export const isIE11 = () => canUseDOM && window.navigator.userAgent.indexOf('Trident') > -1 && window.navigator.userAgent.indexOf('rv:11.0') > -1;
9
- export const isAndroid = () => canUseDOM && /Android/i.test(navigator.userAgent);
10
- export const getChromeVersion = () => {
11
- if (canUseDOM) {
12
- const match = window.navigator.userAgent.match(/Chrom(e|ium)\/([\d\.]+)\./);
13
- return match ? parseFloat(match[2]) : false;
14
- }
15
- return false;
16
- };
8
+ export const isAndroid = () => canUseDOM && /Android/i.test(navigator.userAgent);
@@ -134,8 +134,6 @@ function some(children, func, context) {
134
134
  if (! /*#__PURE__*/React.isValidElement(child)) {
135
135
  return;
136
136
  }
137
-
138
- /* eslint-disable */
139
137
  if (func.call(context, child, index += 1)) {
140
138
  result = true;
141
139
  }
@@ -0,0 +1,21 @@
1
+ import { Color } from '../types/colours';
2
+ export declare const isPresetColor: (color?: Color | React.CSSProperties['color']) => boolean;
3
+ /**
4
+ * Convert short hex color to full hex color
5
+ * e.g. #fff -> #ffffff
6
+ */
7
+ export declare const expandHexColor: (color: string) => string;
8
+ /**
9
+ * Calculate relative luminance of a color
10
+ * Using the formula from WCAG 2.0
11
+ */
12
+ export declare const getLuminance: (color: string) => number;
13
+ /**
14
+ * Get contrasting text color (black or white) based on background color
15
+ */
16
+ export declare const getContrastText: (bgColor: string) => string;
17
+ /**
18
+ * Create CSS color variables for custom colors
19
+ * Returns background and optional text color variables
20
+ */
21
+ export declare const createColorVariables: (color?: Color | React.CSSProperties['color'], bgFieldName?: string, textFieldName?: string) => React.CSSProperties | undefined;
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { Colours } from "../types/colours.js";
3
+ export const isPresetColor = color => {
4
+ if (!color) {
5
+ return false;
6
+ }
7
+ if (color === 'default') {
8
+ return true;
9
+ }
10
+ return Object.values(Colours).includes(color);
11
+ };
12
+
13
+ /**
14
+ * Convert short hex color to full hex color
15
+ * e.g. #fff -> #ffffff
16
+ */
17
+ export const expandHexColor = color => {
18
+ const hex = color.toLowerCase().replace('#', '');
19
+ if (hex.length === 3) {
20
+ return `#${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`;
21
+ }
22
+ return `#${hex}`;
23
+ };
24
+
25
+ /**
26
+ * Calculate relative luminance of a color
27
+ * Using the formula from WCAG 2.0
28
+ */
29
+ export const getLuminance = color => {
30
+ // Convert hex to rgb
31
+ const fullHex = expandHexColor(color);
32
+ const hex = fullHex.replace('#', '');
33
+ const r = parseInt(hex.substring(0, 2), 16) / 255;
34
+ const g = parseInt(hex.substring(2, 4), 16) / 255;
35
+ const b = parseInt(hex.substring(4, 6), 16) / 255;
36
+
37
+ // Convert rgb to relative luminance
38
+ const rs = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
39
+ const gs = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4);
40
+ const bs = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
41
+ return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
42
+ };
43
+
44
+ /**
45
+ * Get contrasting text color (black or white) based on background color
46
+ */
47
+ export const getContrastText = bgColor => {
48
+ // For non-hex colors, return default dark text
49
+ if (!bgColor.startsWith('#')) {
50
+ return 'var(--rs-text-primary)';
51
+ }
52
+ const luminance = getLuminance(bgColor);
53
+ return luminance > 0.5 ? '#000000' : '#ffffff';
54
+ };
55
+
56
+ /**
57
+ * Create CSS color variables for custom colors
58
+ * Returns background and optional text color variables
59
+ */
60
+ export const createColorVariables = function (color, bgFieldName, textFieldName) {
61
+ if (bgFieldName === void 0) {
62
+ bgFieldName = '--rs-color-bg';
63
+ }
64
+ if (color && !isPresetColor(color)) {
65
+ const colorStr = color.toString();
66
+ // Only convert to hex if it's a hex color
67
+ const bgColor = colorStr.startsWith('#') ? expandHexColor(colorStr) : colorStr;
68
+ const styles = {
69
+ [bgFieldName]: bgColor
70
+ };
71
+ if (textFieldName) {
72
+ styles[textFieldName] = getContrastText(bgColor);
73
+ }
74
+ return styles;
75
+ }
76
+ return undefined;
77
+ };
@@ -1,4 +1,16 @@
1
+ /// <reference types="react" />
1
2
  /**
2
3
  * Processes and returns a value suitable for CSS (with a unit).
3
4
  */
4
- export declare function getCssValue(value?: number | string, unit?: string): string | undefined;
5
+ export declare function getCssValue(value?: number | string | null, unit?: string): string;
6
+ type CSSVariables = Partial<Record<`--${string}`, string>>;
7
+ type StyleProperties = React.CSSProperties & CSSVariables;
8
+ /**
9
+ * Merge multiple style objects, filtering out undefined values
10
+ */
11
+ export declare function mergeStyles(...styles: (React.CSSProperties | undefined | null)[]): StyleProperties;
12
+ /**
13
+ * Create CSS variables for offset positioning
14
+ */
15
+ export declare function createOffsetStyles(offset?: [number | string, number | string], prefix?: string): React.CSSProperties | undefined;
16
+ export {};
@@ -6,13 +6,50 @@ export function getCssValue(value, unit) {
6
6
  if (unit === void 0) {
7
7
  unit = 'px';
8
8
  }
9
+ if (value === undefined || value === null || value === '') {
10
+ return '';
11
+ }
12
+
13
+ // If the value is 0, return it as a string without unit
14
+ if (value === 0) {
15
+ return '0';
16
+ }
17
+
9
18
  // If the value is a number, append the default unit (defaults to 'px')
10
19
  if (typeof value === 'number') {
11
20
  return `${value}${unit}`;
12
21
  }
13
22
 
14
- // If the value is already a string (and likely contains a unit), return it as is
15
- if (typeof value === 'string') {
16
- return value;
23
+ // Return string values as is
24
+ return value.toString();
25
+ }
26
+ /**
27
+ * Merge multiple style objects, filtering out undefined values
28
+ */
29
+ export function mergeStyles() {
30
+ for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
31
+ styles[_key] = arguments[_key];
32
+ }
33
+ return styles.filter(Boolean).reduce((acc, style) => {
34
+ if (!style) return acc;
35
+ return {
36
+ ...acc,
37
+ ...style
38
+ };
39
+ }, {});
40
+ }
41
+
42
+ /**
43
+ * Create CSS variables for offset positioning
44
+ */
45
+ export function createOffsetStyles(offset, prefix) {
46
+ if (prefix === void 0) {
47
+ prefix = '--rs-offset';
17
48
  }
49
+ if (!offset) return undefined;
50
+ const [x, y] = offset;
51
+ return {
52
+ [`${prefix}-x`]: getCssValue(x),
53
+ [`${prefix}-y`]: getCssValue(y)
54
+ };
18
55
  }
@@ -1,9 +1,9 @@
1
1
  'use client';
2
+ /* eslint-disable react/no-find-dom-node */
2
3
  import ReactDOM from 'react-dom';
3
4
  function safeFindDOMNode(componentOrElement) {
4
5
  if (componentOrElement && 'setState' in componentOrElement) {
5
6
  var _ReactDOM$findDOMNode;
6
- // eslint-disable-next-line react/no-find-dom-node
7
7
  return (_ReactDOM$findDOMNode = ReactDOM.findDOMNode) === null || _ReactDOM$findDOMNode === void 0 ? void 0 : _ReactDOM$findDOMNode.call(ReactDOM, componentOrElement);
8
8
  }
9
9
  return componentOrElement !== null && componentOrElement !== void 0 ? componentOrElement : null;
@@ -21,7 +21,6 @@ export function getDOMNode(elementOrRef) {
21
21
  }
22
22
 
23
23
  // If you can't get the native HTML element, you can only get it through findDOMNode.
24
- // eslint-disable-next-line react/no-find-dom-node
25
24
  return safeFindDOMNode(element);
26
25
  }
27
26
  export default getDOMNode;
@@ -3,5 +3,6 @@
3
3
  * @description escape Regular_Expressions special_characters '^$.|*+?{\\[()'
4
4
  */
5
5
  export function getSafeRegExpString(str) {
6
- return str.replace(/([\^\$\.\|\*\+\?\{\\\[\(\)])/g, '\\$1');
6
+ const specialChars = '\\^$.|?*+()[]{}';
7
+ return str.replace(new RegExp(`([${specialChars}])`, 'g'), '\\$1');
7
8
  }
@@ -1,5 +1,7 @@
1
1
  export * from './BrowserDetection';
2
2
  export * from './htmlPropsUtils';
3
+ export * from './css';
4
+ export * from './colours';
3
5
  export { stringifyReactNode, reactToString } from './stringifyReactNode';
4
6
  export { getSafeRegExpString } from './getSafeRegExpString';
5
7
  export { getDOMNode } from './getDOMNode';
@@ -13,7 +15,6 @@ export { placementPolyfill } from './placementPolyfill';
13
15
  export { mergeRefs } from './mergeRefs';
14
16
  export { shallowEqual, shallowEqualArray } from './shallowEqual';
15
17
  export { composeFunctions } from './composeFunctions';
16
- export { render } from './render';
17
18
  export { safeSetSelection } from './safeSetSelection';
18
19
  export { getStringLength } from './getStringLength';
19
20
  export { getDataGroupBy } from './getDataGroupBy';
@@ -24,4 +25,3 @@ export type { ComponentProps } from './createComponent';
24
25
  export { attachParent } from './attachParent';
25
26
  export { isFocusEntering, isFocusLeaving } from './events';
26
27
  export { isFocusableElement } from './dom';
27
- export { getCssValue } from './css';
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  export * from "./BrowserDetection.js";
3
3
  export * from "./htmlPropsUtils.js";
4
+ export * from "./css.js";
5
+ export * from "./colours.js";
4
6
  export { stringifyReactNode, reactToString } from "./stringifyReactNode.js";
5
7
  export { getSafeRegExpString } from "./getSafeRegExpString.js";
6
8
  export { getDOMNode } from "./getDOMNode.js";
@@ -14,7 +16,6 @@ export { placementPolyfill } from "./placementPolyfill.js";
14
16
  export { mergeRefs } from "./mergeRefs.js";
15
17
  export { shallowEqual, shallowEqualArray } from "./shallowEqual.js";
16
18
  export { composeFunctions } from "./composeFunctions.js";
17
- export { render } from "./render.js";
18
19
  export { safeSetSelection } from "./safeSetSelection.js";
19
20
  export { getStringLength } from "./getStringLength.js";
20
21
  export { getDataGroupBy } from "./getDataGroupBy.js";
@@ -23,5 +24,4 @@ export { warnOnce } from "./warnOnce.js";
23
24
  export { createComponent } from "./createComponent.js";
24
25
  export { attachParent } from "./attachParent.js";
25
26
  export { isFocusEntering, isFocusLeaving } from "./events.js";
26
- export { isFocusableElement } from "./dom.js";
27
- export { getCssValue } from "./css.js";
27
+ export { isFocusableElement } from "./dom.js";
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
3
+ export declare const defaultToasterContainer: () => HTMLElement | null;
3
4
  export type PlacementType = 'topCenter' | 'bottomCenter' | 'topStart' | 'topEnd' | 'bottomStart' | 'bottomEnd';
4
5
  export declare const toastPlacements: PlacementType[];
5
6
  export interface ToastContainerProps extends WithAsProps {
@@ -12,7 +13,7 @@ export interface ToastContainerProps extends WithAsProps {
12
13
  /**
13
14
  * Set the message to appear in the specified container
14
15
  */
15
- container?: HTMLElement | (() => HTMLElement);
16
+ container?: HTMLElement | (() => HTMLElement) | null;
16
17
  /**
17
18
  * The number of milliseconds to wait before automatically closing a message.
18
19
  */
@@ -21,18 +22,13 @@ export interface ToastContainerProps extends WithAsProps {
21
22
  * Reset the hide timer if the mouse moves over the message.
22
23
  */
23
24
  mouseReset?: boolean;
24
- /**
25
- * Callback fired when the component mounts
26
- */
27
- callback?: (ref: React.RefObject<ToastContainerInstance>) => void;
28
25
  }
29
26
  interface PushOptions {
30
27
  duration?: number;
31
28
  mouseReset?: boolean;
32
- container?: HTMLElement | (() => HTMLElement);
29
+ container?: HTMLElement | (() => HTMLElement) | null;
33
30
  }
34
31
  export interface ToastContainerInstance {
35
- root: HTMLElement;
36
32
  push: (message: React.ReactNode, options?: PushOptions) => string;
37
33
  remove: (key: string) => void;
38
34
  clear: () => void;
@@ -41,8 +37,12 @@ export interface ToastContainerInstance {
41
37
  export interface NodeProps extends WithAsProps {
42
38
  onClose?: (event?: React.MouseEvent<HTMLDivElement>) => void;
43
39
  }
40
+ export type GetInstancePropsType = Omit<ToastContainerProps, 'container' | 'placement'> & {
41
+ container: HTMLElement | null;
42
+ placement: PlacementType;
43
+ };
44
44
  interface ToastContainerComponent extends RsRefForwardingComponent<'div', ToastContainerProps> {
45
- getInstance: (props: ToastContainerProps) => Promise<[React.RefObject<ToastContainerInstance>, () => void]>;
45
+ getInstance: (props: GetInstancePropsType) => Promise<[React.RefObject<ToastContainerInstance>, string]>;
46
46
  }
47
47
  declare const ToastContainer: ToastContainerComponent;
48
48
  export default ToastContainer;
@@ -1,12 +1,16 @@
1
1
  'use client';
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- import React, { useState, useImperativeHandle, useRef, useCallback } from 'react';
4
- import { createPortal } from 'react-dom';
3
+ import React, { useState, useImperativeHandle, useCallback } from 'react';
5
4
  import kebabCase from 'lodash/kebabCase';
6
5
  import Transition from "../Animation/Transition.js";
7
- import { useClassNames } from "../internals/hooks/index.js";
8
- import { guid, createChainedFunction, render } from "../internals/utils/index.js";
9
6
  import ToastContext from "./ToastContext.js";
7
+ import canUseDOM from 'dom-lib/canUseDOM';
8
+ import { useClassNames } from "../internals/hooks/index.js";
9
+ import { guid, createChainedFunction } from "../internals/utils/index.js";
10
+ import { render } from "./render.js";
11
+ export const defaultToasterContainer = () => {
12
+ return canUseDOM ? document.body : null;
13
+ };
10
14
  export const toastPlacements = ['topCenter', 'bottomCenter', 'topStart', 'topEnd', 'bottomStart', 'bottomEnd'];
11
15
  const useMessages = () => {
12
16
  const [messages, setMessages] = useState([]);
@@ -68,13 +72,11 @@ const useMessages = () => {
68
72
  };
69
73
  };
70
74
  const ToastContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
71
- const rootRef = useRef();
72
75
  const {
73
76
  as: Component = 'div',
74
77
  className,
75
78
  classPrefix = 'toast-container',
76
79
  placement = 'topCenter',
77
- callback,
78
80
  ...rest
79
81
  } = props;
80
82
  const {
@@ -90,7 +92,6 @@ const ToastContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
90
92
  messages
91
93
  } = useMessages();
92
94
  useImperativeHandle(ref, () => ({
93
- root: rootRef.current,
94
95
  push,
95
96
  clear,
96
97
  remove
@@ -99,10 +100,16 @@ const ToastContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
99
100
  const {
100
101
  mouseReset,
101
102
  duration,
102
- node,
103
- container
103
+ node
104
104
  } = item;
105
- const toastWithTransition = /*#__PURE__*/React.createElement(Transition, {
105
+ return /*#__PURE__*/React.createElement(ToastContext.Provider, {
106
+ value: {
107
+ usedToaster: true,
108
+ mouseReset,
109
+ duration
110
+ },
111
+ key: item.key
112
+ }, /*#__PURE__*/React.createElement(Transition, {
106
113
  in: item.visible,
107
114
  exitedClassName: rootPrefix('toast-fade-exited'),
108
115
  exitingClassName: rootPrefix('toast-fade-exiting'),
@@ -122,42 +129,37 @@ const ToastContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
122
129
  onClose: createChainedFunction((_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.onClose, () => remove(item.key)),
123
130
  className: merge(rootPrefix('toast'), (_node$props2 = node.props) === null || _node$props2 === void 0 ? void 0 : _node$props2.className, transitionClassName)
124
131
  });
125
- });
126
- return /*#__PURE__*/React.createElement(ToastContext.Provider, {
127
- value: {
128
- usedToaster: true,
129
- mouseReset,
130
- duration
131
- },
132
- key: item.key
133
- }, container ? /*#__PURE__*/createPortal(toastWithTransition, typeof container === 'function' ? container() : container) : toastWithTransition);
132
+ }));
134
133
  });
135
134
  return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
136
- ref: selfRef => {
137
- rootRef.current = selfRef;
138
- callback === null || callback === void 0 || callback(selfRef);
139
- },
140
135
  className: classes
141
136
  }), elements);
142
137
  });
143
- ToastContainer.getInstance = props => {
138
+ ToastContainer.getInstance = async props => {
144
139
  const {
145
140
  container,
146
- ...rest
141
+ ...toastProps
147
142
  } = props;
148
- const containerRef = /*#__PURE__*/React.createRef();
149
- const containerElement = (typeof container === 'function' ? container() : container) || document.body;
150
- return new Promise(resolve => {
151
- const renderCallback = () => {
152
- resolve([containerRef, unmount]);
153
- };
154
- const {
155
- unmount
156
- } = render(/*#__PURE__*/React.createElement(ToastContainer, _extends({}, rest, {
157
- ref: containerRef,
158
- callback: renderCallback
159
- })), containerElement);
143
+
144
+ // Promise to wait for containerRef to be assigned
145
+ let resolveContainerRef = null;
146
+ const containerRefReady = new Promise(resolve => {
147
+ resolveContainerRef = resolve;
160
148
  });
149
+
150
+ // Create a React ref for the ToastContainer instance
151
+ const toastContainerRef = /*#__PURE__*/React.createRef();
152
+
153
+ // Render the ToastContainer component into the specified container
154
+ const containerId = render(/*#__PURE__*/React.createElement(ToastContainer, _extends({}, toastProps, {
155
+ ref: ref => {
156
+ var _resolveContainerRef;
157
+ toastContainerRef.current = ref;
158
+ (_resolveContainerRef = resolveContainerRef) === null || _resolveContainerRef === void 0 || _resolveContainerRef();
159
+ }
160
+ })), container);
161
+ await containerRefReady;
162
+ return [toastContainerRef, containerId];
161
163
  };
162
164
  ToastContainer.displayName = 'ToastContainer';
163
165
  export default ToastContainer;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function render(element: React.ReactElement<any>, container: HTMLElement | null): string;
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { guid } from "../internals/utils/index.js";
4
+ import { RSUITE_TOASTER_ID } from "../internals/symbols.js";
5
+ export function render(element, container) {
6
+ const mountElement = document.createElement('div');
7
+ mountElement.className = 'rs-toaster-mount-element';
8
+ const containerElement = container;
9
+
10
+ // Add the detached element to the root
11
+ containerElement.appendChild(mountElement);
12
+ if (!containerElement[RSUITE_TOASTER_ID]) {
13
+ // Attach the containerId to the containerElement
14
+ containerElement[RSUITE_TOASTER_ID] = guid();
15
+ }
16
+ const root = createRoot(mountElement, {
17
+ identifierPrefix: 'rs-root-'
18
+ });
19
+ root.render(element);
20
+ return containerElement[RSUITE_TOASTER_ID];
21
+ }
@@ -1,28 +1,26 @@
1
1
  'use client';
2
- import ToastContainer from "./ToastContainer.js";
3
- const defaultContainerId = 'default';
2
+ import ToastContainer, { defaultToasterContainer } from "./ToastContainer.js";
3
+ import { RSUITE_TOASTER_ID } from "../internals/symbols.js";
4
4
  const containers = new Map();
5
5
 
6
6
  /**
7
- * Create a container by Id.
8
- * @param containerId
9
- * @param options
7
+ * Create a container instance.
8
+ * @param placement
9
+ * @param props
10
10
  */
11
- async function createContainer(containerId, props) {
12
- const [container] = await ToastContainer.getInstance(props);
13
- containers.set(containerId || defaultContainerId, container);
11
+ async function createContainer(placement, props) {
12
+ const [container, containerId] = await ToastContainer.getInstance(props);
13
+ containers.set(`${containerId}_${placement}`, container);
14
14
  return container;
15
15
  }
16
16
 
17
17
  /**
18
18
  * Get the container by ID. Use default ID when ID is not available.
19
19
  * @param containerId
20
+ * @param placement
20
21
  */
21
- function getContainer(containerId) {
22
- if (containers.size == 0) {
23
- return null;
24
- }
25
- return containers.get(containerId || defaultContainerId);
22
+ function getContainer(containerId, placement) {
23
+ return containers.get(`${containerId}_${placement}`);
26
24
  }
27
25
  const toaster = message => toaster.push(message);
28
26
  toaster.push = function (message, options) {
@@ -30,14 +28,25 @@ toaster.push = function (message, options) {
30
28
  options = {};
31
29
  }
32
30
  const {
33
- placement: containerId,
31
+ placement = 'topCenter',
32
+ container = defaultToasterContainer,
34
33
  ...restOptions
35
34
  } = options;
36
- const container = getContainer(containerId);
37
- if (container !== null && container !== void 0 && container.current) {
38
- return container.current.push(message, restOptions);
35
+ const containerElement = typeof container === 'function' ? container() : container;
36
+ const containerElementId = containerElement ? containerElement[RSUITE_TOASTER_ID] : null;
37
+ if (containerElementId) {
38
+ const existedContainer = getContainer(containerElementId, placement);
39
+ if (existedContainer) {
40
+ var _existedContainer$cur;
41
+ return (_existedContainer$cur = existedContainer.current) === null || _existedContainer$cur === void 0 ? void 0 : _existedContainer$cur.push(message, restOptions);
42
+ }
39
43
  }
40
- return createContainer(containerId !== null && containerId !== void 0 ? containerId : '', options).then(ref => {
44
+ const newOptions = {
45
+ ...options,
46
+ container: containerElement,
47
+ placement
48
+ };
49
+ return createContainer(placement, newOptions).then(ref => {
41
50
  var _ref$current;
42
51
  return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.push(message, restOptions);
43
52
  });
@@ -32,9 +32,7 @@ const matchMedia = query => {
32
32
  */
33
33
  export function useMediaQuery(query) {
34
34
  const queries = Array.isArray(query) ? query : [query];
35
- const mediaQueries = useMemo(() => queries.map(query => mediaQuerySizeMap[query] || query),
36
- // eslint-disable-next-line react-hooks/exhaustive-deps
37
- [...queries]);
35
+ const mediaQueries = useMemo(() => queries.map(query => mediaQuerySizeMap[query] || query), [...queries]);
38
36
  const mediaQueryArray = useRef(mediaQueries.map(query => matchMedia(query).matches));
39
37
  const subscribe = useCallback(callback => {
40
38
  const list = mediaQueries.map(query => matchMedia(query));