@react-fabric/core 1.0.0-beta.23 → 1.0.0-beta.25
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.
- package/css/reset/_reset.css +1 -1
- package/dist/cjs/components/animations/Animations.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/button/ButtonGroup.js +3 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +2 -1
- package/dist/cjs/components/callout/Callout.js +2 -1
- package/dist/cjs/components/card/Card.js +1 -1
- package/dist/cjs/components/card/CardCover.js +1 -1
- package/dist/cjs/components/chip/Chip.js +1 -1
- package/dist/cjs/components/divider/Divider.js +1 -1
- package/dist/cjs/components/icon/Icon.js +1 -1
- package/dist/cjs/components/menu/Menu.js +8 -4
- package/dist/cjs/components/menu/MenuItem.js +10 -3
- package/dist/cjs/components/progress/ProgressBar.js +2 -1
- package/dist/cjs/components/progress/ProgressCircle.js +2 -1
- package/dist/cjs/components/tabpanel/TabPanel.js +1 -1
- package/dist/cjs/core/headfoot/HeadFoot.js +2 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/overlays/alert/Alert.js +1 -1
- package/dist/cjs/overlays/message/Message.js +1 -1
- package/dist/cjs/overlays/toast/Toast.js +1 -1
- package/dist/cjs/typography/Abbr.js +1 -1
- package/dist/cjs/typography/Anchor.js +2 -1
- package/dist/cjs/typography/Mark.js +1 -1
- package/dist/cjs/typography/Text.js +1 -1
- package/dist/cjs/typography/Title.js +2 -1
- package/dist/cjs/utils/cloneElement.js +44 -0
- package/dist/esm/components/animations/Animations.js +1 -1
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/button/ButtonGroup.js +2 -1
- package/dist/esm/components/button/ToggleButtonGroup.js +2 -1
- package/dist/esm/components/callout/Callout.js +2 -1
- package/dist/esm/components/card/Card.js +1 -1
- package/dist/esm/components/card/CardCover.js +1 -1
- package/dist/esm/components/chip/Chip.js +1 -1
- package/dist/esm/components/divider/Divider.js +1 -1
- package/dist/esm/components/icon/Icon.js +1 -1
- package/dist/esm/components/menu/Menu.js +8 -4
- package/dist/esm/components/menu/MenuItem.js +11 -4
- package/dist/esm/components/progress/ProgressBar.js +2 -1
- package/dist/esm/components/progress/ProgressCircle.js +2 -1
- package/dist/esm/components/tabpanel/TabPanel.js +1 -1
- package/dist/esm/core/headfoot/HeadFoot.js +2 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/overlays/alert/Alert.js +1 -1
- package/dist/esm/overlays/message/Message.js +1 -1
- package/dist/esm/overlays/toast/Toast.js +1 -1
- package/dist/esm/typography/Abbr.js +1 -1
- package/dist/esm/typography/Anchor.js +2 -1
- package/dist/esm/typography/Mark.js +1 -1
- package/dist/esm/typography/Text.js +1 -1
- package/dist/esm/typography/Title.js +2 -1
- package/dist/esm/utils/cloneElement.js +44 -0
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/cloneElement.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/button/ButtonGroup.tsx +1 -1
- package/src/components/button/ToggleButtonGroup.tsx +2 -1
- package/src/components/menu/Menu.tsx +6 -5
- package/src/components/menu/MenuItem.tsx +7 -1
- package/src/index.ts +2 -0
- package/src/utils/cloneElement.ts +44 -0
- package/src/utils/index.ts +1 -0
package/css/reset/_reset.css
CHANGED
|
@@ -5,10 +5,10 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var useEffectDebugger = require('../../hooks/useEffectDebugger.js');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
9
|
var getColor = require('../../utils/getColor.js');
|
|
9
10
|
require('@react-fabric/utilities');
|
|
10
11
|
var Animations_module = require('./Animations.module.css');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
|
|
13
13
|
var _excluded = ["className", "color", "strokeColor", "type"],
|
|
14
14
|
_excluded2 = ["className"];
|
|
@@ -7,9 +7,9 @@ var utilities = require('@react-fabric/utilities');
|
|
|
7
7
|
var BoringAvatar = require('boring-avatars');
|
|
8
8
|
var classNames = require('classnames');
|
|
9
9
|
var react = require('react');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
var getColor = require('../../utils/getColor.js');
|
|
11
12
|
var Avatar_module = require('./Avatar.module.css');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
|
|
14
14
|
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "onClick"];
|
|
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,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
-
var utilities = require('@react-fabric/utilities');
|
|
6
5
|
var classNames = require('classnames');
|
|
7
6
|
var react = require('react');
|
|
7
|
+
var cloneElement = require('../../utils/cloneElement.js');
|
|
8
|
+
require('@react-fabric/utilities');
|
|
8
9
|
var Button_module = require('./Button.module.css');
|
|
9
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
|
|
@@ -26,7 +27,7 @@ var ButtonGroup = function ButtonGroup(_ref) {
|
|
|
26
27
|
"data-ref": "buttonGroup",
|
|
27
28
|
className: classNames(Button_module.buttonGroup, className, fullWidth ? "flex" : "inline-flex", "flex-nowrap align-middle rounded", vertical && Button_module.vertical, vertical && "flex-col items-stretch")
|
|
28
29
|
}, aria), {}, {
|
|
29
|
-
children:
|
|
30
|
+
children: cloneElement.cloneChildren(children, function (child) {
|
|
30
31
|
return /*#__PURE__*/react.cloneElement(child, _objectSpread({
|
|
31
32
|
color: color,
|
|
32
33
|
size: size,
|
|
@@ -7,6 +7,7 @@ var utilities = require('@react-fabric/utilities');
|
|
|
7
7
|
var classNames = require('classnames');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var useControlledValue = require('../../hooks/useControlledValue.js');
|
|
10
|
+
var cloneElement = require('../../utils/cloneElement.js');
|
|
10
11
|
var Button_module = require('./Button.module.css');
|
|
11
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
13
|
|
|
@@ -48,7 +49,7 @@ var ToggleButtonGroup = function ToggleButtonGroup(_ref) {
|
|
|
48
49
|
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
49
50
|
className: classNames(Button_module.buttonGroup, className, fullWidth ? "flex" : "inline-flex", "flex-nowrap align-middle", vertical && Button_module.vertical, vertical && "flex-col")
|
|
50
51
|
}, aria), {}, {
|
|
51
|
-
children:
|
|
52
|
+
children: cloneElement.cloneChildren(children, function (child) {
|
|
52
53
|
return /*#__PURE__*/react.cloneElement(child, _objectSpread(_objectSpread({
|
|
53
54
|
color: color,
|
|
54
55
|
size: size,
|
|
@@ -4,10 +4,11 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var icons = require('../../types/icons.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
var getColor = require('../../utils/getColor.js');
|
|
8
10
|
require('@react-fabric/utilities');
|
|
9
11
|
var Icon = require('../icon/Icon.js');
|
|
10
|
-
var jsxRuntime = require('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 @@ var classNames = require('classnames');
|
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var ErrorBoundary = require('../../core/boundary/ErrorBoundary.js');
|
|
9
9
|
var HeadFoot = require('../../core/headfoot/HeadFoot.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
require('@react-fabric/utilities');
|
|
11
12
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
12
13
|
var Card_module = require('./Card.module.css');
|
|
13
|
-
var jsxRuntime = require('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 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
6
|
var classNames = require('classnames');
|
|
7
7
|
var react = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
9
|
require('@react-fabric/utilities');
|
|
9
10
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
10
11
|
var Media = require('../media/Media.js');
|
|
11
12
|
var Card_module = require('./Card.module.css');
|
|
12
|
-
var jsxRuntime = require('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 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var useEffectDebugger = require('../../hooks/useEffectDebugger.js');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
9
|
var getColor = require('../../utils/getColor.js');
|
|
9
10
|
require('@react-fabric/utilities');
|
|
10
11
|
var Icon = require('../icon/Icon.js');
|
|
11
12
|
var Chip_module = require('./Chip.module.css');
|
|
12
|
-
var jsxRuntime = require('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
|
var classNames = require('classnames');
|
|
4
4
|
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var getColor = require('../../utils/getColor.js');
|
|
6
7
|
require('@react-fabric/utilities');
|
|
7
8
|
var Divider_module = require('./Divider.module.css');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* React Fabric
|
|
@@ -5,9 +5,9 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
5
5
|
var utilities = require('@react-fabric/utilities');
|
|
6
6
|
var classNames = require('classnames');
|
|
7
7
|
var react = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
9
|
var getColor = require('../../utils/getColor.js');
|
|
9
10
|
var Icon_module = require('./Icon.module.css');
|
|
10
|
-
var jsxRuntime = require('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; }
|
|
@@ -7,15 +7,18 @@ var react = require('@floating-ui/react');
|
|
|
7
7
|
var utilities = require('@react-fabric/utilities');
|
|
8
8
|
var classNames = require('classnames');
|
|
9
9
|
var react$1 = require('react');
|
|
10
|
+
var HotKeyWrapper = require('../../hotkeys/HotKeyWrapper.js');
|
|
10
11
|
var icons = require('../../types/icons.js');
|
|
12
|
+
var cloneElement = require('../../utils/cloneElement.js');
|
|
11
13
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
12
14
|
var MenuItem = require('./MenuItem.js');
|
|
13
|
-
var HotKeyWrapper = require('../../hotkeys/HotKeyWrapper.js');
|
|
14
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
16
|
|
|
16
17
|
var _excluded = ["children", "minimal", "menuClassName", "onClick", "ref"];
|
|
17
18
|
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; }
|
|
18
19
|
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
|
+
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
21
|
+
|
|
19
22
|
var MenuComponent = function MenuComponent(_ref) {
|
|
20
23
|
var _refs$domReference$cu, _refs$domReference$cu2;
|
|
21
24
|
var children = _ref.children,
|
|
@@ -63,8 +66,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
63
66
|
})
|
|
64
67
|
});
|
|
65
68
|
var click = react.useClick(context, {
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
event: "mousedown",
|
|
70
|
+
toggle: !isNested,
|
|
71
|
+
ignoreMouse: isNested
|
|
68
72
|
});
|
|
69
73
|
var role = react.useRole(context, {
|
|
70
74
|
role: "menu"
|
|
@@ -178,7 +182,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
178
182
|
onClick: isNested ? undefined : handleClick
|
|
179
183
|
})), {}, {
|
|
180
184
|
style: !isNested ? rest.style : floatingStyles,
|
|
181
|
-
children:
|
|
185
|
+
children: cloneElement.cloneChildren(children, function (child, index) {
|
|
182
186
|
labelsRef.current[index] = child.props.label;
|
|
183
187
|
return /*#__PURE__*/react$1.cloneElement(child, nodeCheck.nodeCheck(child, MenuItem.MenuItem, Menu, MenuComponent) ? _objectSpread({
|
|
184
188
|
minimal: !isNested && minimal,
|
|
@@ -19,7 +19,7 @@ require('../../types/icons.js');
|
|
|
19
19
|
require('../../hotkeys/HotKeyWrapper.js');
|
|
20
20
|
var Menu_module = require('./Menu.module.css');
|
|
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"],
|
|
22
|
+
var _excluded = ["as", "label", "color", "className", "icon", "iconBg", "iconColor", "appendLabel", "rtlFlip", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "tabIndex", "minimal", "data-open", "ref"],
|
|
23
23
|
_excluded2 = ["children"];
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
@@ -41,6 +41,8 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
41
41
|
_onClick = _ref.onClick,
|
|
42
42
|
badge = _ref.badge,
|
|
43
43
|
hotKey = _ref.hotKey,
|
|
44
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
45
|
+
tabIndex = _ref$tabIndex === void 0 ? -1 : _ref$tabIndex,
|
|
44
46
|
minimal = _ref.minimal,
|
|
45
47
|
childOpen = _ref["data-open"],
|
|
46
48
|
ref = _ref.ref,
|
|
@@ -50,6 +52,10 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
50
52
|
var badgeProps = react.useMemo(function () {
|
|
51
53
|
return Badge.getBadgeProps(badge);
|
|
52
54
|
}, [badge]);
|
|
55
|
+
react.useEffect(function () {
|
|
56
|
+
var _elRef$current;
|
|
57
|
+
tabIndex === 0 && ((_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.focus());
|
|
58
|
+
}, [tabIndex]);
|
|
53
59
|
var iconEl = react.useMemo(function () {
|
|
54
60
|
var _path;
|
|
55
61
|
var path = icon;
|
|
@@ -109,6 +115,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
109
115
|
"data-open": childOpen,
|
|
110
116
|
disabled: disabled,
|
|
111
117
|
"data-id": id,
|
|
118
|
+
tabIndex: tabIndex,
|
|
112
119
|
onClick: function onClick(e) {
|
|
113
120
|
(_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
|
|
114
121
|
}
|
|
@@ -116,8 +123,8 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
116
123
|
children: [hotKey && /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
117
124
|
keyCombo: hotKey,
|
|
118
125
|
handler: function handler() {
|
|
119
|
-
var _elRef$
|
|
120
|
-
return (_elRef$
|
|
126
|
+
var _elRef$current2, _elRef$current2$click;
|
|
127
|
+
return (_elRef$current2 = elRef.current) === null || _elRef$current2 === void 0 || (_elRef$current2$click = _elRef$current2.click) === null || _elRef$current2$click === void 0 ? void 0 : _elRef$current2$click.call(_elRef$current2);
|
|
121
128
|
}
|
|
122
129
|
}), menuLabel]
|
|
123
130
|
}))
|
|
@@ -4,9 +4,10 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var utilities = require('@react-fabric/utilities');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var useEffectDebugger = require('../../hooks/useEffectDebugger.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
var getColor = require('../../utils/getColor.js');
|
|
8
10
|
var Progress_module = require('./Progress.module.css');
|
|
9
|
-
var jsxRuntime = require('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
|
var utilities = require('@react-fabric/utilities');
|
|
4
4
|
var classNames = require('classnames');
|
|
5
5
|
var useEffectDebugger = require('../../hooks/useEffectDebugger.js');
|
|
6
|
-
|
|
6
|
+
require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var getColor = require('../../utils/getColor.js');
|
|
8
9
|
|
|
9
10
|
/*
|
|
10
11
|
* React Fabric
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
4
|
var classNames = require('classnames');
|
|
5
5
|
var react = require('react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
require('@react-fabric/utilities');
|
|
7
8
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
8
9
|
var Tab = require('./Tab.js');
|
|
9
10
|
var TabPanel_module = require('./TabPanel.module.css');
|
|
10
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
12
|
// TODO: implement append/prepend tab-bar items
|
|
13
13
|
|
|
@@ -4,10 +4,11 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var useEffectDebugger = require('../../hooks/useEffectDebugger.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
var getColor = require('../../utils/getColor.js');
|
|
8
10
|
require('@react-fabric/utilities');
|
|
9
11
|
var HeadFoot_module = require('./HeadFoot.module.css');
|
|
10
|
-
var jsxRuntime = require('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/cjs/index.js
CHANGED
|
@@ -51,6 +51,7 @@ require('react');
|
|
|
51
51
|
require('react-i18next');
|
|
52
52
|
var icons = require('./types/icons.js');
|
|
53
53
|
var Title = require('./typography/Title.js');
|
|
54
|
+
var cloneElement = require('./utils/cloneElement.js');
|
|
54
55
|
require('@react-fabric/utilities');
|
|
55
56
|
require('react/jsx-runtime');
|
|
56
57
|
var Flyout = require('./overlays/flyout/Flyout.js');
|
|
@@ -136,6 +137,7 @@ Object.defineProperty(exports, "CoreIcons", {
|
|
|
136
137
|
get: function () { return icons.CoreIcons; }
|
|
137
138
|
});
|
|
138
139
|
exports.Title = Title.Title;
|
|
140
|
+
exports.cloneChildren = cloneElement.cloneChildren;
|
|
139
141
|
exports.Flyout = Flyout.Flyout;
|
|
140
142
|
exports.Modal = Modal.Modal;
|
|
141
143
|
exports.Tooltip = Tooltip.Tooltip;
|
|
@@ -11,10 +11,10 @@ var Button = require('../../components/button/Button.js');
|
|
|
11
11
|
var Icon = require('../../components/icon/Icon.js');
|
|
12
12
|
var icons = require('../../types/icons.js');
|
|
13
13
|
var Title = require('../../typography/Title.js');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
14
15
|
var getColor = require('../../utils/getColor.js');
|
|
15
16
|
require('@react-fabric/utilities');
|
|
16
17
|
var Alert_module = require('./Alert.module.css');
|
|
17
|
-
var jsxRuntime = require('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
|
var classNames = require('classnames');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var Icon = require('../../components/icon/Icon.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var getColor = require('../../utils/getColor.js');
|
|
7
8
|
require('@react-fabric/utilities');
|
|
8
9
|
var Message_module = require('./Message.module.css');
|
|
9
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
11
11
|
/*
|
|
12
12
|
* React Fabric
|
|
@@ -7,10 +7,10 @@ var Animations = require('../../components/animations/Animations.js');
|
|
|
7
7
|
var Button = require('../../components/button/Button.js');
|
|
8
8
|
var Icon = require('../../components/icon/Icon.js');
|
|
9
9
|
var icons = require('../../types/icons.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
var getColor = require('../../utils/getColor.js');
|
|
11
12
|
require('@react-fabric/utilities');
|
|
12
13
|
var Toast_module = require('./Toast.module.css');
|
|
13
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
16
|
* React Fabric
|
|
@@ -7,9 +7,9 @@ var classNames = require('classnames');
|
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var useEffectDebugger = require('../hooks/useEffectDebugger.js');
|
|
9
9
|
var Tooltip = require('../overlays/tooltip/Tooltip.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
var getColor = require('../utils/getColor.js');
|
|
11
12
|
var Typography_module = require('./Typography.module.css');
|
|
12
|
-
var jsxRuntime = require('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 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var useEffectDebugger = require('../hooks/useEffectDebugger.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
var getColor = require('../utils/getColor.js');
|
|
8
10
|
require('@react-fabric/utilities');
|
|
9
11
|
var types = require('./types.js');
|
|
10
|
-
var jsxRuntime = require('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 @@ var utilities = require('@react-fabric/utilities');
|
|
|
6
6
|
var classNames = require('classnames');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var useEffectDebugger = require('../hooks/useEffectDebugger.js');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
10
|
var getColor = require('../utils/getColor.js');
|
|
10
11
|
var Typography_module = require('./Typography.module.css');
|
|
11
|
-
var jsxRuntime = require('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 @@ var reactI18next = require('react-i18next');
|
|
|
10
10
|
var useEffectDebugger = require('../hooks/useEffectDebugger.js');
|
|
11
11
|
var usePropToggle = require('../hooks/usePropToggle.js');
|
|
12
12
|
var calculateDimensions = require('../utils/calculateDimensions.js');
|
|
13
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
14
|
var getColor = require('../utils/getColor.js');
|
|
14
15
|
var Typography_module = require('./Typography.module.css');
|
|
15
16
|
var types = require('./types.js');
|
|
16
|
-
var jsxRuntime = require('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 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var useEffectDebugger = require('../hooks/useEffectDebugger.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
var getColor = require('../utils/getColor.js');
|
|
8
10
|
require('@react-fabric/utilities');
|
|
9
11
|
var types = require('./types.js');
|
|
10
12
|
var Typography_module = require('./Typography.module.css');
|
|
11
|
-
var jsxRuntime = require('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 strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var jsxRuntime = require('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 = react.Children.map(children, function (c) {
|
|
32
|
+
if ( /*#__PURE__*/react.isValidElement(c)) {
|
|
33
|
+
if (c.type === jsxRuntime.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
|
+
exports.cloneChildren = cloneChildren;
|
|
@@ -5,10 +5,10 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { useMemo } 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 classes from './Animations.module.css';
|
|
11
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
12
|
|
|
13
13
|
var _excluded = ["className", "color", "strokeColor", "type"],
|
|
14
14
|
_excluded2 = ["className"];
|
|
@@ -7,9 +7,9 @@ import { isSvgPath } from '@react-fabric/utilities';
|
|
|
7
7
|
import BoringAvatar from 'boring-avatars';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useState, useMemo } from 'react';
|
|
10
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
11
|
import { getColor, getBgClass, getColorClass } from '../../utils/getColor.js';
|
|
11
12
|
import classes from './Avatar.module.css';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "onClick"];
|
|
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,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
-
import { cloneChildren } from '@react-fabric/utilities';
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import { cloneElement } from 'react';
|
|
7
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
8
|
+
import '@react-fabric/utilities';
|
|
8
9
|
import classes from './Button.module.css';
|
|
9
10
|
import { jsx } from 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
|
-
import { isArray, EMPTY_ARRAY
|
|
6
|
+
import { isArray, EMPTY_ARRAY } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { useMemo, useCallback, cloneElement } from 'react';
|
|
9
9
|
import { useControlledValue } from '../../hooks/useControlledValue.js';
|
|
10
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
10
11
|
import classes from './Button.module.css';
|
|
11
12
|
import { jsx } from 'react/jsx-runtime';
|
|
12
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 { 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,18 +4,21 @@ 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
|
|
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
|
-
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
14
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
16
|
|
|
16
17
|
var _excluded = ["children", "minimal", "menuClassName", "onClick", "ref"];
|
|
17
18
|
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; }
|
|
18
19
|
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
|
+
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
21
|
+
|
|
19
22
|
var MenuComponent = function MenuComponent(_ref) {
|
|
20
23
|
var _refs$domReference$cu, _refs$domReference$cu2;
|
|
21
24
|
var children = _ref.children,
|
|
@@ -63,8 +66,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
63
66
|
})
|
|
64
67
|
});
|
|
65
68
|
var click = useClick(context, {
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
event: "mousedown",
|
|
70
|
+
toggle: !isNested,
|
|
71
|
+
ignoreMouse: isNested
|
|
68
72
|
});
|
|
69
73
|
var role = useRole(context, {
|
|
70
74
|
role: "menu"
|
|
@@ -5,7 +5,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import { useFloatingTree } from '@floating-ui/react';
|
|
6
6
|
import { iconToken, mergeRefs } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { useRef, useMemo, useCallback, Fragment } from 'react';
|
|
8
|
+
import { useRef, useMemo, useEffect, useCallback, Fragment } from 'react';
|
|
9
9
|
import { HotKey } from '../../hotkeys/HotKey.js';
|
|
10
10
|
import { HotKeyLabel } from '../../hotkeys/HotKeyLabel.js';
|
|
11
11
|
import '@babel/runtime/helpers/slicedToArray';
|
|
@@ -19,7 +19,7 @@ import '../../types/icons.js';
|
|
|
19
19
|
import '../../hotkeys/HotKeyWrapper.js';
|
|
20
20
|
import classes from './Menu.module.css';
|
|
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"],
|
|
22
|
+
var _excluded = ["as", "label", "color", "className", "icon", "iconBg", "iconColor", "appendLabel", "rtlFlip", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "tabIndex", "minimal", "data-open", "ref"],
|
|
23
23
|
_excluded2 = ["children"];
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
@@ -41,6 +41,8 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
41
41
|
_onClick = _ref.onClick,
|
|
42
42
|
badge = _ref.badge,
|
|
43
43
|
hotKey = _ref.hotKey,
|
|
44
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
45
|
+
tabIndex = _ref$tabIndex === void 0 ? -1 : _ref$tabIndex,
|
|
44
46
|
minimal = _ref.minimal,
|
|
45
47
|
childOpen = _ref["data-open"],
|
|
46
48
|
ref = _ref.ref,
|
|
@@ -50,6 +52,10 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
50
52
|
var badgeProps = useMemo(function () {
|
|
51
53
|
return getBadgeProps(badge);
|
|
52
54
|
}, [badge]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
var _elRef$current;
|
|
57
|
+
tabIndex === 0 && ((_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.focus());
|
|
58
|
+
}, [tabIndex]);
|
|
53
59
|
var iconEl = useMemo(function () {
|
|
54
60
|
var _path;
|
|
55
61
|
var path = icon;
|
|
@@ -109,6 +115,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
109
115
|
"data-open": childOpen,
|
|
110
116
|
disabled: disabled,
|
|
111
117
|
"data-id": id,
|
|
118
|
+
tabIndex: tabIndex,
|
|
112
119
|
onClick: function onClick(e) {
|
|
113
120
|
(_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
|
|
114
121
|
}
|
|
@@ -116,8 +123,8 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
116
123
|
children: [hotKey && /*#__PURE__*/jsx(HotKey, {
|
|
117
124
|
keyCombo: hotKey,
|
|
118
125
|
handler: function handler() {
|
|
119
|
-
var _elRef$
|
|
120
|
-
return (_elRef$
|
|
126
|
+
var _elRef$current2, _elRef$current2$click;
|
|
127
|
+
return (_elRef$current2 = elRef.current) === null || _elRef$current2 === void 0 || (_elRef$current2$click = _elRef$current2.click) === null || _elRef$current2$click === void 0 ? void 0 : _elRef$current2$click.call(_elRef$current2);
|
|
121
128
|
}
|
|
122
129
|
}), menuLabel]
|
|
123
130
|
}))
|
|
@@ -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
|
|
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';
|
|
@@ -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
|
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type PolymorphicProps } from "../../types";
|
|
3
3
|
import { type MenuItemProps } from "./types";
|
|
4
|
-
export declare const MenuItem: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ as, label, color, className, icon, iconBg, iconColor, appendLabel, rtlFlip, altIcon, id, active, disabled, onClick, badge, hotKey, minimal, "data-open": childOpen, ref, ...aria }: MenuItemProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const MenuItem: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ as, label, color, className, icon, iconBg, iconColor, appendLabel, rtlFlip, altIcon, id, active, disabled, onClick, badge, hotKey, tabIndex, minimal, "data-open": childOpen, ref, ...aria }: MenuItemProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export { HotKeyLabel } from "./hotkeys/HotKeyLabel";
|
|
|
18
18
|
export { HotKeyWrapper } from "./hotkeys/HotKeyWrapper";
|
|
19
19
|
export { type ModalProps } from "./types";
|
|
20
20
|
export { CoreIcons } from "./types/icons";
|
|
21
|
+
export { cloneChildren } from "./utils";
|
|
21
22
|
export { ApplicationProvider, useApplicationContext, useGlobals, useNotificationService, } from "./context/Global";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.25",
|
|
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.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.25",
|
|
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": "
|
|
59
|
+
"gitHead": "34640e2473c7823254e82aa7aed920c9c6f8f503"
|
|
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 {
|
|
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
|
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
useRole,
|
|
46
46
|
useTypeahead,
|
|
47
47
|
} from "@floating-ui/react";
|
|
48
|
-
import {
|
|
48
|
+
import { mergeRefs } from "@react-fabric/utilities";
|
|
49
49
|
import classNames from "classnames";
|
|
50
50
|
import {
|
|
51
51
|
cloneElement,
|
|
@@ -55,11 +55,11 @@ import {
|
|
|
55
55
|
useRef,
|
|
56
56
|
useState,
|
|
57
57
|
} from "react";
|
|
58
|
+
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
58
59
|
import { CoreIcons } from "../../types/icons";
|
|
59
|
-
import { nodeCheck } from "../../utils";
|
|
60
|
+
import { cloneChildren, nodeCheck } from "../../utils";
|
|
60
61
|
import { MenuItem } from "./MenuItem";
|
|
61
62
|
import { type MenuProps } from "./types";
|
|
62
|
-
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
63
63
|
|
|
64
64
|
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
65
65
|
|
|
@@ -104,8 +104,9 @@ const MenuComponent = ({
|
|
|
104
104
|
handleClose: safePolygon({ blockPointerEvents: true }),
|
|
105
105
|
});
|
|
106
106
|
const click = useClick(context, {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
event: "mousedown",
|
|
108
|
+
toggle: !isNested,
|
|
109
|
+
ignoreMouse: isNested,
|
|
109
110
|
});
|
|
110
111
|
const role = useRole(context, { role: "menu" });
|
|
111
112
|
const dismiss = useDismiss(context, { bubbles: true });
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
25
|
import { iconToken, mergeRefs } from "@react-fabric/utilities";
|
|
26
26
|
import classNames from "classnames";
|
|
27
|
-
import { Fragment, useCallback, useMemo, useRef } from "react";
|
|
27
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from "react";
|
|
28
28
|
import { HotKey } from "../../hotkeys/HotKey";
|
|
29
29
|
import { HotKeyLabel } from "../../hotkeys/HotKeyLabel";
|
|
30
30
|
import { Tooltip } from "../../overlays";
|
|
@@ -51,6 +51,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
51
51
|
onClick,
|
|
52
52
|
badge,
|
|
53
53
|
hotKey,
|
|
54
|
+
tabIndex = -1,
|
|
54
55
|
// @ts-expect-error ignore
|
|
55
56
|
minimal,
|
|
56
57
|
// @ts-expect-error ignore
|
|
@@ -65,6 +66,10 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
65
66
|
return getBadgeProps(badge);
|
|
66
67
|
}, [badge]);
|
|
67
68
|
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
tabIndex === 0 && elRef.current?.focus();
|
|
71
|
+
}, [tabIndex]);
|
|
72
|
+
|
|
68
73
|
const iconEl = useMemo(() => {
|
|
69
74
|
let path = icon;
|
|
70
75
|
if (minimal && !path) {
|
|
@@ -152,6 +157,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
152
157
|
data-open={childOpen}
|
|
153
158
|
disabled={disabled}
|
|
154
159
|
data-id={id}
|
|
160
|
+
tabIndex={tabIndex}
|
|
155
161
|
onClick={(e) => {
|
|
156
162
|
onClick?.(e) !== false && tree?.events.emit("click");
|
|
157
163
|
}}
|
package/src/index.ts
CHANGED
|
@@ -45,6 +45,8 @@ export { HotKeyWrapper } from "./hotkeys/HotKeyWrapper";
|
|
|
45
45
|
export { type ModalProps } from "./types";
|
|
46
46
|
export { CoreIcons } from "./types/icons";
|
|
47
47
|
|
|
48
|
+
export { cloneChildren } from "./utils";
|
|
49
|
+
|
|
48
50
|
export {
|
|
49
51
|
ApplicationProvider,
|
|
50
52
|
useApplicationContext,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { type ReactNode, Children, isValidElement } from "react";
|
|
25
|
+
import { Fragment } from "react/jsx-runtime";
|
|
26
|
+
|
|
27
|
+
export const cloneChildren = (
|
|
28
|
+
children: ReactNode,
|
|
29
|
+
callback: (child: ReactNode, index: number) => ReactNode,
|
|
30
|
+
): ReactNode => {
|
|
31
|
+
return Children.map(children, (c: ReactNode) => {
|
|
32
|
+
if (isValidElement(c)) {
|
|
33
|
+
if (c.type === Fragment) {
|
|
34
|
+
// just compare to `Fragment`
|
|
35
|
+
return cloneChildren(c.props?.children, callback);
|
|
36
|
+
}
|
|
37
|
+
return c;
|
|
38
|
+
}
|
|
39
|
+
return c;
|
|
40
|
+
})
|
|
41
|
+
?.flat()
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map(callback);
|
|
44
|
+
};
|