@react-fabric/core 1.0.0-beta.24 → 1.0.0-beta.26
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/dropdown/DropdownTool.js +1 -1
- package/dist/cjs/components/menu/Menu.js +3 -2
- package/dist/cjs/components/menu/MenuItem.js +10 -3
- package/dist/cjs/core/responsive/Responsive.js +1 -1
- package/dist/esm/components/dropdown/DropdownTool.js +1 -1
- package/dist/esm/components/menu/Menu.js +3 -2
- package/dist/esm/components/menu/MenuItem.js +11 -4
- package/dist/esm/core/responsive/Responsive.js +1 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/dropdown/DropdownTool.tsx +1 -1
- package/src/components/menu/Menu.tsx +3 -2
- package/src/components/menu/MenuItem.tsx +7 -1
- package/src/core/responsive/Responsive.tsx +2 -1
- package/src/core/theme/ThemeProvider.tsx +1 -1
package/css/reset/_reset.css
CHANGED
|
@@ -20,7 +20,7 @@ var DropdownTool = function DropdownTool(_ref) {
|
|
|
20
20
|
return /*#__PURE__*/jsxRuntime.jsxs(Dropdown.Dropdown, _objectSpread(_objectSpread({}, props), {}, {
|
|
21
21
|
children: [/*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
22
22
|
icon: icon !== null && icon !== void 0 ? icon : icons.CoreIcons.caretDown,
|
|
23
|
-
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover:inline-block data-[dropdown-open]:inline-block")
|
|
23
|
+
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover/tool:inline-block data-[dropdown-open]:inline-block")
|
|
24
24
|
}), children]
|
|
25
25
|
}));
|
|
26
26
|
};
|
|
@@ -66,8 +66,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
66
66
|
})
|
|
67
67
|
});
|
|
68
68
|
var click = react.useClick(context, {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
event: "mousedown",
|
|
70
|
+
toggle: !isNested,
|
|
71
|
+
ignoreMouse: isNested
|
|
71
72
|
});
|
|
72
73
|
var role = react.useRole(context, {
|
|
73
74
|
role: "menu"
|
|
@@ -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
|
}))
|
|
@@ -53,7 +53,7 @@ var Col = function Col(_ref3) {
|
|
|
53
53
|
stretchContent = _ref3.stretchContent,
|
|
54
54
|
aria = _objectWithoutProperties(_ref3, _excluded3);
|
|
55
55
|
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
56
|
-
className: classNames(Responsive_module.col, className, stretchContent && Responsive_module.stretchContent, flex === "
|
|
56
|
+
className: classNames(Responsive_module.col, className, stretchContent && Responsive_module.stretchContent, flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-initial", flex === "content" && "flex-content", align && "self-".concat(align))
|
|
57
57
|
}, aria), {}, {
|
|
58
58
|
children: children
|
|
59
59
|
}));
|
|
@@ -20,7 +20,7 @@ var DropdownTool = function DropdownTool(_ref) {
|
|
|
20
20
|
return /*#__PURE__*/jsxs(Dropdown, _objectSpread(_objectSpread({}, props), {}, {
|
|
21
21
|
children: [/*#__PURE__*/jsx(Icon, {
|
|
22
22
|
icon: icon !== null && icon !== void 0 ? icon : CoreIcons.caretDown,
|
|
23
|
-
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover:inline-block data-[dropdown-open]:inline-block")
|
|
23
|
+
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover/tool:inline-block data-[dropdown-open]:inline-block")
|
|
24
24
|
}), children]
|
|
25
25
|
}));
|
|
26
26
|
};
|
|
@@ -66,8 +66,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
66
66
|
})
|
|
67
67
|
});
|
|
68
68
|
var click = useClick(context, {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
event: "mousedown",
|
|
70
|
+
toggle: !isNested,
|
|
71
|
+
ignoreMouse: isNested
|
|
71
72
|
});
|
|
72
73
|
var role = useRole(context, {
|
|
73
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
|
}))
|
|
@@ -53,7 +53,7 @@ var Col = function Col(_ref3) {
|
|
|
53
53
|
stretchContent = _ref3.stretchContent,
|
|
54
54
|
aria = _objectWithoutProperties(_ref3, _excluded3);
|
|
55
55
|
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
56
|
-
className: classNames(classes.col, className, stretchContent && classes.stretchContent, flex === "
|
|
56
|
+
className: classNames(classes.col, className, stretchContent && classes.stretchContent, flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-initial", flex === "content" && "flex-content", align && "self-".concat(align))
|
|
57
57
|
}, aria), {}, {
|
|
58
58
|
children: children
|
|
59
59
|
}));
|
|
@@ -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/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.26",
|
|
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.26",
|
|
40
40
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.7",
|
|
42
42
|
"@tailwindcss/typography": "^0.5.13",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"i18next": "^23.15.1",
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
51
|
+
"react": "^19.0.0",
|
|
52
|
+
"react-dom": "^19.0.0",
|
|
53
53
|
"react-i18next": "^15.0.2"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=18.12.0",
|
|
57
57
|
"npm": ">=8.19.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "452f821dc8b22c5765b3858cc53ad9d7e2f9bcf1"
|
|
60
60
|
}
|
|
@@ -50,7 +50,7 @@ export const DropdownTool = ({
|
|
|
50
50
|
className,
|
|
51
51
|
"outline bg-base flex-content pointer-events-auto cursor-pointer",
|
|
52
52
|
groupHover &&
|
|
53
|
-
"hidden group-hover:inline-block data-[dropdown-open]:inline-block",
|
|
53
|
+
"hidden group-hover/tool:inline-block data-[dropdown-open]:inline-block",
|
|
54
54
|
)}
|
|
55
55
|
/>
|
|
56
56
|
{children}
|
|
@@ -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
|
}}
|
|
@@ -159,9 +159,10 @@ export const Col = ({
|
|
|
159
159
|
classes.col,
|
|
160
160
|
className,
|
|
161
161
|
stretchContent && classes.stretchContent,
|
|
162
|
-
flex === "auto" && "flex-content",
|
|
163
162
|
flex === "fill" && "flex-1",
|
|
164
163
|
flex === "full" && "flex-full",
|
|
164
|
+
flex === "auto" && "flex-initial",
|
|
165
|
+
flex === "content" && "flex-content",
|
|
165
166
|
align && `self-${align}`,
|
|
166
167
|
)}
|
|
167
168
|
{...aria}
|