@blocklet/list 0.9.8 → 0.9.9
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/base.js +1 -3
- package/lib/components/autocomplete/index.js +6 -7
- package/lib/index.js +2 -2
- package/package.json +2 -2
- package/src/base.js +3 -5
- package/src/components/autocomplete/index.js +6 -7
- package/src/index.js +5 -5
package/lib/base.js
CHANGED
|
@@ -128,9 +128,7 @@ function ListBase() {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const StyledMin = _styled.default.main(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n .filter-bar {\n justify-content: space-between;\n margin-bottom: ", ";\n }\n .sort-button {\n white-space: nowrap;\n }\n .search-container {\n flex: 2;\n margin-left: 0px;\n }\n\n .filter-container {\n flex: 1;\n display: flex;\n justify-content: flex-end;\n }\n @media (max-width: ", "px) {\n .search-container {\n width: 100%;\n margin-bottom: ", ";\n }\n .filter-container {\n margin-left: 0;\n display: flex;\n justify-content: flex-start;\n }\n .filter-bar {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n }\n @media (max-width: ", "px) {\n .sort-button {\n font-size: 12px;\n }\n }\n"])), props =>
|
|
132
|
-
return props.theme.spacing(2);
|
|
133
|
-
}, props => props.theme.breakpoints.values.md, props => props.theme.spacing(2), props => props.theme.breakpoints.values.md);
|
|
131
|
+
const StyledMin = _styled.default.main(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n .filter-bar {\n justify-content: space-between;\n margin-bottom: ", ";\n }\n .sort-button {\n white-space: nowrap;\n }\n .bl-search-container {\n flex: 2;\n margin-left: 0px;\n }\n\n .filter-container {\n flex: 1;\n display: flex;\n justify-content: flex-end;\n }\n @media (max-width: ", "px) {\n .bl-search-container {\n width: 100%;\n margin-bottom: ", ";\n }\n .filter-container {\n margin-left: 0;\n display: flex;\n justify-content: flex-start;\n }\n .filter-bar {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n }\n @media (max-width: ", "px) {\n .sort-button {\n font-size: 12px;\n }\n }\n"])), props => props.theme.spacing(2), props => props.theme.breakpoints.values.md, props => props.theme.spacing(2), props => props.theme.breakpoints.values.md);
|
|
134
132
|
|
|
135
133
|
const FilterContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: sticky;\n top: 0;\n z-index: 9;\n background-color: white;\n"])));
|
|
136
134
|
|
|
@@ -23,8 +23,6 @@ var _filter = require("../../contexts/filter");
|
|
|
23
23
|
|
|
24
24
|
var _item = _interopRequireDefault(require("./item"));
|
|
25
25
|
|
|
26
|
-
require("@algolia/autocomplete-theme-classic");
|
|
27
|
-
|
|
28
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
27
|
|
|
30
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -109,9 +107,10 @@ function Autocomplete() {
|
|
|
109
107
|
},
|
|
110
108
|
|
|
111
109
|
classNames: {
|
|
112
|
-
panel: '
|
|
113
|
-
label: '
|
|
114
|
-
form: '
|
|
110
|
+
panel: 'bl-autocomplete-panel',
|
|
111
|
+
label: 'bl-autocomplete-label',
|
|
112
|
+
form: 'bl-autocomplete-form',
|
|
113
|
+
input: 'bl-autocomplete-input'
|
|
115
114
|
},
|
|
116
115
|
placeholder: t('common.searchStore'),
|
|
117
116
|
initialState: {
|
|
@@ -180,7 +179,7 @@ function Autocomplete() {
|
|
|
180
179
|
},
|
|
181
180
|
|
|
182
181
|
noResults() {
|
|
183
|
-
return '
|
|
182
|
+
return t('blocklet.noResults');
|
|
184
183
|
}
|
|
185
184
|
|
|
186
185
|
}
|
|
@@ -193,7 +192,7 @@ function Autocomplete() {
|
|
|
193
192
|
};
|
|
194
193
|
}, [endpoint, filters, getResults, muiTheme, onReset, onSubmit, t]);
|
|
195
194
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
196
|
-
className: "search-container",
|
|
195
|
+
className: "bl-search-container",
|
|
197
196
|
ref: containerRef
|
|
198
197
|
});
|
|
199
198
|
}
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _propTypes = require("./libs/prop-types");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("./libs/utils");
|
|
19
19
|
|
|
20
|
-
require("@algolia/autocomplete-theme-classic");
|
|
20
|
+
require("@algolia/autocomplete-theme-classic/dist/theme.css");
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
|
|
@@ -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 .
|
|
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: none !important;\n &:focus-within {\n box-shadow: none !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.9",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"eslint": "^8.21.0",
|
|
69
69
|
"prettier": "^2.7.1"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "bb89ecfc4767e5799d59141d633d5955666fd8bf"
|
|
72
72
|
}
|
package/src/base.js
CHANGED
|
@@ -96,14 +96,12 @@ const StyledMin = styled.main`
|
|
|
96
96
|
height: 100%;
|
|
97
97
|
.filter-bar {
|
|
98
98
|
justify-content: space-between;
|
|
99
|
-
margin-bottom: ${(props) =>
|
|
100
|
-
return props.theme.spacing(2);
|
|
101
|
-
}};
|
|
99
|
+
margin-bottom: ${(props) => props.theme.spacing(2)};
|
|
102
100
|
}
|
|
103
101
|
.sort-button {
|
|
104
102
|
white-space: nowrap;
|
|
105
103
|
}
|
|
106
|
-
.search-container {
|
|
104
|
+
.bl-search-container {
|
|
107
105
|
flex: 2;
|
|
108
106
|
margin-left: 0px;
|
|
109
107
|
}
|
|
@@ -114,7 +112,7 @@ const StyledMin = styled.main`
|
|
|
114
112
|
justify-content: flex-end;
|
|
115
113
|
}
|
|
116
114
|
@media (max-width: ${(props) => props.theme.breakpoints.values.md}px) {
|
|
117
|
-
.search-container {
|
|
115
|
+
.bl-search-container {
|
|
118
116
|
width: 100%;
|
|
119
117
|
margin-bottom: ${(props) => props.theme.spacing(2)};
|
|
120
118
|
}
|
|
@@ -10,8 +10,6 @@ import constant from '../../libs/constant';
|
|
|
10
10
|
import { useFilterContext } from '../../contexts/filter';
|
|
11
11
|
import Blocklet from './item';
|
|
12
12
|
|
|
13
|
-
import '@algolia/autocomplete-theme-classic';
|
|
14
|
-
|
|
15
13
|
const cachePool = new Map();
|
|
16
14
|
|
|
17
15
|
export default function Autocomplete() {
|
|
@@ -74,9 +72,10 @@ export default function Autocomplete() {
|
|
|
74
72
|
panelRootRef.current.render(children);
|
|
75
73
|
},
|
|
76
74
|
classNames: {
|
|
77
|
-
panel: '
|
|
78
|
-
label: '
|
|
79
|
-
form: '
|
|
75
|
+
panel: 'bl-autocomplete-panel',
|
|
76
|
+
label: 'bl-autocomplete-label',
|
|
77
|
+
form: 'bl-autocomplete-form',
|
|
78
|
+
input: 'bl-autocomplete-input',
|
|
80
79
|
},
|
|
81
80
|
placeholder: t('common.searchStore'),
|
|
82
81
|
initialState: {
|
|
@@ -127,7 +126,7 @@ export default function Autocomplete() {
|
|
|
127
126
|
);
|
|
128
127
|
},
|
|
129
128
|
noResults() {
|
|
130
|
-
return '
|
|
129
|
+
return t('blocklet.noResults');
|
|
131
130
|
},
|
|
132
131
|
},
|
|
133
132
|
},
|
|
@@ -140,5 +139,5 @@ export default function Autocomplete() {
|
|
|
140
139
|
};
|
|
141
140
|
}, [endpoint, filters, getResults, muiTheme, onReset, onSubmit, t]);
|
|
142
141
|
|
|
143
|
-
return <div className="search-container" ref={containerRef} />;
|
|
142
|
+
return <div className="bl-search-container" ref={containerRef} />;
|
|
144
143
|
}
|
package/src/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import SelectBase from './base';
|
|
|
4
4
|
import { FilterProvider } from './contexts/filter';
|
|
5
5
|
import { propTypes, defaultProps } from './libs/prop-types';
|
|
6
6
|
import { toColorRgb } from './libs/utils';
|
|
7
|
-
|
|
8
|
-
import '@algolia/autocomplete-theme-classic';
|
|
7
|
+
// 不知道为什么引入 theme.min.css 话,blocklet-store 打包就会报错
|
|
8
|
+
import '@algolia/autocomplete-theme-classic/dist/theme.css';
|
|
9
9
|
|
|
10
10
|
export default function BlockletList(props) {
|
|
11
11
|
const muiTheme = useTheme();
|
|
@@ -21,15 +21,15 @@ export default function BlockletList(props) {
|
|
|
21
21
|
--aa-primary-color-rgb: ${primaryColor.r}, ${primaryColor.g}, ${primaryColor.b} !important;
|
|
22
22
|
--aa-input-background-color-rgb: 250, 250, 250 !important;
|
|
23
23
|
}
|
|
24
|
-
.
|
|
24
|
+
.bl-autocomplete-panel {
|
|
25
25
|
z-index: ${theme.zIndex.modal + 1} !important;
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.bl-autocomplete-label {
|
|
28
28
|
.aa-SubmitIcon {
|
|
29
29
|
color: ${theme.palette.grey[500]} !important;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
.
|
|
32
|
+
.bl-autocomplete-form {
|
|
33
33
|
border: none !important;
|
|
34
34
|
&:focus-within {
|
|
35
35
|
box-shadow: none !important;
|