@blocklet/list 0.8.24 → 0.8.27
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 +61 -53
- package/lib/components/aside.js +24 -19
- package/lib/components/custom-select/button.js +13 -8
- package/lib/components/custom-select/custom-select.js +70 -54
- package/lib/components/filter/custom-chip.js +16 -8
- package/lib/components/filter/group.js +19 -15
- package/lib/components/filter/icon.js +39 -36
- package/lib/components/list/empty.js +39 -28
- package/lib/components/list/list.js +64 -44
- package/lib/components/search.js +21 -15
- package/lib/contexts/filter.js +7 -8
- package/lib/index.js +11 -3
- package/package.json +9 -5
- package/src/base.js +2 -3
- package/src/components/aside.js +2 -3
- package/src/components/custom-select/button.js +1 -1
- package/src/components/custom-select/custom-select.js +6 -5
- package/src/components/filter/custom-chip.js +2 -3
- package/src/components/filter/group.js +0 -1
- package/src/components/filter/icon.js +1 -1
- package/src/components/list/empty.js +6 -7
- package/src/components/list/list.js +0 -1
- package/src/components/search.js +3 -3
- package/src/contexts/filter.js +1 -1
- package/src/index.js +0 -2
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
exports.EmptyTitle = EmptyTitle;
|
|
7
|
+
exports.NoResults = NoResults;
|
|
8
|
+
exports.NoResultsTips = NoResultsTips;
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -15,23 +15,24 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
|
15
15
|
|
|
16
16
|
var _filter = require("../../contexts/filter");
|
|
17
17
|
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
function NoResults() {
|
|
21
23
|
const {
|
|
22
24
|
t
|
|
23
25
|
} = (0, _filter.useFilterContext)();
|
|
24
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
25
27
|
style: {
|
|
26
28
|
textAlign: 'center'
|
|
27
29
|
},
|
|
28
|
-
variant: "subtitle2"
|
|
29
|
-
|
|
30
|
-
};
|
|
30
|
+
variant: "subtitle2",
|
|
31
|
+
children: t('blocklet.noResults')
|
|
32
|
+
});
|
|
33
|
+
}
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const NoResultsTips = _ref => {
|
|
35
|
+
function NoResultsTips(_ref) {
|
|
35
36
|
let {
|
|
36
37
|
filterTip,
|
|
37
38
|
keywordTip
|
|
@@ -46,16 +47,21 @@ const NoResultsTips = _ref => {
|
|
|
46
47
|
return ' , ';
|
|
47
48
|
};
|
|
48
49
|
|
|
49
|
-
return /*#__PURE__*/
|
|
50
|
-
className: "tips"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
51
|
+
className: "tips",
|
|
52
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
53
|
+
style: {
|
|
54
|
+
marginRight: '16px'
|
|
55
|
+
},
|
|
56
|
+
children: t('blocklet.emptyTip')
|
|
57
|
+
}), filterTip && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
58
|
+
children: t('blocklet.filterTip')
|
|
59
|
+
}), filterTip && keywordTip && getSplit(), keywordTip && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
60
|
+
children: t('blocklet.keywordTip')
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
57
64
|
|
|
58
|
-
exports.NoResultsTips = NoResultsTips;
|
|
59
65
|
NoResultsTips.propTypes = {
|
|
60
66
|
filterTip: _propTypes.default.bool,
|
|
61
67
|
keywordTip: _propTypes.default.bool
|
|
@@ -65,20 +71,25 @@ NoResultsTips.defaultProps = {
|
|
|
65
71
|
keywordTip: false
|
|
66
72
|
};
|
|
67
73
|
|
|
68
|
-
|
|
74
|
+
function EmptyTitle(_ref2) {
|
|
69
75
|
let {
|
|
70
76
|
primaryStart,
|
|
71
77
|
primaryEnd,
|
|
72
78
|
filter
|
|
73
79
|
} = _ref2;
|
|
74
|
-
return /*#__PURE__*/
|
|
75
|
-
variant: "subtitle2"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
81
|
+
variant: "subtitle2",
|
|
82
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
83
|
+
children: primaryStart
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
85
|
+
className: "primary",
|
|
86
|
+
children: [" ", filter, " "]
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
88
|
+
children: [primaryEnd, " "]
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
80
92
|
|
|
81
|
-
exports.EmptyTitle = EmptyTitle;
|
|
82
93
|
EmptyTitle.propTypes = {
|
|
83
94
|
primaryStart: _propTypes.default.string.isRequired,
|
|
84
95
|
primaryEnd: _propTypes.default.string.isRequired,
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = BlockletList;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
9
|
|
|
12
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
@@ -27,10 +25,18 @@ var _filter = require("../../contexts/filter");
|
|
|
27
25
|
|
|
28
26
|
var _utils = require("../../libs/utils");
|
|
29
27
|
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
30
|
const _excluded = ["blocklets"];
|
|
31
31
|
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
|
|
38
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
+
|
|
34
40
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
41
|
|
|
36
42
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -54,70 +60,84 @@ function BlockletList(_ref) {
|
|
|
54
60
|
const showFilterTip = !!selectedCategory || !!filters.price;
|
|
55
61
|
|
|
56
62
|
if (errors.fetchBlockletsError) {
|
|
57
|
-
return /*#__PURE__*/
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
58
64
|
type: "error",
|
|
59
|
-
variant: "icon"
|
|
60
|
-
|
|
65
|
+
variant: "icon",
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
67
|
+
children: (0, _utils.formatError)(errors.fetchBlockletsError)
|
|
68
|
+
})
|
|
69
|
+
});
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
if (loadings.fetchBlockletsLoading) {
|
|
64
|
-
return /*#__PURE__*/
|
|
73
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
65
74
|
display: "flex",
|
|
66
75
|
alignItems: "center",
|
|
67
|
-
justifyContent: "center"
|
|
68
|
-
|
|
76
|
+
justifyContent: "center",
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {})
|
|
78
|
+
});
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
if (filters.keyword && showFilterTip && blockletList.length === 0) {
|
|
72
|
-
return /*#__PURE__*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CustomEmpty, {
|
|
83
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.EmptyTitle, {
|
|
84
|
+
primaryStart: t('blocklet.noBlockletPart1'),
|
|
85
|
+
primaryEnd: t('blocklet.noBlockletPart2'),
|
|
86
|
+
filter: filters.keyword
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.NoResultsTips, {
|
|
88
|
+
keywordTip: true,
|
|
89
|
+
filterTip: true
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
if (filters.keyword && blockletList.length === 0) {
|
|
83
|
-
return /*#__PURE__*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CustomEmpty, {
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.EmptyTitle, {
|
|
97
|
+
primaryStart: t('blocklet.noBlockletPart1'),
|
|
98
|
+
primaryEnd: t('blocklet.noBlockletPart2'),
|
|
99
|
+
filter: filters.keyword
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.NoResultsTips, {
|
|
101
|
+
keywordTip: true
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
if (showFilterTip && blockletList.length === 0) {
|
|
93
107
|
const categoryLocale = getCategoryLocale(selectedCategory);
|
|
94
|
-
return /*#__PURE__*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CustomEmpty, {
|
|
109
|
+
children: [categoryLocale ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.EmptyTitle, {
|
|
110
|
+
primaryStart: t('blocklet.noCategoryResults1'),
|
|
111
|
+
primaryEnd: t('blocklet.noCategoryResults2'),
|
|
112
|
+
filter: categoryLocale
|
|
113
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.NoResults, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.NoResultsTips, {
|
|
114
|
+
filterTip: true
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
if (blockletList.length === 0) {
|
|
104
|
-
return /*#__PURE__*/
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomEmpty, {
|
|
121
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.NoResults, {})
|
|
122
|
+
});
|
|
105
123
|
}
|
|
106
124
|
|
|
107
|
-
return /*#__PURE__*/
|
|
125
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, _objectSpread(_objectSpread({
|
|
108
126
|
container: true
|
|
109
|
-
}, rest),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
}, rest), {}, {
|
|
128
|
+
children: blocklets.map(blocklet => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledGrid, {
|
|
129
|
+
item: true,
|
|
130
|
+
lg: 4,
|
|
131
|
+
md: 6,
|
|
132
|
+
sm: 6,
|
|
133
|
+
xs: 12,
|
|
134
|
+
"data-blocklet-did": blocklet.did,
|
|
135
|
+
children: blockletRender({
|
|
136
|
+
blocklet,
|
|
137
|
+
blocklets: blockletList
|
|
138
|
+
})
|
|
139
|
+
}, blocklet.did))
|
|
140
|
+
}));
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
BlockletList.propTypes = {
|
package/lib/components/search.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -21,19 +21,23 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _filter = require("../contexts/filter");
|
|
23
23
|
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
24
26
|
const _excluded = ["placeholder"];
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
|
-
function
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
33
|
|
|
30
|
-
function
|
|
34
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
35
|
|
|
32
36
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
33
37
|
|
|
34
38
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
function Search(_ref) {
|
|
37
41
|
let {
|
|
38
42
|
placeholder
|
|
39
43
|
} = _ref,
|
|
@@ -64,26 +68,28 @@ const Search = _ref => {
|
|
|
64
68
|
(0, _react.useEffect)(() => {
|
|
65
69
|
setSearchStr(filters.keyword || '');
|
|
66
70
|
}, [filters.keyword]);
|
|
67
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSearch, _objectSpread({
|
|
68
72
|
inputProps: {
|
|
69
73
|
'data-cy': 'search-blocklet'
|
|
70
74
|
},
|
|
71
|
-
startAdornment: /*#__PURE__*/
|
|
72
|
-
position: "start"
|
|
73
|
-
|
|
75
|
+
startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
|
|
76
|
+
position: "start",
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSearchIcon, {})
|
|
78
|
+
}),
|
|
74
79
|
onChange: handleChange,
|
|
75
80
|
placeholder: placeholder,
|
|
76
81
|
value: searchStr,
|
|
77
82
|
title: placeholder,
|
|
78
83
|
"data-cy": "search",
|
|
79
|
-
endAdornment: searchStr && /*#__PURE__*/
|
|
80
|
-
position: "end"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
endAdornment: searchStr && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
|
|
85
|
+
position: "end",
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCloseIcon, {
|
|
87
|
+
"data-cy": "search-delete",
|
|
88
|
+
onClick: handleClose
|
|
89
|
+
})
|
|
90
|
+
})
|
|
85
91
|
}, rest));
|
|
86
|
-
}
|
|
92
|
+
}
|
|
87
93
|
|
|
88
94
|
Search.propTypes = {
|
|
89
95
|
placeholder: _propTypes.default.string
|
package/lib/contexts/filter.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.FilterConsumer = void 0;
|
|
|
7
7
|
exports.FilterProvider = FilterProvider;
|
|
8
8
|
exports.useFilterContext = useFilterContext;
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
10
|
+
var _react = require("react");
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
@@ -23,11 +23,9 @@ var _locale = _interopRequireDefault(require("../assets/locale"));
|
|
|
23
23
|
|
|
24
24
|
var _propTypes2 = require("../libs/prop-types");
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
27
|
|
|
30
|
-
function
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
29
|
|
|
32
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
31
|
|
|
@@ -248,9 +246,10 @@ function FilterProvider(_ref) {
|
|
|
248
246
|
fetchBlocklets();
|
|
249
247
|
fetchCategories();
|
|
250
248
|
}, [endpoint]);
|
|
251
|
-
return /*#__PURE__*/
|
|
252
|
-
value: filterStore
|
|
253
|
-
|
|
249
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
250
|
+
value: filterStore,
|
|
251
|
+
children: children
|
|
252
|
+
});
|
|
254
253
|
}
|
|
255
254
|
|
|
256
255
|
FilterProvider.propTypes = _objectSpread(_objectSpread({}, _propTypes2.propTypes), {}, {
|
package/lib/index.js
CHANGED
|
@@ -5,18 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = BlockletList;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _base = _interopRequireDefault(require("./base"));
|
|
11
9
|
|
|
12
10
|
var _filter = require("./contexts/filter");
|
|
13
11
|
|
|
14
12
|
var _propTypes = require("./libs/prop-types");
|
|
15
13
|
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
18
24
|
function BlockletList(props) {
|
|
19
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_filter.FilterProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.default, {})
|
|
27
|
+
}));
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
BlockletList.propTypes = _propTypes.propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.27",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"url": "git@github.com:blocklet/blocklet-store.git"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"lint": "eslint src",
|
|
24
|
+
"lint": "eslint src stories --ext=js,jsx,ts,tsx,mjs",
|
|
25
|
+
"lint:fix": "npm run lint -- --fix",
|
|
25
26
|
"build": "rm -rf lib && babel src --out-dir lib --copy-files",
|
|
26
27
|
"watch": "babel src --out-dir lib -w --copy-files",
|
|
27
28
|
"precommit": "CI=1 yarn test",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"react": ">=18.1.0"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@arcblock/ux": "^2.1.
|
|
41
|
+
"@arcblock/ux": "^2.1.10",
|
|
41
42
|
"@emotion/react": "^11.9.0",
|
|
42
43
|
"@emotion/styled": "^11.8.1",
|
|
43
44
|
"@mui/icons-material": "^5.6.2",
|
|
@@ -50,13 +51,16 @@
|
|
|
50
51
|
"url-join": "^4.0.1"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
54
|
+
"@arcblock/eslint-config": "0.2.1",
|
|
53
55
|
"@babel/cli": "^7.8.4",
|
|
54
56
|
"@babel/core": "^7.8.4",
|
|
55
57
|
"@babel/preset-env": "^7.8.4",
|
|
56
58
|
"@babel/preset-react": "^7.8.3",
|
|
57
59
|
"@emotion/babel-plugin": "^11.9.2",
|
|
58
60
|
"babel-plugin-inline-react-svg": "^2.0.1",
|
|
59
|
-
"babel-plugin-styled-components": "^1.10.7"
|
|
61
|
+
"babel-plugin-styled-components": "^1.10.7",
|
|
62
|
+
"eslint": "^8.16.0",
|
|
63
|
+
"prettier": "^2.6.2"
|
|
60
64
|
},
|
|
61
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "af6bdbc88dd0cd533d63dbe00dbc26e0d04d0ff6"
|
|
62
66
|
}
|
package/src/base.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import SortIcon from '@mui/icons-material/Sort';
|
|
4
3
|
import { Box, Hidden } from '@mui/material';
|
|
@@ -12,7 +11,7 @@ import BlockletList from './components/list';
|
|
|
12
11
|
import Aside from './components/aside';
|
|
13
12
|
import Search from './components/search';
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
function ListBase() {
|
|
16
15
|
const {
|
|
17
16
|
handleDeveloper,
|
|
18
17
|
blockletList,
|
|
@@ -81,7 +80,7 @@ const ListBase = () => {
|
|
|
81
80
|
</StyledMin>
|
|
82
81
|
</Box>
|
|
83
82
|
);
|
|
84
|
-
}
|
|
83
|
+
}
|
|
85
84
|
|
|
86
85
|
const StyledMin = styled.main`
|
|
87
86
|
flex: 1;
|
package/src/components/aside.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
|
|
4
3
|
import { useFilterContext } from '../contexts/filter';
|
|
5
4
|
import { FilterGroup } from './filter';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
function Aside() {
|
|
8
7
|
const { selectedCategory, handleCategory, t, handlePrice, filters, categoryOptions, priceOptions } =
|
|
9
8
|
useFilterContext();
|
|
10
9
|
|
|
@@ -23,7 +22,7 @@ const Aside = () => {
|
|
|
23
22
|
</div>
|
|
24
23
|
</StyledAside>
|
|
25
24
|
);
|
|
26
|
-
}
|
|
25
|
+
}
|
|
27
26
|
|
|
28
27
|
const StyledAside = styled.aside`
|
|
29
28
|
width: 220px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-unused-expressions */
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import useTheme from '@mui/styles/useTheme';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
@@ -12,7 +12,7 @@ import isEqual from 'lodash/isEqual';
|
|
|
12
12
|
|
|
13
13
|
import Button from './button';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function CustomSelect({
|
|
16
16
|
title,
|
|
17
17
|
value,
|
|
18
18
|
icon,
|
|
@@ -25,11 +25,12 @@ const CustomSelect = ({
|
|
|
25
25
|
onInput,
|
|
26
26
|
itemRender,
|
|
27
27
|
...buttonProps
|
|
28
|
-
})
|
|
28
|
+
}) {
|
|
29
29
|
const anchorRef = useRef(null);
|
|
30
30
|
const theme = useTheme();
|
|
31
31
|
const [open, setOpen] = useState(false);
|
|
32
|
-
|
|
32
|
+
// eslint-disable-next-line no-nested-ternary
|
|
33
|
+
const [currentValue, setCurrentValue] = useState(value !== null ? value : multiple ? [] : '');
|
|
33
34
|
const isSm = useMediaQuery(theme.breakpoints.down('sm'));
|
|
34
35
|
|
|
35
36
|
useEffect(() => {
|
|
@@ -126,7 +127,7 @@ const CustomSelect = ({
|
|
|
126
127
|
</Popper>
|
|
127
128
|
</>
|
|
128
129
|
);
|
|
129
|
-
}
|
|
130
|
+
}
|
|
130
131
|
|
|
131
132
|
CustomSelect.propTypes = {
|
|
132
133
|
options: PropTypes.array.isRequired,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { Chip } from '@mui/material';
|
|
@@ -12,14 +11,14 @@ const StyleDiv = styled.div`
|
|
|
12
11
|
padding: 4px 0;
|
|
13
12
|
}
|
|
14
13
|
`;
|
|
15
|
-
|
|
14
|
+
function FilterChip({ label, icon, onDelete, ...containerProps }) {
|
|
16
15
|
if (!label) return null;
|
|
17
16
|
return (
|
|
18
17
|
<StyleDiv {...containerProps}>
|
|
19
18
|
<Chip icon={icon} label={label} onDelete={onDelete} />
|
|
20
19
|
</StyleDiv>
|
|
21
20
|
);
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
FilterChip.propTypes = {
|
|
24
23
|
label: PropTypes.string,
|
|
25
24
|
onDelete: PropTypes.func,
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import Box from '@mui/material/Box';
|
|
4
3
|
import Typography from '@mui/material/Typography';
|
|
5
4
|
|
|
6
5
|
import { useFilterContext } from '../../contexts/filter';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
function NoResults() {
|
|
9
8
|
const { t } = useFilterContext();
|
|
10
9
|
return (
|
|
11
10
|
<Typography style={{ textAlign: 'center' }} variant="subtitle2">
|
|
12
11
|
{t('blocklet.noResults')}
|
|
13
12
|
</Typography>
|
|
14
13
|
);
|
|
15
|
-
}
|
|
16
|
-
|
|
14
|
+
}
|
|
15
|
+
function NoResultsTips({ filterTip, keywordTip }) {
|
|
17
16
|
const { t, locale } = useFilterContext();
|
|
18
17
|
|
|
19
18
|
const getSplit = () => {
|
|
@@ -28,7 +27,7 @@ const NoResultsTips = ({ filterTip, keywordTip }) => {
|
|
|
28
27
|
{keywordTip && <span>{t('blocklet.keywordTip')}</span>}
|
|
29
28
|
</Box>
|
|
30
29
|
);
|
|
31
|
-
}
|
|
30
|
+
}
|
|
32
31
|
NoResultsTips.propTypes = {
|
|
33
32
|
filterTip: PropTypes.bool,
|
|
34
33
|
keywordTip: PropTypes.bool,
|
|
@@ -38,7 +37,7 @@ NoResultsTips.defaultProps = {
|
|
|
38
37
|
filterTip: false,
|
|
39
38
|
keywordTip: false,
|
|
40
39
|
};
|
|
41
|
-
|
|
40
|
+
function EmptyTitle({ primaryStart, primaryEnd, filter }) {
|
|
42
41
|
return (
|
|
43
42
|
<Typography variant="subtitle2">
|
|
44
43
|
<span>{primaryStart}</span>
|
|
@@ -46,7 +45,7 @@ const EmptyTitle = ({ primaryStart, primaryEnd, filter }) => {
|
|
|
46
45
|
<span>{primaryEnd} </span>
|
|
47
46
|
</Typography>
|
|
48
47
|
);
|
|
49
|
-
}
|
|
48
|
+
}
|
|
50
49
|
EmptyTitle.propTypes = {
|
|
51
50
|
primaryStart: PropTypes.string.isRequired,
|
|
52
51
|
primaryEnd: PropTypes.string.isRequired,
|