@blocklet/list 0.9.25 → 0.9.28
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/lib/components/autocomplete/index.js +18 -0
- package/lib/index.js +1 -1
- package/package.json +3 -2
- package/src/base.js +1 -0
- package/src/components/autocomplete/index.js +17 -0
- package/src/index.js +2 -1
|
@@ -13,6 +13,8 @@ var _client = require("react-dom/client");
|
|
|
13
13
|
|
|
14
14
|
var _autocompleteJs = require("@algolia/autocomplete-js");
|
|
15
15
|
|
|
16
|
+
var _reactHotkeysHook = require("react-hotkeys-hook");
|
|
17
|
+
|
|
16
18
|
var _react2 = require("@emotion/react");
|
|
17
19
|
|
|
18
20
|
var _styles = require("@mui/material/styles");
|
|
@@ -66,6 +68,22 @@ function Autocomplete(_ref) {
|
|
|
66
68
|
const onReset = (0, _react.useCallback)(() => {
|
|
67
69
|
handleKeyword();
|
|
68
70
|
}, [handleKeyword]);
|
|
71
|
+
(0, _reactHotkeysHook.useHotkeys)('/, ctrl + k, command + k', e => {
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
|
|
75
|
+
if (containerRef.current) {
|
|
76
|
+
const input = containerRef.current.querySelector('input.bl-autocomplete-input');
|
|
77
|
+
|
|
78
|
+
if (input) {
|
|
79
|
+
input.focus();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return false;
|
|
84
|
+
}, {
|
|
85
|
+
enableOnTags: ['INPUT']
|
|
86
|
+
});
|
|
69
87
|
(0, _react.useEffect)(() => {
|
|
70
88
|
if (!containerRef.current) {
|
|
71
89
|
return undefined;
|
package/lib/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function BlockletList(props) {
|
|
|
37
37
|
const muiTheme = (0, _styles.useTheme)();
|
|
38
38
|
const primaryColor = (0, _utils.toColorRgb)(muiTheme.palette.primary.main);
|
|
39
39
|
const globalStyles = {
|
|
40
|
-
autocomplete: theme => (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root {\n --aa-detached-media-query: (max-width: ", "px) !important;\n --aa-detached-modal-media-query: (min-width: ", "px) !important;\n --aa-detached-modal-max-width: ", "px !important;\n --aa-selected-color-rgb: ", ", ", ", ", " !important;\n --aa-primary-color-rgb: ", ", ", ", ", " !important;\n --aa-input-background-color-rgb: 250, 250, 250 !important;\n }\n .bl-autocomplete-panel {\n z-index: ", " !important;\n }\n .bl-autocomplete-label {\n .aa-SubmitIcon {\n color: ", " !important;\n }\n }\n .bl-autocomplete-form {\n border:
|
|
40
|
+
autocomplete: theme => (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root {\n --aa-detached-media-query: (max-width: ", "px) !important;\n --aa-detached-modal-media-query: (min-width: ", "px) !important;\n --aa-detached-modal-max-width: ", "px !important;\n --aa-selected-color-rgb: ", ", ", ", ", " !important;\n --aa-primary-color-rgb: ", ", ", ", ", " !important;\n --aa-input-background-color-rgb: 250, 250, 250 !important;\n }\n .bl-autocomplete-panel {\n z-index: ", " !important;\n }\n .bl-autocomplete-label {\n .aa-SubmitIcon {\n color: ", " !important;\n }\n }\n .bl-autocomplete-form {\n border: 1px solid #fff !important;\n &:focus-within {\n box-shadow: none !important;\n border: 1px solid rgba(0, 0, 0, 0.12) !important;\n }\n }\n .aa-DetachedSearchButton {\n border: none !important;\n &:focus-within {\n box-shadow: none !important;\n }\n .aa-SubmitIcon {\n color: ", " !important;\n }\n }\n "])), theme.breakpoints.values.md, theme.breakpoints.values.md, theme.breakpoints.values.md, primaryColor.r, primaryColor.g, primaryColor.b, primaryColor.r, primaryColor.g, primaryColor.b, theme.zIndex.modal + 1, theme.palette.grey[500], theme.palette.grey[500])
|
|
41
41
|
};
|
|
42
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_filter.FilterProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
43
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Global, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"prop-types": "^15.8.1",
|
|
56
56
|
"react-error-boundary": "^3.1.4",
|
|
57
|
+
"react-hotkeys-hook": "^3.4.7",
|
|
57
58
|
"react-infinite-scroll-hook": "^4.0.3",
|
|
58
59
|
"url-join": "^4.0.1"
|
|
59
60
|
},
|
|
@@ -68,5 +69,5 @@
|
|
|
68
69
|
"eslint": "^8.22.0",
|
|
69
70
|
"prettier": "^2.7.1"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "bddbed0128ffa0254182d41a14e640c764884fb0"
|
|
72
73
|
}
|
package/src/base.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Box, Hidden } from '@mui/material';
|
|
|
4
4
|
import FaceIcon from '@mui/icons-material/Face';
|
|
5
5
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
6
|
import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
|
|
7
|
+
|
|
7
8
|
import { useFilterContext } from './contexts/filter';
|
|
8
9
|
import CustomSelect from './components/custom-select';
|
|
9
10
|
import { CustomChip, FilterIcon } from './components/filter';
|
|
@@ -2,6 +2,7 @@ import { createElement, Fragment, useEffect, useRef, useCallback } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { autocomplete } from '@algolia/autocomplete-js';
|
|
5
|
+
import { useHotkeys } from 'react-hotkeys-hook';
|
|
5
6
|
|
|
6
7
|
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
|
7
8
|
import { ThemeProvider as MuiThemeProvider, useTheme } from '@mui/material/styles';
|
|
@@ -38,6 +39,22 @@ export default function Autocomplete({ onSelect }) {
|
|
|
38
39
|
handleKeyword();
|
|
39
40
|
}, [handleKeyword]);
|
|
40
41
|
|
|
42
|
+
useHotkeys(
|
|
43
|
+
'/, ctrl + k, command + k',
|
|
44
|
+
(e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
if (containerRef.current) {
|
|
48
|
+
const input = containerRef.current.querySelector('input.bl-autocomplete-input');
|
|
49
|
+
if (input) {
|
|
50
|
+
input.focus();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
},
|
|
55
|
+
{ enableOnTags: ['INPUT'] }
|
|
56
|
+
);
|
|
57
|
+
|
|
41
58
|
useEffect(() => {
|
|
42
59
|
if (!containerRef.current) {
|
|
43
60
|
return undefined;
|
package/src/index.js
CHANGED
|
@@ -30,9 +30,10 @@ export default function BlockletList(props) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
.bl-autocomplete-form {
|
|
33
|
-
border:
|
|
33
|
+
border: 1px solid #fff !important;
|
|
34
34
|
&:focus-within {
|
|
35
35
|
box-shadow: none !important;
|
|
36
|
+
border: 1px solid rgba(0, 0, 0, 0.12) !important;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
.aa-DetachedSearchButton {
|