@react-fabric/core 1.0.0-beta.22 → 1.0.0-beta.24

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 (66) hide show
  1. package/dist/cjs/components/animations/Animations.js +1 -1
  2. package/dist/cjs/components/avatar/Avatar.js +1 -1
  3. package/dist/cjs/components/button/ButtonGroup.js +3 -2
  4. package/dist/cjs/components/button/ToggleButtonGroup.js +2 -1
  5. package/dist/cjs/components/callout/Callout.js +2 -1
  6. package/dist/cjs/components/card/Card.js +1 -1
  7. package/dist/cjs/components/card/CardCover.js +1 -1
  8. package/dist/cjs/components/chip/Chip.js +1 -1
  9. package/dist/cjs/components/divider/Divider.js +1 -1
  10. package/dist/cjs/components/icon/Icon.js +1 -1
  11. package/dist/cjs/components/menu/Menu.js +31 -27
  12. package/dist/cjs/components/menu/MenuItem.js +20 -12
  13. package/dist/cjs/components/progress/ProgressBar.js +2 -1
  14. package/dist/cjs/components/progress/ProgressCircle.js +2 -1
  15. package/dist/cjs/components/tabpanel/TabPanel.js +1 -1
  16. package/dist/cjs/core/headfoot/HeadFoot.js +2 -1
  17. package/dist/cjs/index.js +4 -0
  18. package/dist/cjs/overlays/alert/Alert.js +1 -1
  19. package/dist/cjs/overlays/message/Message.js +1 -1
  20. package/dist/cjs/overlays/toast/Toast.js +1 -1
  21. package/dist/cjs/overlays/tooltip/Tooltip.js +1 -1
  22. package/dist/cjs/typography/Abbr.js +1 -1
  23. package/dist/cjs/typography/Anchor.js +2 -1
  24. package/dist/cjs/typography/Mark.js +1 -1
  25. package/dist/cjs/typography/Text.js +1 -1
  26. package/dist/cjs/typography/Title.js +2 -1
  27. package/dist/cjs/utils/cloneElement.js +44 -0
  28. package/dist/esm/components/animations/Animations.js +1 -1
  29. package/dist/esm/components/avatar/Avatar.js +1 -1
  30. package/dist/esm/components/button/ButtonGroup.js +2 -1
  31. package/dist/esm/components/button/ToggleButtonGroup.js +2 -1
  32. package/dist/esm/components/callout/Callout.js +2 -1
  33. package/dist/esm/components/card/Card.js +1 -1
  34. package/dist/esm/components/card/CardCover.js +1 -1
  35. package/dist/esm/components/chip/Chip.js +1 -1
  36. package/dist/esm/components/divider/Divider.js +1 -1
  37. package/dist/esm/components/icon/Icon.js +1 -1
  38. package/dist/esm/components/menu/Menu.js +32 -28
  39. package/dist/esm/components/menu/MenuItem.js +14 -6
  40. package/dist/esm/components/progress/ProgressBar.js +2 -1
  41. package/dist/esm/components/progress/ProgressCircle.js +2 -1
  42. package/dist/esm/components/tabpanel/TabPanel.js +1 -1
  43. package/dist/esm/core/headfoot/HeadFoot.js +2 -1
  44. package/dist/esm/index.js +2 -0
  45. package/dist/esm/overlays/alert/Alert.js +1 -1
  46. package/dist/esm/overlays/message/Message.js +1 -1
  47. package/dist/esm/overlays/toast/Toast.js +1 -1
  48. package/dist/esm/overlays/tooltip/Tooltip.js +1 -1
  49. package/dist/esm/typography/Abbr.js +1 -1
  50. package/dist/esm/typography/Anchor.js +2 -1
  51. package/dist/esm/typography/Mark.js +1 -1
  52. package/dist/esm/typography/Text.js +1 -1
  53. package/dist/esm/typography/Title.js +2 -1
  54. package/dist/esm/utils/cloneElement.js +44 -0
  55. package/dist/types/index.d.ts +2 -0
  56. package/dist/types/utils/cloneElement.d.ts +2 -0
  57. package/dist/types/utils/index.d.ts +1 -0
  58. package/package.json +3 -3
  59. package/src/components/button/ButtonGroup.tsx +1 -1
  60. package/src/components/button/ToggleButtonGroup.tsx +2 -1
  61. package/src/components/menu/Menu.tsx +45 -42
  62. package/src/components/menu/MenuItem.tsx +8 -3
  63. package/src/index.ts +3 -0
  64. package/src/overlays/tooltip/Tooltip.tsx +1 -1
  65. package/src/utils/cloneElement.ts +44 -0
  66. package/src/utils/index.ts +1 -0
@@ -4,10 +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 { CoreIcons } from '../../types/icons.js';
7
+ import 'react';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
9
  import { getBgClass, getColorClass, getBorderClass } from '../../utils/getColor.js';
8
10
  import '@react-fabric/utilities';
9
11
  import { Icon } from '../icon/Icon.js';
10
- import { jsxs, jsx } from 'react/jsx-runtime';
11
12
 
12
13
  var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose", "className"];
13
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; }
@@ -7,10 +7,10 @@ import classNames from 'classnames';
7
7
  import { useMemo, Children } from 'react';
8
8
  import { ErrorBoundary } from '../../core/boundary/ErrorBoundary.js';
9
9
  import { Header, Footer } from '../../core/headfoot/HeadFoot.js';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
11
  import '@react-fabric/utilities';
11
12
  import { nodeCheck } from '../../utils/nodeCheck.js';
12
13
  import classes from './Card.module.css';
13
- import { jsx, jsxs } from 'react/jsx-runtime';
14
14
 
15
15
  var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "flex", "draggable", "dragKey", "dragData", "ref"];
16
16
  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,11 +5,11 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import classNames from 'classnames';
7
7
  import { useMemo, Children } from 'react';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
9
  import '@react-fabric/utilities';
9
10
  import { nodeCheck } from '../../utils/nodeCheck.js';
10
11
  import { Image, Video } from '../media/Media.js';
11
12
  import classes from './Card.module.css';
12
- import { jsxs, jsx } from 'react/jsx-runtime';
13
13
 
14
14
  var _excluded = ["className", "children", "height", "justify", "colorScheme"];
15
15
  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,11 +5,11 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
5
5
  import classNames from 'classnames';
6
6
  import { useCallback } from 'react';
7
7
  import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
9
  import { getColor, getColorClass } from '../../utils/getColor.js';
9
10
  import '@react-fabric/utilities';
10
11
  import { Icon } from '../icon/Icon.js';
11
12
  import classes from './Chip.module.css';
12
- import { jsxs, jsx } from 'react/jsx-runtime';
13
13
 
14
14
  var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "disabled", "onClick", "onIconClick", "onRemove", "rounded", "stopPropagation", "as"];
15
15
  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; }
@@ -2,10 +2,10 @@
2
2
 
3
3
  import classNames from 'classnames';
4
4
  import { useCallback } from 'react';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
6
  import { getBorderClass, getBgClass, getColorClass } from '../../utils/getColor.js';
6
7
  import '@react-fabric/utilities';
7
8
  import classes from './Divider.module.css';
8
- import { jsx, jsxs } from 'react/jsx-runtime';
9
9
 
10
10
  /*
11
11
  * React Fabric
@@ -5,9 +5,9 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
5
5
  import { isSvgPath, isString } from '@react-fabric/utilities';
6
6
  import classNames from 'classnames';
7
7
  import { useMemo } from 'react';
8
+ import { jsx } from 'react/jsx-runtime';
8
9
  import { getColor, getBgClass, getColorClass } from '../../utils/getColor.js';
9
10
  import classes from './Icon.module.css';
10
- import { jsx } from 'react/jsx-runtime';
11
11
 
12
12
  var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "viewBox", "className", "onClick"];
13
13
  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; }
@@ -4,10 +4,12 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import { useFloatingParentNodeId, useFloatingTree, FloatingTree, useFloatingNodeId, useFloating, offset, flip, shift, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingList, FloatingOverlay, FloatingFocusManager, FloatingPortal } from '@floating-ui/react';
7
- import { mergeRefs, cloneChildren } from '@react-fabric/utilities';
7
+ import { mergeRefs } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { useState, useRef, useEffect, useCallback, cloneElement, Fragment } from 'react';
10
+ import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
10
11
  import { CoreIcons } from '../../types/icons.js';
12
+ import { cloneChildren } from '../../utils/cloneElement.js';
11
13
  import { nodeCheck } from '../../utils/nodeCheck.js';
12
14
  import { MenuItem } from './MenuItem.js';
13
15
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -165,33 +167,35 @@ var MenuComponent = function MenuComponent(_ref) {
165
167
  elementsRef: elementsRef,
166
168
  labelsRef: labelsRef,
167
169
  children: (!isNested || isOpen) && /*#__PURE__*/jsxs(Wrapper, _objectSpread(_objectSpread({}, wrapperProps), {}, {
168
- children: [isNested && /*#__PURE__*/jsx(FloatingOverlay, {}), /*#__PURE__*/jsx(FloatingFocusManager, {
169
- context: context,
170
- modal: !isNested,
171
- initialFocus: isNested ? -1 : 0,
172
- returnFocus: !isNested,
173
- children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
174
- className: classNames(menuClassName, "flex flex-col bg-base p-1 menu-list", isNested && "outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-[var(--z-popover)]"),
175
- autoFocus: true,
176
- ref: mergeRefs(isNested ? refs.setFloating : ref)
177
- }, getFloatingProps({
178
- onClick: isNested ? undefined : handleClick
179
- })), {}, {
180
- style: !isNested ? rest.style : floatingStyles,
181
- children: cloneChildren(children, function (child, index) {
182
- labelsRef.current[index] = child.props.label;
183
- return /*#__PURE__*/cloneElement(child, nodeCheck(child, MenuItem, Menu, MenuComponent) ? _objectSpread({
184
- minimal: !isNested && minimal,
185
- "data-focus": activeIndex === index,
186
- ref: function ref(el) {
187
- return elementsRef.current[index] = el;
188
- }
189
- }, getItemProps({
190
- onClick: child.props.onClick,
191
- tabIndex: activeIndex === index ? 0 : -1
192
- })) : {});
193
- })
194
- }))
170
+ children: [isNested && /*#__PURE__*/jsx(FloatingOverlay, {}), /*#__PURE__*/jsx(HotKeyWrapper, {
171
+ children: /*#__PURE__*/jsx(FloatingFocusManager, {
172
+ context: context,
173
+ modal: !isNested,
174
+ initialFocus: isNested ? -1 : 0,
175
+ returnFocus: !isNested,
176
+ children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
177
+ className: classNames(menuClassName, "flex flex-col bg-base p-1 menu-list", isNested && "outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-[var(--z-popover)]"),
178
+ autoFocus: true,
179
+ ref: mergeRefs(isNested ? refs.setFloating : ref)
180
+ }, getFloatingProps({
181
+ onClick: isNested ? undefined : handleClick
182
+ })), {}, {
183
+ style: !isNested ? rest.style : floatingStyles,
184
+ children: cloneChildren(children, function (child, index) {
185
+ labelsRef.current[index] = child.props.label;
186
+ return /*#__PURE__*/cloneElement(child, nodeCheck(child, MenuItem, Menu, MenuComponent) ? _objectSpread({
187
+ minimal: !isNested && minimal,
188
+ "data-focus": activeIndex === index,
189
+ ref: function ref(el) {
190
+ return elementsRef.current[index] = el;
191
+ }
192
+ }, getItemProps({
193
+ onClick: child.props.onClick,
194
+ tabIndex: activeIndex === index ? 0 : -1
195
+ })) : {});
196
+ })
197
+ }))
198
+ })
195
199
  })]
196
200
  }))
197
201
  })]
@@ -3,19 +3,20 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import { useFloatingTree } from '@floating-ui/react';
6
- import { iconToken } from '@react-fabric/utilities';
6
+ import { iconToken, mergeRefs } from '@react-fabric/utilities';
7
7
  import classNames from 'classnames';
8
- import { useMemo, useCallback, Fragment } from 'react';
8
+ import { useRef, useMemo, useCallback, Fragment } from 'react';
9
+ import { HotKey } from '../../hotkeys/HotKey.js';
9
10
  import { HotKeyLabel } from '../../hotkeys/HotKeyLabel.js';
10
11
  import '@babel/runtime/helpers/slicedToArray';
11
12
  import 'react-i18next';
12
13
  import '../../hooks/useEffectDebugger.js';
13
14
  import { jsx, jsxs } from 'react/jsx-runtime';
14
- import '../../hotkeys/HotKeyWrapper.js';
15
15
  import { Tooltip } from '../../overlays/tooltip/Tooltip.js';
16
16
  import { getBadgeProps, Badge } from '../badge/Badge.js';
17
17
  import { Icon } from '../icon/Icon.js';
18
18
  import '../../types/icons.js';
19
+ import '../../hotkeys/HotKeyWrapper.js';
19
20
  import classes from './Menu.module.css';
20
21
 
21
22
  var _excluded = ["as", "label", "color", "className", "icon", "iconBg", "iconColor", "appendLabel", "rtlFlip", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "minimal", "data-open", "ref"],
@@ -44,6 +45,7 @@ var MenuItem = function MenuItem(_ref) {
44
45
  childOpen = _ref["data-open"],
45
46
  ref = _ref.ref,
46
47
  aria = _objectWithoutProperties(_ref, _excluded);
48
+ var elRef = useRef(null);
47
49
  var tree = useFloatingTree();
48
50
  var badgeProps = useMemo(function () {
49
51
  return getBadgeProps(badge);
@@ -98,8 +100,8 @@ var MenuItem = function MenuItem(_ref) {
98
100
  }, [iconEl, minimal, appendLabel, label, badge, badgeProps, hotKey, active]);
99
101
  var E = as !== null && as !== void 0 ? as : "button";
100
102
  return /*#__PURE__*/jsx(Wrapper, _objectSpread(_objectSpread({}, aria), {}, {
101
- children: /*#__PURE__*/jsx(E, _objectSpread(_objectSpread({
102
- ref: ref,
103
+ children: /*#__PURE__*/jsxs(E, _objectSpread(_objectSpread({
104
+ ref: mergeRefs(ref, elRef),
103
105
  "data-dropdown-dismiss": true,
104
106
  "data-color": color,
105
107
  className: classNames(classes.menuItem, className, active && classes.active, minimal && classes.minimal, disabled && classes.disabled, "rounded-capped relative max-w-[50vw] my-0.5"),
@@ -111,7 +113,13 @@ var MenuItem = function MenuItem(_ref) {
111
113
  (_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
112
114
  }
113
115
  }, minimal ? {} : aria), {}, {
114
- children: menuLabel
116
+ children: [hotKey && /*#__PURE__*/jsx(HotKey, {
117
+ keyCombo: hotKey,
118
+ handler: function handler() {
119
+ var _elRef$current, _elRef$current$click;
120
+ return (_elRef$current = elRef.current) === null || _elRef$current === void 0 || (_elRef$current$click = _elRef$current.click) === null || _elRef$current$click === void 0 ? void 0 : _elRef$current$click.call(_elRef$current);
121
+ }
122
+ }), menuLabel]
115
123
  }))
116
124
  }));
117
125
  };
@@ -4,9 +4,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import { Format } from '@react-fabric/utilities';
5
5
  import classNames from 'classnames';
6
6
  import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
7
+ import 'react';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
9
  import { getColorClass } from '../../utils/getColor.js';
8
10
  import classes from './Progress.module.css';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
11
 
11
12
  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; }
12
13
  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; }
@@ -3,8 +3,9 @@
3
3
  import { Format } from '@react-fabric/utilities';
4
4
  import classNames from 'classnames';
5
5
  import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
6
- import { getColorClass } from '../../utils/getColor.js';
6
+ import 'react';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
8
+ import { getColorClass } from '../../utils/getColor.js';
8
9
 
9
10
  /*
10
11
  * React Fabric
@@ -3,11 +3,11 @@
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import classNames from 'classnames';
5
5
  import { useState, useMemo, Children, useEffect, useCallback, cloneElement } from 'react';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
7
  import '@react-fabric/utilities';
7
8
  import { nodeCheck } from '../../utils/nodeCheck.js';
8
9
  import { Tab } from './Tab.js';
9
10
  import classes from './TabPanel.module.css';
10
- import { jsxs, jsx } from 'react/jsx-runtime';
11
11
 
12
12
  // TODO: implement append/prepend tab-bar items
13
13
 
@@ -4,10 +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 { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
7
+ import 'react';
8
+ import { jsx } from 'react/jsx-runtime';
7
9
  import { getColor, getBgClass, getColorClass } from '../../utils/getColor.js';
8
10
  import '@react-fabric/utilities';
9
11
  import classes from './HeadFoot.module.css';
10
- import { jsx } from 'react/jsx-runtime';
11
12
 
12
13
  var _excluded = ["as", "children", "className", "bg", "color", "flex", "area", "dir", "align", "justify"];
13
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; }
package/dist/esm/index.js CHANGED
@@ -51,6 +51,7 @@ import 'react';
51
51
  import 'react-i18next';
52
52
  export { CoreIcons } from './types/icons.js';
53
53
  export { Title } from './typography/Title.js';
54
+ export { cloneChildren } from './utils/cloneElement.js';
54
55
  import '@react-fabric/utilities';
55
56
  import 'react/jsx-runtime';
56
57
  export { Flyout } from './overlays/flyout/Flyout.js';
@@ -73,4 +74,5 @@ export { useResizeObserver } from './hooks/useResizeObserver.js';
73
74
  export { useLocalStorage, useSessionStorage } from './hooks/useStorage.js';
74
75
  export { HotKey } from './hotkeys/HotKey.js';
75
76
  export { HotKeyLabel } from './hotkeys/HotKeyLabel.js';
77
+ export { HotKeyWrapper } from './hotkeys/HotKeyWrapper.js';
76
78
  export { ApplicationProvider, useApplicationContext, useGlobals, useNotificationService } from './context/Global.js';
@@ -11,10 +11,10 @@ import { Button } from '../../components/button/Button.js';
11
11
  import { Icon } from '../../components/icon/Icon.js';
12
12
  import { CoreIcons } from '../../types/icons.js';
13
13
  import { Title } from '../../typography/Title.js';
14
+ import { jsx, jsxs } from 'react/jsx-runtime';
14
15
  import { getColorClass, getBorderClass } from '../../utils/getColor.js';
15
16
  import '@react-fabric/utilities';
16
17
  import classes from './Alert.module.css';
17
- import { jsx, jsxs } from 'react/jsx-runtime';
18
18
 
19
19
  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; }
20
20
  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; }
@@ -3,10 +3,10 @@
3
3
  import classNames from 'classnames';
4
4
  import { useRef, useCallback, useLayoutEffect } from 'react';
5
5
  import { Icon } from '../../components/icon/Icon.js';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
7
  import { getBgClass, getColorClass } from '../../utils/getColor.js';
7
8
  import '@react-fabric/utilities';
8
9
  import classes from './Message.module.css';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
10
 
11
11
  /*
12
12
  * React Fabric
@@ -7,10 +7,10 @@ import { AnimationIndicator } from '../../components/animations/Animations.js';
7
7
  import { Button } from '../../components/button/Button.js';
8
8
  import { Icon } from '../../components/icon/Icon.js';
9
9
  import { CoreIcons } from '../../types/icons.js';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
11
  import { getColorClass, getBorderClass, getBgClass } from '../../utils/getColor.js';
11
12
  import '@react-fabric/utilities';
12
13
  import classes from './Toast.module.css';
13
- import { jsx, jsxs } from 'react/jsx-runtime';
14
14
 
15
15
  /*
16
16
  * React Fabric
@@ -118,7 +118,7 @@ var Tooltip = function Tooltip(_ref) {
118
118
  style: floatingStyles
119
119
  }, getFloatingProps()), {}, {
120
120
  children: [/*#__PURE__*/jsx("span", {
121
- className: classNames("font-medium text-dimmed flex-1", isString(content) && "whitespace-pre-wrap mixed-lang"),
121
+ className: classNames("font-medium text-dimmed flex-1 break-all", isString(content) && "whitespace-pre-wrap mixed-lang"),
122
122
  children: content
123
123
  }), copyEl, /*#__PURE__*/jsx(FloatingArrow, {
124
124
  ref: arrowRef,
@@ -7,9 +7,9 @@ import classNames from 'classnames';
7
7
  import { useCallback, Fragment, useMemo } from 'react';
8
8
  import { useMemoDebugger } from '../hooks/useEffectDebugger.js';
9
9
  import { Tooltip, getTooltipProps } from '../overlays/tooltip/Tooltip.js';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
11
  import { getColorClass, getColor } from '../utils/getColor.js';
11
12
  import classes from './Typography.module.css';
12
- import { jsx, jsxs } from 'react/jsx-runtime';
13
13
 
14
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; }
15
15
  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; }
@@ -4,10 +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 { useMemoDebugger } from '../hooks/useEffectDebugger.js';
7
+ import 'react';
8
+ import { jsx } from 'react/jsx-runtime';
7
9
  import { getColor, getBgClass, getColorClass } from '../utils/getColor.js';
8
10
  import '@react-fabric/utilities';
9
11
  import { TextSizeMap } from './types.js';
10
- import { jsx } from 'react/jsx-runtime';
11
12
 
12
13
  var _excluded = ["ref", "as", "children", "className", "bg", "color", "family", "size"];
13
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; }
@@ -6,9 +6,9 @@ import { isString, isEmpty, tokenize } from '@react-fabric/utilities';
6
6
  import classNames from 'classnames';
7
7
  import { useCallback, Fragment } from 'react';
8
8
  import { useMemoDebugger } from '../hooks/useEffectDebugger.js';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
10
  import { getBgClass, getColor } from '../utils/getColor.js';
10
11
  import classes from './Typography.module.css';
11
- import { jsx, jsxs } from 'react/jsx-runtime';
12
12
 
13
13
  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; }
14
14
  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; }
@@ -10,10 +10,10 @@ import { useTranslation } from 'react-i18next';
10
10
  import { useLayoutEffectDebugger, useMemoDebugger } from '../hooks/useEffectDebugger.js';
11
11
  import { usePropToggle } from '../hooks/usePropToggle.js';
12
12
  import { calculateTextHeight } from '../utils/calculateDimensions.js';
13
+ import { jsx, jsxs } from 'react/jsx-runtime';
13
14
  import { getColor, getBgClass, getColorClass } from '../utils/getColor.js';
14
15
  import classes from './Typography.module.css';
15
16
  import { TextSizeMap } from './types.js';
16
- import { jsx, jsxs } from 'react/jsx-runtime';
17
17
 
18
18
  var _excluded = ["children", "className", "inline", "bg", "color", "family", "size", "clamp", "align"];
19
19
  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; }
@@ -4,11 +4,12 @@ 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 { useMemoDebugger } from '../hooks/useEffectDebugger.js';
7
+ import 'react';
8
+ import { jsx } from 'react/jsx-runtime';
7
9
  import { getColor, getBgClass, getColorClass } from '../utils/getColor.js';
8
10
  import '@react-fabric/utilities';
9
11
  import { TitleSizeMap } from './types.js';
10
12
  import classes from './Typography.module.css';
11
- import { jsx } from 'react/jsx-runtime';
12
13
 
13
14
  var _excluded = ["children", "className", "as", "bg", "color", "size", "align", "family"];
14
15
  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; }
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+
3
+ import { Children, isValidElement } from 'react';
4
+ import { Fragment } from 'react/jsx-runtime';
5
+
6
+ /*
7
+ * React Fabric
8
+ * @version: 1.0.0
9
+ *
10
+ *
11
+ * The MIT License (MIT)
12
+ * Copyright (c) 2024 Adarsh Pastakia
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
15
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
16
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
21
+ * portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
24
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+ */
28
+
29
+ var cloneChildren = function cloneChildren(children, callback) {
30
+ var _Children$map;
31
+ return (_Children$map = Children.map(children, function (c) {
32
+ if ( /*#__PURE__*/isValidElement(c)) {
33
+ if (c.type === Fragment) {
34
+ var _c$props;
35
+ // just compare to `Fragment`
36
+ return cloneChildren((_c$props = c.props) === null || _c$props === void 0 ? void 0 : _c$props.children, callback);
37
+ }
38
+ return c;
39
+ }
40
+ return c;
41
+ })) === null || _Children$map === void 0 ? void 0 : _Children$map.flat().filter(Boolean).map(callback);
42
+ };
43
+
44
+ export { cloneChildren };
@@ -15,6 +15,8 @@ export * from "./hooks/useResizeObserver";
15
15
  export * from "./hooks/useStorage";
16
16
  export { HotKey } from "./hotkeys/HotKey";
17
17
  export { HotKeyLabel } from "./hotkeys/HotKeyLabel";
18
+ export { HotKeyWrapper } from "./hotkeys/HotKeyWrapper";
18
19
  export { type ModalProps } from "./types";
19
20
  export { CoreIcons } from "./types/icons";
21
+ export { cloneChildren } from "./utils";
20
22
  export { ApplicationProvider, useApplicationContext, useGlobals, useNotificationService, } from "./context/Global";
@@ -0,0 +1,2 @@
1
+ import { type ReactNode } from "react";
2
+ export declare const cloneChildren: (children: ReactNode, callback: (child: ReactNode, index: number) => ReactNode) => ReactNode;
@@ -1,3 +1,4 @@
1
1
  export * from "./calculateDimensions";
2
+ export * from "./cloneElement";
2
3
  export * from "./getColor";
3
4
  export * from "./nodeCheck";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/core",
3
- "version": "1.0.0-beta.22",
3
+ "version": "1.0.0-beta.24",
4
4
  "description": "RUF: Core package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@floating-ui/react": "^0.26.24",
39
- "@react-fabric/utilities": "^1.0.0-beta.22",
39
+ "@react-fabric/utilities": "^1.0.0-beta.24",
40
40
  "@tailwindcss/container-queries": "^0.1.1",
41
41
  "@tailwindcss/forms": "^0.5.7",
42
42
  "@tailwindcss/typography": "^0.5.13",
@@ -56,5 +56,5 @@
56
56
  "node": ">=18.12.0",
57
57
  "npm": ">=8.19.0"
58
58
  },
59
- "gitHead": "71904746bcfbbb6b4ee39c5fc7a00c8f4a18a052"
59
+ "gitHead": "ccdec75c17dcc549e7a0cad3fd1fda2001c5f990"
60
60
  }
@@ -21,7 +21,6 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { cloneChildren } from "@react-fabric/utilities";
25
24
  import classNames from "classnames";
26
25
  import { cloneElement } from "react";
27
26
  import {
@@ -33,6 +32,7 @@ import {
33
32
  type SizeType,
34
33
  type TestProps,
35
34
  } from "../../types";
35
+ import { cloneChildren } from "../../utils";
36
36
  import { type Button } from "./Button";
37
37
  import classes from "./Button.module.css";
38
38
 
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { cloneChildren, EMPTY_ARRAY, isArray } from "@react-fabric/utilities";
24
+ import { EMPTY_ARRAY, isArray } from "@react-fabric/utilities";
25
25
  import classNames from "classnames";
26
26
  import { cloneElement, useCallback, useMemo } from "react";
27
27
  import { useControlledValue } from "../../hooks/useControlledValue";
@@ -32,6 +32,7 @@ import {
32
32
  type CssProp,
33
33
  type SizeType,
34
34
  } from "../../types";
35
+ import { cloneChildren } from "../../utils";
35
36
  import { type ButtonProps } from "./Button";
36
37
  import classes from "./Button.module.css";
37
38