@react-fabric/core 1.0.0-beta.61 → 1.0.0-beta.63

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 (317) hide show
  1. package/css/components/_animations.css +7 -11
  2. package/css/components/_avatar.css +5 -5
  3. package/css/components/_badge.css +2 -1
  4. package/css/components/_breadcrumbs.css +7 -5
  5. package/css/components/_button.css +49 -9
  6. package/css/components/_card.css +9 -17
  7. package/css/components/_chip.css +0 -4
  8. package/css/components/_dropdown.css +1 -0
  9. package/css/components/_flyout.css +1 -1
  10. package/css/components/_media.css +2 -14
  11. package/css/components/_menu.css +1 -1
  12. package/css/components/_modal.css +3 -3
  13. package/css/components/_progress.css +1 -1
  14. package/css/components/_stepper.css +2 -1
  15. package/css/components/_tabPanel.css +4 -4
  16. package/css/core/_aside.css +3 -3
  17. package/css/core/_errorboundary.css +2 -10
  18. package/css/core/_page.css +1 -1
  19. package/css/core/_responsive.css +8 -0
  20. package/css/core/_theme.css +1 -1
  21. package/css/core/_viewport.css +1 -5
  22. package/css/reset/_reset.css +42 -43
  23. package/css/reset/_theme.css +214 -201
  24. package/css/styles.css +5 -0
  25. package/css/theme/_colors.css +14 -0
  26. package/css/theme/_utilities.css +103 -225
  27. package/css/theme/index.css +4 -6
  28. package/dist/cjs/components/actionLabel/ActionLabel.js +1 -1
  29. package/dist/cjs/components/animations/Animations.js +7 -7
  30. package/dist/cjs/components/avatar/Avatar.js +1 -1
  31. package/dist/cjs/components/avatar/AvatarGroup.js +1 -1
  32. package/dist/cjs/components/badge/Badge.js +5 -27
  33. package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +1 -1
  34. package/dist/cjs/components/button/Button.js +8 -6
  35. package/dist/cjs/components/button/ButtonGroup.js +1 -1
  36. package/dist/cjs/components/button/ConfirmButton.js +7 -6
  37. package/dist/cjs/components/button/ToggleButtonGroup.js +1 -1
  38. package/dist/cjs/components/callout/Callout.js +8 -7
  39. package/dist/cjs/components/card/Card.js +3 -3
  40. package/dist/cjs/components/card/CardCover.js +1 -1
  41. package/dist/cjs/components/card/FlipContent.js +2 -2
  42. package/dist/cjs/components/chip/Chip.js +8 -7
  43. package/dist/cjs/components/collapsable/Collapsable.js +4 -3
  44. package/dist/cjs/components/divider/Divider.js +2 -2
  45. package/dist/cjs/components/dropdown/Dropdown.js +28 -14
  46. package/dist/cjs/components/empty/EmptyContent.js +1 -1
  47. package/dist/cjs/components/icon/Icon.js +26 -40
  48. package/dist/cjs/components/media/Media.js +13 -13
  49. package/dist/cjs/components/menu/ContextMenu.js +23 -13
  50. package/dist/cjs/components/menu/Menu.js +19 -14
  51. package/dist/cjs/components/menu/MenuItem.js +5 -4
  52. package/dist/cjs/components/meter/Meter.js +1 -1
  53. package/dist/cjs/components/navigator/Navigator.js +6 -6
  54. package/dist/cjs/components/panel/Panel.js +6 -4
  55. package/dist/cjs/components/panel/PanelGroup.js +3 -3
  56. package/dist/cjs/components/panel/PanelStack.js +5 -5
  57. package/dist/cjs/components/progress/ProgressBar.js +2 -2
  58. package/dist/cjs/components/progress/ProgressCircle.js +2 -2
  59. package/dist/cjs/components/tabpanel/Tab.js +6 -4
  60. package/dist/cjs/components/tabpanel/TabPanel.js +7 -6
  61. package/dist/cjs/context/Global.js +2 -55
  62. package/dist/cjs/context/NotificationCenter.js +38 -39
  63. package/dist/cjs/context/context.js +59 -0
  64. package/dist/cjs/core/aside/Aside.js +9 -7
  65. package/dist/cjs/core/boundary/ErrorBoundary.js +2 -4
  66. package/dist/cjs/core/page/Page.js +4 -1
  67. package/dist/cjs/core/responsive/Responsive.js +3 -2
  68. package/dist/cjs/core/theme/ThemeProvider.js +5 -4
  69. package/dist/cjs/core/viewport/Viewport.js +1 -1
  70. package/dist/cjs/hooks/useContextMenu.js +103 -0
  71. package/dist/cjs/hooks/useIsDark.js +6 -4
  72. package/dist/cjs/hooks/useNavigator.js +11 -10
  73. package/dist/cjs/hooks/useOverlayService.js +27 -38
  74. package/dist/cjs/hooks/usePropToggle.js +2 -2
  75. package/dist/cjs/hooks/useResize.js +8 -6
  76. package/dist/cjs/hooks/useResizeObserver.js +5 -5
  77. package/dist/cjs/hooks/useStepper.js +2 -6
  78. package/dist/cjs/hotkeys/HotKey.js +2 -2
  79. package/dist/cjs/hotkeys/HotKeyWrapper.js +8 -13
  80. package/dist/cjs/hotkeys/commons.js +1 -1
  81. package/dist/cjs/hotkeys/context.js +36 -0
  82. package/dist/cjs/i18n/index.js +4 -4
  83. package/dist/cjs/index.js +10 -5
  84. package/dist/cjs/overlays/alert/Alert.js +6 -5
  85. package/dist/cjs/overlays/flyout/Flyout.js +8 -6
  86. package/dist/cjs/overlays/message/Message.js +5 -5
  87. package/dist/cjs/overlays/modal/Modal.js +5 -3
  88. package/dist/cjs/overlays/toast/Toast.js +4 -4
  89. package/dist/cjs/overlays/tooltip/Tooltip.js +2 -16
  90. package/dist/cjs/typography/Abbr.js +4 -5
  91. package/dist/cjs/typography/Anchor.js +2 -2
  92. package/dist/cjs/typography/Copy.js +2 -2
  93. package/dist/cjs/typography/Mark.js +2 -4
  94. package/dist/cjs/typography/Text.js +4 -4
  95. package/dist/cjs/typography/Title.js +2 -2
  96. package/dist/cjs/utils/cloneElement.js +4 -4
  97. package/dist/cjs/utils/getBadgeProps.js +51 -0
  98. package/dist/cjs/utils/getIconProps.js +42 -0
  99. package/dist/cjs/utils/getTooltipProps.js +45 -0
  100. package/dist/esm/components/actionLabel/ActionLabel.js +1 -1
  101. package/dist/esm/components/animations/Animations.js +7 -7
  102. package/dist/esm/components/avatar/Avatar.js +1 -1
  103. package/dist/esm/components/avatar/AvatarGroup.js +1 -1
  104. package/dist/esm/components/badge/Badge.js +7 -28
  105. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +1 -1
  106. package/dist/esm/components/button/Button.js +9 -7
  107. package/dist/esm/components/button/ButtonGroup.js +3 -3
  108. package/dist/esm/components/button/ConfirmButton.js +8 -7
  109. package/dist/esm/components/button/ToggleButtonGroup.js +3 -3
  110. package/dist/esm/components/callout/Callout.js +8 -7
  111. package/dist/esm/components/card/Card.js +4 -4
  112. package/dist/esm/components/card/CardCover.js +1 -1
  113. package/dist/esm/components/card/FlipContent.js +2 -2
  114. package/dist/esm/components/chip/Chip.js +9 -8
  115. package/dist/esm/components/collapsable/Collapsable.js +4 -3
  116. package/dist/esm/components/divider/Divider.js +2 -2
  117. package/dist/esm/components/dropdown/Dropdown.js +30 -16
  118. package/dist/esm/components/empty/EmptyContent.js +1 -1
  119. package/dist/esm/components/icon/Icon.js +28 -41
  120. package/dist/esm/components/media/Media.js +13 -13
  121. package/dist/esm/components/menu/ContextMenu.js +24 -14
  122. package/dist/esm/components/menu/Menu.js +22 -17
  123. package/dist/esm/components/menu/MenuItem.js +6 -5
  124. package/dist/esm/components/meter/Meter.js +1 -1
  125. package/dist/esm/components/navigator/Navigator.js +7 -7
  126. package/dist/esm/components/panel/Panel.js +6 -4
  127. package/dist/esm/components/panel/PanelGroup.js +4 -4
  128. package/dist/esm/components/panel/PanelStack.js +6 -6
  129. package/dist/esm/components/progress/ProgressBar.js +2 -2
  130. package/dist/esm/components/progress/ProgressCircle.js +2 -2
  131. package/dist/esm/components/tabpanel/Tab.js +6 -4
  132. package/dist/esm/components/tabpanel/TabPanel.js +8 -7
  133. package/dist/esm/context/Global.js +3 -52
  134. package/dist/esm/context/NotificationCenter.js +38 -39
  135. package/dist/esm/context/context.js +56 -0
  136. package/dist/esm/core/aside/Aside.js +10 -8
  137. package/dist/esm/core/boundary/ErrorBoundary.js +1 -3
  138. package/dist/esm/core/page/Page.js +4 -1
  139. package/dist/esm/core/responsive/Responsive.js +3 -2
  140. package/dist/esm/core/theme/ThemeProvider.js +4 -3
  141. package/dist/esm/core/viewport/Viewport.js +1 -1
  142. package/dist/esm/hooks/useContextMenu.js +103 -0
  143. package/dist/esm/hooks/useIsDark.js +7 -5
  144. package/dist/esm/hooks/useNavigator.js +12 -11
  145. package/dist/esm/hooks/useOverlayService.js +28 -39
  146. package/dist/esm/hooks/usePropToggle.js +3 -3
  147. package/dist/esm/hooks/useResize.js +9 -7
  148. package/dist/esm/hooks/useResizeObserver.js +6 -6
  149. package/dist/esm/hooks/useStepper.js +2 -6
  150. package/dist/esm/hotkeys/HotKey.js +1 -1
  151. package/dist/esm/hotkeys/HotKeyWrapper.js +9 -12
  152. package/dist/esm/hotkeys/commons.js +1 -1
  153. package/dist/esm/hotkeys/context.js +35 -0
  154. package/dist/esm/i18n/index.js +2 -2
  155. package/dist/esm/index.js +8 -4
  156. package/dist/esm/overlays/alert/Alert.js +7 -6
  157. package/dist/esm/overlays/flyout/Flyout.js +9 -7
  158. package/dist/esm/overlays/message/Message.js +6 -6
  159. package/dist/esm/overlays/modal/Modal.js +6 -4
  160. package/dist/esm/overlays/toast/Toast.js +5 -5
  161. package/dist/esm/overlays/tooltip/Tooltip.js +4 -17
  162. package/dist/esm/typography/Abbr.js +4 -5
  163. package/dist/esm/typography/Anchor.js +2 -2
  164. package/dist/esm/typography/Copy.js +3 -3
  165. package/dist/esm/typography/Mark.js +2 -4
  166. package/dist/esm/typography/Text.js +5 -5
  167. package/dist/esm/typography/Title.js +2 -2
  168. package/dist/esm/utils/cloneElement.js +4 -4
  169. package/dist/esm/utils/getBadgeProps.js +51 -0
  170. package/dist/esm/utils/getIconProps.js +42 -0
  171. package/dist/esm/utils/getTooltipProps.js +45 -0
  172. package/dist/types/components/actionLabel/ActionLabel.d.ts +1 -1
  173. package/dist/types/components/animations/Animations.d.ts +6 -6
  174. package/dist/types/components/avatar/Avatar.d.ts +1 -1
  175. package/dist/types/components/avatar/AvatarGroup.d.ts +1 -1
  176. package/dist/types/components/badge/Badge.d.ts +2 -10
  177. package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
  178. package/dist/types/components/button/Button.d.ts +1 -1
  179. package/dist/types/components/button/ButtonGroup.d.ts +1 -1
  180. package/dist/types/components/button/ConfirmButton.d.ts +1 -1
  181. package/dist/types/components/button/ToggleButtonGroup.d.ts +1 -1
  182. package/dist/types/components/callout/Callout.d.ts +7 -3
  183. package/dist/types/components/card/Card.d.ts +2 -2
  184. package/dist/types/components/card/CardCover.d.ts +1 -1
  185. package/dist/types/components/card/FlipContent.d.ts +1 -1
  186. package/dist/types/components/chip/Chip.d.ts +1 -1
  187. package/dist/types/components/collapsable/Collapsable.d.ts +1 -1
  188. package/dist/types/components/divider/Divider.d.ts +1 -1
  189. package/dist/types/components/dropdown/Dropdown.d.ts +7 -3
  190. package/dist/types/components/dropdown/DropdownTool.d.ts +1 -1
  191. package/dist/types/components/empty/EmptyContent.d.ts +3 -3
  192. package/dist/types/components/icon/Icon.d.ts +3 -4
  193. package/dist/types/components/index.d.ts +3 -3
  194. package/dist/types/components/media/Media.d.ts +2 -2
  195. package/dist/types/components/menu/ContextMenu.d.ts +1 -1
  196. package/dist/types/components/menu/Menu.d.ts +1 -1
  197. package/dist/types/components/menu/types.d.ts +6 -1
  198. package/dist/types/components/meter/Meter.d.ts +1 -1
  199. package/dist/types/components/navigator/Navigator.d.ts +7 -1
  200. package/dist/types/components/panel/Panel.d.ts +2 -2
  201. package/dist/types/components/panel/PanelGroup.d.ts +1 -1
  202. package/dist/types/components/panel/PanelStack.d.ts +1 -1
  203. package/dist/types/components/progress/ProgressBar.d.ts +1 -1
  204. package/dist/types/components/progress/ProgressCircle.d.ts +1 -1
  205. package/dist/types/components/tabpanel/Tab.d.ts +1 -1
  206. package/dist/types/components/tabpanel/TabPanel.d.ts +1 -1
  207. package/dist/types/context/Global.d.ts +0 -82
  208. package/dist/types/context/context.d.ts +85 -0
  209. package/dist/types/core/aside/Aside.d.ts +2 -2
  210. package/dist/types/core/responsive/Responsive.d.ts +5 -1
  211. package/dist/types/core/theme/ThemeProvider.d.ts +2 -2
  212. package/dist/types/hooks/useContextMenu.d.ts +10 -0
  213. package/dist/types/hooks/useOverlayService.d.ts +3 -5
  214. package/dist/types/hotkeys/HotKeyWrapper.d.ts +0 -9
  215. package/dist/types/hotkeys/context.d.ts +9 -0
  216. package/dist/types/index.d.ts +4 -2
  217. package/dist/types/overlays/alert/Alert.d.ts +2 -2
  218. package/dist/types/overlays/flyout/Flyout.d.ts +2 -2
  219. package/dist/types/overlays/message/Message.d.ts +2 -2
  220. package/dist/types/overlays/modal/Modal.d.ts +2 -2
  221. package/dist/types/overlays/toast/Toast.d.ts +2 -2
  222. package/dist/types/overlays/tooltip/Tooltip.d.ts +0 -3
  223. package/dist/types/types/index.d.ts +2 -2
  224. package/dist/types/typography/Abbr.d.ts +4 -8
  225. package/dist/types/typography/Anchor.d.ts +1 -1
  226. package/dist/types/typography/Copy.d.ts +1 -1
  227. package/dist/types/typography/Mark.d.ts +2 -2
  228. package/dist/types/typography/Text.d.ts +1 -1
  229. package/dist/types/typography/Title.d.ts +1 -1
  230. package/dist/types/utils/getBadgeProps.d.ts +9 -0
  231. package/dist/types/utils/getIconProps.d.ts +2 -0
  232. package/dist/types/utils/getTooltipProps.d.ts +4 -0
  233. package/dist/types/utils/index.d.ts +3 -0
  234. package/package.json +14 -15
  235. package/src/components/actionLabel/ActionLabel.tsx +1 -1
  236. package/src/components/animations/Animations.tsx +6 -6
  237. package/src/components/avatar/Avatar.tsx +1 -1
  238. package/src/components/avatar/AvatarGroup.tsx +1 -1
  239. package/src/components/badge/Badge.tsx +8 -46
  240. package/src/components/breadcrumbs/Breadcrumbs.tsx +1 -1
  241. package/src/components/button/Button.tsx +24 -52
  242. package/src/components/button/ButtonGroup.tsx +1 -1
  243. package/src/components/button/ConfirmButton.tsx +23 -20
  244. package/src/components/button/ToggleButtonGroup.tsx +1 -1
  245. package/src/components/callout/Callout.tsx +14 -19
  246. package/src/components/card/Card.tsx +9 -11
  247. package/src/components/card/CardCover.tsx +1 -1
  248. package/src/components/card/FlipContent.tsx +2 -2
  249. package/src/components/chip/Chip.tsx +16 -33
  250. package/src/components/collapsable/Collapsable.tsx +2 -2
  251. package/src/components/divider/Divider.tsx +1 -1
  252. package/src/components/dropdown/Dropdown.tsx +60 -73
  253. package/src/components/dropdown/DropdownTool.tsx +1 -1
  254. package/src/components/empty/EmptyContent.tsx +3 -3
  255. package/src/components/icon/Icon.tsx +27 -54
  256. package/src/components/index.ts +5 -4
  257. package/src/components/media/Media.tsx +3 -3
  258. package/src/components/menu/ContextMenu.tsx +30 -30
  259. package/src/components/menu/Menu.tsx +35 -63
  260. package/src/components/menu/MenuItem.tsx +9 -28
  261. package/src/components/menu/types.ts +6 -1
  262. package/src/components/meter/Meter.tsx +1 -1
  263. package/src/components/navigator/Navigator.tsx +13 -11
  264. package/src/components/panel/Panel.tsx +13 -54
  265. package/src/components/panel/PanelGroup.tsx +3 -4
  266. package/src/components/panel/PanelStack.tsx +20 -25
  267. package/src/components/progress/ProgressBar.tsx +2 -2
  268. package/src/components/progress/ProgressCircle.tsx +2 -2
  269. package/src/components/tabpanel/Tab.tsx +9 -28
  270. package/src/components/tabpanel/TabPanel.tsx +13 -15
  271. package/src/context/Global.tsx +18 -125
  272. package/src/context/NotificationCenter.tsx +0 -1
  273. package/src/context/context.ts +100 -0
  274. package/src/core/aside/Aside.tsx +18 -55
  275. package/src/core/boundary/ErrorBoundary.tsx +8 -37
  276. package/src/core/page/Page.tsx +3 -5
  277. package/src/core/responsive/Responsive.tsx +10 -34
  278. package/src/core/theme/ThemeProvider.tsx +5 -8
  279. package/src/core/viewport/Viewport.tsx +1 -1
  280. package/src/hooks/useContextMenu.tsx +131 -0
  281. package/src/hooks/useIsDark.ts +7 -5
  282. package/src/hooks/useNavigator.tsx +8 -12
  283. package/src/hooks/useOverlayService.tsx +22 -17
  284. package/src/hooks/usePropToggle.ts +3 -3
  285. package/src/hooks/useResize.ts +14 -17
  286. package/src/hooks/useResizeObserver.ts +21 -21
  287. package/src/hooks/useStepper.tsx +1 -1
  288. package/src/hotkeys/HotKey.tsx +1 -1
  289. package/src/hotkeys/HotKeyWrapper.tsx +81 -105
  290. package/src/hotkeys/commons.ts +2 -0
  291. package/src/hotkeys/context.ts +32 -0
  292. package/src/i18n/index.ts +2 -2
  293. package/src/index.ts +4 -7
  294. package/src/overlays/alert/Alert.tsx +12 -16
  295. package/src/overlays/flyout/Flyout.tsx +32 -69
  296. package/src/overlays/message/Message.tsx +11 -15
  297. package/src/overlays/modal/Modal.tsx +23 -57
  298. package/src/overlays/toast/Toast.tsx +16 -15
  299. package/src/overlays/tooltip/Tooltip.tsx +6 -29
  300. package/src/types/global.d.ts +12 -0
  301. package/src/types/index.ts +2 -2
  302. package/src/typography/Abbr.tsx +11 -39
  303. package/src/typography/Anchor.tsx +1 -1
  304. package/src/typography/Copy.tsx +4 -4
  305. package/src/typography/Mark.tsx +2 -3
  306. package/src/typography/Text.tsx +8 -6
  307. package/src/typography/Title.tsx +1 -1
  308. package/src/utils/getBadgeProps.ts +45 -0
  309. package/src/utils/getIconProps.ts +35 -0
  310. package/src/utils/getTooltipProps.ts +38 -0
  311. package/src/utils/index.ts +3 -0
  312. /package/dist/cjs/i18n/{ar.json.js → ar/core.json.js} +0 -0
  313. /package/dist/cjs/i18n/{en.json.js → en/core.json.js} +0 -0
  314. /package/dist/esm/i18n/{ar.json.js → ar/core.json.js} +0 -0
  315. /package/dist/esm/i18n/{en.json.js → en/core.json.js} +0 -0
  316. /package/src/i18n/{ar.json → ar/core.json} +0 -0
  317. /package/src/i18n/{en.json → en/core.json} +0 -0
@@ -75,26 +75,25 @@ var NotificationManager = function NotificationManager(_ref) {
75
75
  updateToasts.current();
76
76
  updateAlerts.current();
77
77
  });
78
- var openNotification = useRef( /*#__PURE__*/function () {
79
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(map, update, Notif, props) {
78
+ var openNotification = useRef(/*#__PURE__*/function () {
79
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(map, update, Notif, props) {
80
80
  var timeout,
81
81
  timerRef,
82
82
  obj,
83
83
  _args = arguments;
84
- return _regeneratorRuntime.wrap(function _callee$(_context) {
84
+ return _regeneratorRuntime.wrap(function (_context) {
85
85
  while (1) switch (_context.prev = _context.next) {
86
86
  case 0:
87
87
  timeout = _args.length > 4 && _args[4] !== undefined ? _args[4] : 5000;
88
88
  timerRef = null;
89
89
  obj = makeProps(props);
90
- _context.next = 5;
90
+ _context.next = 1;
91
91
  return new Promise(function (resolve) {
92
92
  var key = uuid();
93
93
  var handleClose = function handleClose() {
94
94
  var b = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
95
95
  clearTimeout(timerRef);
96
96
  setTimeout(function () {
97
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
98
97
  delete map[key];
99
98
  update();
100
99
  resolve(b);
@@ -111,9 +110,9 @@ var NotificationManager = function NotificationManager(_ref) {
111
110
  timerRef = setTimeout(handleClose, timeout);
112
111
  }
113
112
  });
114
- case 5:
113
+ case 1:
115
114
  return _context.abrupt("return", _context.sent);
116
- case 6:
115
+ case 2:
117
116
  case "end":
118
117
  return _context.stop();
119
118
  }
@@ -123,19 +122,19 @@ var NotificationManager = function NotificationManager(_ref) {
123
122
  return _ref2.apply(this, arguments);
124
123
  };
125
124
  }());
126
- var showMessage = useRef( /*#__PURE__*/function () {
127
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
125
+ var showMessage = useRef(/*#__PURE__*/function () {
126
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
128
127
  var timeout,
129
128
  _args2 = arguments;
130
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
129
+ return _regeneratorRuntime.wrap(function (_context2) {
131
130
  while (1) switch (_context2.prev = _context2.next) {
132
131
  case 0:
133
132
  timeout = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 5000;
134
- _context2.next = 3;
133
+ _context2.next = 1;
135
134
  return openNotification.current(refItems.current.messages, updateMessages.current, Message, props, timeout);
136
- case 3:
135
+ case 1:
137
136
  return _context2.abrupt("return", _context2.sent);
138
- case 4:
137
+ case 2:
139
138
  case "end":
140
139
  return _context2.stop();
141
140
  }
@@ -145,19 +144,19 @@ var NotificationManager = function NotificationManager(_ref) {
145
144
  return _ref3.apply(this, arguments);
146
145
  };
147
146
  }());
148
- var showToast = useRef( /*#__PURE__*/function () {
149
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(props) {
147
+ var showToast = useRef(/*#__PURE__*/function () {
148
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(props) {
150
149
  var timeout,
151
150
  _args3 = arguments;
152
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
151
+ return _regeneratorRuntime.wrap(function (_context3) {
153
152
  while (1) switch (_context3.prev = _context3.next) {
154
153
  case 0:
155
154
  timeout = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : 5000;
156
- _context3.next = 3;
155
+ _context3.next = 1;
157
156
  return openNotification.current(refItems.current.toasts, updateToasts.current, Toast, props, timeout);
158
- case 3:
157
+ case 1:
159
158
  return _context3.abrupt("return", _context3.sent);
160
- case 4:
159
+ case 2:
161
160
  case "end":
162
161
  return _context3.stop();
163
162
  }
@@ -167,16 +166,16 @@ var NotificationManager = function NotificationManager(_ref) {
167
166
  return _ref4.apply(this, arguments);
168
167
  };
169
168
  }());
170
- var showAlert = useRef( /*#__PURE__*/function () {
171
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(props) {
172
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
169
+ var showAlert = useRef(/*#__PURE__*/function () {
170
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(props) {
171
+ return _regeneratorRuntime.wrap(function (_context4) {
173
172
  while (1) switch (_context4.prev = _context4.next) {
174
173
  case 0:
175
- _context4.next = 2;
174
+ _context4.next = 1;
176
175
  return openNotification.current(refItems.current.alerts, updateAlerts.current, Alert, props, 0);
177
- case 2:
176
+ case 1:
178
177
  return _context4.abrupt("return", _context4.sent);
179
- case 3:
178
+ case 2:
180
179
  case "end":
181
180
  return _context4.stop();
182
181
  }
@@ -186,18 +185,18 @@ var NotificationManager = function NotificationManager(_ref) {
186
185
  return _ref5.apply(this, arguments);
187
186
  };
188
187
  }());
189
- var showError = useRef( /*#__PURE__*/function () {
190
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(props) {
191
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
188
+ var showError = useRef(/*#__PURE__*/function () {
189
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(props) {
190
+ return _regeneratorRuntime.wrap(function (_context5) {
192
191
  while (1) switch (_context5.prev = _context5.next) {
193
192
  case 0:
194
- _context5.next = 3;
193
+ _context5.next = 1;
195
194
  return openNotification.current(refItems.current.toasts, Toast, _objectSpread(_objectSpread({}, makeProps(props)), {}, {
196
195
  color: "danger"
197
196
  }), 0);
198
- case 3:
197
+ case 1:
199
198
  return _context5.abrupt("return", _context5.sent);
200
- case 4:
199
+ case 2:
201
200
  case "end":
202
201
  return _context5.stop();
203
202
  }
@@ -217,7 +216,7 @@ var NotificationManager = function NotificationManager(_ref) {
217
216
  });
218
217
  }, []);
219
218
  return /*#__PURE__*/jsxs(Fragment, {
220
- children: [/*#__PURE__*/createPortal( /*#__PURE__*/jsx("div", {
219
+ children: [/*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
221
220
  style: {
222
221
  zIndex: "var(--z-overlay)"
223
222
  },
@@ -227,24 +226,24 @@ var NotificationManager = function NotificationManager(_ref) {
227
226
  el = _ref8[0];
228
227
  return el;
229
228
  })
230
- }), document.body), /*#__PURE__*/createPortal( /*#__PURE__*/jsx("div", {
229
+ }), document.body), /*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
231
230
  style: {
232
231
  zIndex: "var(--z-notifications)"
233
232
  },
234
233
  className: "fabric-container__notifs flex flex-nowrap pointer-events-none fixed inset-0 p-2 bg-transparent flex-col-reverse items-center justify-end",
235
234
  children: Object.values(messages).map(function (_ref9) {
236
- var _ref10 = _slicedToArray(_ref9, 1),
237
- el = _ref10[0];
235
+ var _ref0 = _slicedToArray(_ref9, 1),
236
+ el = _ref0[0];
238
237
  return el;
239
238
  })
240
- }), document.body), /*#__PURE__*/createPortal( /*#__PURE__*/jsx("div", {
239
+ }), document.body), /*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
241
240
  style: {
242
241
  zIndex: "var(--z-notifications)"
243
242
  },
244
243
  className: "fabric-container__toasts flex flex-nowrap pointer-events-none fixed inset-0 p-4 bg-transparent flex-col items-end justify-end overflow-auto scroll-hide",
245
- children: Object.values(toasts).map(function (_ref11) {
246
- var _ref12 = _slicedToArray(_ref11, 1),
247
- el = _ref12[0];
244
+ children: Object.values(toasts).map(function (_ref1) {
245
+ var _ref10 = _slicedToArray(_ref1, 1),
246
+ el = _ref10[0];
248
247
  return el;
249
248
  })
250
249
  }), document.body)]
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import { useContext, createContext } from 'react';
5
+
6
+ var _excluded = ["errorElement"];
7
+ var GlobalContext = /*#__PURE__*/createContext({});
8
+
9
+ /**
10
+ * internal usage only
11
+ * @internal
12
+ */
13
+ var useGlobals = function useGlobals() {
14
+ return useContext(GlobalContext);
15
+ };
16
+
17
+ /**
18
+ * Hook to access the global application context.
19
+ * This hook provides access to the global context values, including the current locale, calendar, and color scheme.
20
+ *
21
+ * @returns {GlobalContextType} The global context values excluding the error element.
22
+ *
23
+ * @example
24
+ * ```jsx
25
+ * const { changeLocale, currentLocale, toggleColorScheme } = useApplicationContext();
26
+ * ```
27
+ */
28
+ var useApplicationContext = function useApplicationContext() {
29
+ var _useContext = useContext(GlobalContext);
30
+ _useContext.errorElement;
31
+ var rest = _objectWithoutProperties(_useContext, _excluded);
32
+ return rest;
33
+ };
34
+
35
+ /**
36
+ * Hook to access the notification manager from the global context.
37
+ * This hook provides methods to show alerts, errors, messages, and toasts.
38
+ * It returns a reference to the notification manager, which can be used to display notifications in the application.
39
+ *
40
+ * @returns {NotificationManagerRef} The notification manager reference.
41
+ *
42
+ * @example
43
+ * ```jsx
44
+ * const notificationService = useNotificationService();
45
+ * notificationService.showMessage("Hello World");
46
+ * ```
47
+ *
48
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-notifications--notifications} for more details on available methods.
49
+ */
50
+ var useNotificationService = function useNotificationService() {
51
+ var _useContext2 = useContext(GlobalContext),
52
+ notificationManager = _useContext2.notificationManager;
53
+ return notificationManager !== null && notificationManager !== void 0 ? notificationManager : {};
54
+ };
55
+
56
+ export { GlobalContext, useApplicationContext, useGlobals, useNotificationService };
@@ -3,14 +3,16 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import classNames from 'classnames';
6
- import { useRef, useState, useEffect, useCallback, useMemo } from 'react';
6
+ import { useRef, useState, useEffect, useEffectEvent, useMemo } from 'react';
7
7
  import { LoadingLine } from '../../components/animations/Animations.js';
8
- import { Icon, getIconProps } from '../../components/icon/Icon.js';
8
+ import { Icon } from '../../components/icon/Icon.js';
9
9
  import { useLayoutEffectDebugger } from '../../hooks/useEffectDebugger.js';
10
10
  import { usePropToggle } from '../../hooks/usePropToggle.js';
11
11
  import { useResize } from '../../hooks/useResize.js';
12
- import { ErrorBoundary } from '../boundary/ErrorBoundary.js';
13
12
  import { jsxs, jsx } from 'react/jsx-runtime';
13
+ import '@react-fabric/utilities';
14
+ import { getIconProps } from '../../utils/getIconProps.js';
15
+ import { ErrorBoundary } from '../boundary/ErrorBoundary.js';
14
16
 
15
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -20,7 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
22
  * It can be aligned to the start or end of the page.
21
23
  *
22
24
  * @param {AsideProps} props - The properties for the Aside component.
23
- * @returns {JSX.Element} The rendered Aside component.
25
+ * @returns {React.ReactElement} The rendered Aside component.
24
26
  *
25
27
  * @example
26
28
  * ```jsx
@@ -96,13 +98,13 @@ var Aside = function Aside(_ref) {
96
98
  var handleResize = useRef(function (_ref2) {
97
99
  var x = _ref2.x;
98
100
  if (elementRef.current != null) {
99
- setWidth(elementRef.current.offsetWidth + x);
101
+ x !== 0 && setWidth(elementRef.current.offsetWidth + x);
100
102
  }
101
103
  });
102
104
  var resizeHandleProps = useResize(handleResize.current, {
103
105
  isReverse: align === "end"
104
106
  });
105
- var tryPeek = useCallback(function () {
107
+ var tryPeek = useEffectEvent(function () {
106
108
  if (isCollapsed) {
107
109
  if (flyout) {
108
110
  setPeek(!peek);
@@ -111,7 +113,7 @@ var Aside = function Aside(_ref) {
111
113
  void toggleCollapse();
112
114
  }
113
115
  }
114
- }, [peek, flyout, isCollapsed, onFlyout, toggleCollapse]);
116
+ });
115
117
  useLayoutEffectDebugger(function () {
116
118
  if (peek) {
117
119
  var handler = function handler(e) {
@@ -141,6 +143,7 @@ var Aside = function Aside(_ref) {
141
143
  style: isCollapsed ? undefined : widthStyles,
142
144
  "data-testid": testId,
143
145
  "data-test-value": testValue,
146
+ ref: elementRef,
144
147
  children: [/*#__PURE__*/jsxs("header", {
145
148
  className: classNames("fabric-asideHeader", headerClassName, "grid area-head items-center"),
146
149
  "data-ref": "asideHeader",
@@ -166,7 +169,6 @@ var Aside = function Aside(_ref) {
166
169
  "data-ref": "asidePlaceholder",
167
170
  className: "fabric-asidePlaceholder"
168
171
  }), /*#__PURE__*/jsx("section", {
169
- ref: elementRef,
170
172
  "data-ref": "asideBody",
171
173
  className: classNames("fabric-asideBody", bodyClassName, "overflow-hidden grid"),
172
174
  style: isCollapsed ? widthStyles : undefined,
@@ -11,10 +11,10 @@ import classNames from 'classnames';
11
11
  import { Component } from 'react';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
+ import { useGlobals } from '../../context/context.js';
14
15
  import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
15
16
  import { usePropToggle } from '../../hooks/usePropToggle.js';
16
17
  import { ErrorIcon } from './ErrorIcon.js';
17
- import { useGlobals } from '../../context/Global.js';
18
18
 
19
19
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
20
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -117,8 +117,6 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
117
117
  stack: error.stack
118
118
  });
119
119
  }
120
-
121
- // eslint-disable-next-line @typescript-eslint/promise-function-async
122
120
  }, {
123
121
  key: "render",
124
122
  value: function render() {
@@ -4,8 +4,11 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import classNames from 'classnames';
6
6
  import { LoadingLine } from '../../components/animations/Animations.js';
7
- import { Icon, getIconProps } from '../../components/icon/Icon.js';
7
+ import { Icon } from '../../components/icon/Icon.js';
8
+ import 'react';
8
9
  import { jsxs, jsx } from 'react/jsx-runtime';
10
+ import '@react-fabric/utilities';
11
+ import { getIconProps } from '../../utils/getIconProps.js';
9
12
 
10
13
  var _excluded = ["ref", "children", "paper", "title", "titleClassName", "icon", "loading", "data-testid", "data-test-value"];
11
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -5,7 +5,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
5
5
  import classNames from 'classnames';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
 
8
- var _excluded = ["children", "fullWidth", "className", "gutter"],
8
+ var _excluded = ["children", "fullWidth", "className", "gutter", "useContainer"],
9
9
  _excluded2 = ["children", "gutter", "noWrap", "orient", "align", "justify", "className"],
10
10
  _excluded3 = ["children", "flex", "align", "truncate", "className", "stretchContent"];
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -31,9 +31,10 @@ var Container = function Container(_ref) {
31
31
  fullWidth = _ref.fullWidth,
32
32
  className = _ref.className,
33
33
  gutter = _ref.gutter,
34
+ useContainer = _ref.useContainer,
34
35
  aria = _objectWithoutProperties(_ref, _excluded);
35
36
  return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
36
- className: classNames("fabric-container", className, !fullWidth && "container mx-auto"),
37
+ className: classNames("fabric-container", className, !fullWidth && (useContainer ? "container-inner mx-auto" : "container mx-auto")),
37
38
  "data-gutter": gutter
38
39
  }, aria), {}, {
39
40
  children: children
@@ -3,7 +3,7 @@
3
3
  import { isColor } from '@react-fabric/utilities';
4
4
  import classNames from 'classnames';
5
5
  import { useMemo } from 'react';
6
- import { useApplicationContext } from '../../context/Global.js';
6
+ import { useApplicationContext } from '../../context/context.js';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  /*
@@ -59,7 +59,8 @@ var ThemeProvider = function ThemeProvider(_ref) {
59
59
  accentColor = _ref.accentColor,
60
60
  tintColor = _ref.tintColor,
61
61
  colorScheme = _ref.colorScheme,
62
- rounding = _ref.rounding;
62
+ rounding = _ref.rounding,
63
+ className = _ref.className;
63
64
  var _useApplicationContex = useApplicationContext(),
64
65
  currentColorScheme = _useApplicationContex.currentColorScheme;
65
66
  var styles = useMemo(function () {
@@ -88,7 +89,7 @@ var ThemeProvider = function ThemeProvider(_ref) {
88
89
  style: styles,
89
90
  "data-color-scheme": colorScheme !== null && colorScheme !== void 0 ? colorScheme : currentColorScheme,
90
91
  "data-rounding": rounding,
91
- className: classNames("fabric-themeProvider", "contents theme-base", branding),
92
+ className: classNames("fabric-themeProvider", "contents theme-base", branding, className),
92
93
  children: children
93
94
  });
94
95
  };
@@ -47,7 +47,7 @@ var Viewport = function Viewport(_ref) {
47
47
  var children = _ref.children;
48
48
  return /*#__PURE__*/jsx("div", {
49
49
  "data-ref": "viewport",
50
- className: classNames("fabric-viewport", "grid overflow-hidden absolute inset-0"),
50
+ className: classNames("fabric-viewport", "grid overflow-hidden absolute inset-0 @container"),
51
51
  children: children
52
52
  });
53
53
  };
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
+ import { useFloatingNodeId, useFloating, autoUpdate, offset, flip, useClick, useDismiss, useInteractions, FloatingPortal, FloatingOverlay, FloatingFocusManager } from '@floating-ui/react';
6
+ import { useState, useEffectEvent, useRef, cloneElement } from 'react';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ /**
12
+ * A hook that provides a context menu that appears on right-click.
13
+ * It uses the Floating UI library to manage the positioning and interactions of the menu.
14
+ * This hook is useful for creating custom context menus that can be triggered by right-clicking on elements.
15
+ *
16
+ * @param {ContextMenuProps} props - The properties for the ContextMenu hook.
17
+ * @returns {[React.ReactElement | null, (e: MouseEvent) => void]} An array containing the rendered ContextMenu component (or null if not open) and the function to handle right-click events.
18
+ */
19
+ var useContextMenu = function useContextMenu(menu) {
20
+ var _refs$domReference$cu, _refs$domReference$cu2;
21
+ var _useState = useState(false),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ isOpen = _useState2[0],
24
+ setIsOpen = _useState2[1];
25
+ var nodeId = useFloatingNodeId();
26
+ var _useFloating = useFloating({
27
+ open: isOpen,
28
+ nodeId: nodeId,
29
+ onOpenChange: function onOpenChange(open, evt, reason) {
30
+ var target = evt === null || evt === void 0 ? void 0 : evt.target;
31
+ if (!(target !== null && target !== void 0 && target.closest(".menu-list"))) setIsOpen(open);
32
+ },
33
+ strategy: "fixed",
34
+ placement: "bottom-start",
35
+ whileElementsMounted: autoUpdate,
36
+ middleware: [offset(8), flip()]
37
+ }),
38
+ refs = _useFloating.refs,
39
+ floatingStyles = _useFloating.floatingStyles,
40
+ context = _useFloating.context;
41
+ var click = useClick(context, {
42
+ toggle: true,
43
+ ignoreMouse: true
44
+ });
45
+ var dismiss = useDismiss(context, {
46
+ bubbles: true
47
+ });
48
+ var _useInteractions = useInteractions([dismiss, click]),
49
+ getFloatingProps = _useInteractions.getFloatingProps;
50
+ var handleClick = useEffectEvent(function (e) {
51
+ var virtual = {
52
+ getBoundingClientRect: function getBoundingClientRect() {
53
+ return {
54
+ width: 0,
55
+ height: 0,
56
+ x: e.clientX,
57
+ y: e.clientY,
58
+ top: e.clientY,
59
+ left: e.clientX,
60
+ right: e.clientX,
61
+ bottom: e.clientY
62
+ };
63
+ }
64
+ };
65
+ refs.setReference(virtual);
66
+ setIsOpen(true);
67
+ e.nativeEvent.stopImmediatePropagation();
68
+ e.preventDefault();
69
+ return false;
70
+ });
71
+ var tryClosing = useRef(function (e) {
72
+ var _e$target;
73
+ if (!((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest("[data-dropdown-dismiss='false']"))) setTimeout(function () {
74
+ return setIsOpen(false);
75
+ }, 50);
76
+ });
77
+ return [isOpen && /*#__PURE__*/jsx(FloatingPortal, {
78
+ root: (_refs$domReference$cu = (_refs$domReference$cu2 = refs.domReference.current) === null || _refs$domReference$cu2 === void 0 ? void 0 : _refs$domReference$cu2.closest(".theme-base")) !== null && _refs$domReference$cu !== void 0 ? _refs$domReference$cu : undefined,
79
+ children: /*#__PURE__*/jsx(FloatingOverlay, {
80
+ lockScroll: true,
81
+ style: {
82
+ zIndex: "var(--z-overlay-mask)",
83
+ position: "absolute",
84
+ overflow: "hidden"
85
+ },
86
+ children: /*#__PURE__*/jsx(FloatingFocusManager, {
87
+ context: context,
88
+ children: /*#__PURE__*/cloneElement(menu, _objectSpread(_objectSpread({}, getFloatingProps()), {}, {
89
+ style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
90
+ borderRadius: "var(--rounding)",
91
+ zIndex: "var(--z-popover)",
92
+ fontSize: "0.875rem"
93
+ }),
94
+ className: "bg-default outline rounded-capped shadow-lg",
95
+ ref: refs.setFloating,
96
+ onMouseUp: tryClosing.current
97
+ }))
98
+ })
99
+ })
100
+ }), handleClick];
101
+ };
102
+
103
+ export { useContextMenu };
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import { useState, useCallback } from 'react';
4
+ import { debounce } from '@react-fabric/utilities';
5
+ import { useState, useEffectEvent } from 'react';
5
6
  import { useLayoutEffectDebugger } from './useEffectDebugger.js';
6
7
 
7
8
  /**
@@ -17,19 +18,20 @@ var useIsDark = function useIsDark() {
17
18
  _useState2 = _slicedToArray(_useState, 2),
18
19
  isDark = _useState2[0],
19
20
  setDark = _useState2[1];
20
- var checkTheme = useCallback(function () {
21
+ var checkTheme = useEffectEvent(function () {
21
22
  var _ref = getComputedStyle(document.documentElement).backgroundColor.match(/\d?\d?\d/g),
22
23
  _ref2 = _slicedToArray(_ref, 1),
23
24
  r = _ref2[0];
24
25
  setDark(+r < 50);
25
- }, []);
26
+ });
26
27
  useLayoutEffectDebugger(function () {
27
28
  if (MutationObserver) {
28
- var ob = new MutationObserver(checkTheme);
29
+ var cb = debounce(checkTheme, 100);
30
+ var ob = new MutationObserver(cb);
29
31
  ob.observe(document.documentElement, {
30
32
  attributes: true
31
33
  });
32
- checkTheme();
34
+ cb();
33
35
  return function () {
34
36
  ob.disconnect();
35
37
  };
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import { useState, useRef, useCallback, useMemo } from 'react';
4
+ import { useState, useEffectEvent, useMemo } from 'react';
5
5
  import { jsxs } from 'react/jsx-runtime';
6
6
 
7
7
  var useNavigator = function useNavigator() {
@@ -11,16 +11,17 @@ var useNavigator = function useNavigator() {
11
11
  _useState2 = _slicedToArray(_useState, 2),
12
12
  currentIndex = _useState2[0],
13
13
  setCurrentIndex = _useState2[1];
14
- var refCurrent = useRef(defaultIndex);
15
- var onNavigate = useCallback(function (dir) {
16
- if (dir === -1) {
17
- refCurrent.current = refCurrent.current > 0 ? refCurrent.current - 1 : totalCount - 1;
18
- }
19
- if (dir === 1) {
20
- refCurrent.current = refCurrent.current + 1 < totalCount ? refCurrent.current + 1 : 0;
21
- }
22
- setCurrentIndex(refCurrent.current);
23
- }, [totalCount]);
14
+ var onNavigate = useEffectEvent(function (dir) {
15
+ setCurrentIndex(function (prevValue) {
16
+ if (dir === -1) {
17
+ return prevValue > 0 ? prevValue - 1 : totalCount - 1;
18
+ }
19
+ if (dir === 1) {
20
+ return prevValue + 1 < totalCount ? prevValue + 1 : 0;
21
+ }
22
+ return prevValue;
23
+ });
24
+ });
24
25
  var headLabel = useMemo(function () {
25
26
  return /*#__PURE__*/jsxs("span", {
26
27
  className: "text-muted leading-none select-none",