@laser-ui/components 0.5.0 → 0.6.0
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/CHANGELOG.md +6 -0
- package/menu/Menu.js +6 -1
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
# [0.6.0](https://github.com/laser-ui/laser-ui/compare/v0.5.0...v0.6.0) (2024-03-06)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **components:** menu init focus only pressing the tab key ([b72b64a](https://github.com/laser-ui/laser-ui/commit/b72b64a4c5d012065debba7903e40e3808c91764))
|
|
10
|
+
|
|
5
11
|
# [0.5.0](https://github.com/laser-ui/laser-ui/compare/v0.4.1...v0.5.0) (2024-01-31)
|
|
6
12
|
|
|
7
13
|
### Features
|
package/menu/Menu.js
CHANGED
|
@@ -19,6 +19,7 @@ function MenuFC(props, ref) {
|
|
|
19
19
|
const uniqueId = useId();
|
|
20
20
|
const getItemId = (id) => `${namespace}-menu-item-${id}-${uniqueId}`;
|
|
21
21
|
const dataRef = useRef({
|
|
22
|
+
mousedown: false,
|
|
22
23
|
updatePosition: new Map(),
|
|
23
24
|
});
|
|
24
25
|
const [focusVisible, focusVisibleWrapper] = useFocusVisible((code) => code.startsWith('Arrow') || ['Home', 'End', 'Enter', 'Space'].includes(code));
|
|
@@ -356,7 +357,10 @@ function MenuFC(props, ref) {
|
|
|
356
357
|
}), { ref: menuRef, tabIndex: (_a = restProps.tabIndex) !== null && _a !== void 0 ? _a : 0, role: "menubar", "aria-orientation": mode === 'horizontal' ? 'horizontal' : 'vertical', "aria-activedescendant": isUndefined(focusId) ? undefined : getItemId(focusId), onFocus: (e) => {
|
|
357
358
|
var _a;
|
|
358
359
|
(_a = restProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
359
|
-
|
|
360
|
+
if (!dataRef.current.mousedown) {
|
|
361
|
+
initFocus();
|
|
362
|
+
}
|
|
363
|
+
dataRef.current.mousedown = false;
|
|
360
364
|
}, onBlur: (e) => {
|
|
361
365
|
var _a;
|
|
362
366
|
(_a = restProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
@@ -375,6 +379,7 @@ function MenuFC(props, ref) {
|
|
|
375
379
|
}, onMouseDown: (e) => {
|
|
376
380
|
var _a;
|
|
377
381
|
(_a = restProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
382
|
+
dataRef.current.mousedown = true;
|
|
378
383
|
preventBlur(e);
|
|
379
384
|
}, onMouseUp: (e) => {
|
|
380
385
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laser-ui/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"module": "./index.js",
|
|
27
27
|
"types": "./index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@laser-ui/hooks": "0.
|
|
30
|
-
"@laser-ui/utils": "0.
|
|
29
|
+
"@laser-ui/hooks": "0.6.0",
|
|
30
|
+
"@laser-ui/utils": "0.6.0",
|
|
31
31
|
"@material-design-icons/svg": "^0.14.12",
|
|
32
32
|
"jss": "^10.10.0",
|
|
33
33
|
"jss-preset-default": "^10.10.0",
|
|
@@ -36,14 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"dayjs": "^1.11.0",
|
|
39
|
-
"immer": ">=2.0.0"
|
|
40
|
-
"react": "^18.0.0",
|
|
41
|
-
"react-dom": "^18.0.0",
|
|
42
|
-
"tslib": "^2.0.0"
|
|
39
|
+
"immer": ">=2.0.0"
|
|
43
40
|
},
|
|
44
41
|
"publishConfig": {
|
|
45
42
|
"access": "public",
|
|
46
43
|
"directory": "../../dist/libs/components"
|
|
47
44
|
},
|
|
48
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b131bc22712979a5de35f237d1b0ef2d490ae62e"
|
|
49
46
|
}
|