@lemon-fe/components 0.0.3 → 0.0.7

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.
@@ -1,11 +1,9 @@
1
- @import '../theme.less';
2
-
3
1
  .@{prefixCls}-layout {
4
2
  position: relative;
5
3
  display: flex;
6
4
  flex-direction: column;
7
5
  min-height: 100%;
8
- background: #f5f5f5;
6
+ background: #f2f2f2;
9
7
 
10
8
  &-header {
11
9
  padding: (@space - 3) @space 0;
@@ -115,7 +115,7 @@ export default function Menu(props) {
115
115
  }, [location.pathname, menus]);
116
116
 
117
117
  var openMenu = function openMenu(item, elm) {
118
- if (item.children && item.children.length > 0) {
118
+ if (item.children !== undefined && item.children.length > 0 || collapsed) {
119
119
  setPopover(item);
120
120
  setTop(elm.offsetTop);
121
121
  setTimeout(function () {
@@ -128,17 +128,7 @@ export default function Menu(props) {
128
128
  }
129
129
  };
130
130
 
131
- var handleMouseEnter = useDebounce(openMenu, 200);
132
-
133
- var toggleMenu = function toggleMenu() {
134
- setCollapsed(function (prev) {
135
- return !prev;
136
- });
137
- };
138
-
139
131
  var closeMenu = function closeMenu() {
140
- handleMouseEnter.cancel();
141
-
142
132
  if (popup.current) {
143
133
  popup.current.classList.remove('animated');
144
134
 
@@ -153,6 +143,18 @@ export default function Menu(props) {
153
143
  }
154
144
  };
155
145
 
146
+ var toggle = useDebounce(function (handler) {
147
+ if (handler) {
148
+ handler();
149
+ }
150
+ }, 200);
151
+
152
+ var toggleCollapse = function toggleCollapse() {
153
+ setCollapsed(function (prev) {
154
+ return !prev;
155
+ });
156
+ };
157
+
156
158
  useEffect(function () {
157
159
  if (!visible) {
158
160
  return;
@@ -282,18 +284,21 @@ export default function Menu(props) {
282
284
  className: classNames("".concat(prefixCls, "-menu"), _defineProperty({}, "".concat(prefixCls, "-menu-collapsed"), collapsed))
283
285
  }, /*#__PURE__*/React.createElement("div", {
284
286
  className: "".concat(prefixCls, "-menu-bar"),
285
- onMouseLeave: closeMenu
286
- }, popover !== null && popover.children !== undefined && /*#__PURE__*/React.createElement("div", {
287
+ onMouseLeave: function onMouseLeave() {
288
+ return toggle(closeMenu);
289
+ }
290
+ }, popover !== null && /*#__PURE__*/React.createElement("div", {
287
291
  className: "".concat(prefixCls, "-menu-popup"),
288
292
  style: {
289
293
  top: top
290
294
  },
291
295
  ref: popup,
292
296
  onMouseEnter: function onMouseEnter() {
293
- return handleMouseEnter.cancel();
297
+ return toggle.cancel();
294
298
  }
295
- }, /*#__PURE__*/React.createElement("div", {
296
- className: "".concat(prefixCls, "-menu-popup-body")
299
+ }, popover.children !== undefined ? /*#__PURE__*/React.createElement("div", {
300
+ className: "".concat(prefixCls, "-menu-popup-body"),
301
+ key: "pop"
297
302
  }, popover.children.map(function (item, index) {
298
303
  return /*#__PURE__*/React.createElement("div", {
299
304
  className: "".concat(prefixCls, "-menu-block"),
@@ -301,9 +306,15 @@ export default function Menu(props) {
301
306
  }, /*#__PURE__*/React.createElement("div", {
302
307
  className: "".concat(prefixCls, "-menu-sub-item")
303
308
  }, item.name), item.children !== undefined && item.children.map(renderItem));
304
- }))), /*#__PURE__*/React.createElement("div", {
309
+ })) : /*#__PURE__*/React.createElement("div", {
310
+ className: "".concat(prefixCls, "-menu-popup-tip"),
311
+ key: "tip"
312
+ }, popover.name)), /*#__PURE__*/React.createElement("div", {
305
313
  className: "".concat(prefixCls, "-menu-collapse"),
306
- onClick: toggleMenu
314
+ onClick: toggleCollapse,
315
+ onMouseEnter: function onMouseEnter() {
316
+ return toggle(closeMenu);
317
+ }
307
318
  }, /*#__PURE__*/React.createElement("svg", {
308
319
  width: "20",
309
320
  height: "20",
@@ -339,12 +350,17 @@ export default function Menu(props) {
339
350
  return handleClick(item);
340
351
  },
341
352
  onMouseEnter: function onMouseEnter(e) {
342
- return handleMouseEnter(item, e.currentTarget);
353
+ var target = e.currentTarget;
354
+ toggle(function () {
355
+ return openMenu(item, target);
356
+ });
343
357
  }
344
- }, /*#__PURE__*/React.createElement("img", {
358
+ }, typeof item.icon === 'string' ? /*#__PURE__*/React.createElement("img", {
345
359
  className: "".concat(prefixCls, "-menu-icon"),
346
360
  src: item.icon
347
- }), /*#__PURE__*/React.createElement("div", {
361
+ }) : /*#__PURE__*/React.createElement("div", {
362
+ className: "".concat(prefixCls, "-menu-icon")
363
+ }, item.icon), /*#__PURE__*/React.createElement("div", {
348
364
  className: "".concat(prefixCls, "-menu-title")
349
365
  }, item.name));
350
366
  })), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -6,7 +6,7 @@
6
6
  flex: 0 0 200px;
7
7
  min-width: 0;
8
8
  height: 100%;
9
- padding: 16px 0;
9
+ padding: 8px 0;
10
10
  white-space: nowrap;
11
11
  transition: flex 0.1s;
12
12
 
@@ -45,11 +45,6 @@
45
45
  transform: rotate(0);
46
46
  }
47
47
 
48
- &-collapsed &-top-item {
49
- margin: 0;
50
- padding: 0 16px;
51
- }
52
-
53
48
  &-collapsed &-popup {
54
49
  left: 52px;
55
50
  }
@@ -59,8 +54,7 @@
59
54
  align-items: center;
60
55
  box-sizing: border-box;
61
56
  height: 44px;
62
- margin: 0 12px;
63
- padding: 0 4px;
57
+ padding: 0 16px;
64
58
  overflow: hidden;
65
59
  color: #333;
66
60
  font-size: 14px;
@@ -94,12 +88,8 @@
94
88
  width: 20px;
95
89
  height: 20px;
96
90
  margin-right: 8px;
91
+ color: rgba(108, 108, 108, 1);
97
92
  font-size: 16px;
98
- opacity: 0.7;
99
- }
100
-
101
- &-top-item-active &-icon {
102
- opacity: 1;
103
93
  }
104
94
 
105
95
  &-title {
@@ -108,6 +98,15 @@
108
98
  text-overflow: ellipsis;
109
99
  }
110
100
 
101
+ &-top-item:hover &-icon {
102
+ color: #333;
103
+ }
104
+
105
+ &-top-item&-top-item-active &-title,
106
+ &-top-item&-top-item-active &-icon {
107
+ color: .primary() [];
108
+ }
109
+
111
110
  &-popup {
112
111
  position: absolute;
113
112
  top: 0;
@@ -125,12 +124,27 @@
125
124
  border-radius: 10px;
126
125
  box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
127
126
  0 6px 16px -8px rgba(0, 0, 0, 0.08);
128
- transform: translate3d(-40px, 0, 0);
127
+ transform: translate3d(-20px, 0, 0);
128
+ opacity: 0;
129
+ transition: all 0.15s;
130
+ }
131
+
132
+ &-tip {
133
+ height: 36px;
134
+ margin: 4px 0 0 4px;
135
+ padding: 0 16px;
136
+ color: #fff;
137
+ line-height: 36px;
138
+ text-align: center;
139
+ background-color: .primary() [];
140
+ border-radius: 22px;
141
+ transform: translate3d(-10px, 0, 0);
129
142
  opacity: 0;
130
- transition: all 0.2s;
143
+ transition: all 0.15s;
131
144
  }
132
145
 
133
- &.animated &-body {
146
+ &.animated &-body,
147
+ &.animated &-tip {
134
148
  transform: translate3d(0, 0, 0);
135
149
  opacity: 1;
136
150
  }
@@ -161,6 +175,7 @@
161
175
  height: 40px;
162
176
  padding: 0 16px;
163
177
  color: rgba(51, 51, 51, 0.5);
178
+ font-weight: 500;
164
179
  font-size: 14px;
165
180
  line-height: 40px;
166
181
  }
@@ -227,11 +242,11 @@
227
242
  width: 107px;
228
243
  height: 36px;
229
244
  margin-left: 12px;
230
- color: rgba(5, 96, 253, 1);
245
+ color: .primary() [];
231
246
  font-size: 14px;
232
247
  text-align: center;
233
248
  background-color: #fff;
234
- border: 1px solid rgba(5, 96, 253, 1);
249
+ border: 1px solid .primary() [];
235
250
  border-radius: 4px;
236
251
  cursor: pointer;
237
252
  user-select: none;
@@ -255,7 +270,7 @@
255
270
  height: 100vh;
256
271
  background-color: #fff;
257
272
  box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
258
- 0px 6px 16px -8px rgba(0, 0, 0, 0.08);
273
+ 0 6px 16px -8px rgba(0, 0, 0, 0.08);
259
274
  transform: translate3d(60px, 0, 0);
260
275
  opacity: 0;
261
276
  transition: all 0.2s;
@@ -307,7 +322,7 @@
307
322
  .transition();
308
323
 
309
324
  &:hover {
310
- color: rgba(5, 96, 253, 1);
325
+ color: .primary() [];
311
326
  background-color: rgba(238, 238, 238, 1);
312
327
  }
313
328
  }
@@ -326,7 +341,7 @@
326
341
  .transition();
327
342
 
328
343
  &:hover {
329
- color: rgba(5, 96, 253, 1);
344
+ color: .primary() [];
330
345
  background-color: rgba(238, 238, 238, 1);
331
346
  }
332
347
  }
@@ -345,12 +360,12 @@
345
360
  cursor: pointer;
346
361
 
347
362
  &:hover {
348
- color: rgba(5, 96, 253, 1);
363
+ color: .primary() [];
349
364
  }
350
365
  }
351
366
  }
352
367
 
353
368
  &-active {
354
- color: rgba(5, 96, 253, 1);
369
+ color: .primary() [];
355
370
  }
356
371
  }
@@ -34,28 +34,22 @@ export default function TabBar(props) {
34
34
  return handleClose(e, index);
35
35
  }
36
36
  }, /*#__PURE__*/React.createElement("svg", {
37
- width: "10",
38
- height: "10",
39
- viewBox: "0 0 9 9",
37
+ width: "14",
38
+ height: "14",
40
39
  xmlns: "http://www.w3.org/2000/svg"
41
40
  }, /*#__PURE__*/React.createElement("g", {
42
- fill: "#000",
43
- fillRule: "evenodd",
44
- fillOpacity: ".25"
45
- }, /*#__PURE__*/React.createElement("rect", {
46
- transform: "rotate(45 4.559 4.559)",
47
- x: "3.976",
48
- y: ".059",
49
- width: "1",
50
- height: "9",
51
- rx: ".5"
52
- }), /*#__PURE__*/React.createElement("rect", {
53
- transform: "rotate(-45 4.559 4.441)",
54
- x: "3.976",
55
- y: "-.059",
56
- width: "1",
57
- height: "9",
58
- rx: ".5"
59
- }))))));
41
+ fill: "none",
42
+ fillRule: "evenodd"
43
+ }, /*#__PURE__*/React.createElement("g", {
44
+ fill: "currentColor"
45
+ }, /*#__PURE__*/React.createElement("g", {
46
+ fillRule: "nonzero"
47
+ }, /*#__PURE__*/React.createElement("path", {
48
+ d: "M7.74992318,2.75006802 L7.74992318,11.250068 C7.74992318,11.6642816 7.41413675,12.000068 6.99992318,12.000068 C6.58570962,12.000068 6.24992318,11.6642816 6.24992318,11.250068 L6.24992318,2.75006802 C6.24992318,2.33585446 6.58570962,2.00006802 6.99992318,2.00006802 C7.41413675,2.00006802 7.74992318,2.33585446 7.74992318,2.75006802 Z",
49
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999923, 7.000068) rotate(45.000000) translate(-6.999923, -7.000068)"
50
+ }), /*#__PURE__*/React.createElement("path", {
51
+ d: "M7.74994595,2.75007682 L7.74994595,11.2500768 C7.74994595,11.6642904 7.41415952,12.0000768 6.99994595,12.0000768 C6.58573239,12.0000768 6.24994595,11.6642904 6.24994595,11.2500768 L6.24994595,2.75007682 C6.24994595,2.33586325 6.58573239,2.00007682 6.99994595,2.00007682 C7.41415952,2.00007682 7.74994595,2.33586325 7.74994595,2.75007682 Z",
52
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999946, 7.000077) rotate(-45.000000) translate(-6.999946, -7.000077)"
53
+ }))))))));
60
54
  }));
61
55
  }
@@ -38,7 +38,7 @@
38
38
  box-sizing: content-box;
39
39
  min-width: 14px;
40
40
  max-width: 120px;
41
- height: 49px;
41
+ height: 43px;
42
42
  cursor: pointer;
43
43
 
44
44
  &::before {
@@ -72,7 +72,7 @@
72
72
  z-index: 4;
73
73
  display: flex;
74
74
  align-items: center;
75
- padding: 10px 10px 17px;
75
+ padding: 7px 12px 14px;
76
76
  background-color: #fff;
77
77
  border-radius: 10px;
78
78
  transition: background-color 0.2s;
@@ -128,12 +128,14 @@
128
128
  &-close {
129
129
  width: 14px;
130
130
  height: 14px;
131
+ color: #c4c4c4;
131
132
  line-height: 14px;
132
133
  text-align: center;
133
134
  border-radius: 50%;
134
135
 
135
136
  &:hover {
136
- background-color: rgba(0, 0, 0, 0.15);
137
+ color: #f2f2f2;
138
+ background-color: #c1c1c1;
137
139
  }
138
140
  }
139
141
  }
@@ -17,7 +17,7 @@
17
17
  align-items: center;
18
18
  box-sizing: border-box;
19
19
  width: 100vw;
20
- height: 56px;
20
+ height: 50px;
21
21
  padding: 0 16px;
22
22
  background: #ffff;
23
23
 
@@ -1,6 +1,8 @@
1
+ import type { ReactElement } from 'react';
2
+
1
3
  export type MenuItem = {
2
4
  name: string;
3
5
  path?: string;
4
- icon?: string;
6
+ icon?: string | ReactElement;
5
7
  children?: MenuItem[];
6
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -12,8 +12,11 @@
12
12
  "scripts": {
13
13
  "test": "echo \"Error: run tests from root\" && exit 1"
14
14
  },
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org"
17
+ },
15
18
  "dependencies": {
16
- "@lemon-fe/hooks": "^0.0.3",
19
+ "@lemon-fe/hooks": "^0.0.7",
17
20
  "antd": "^4.17.0",
18
21
  "classnames": "^2.2.6",
19
22
  "lodash": "^4.17.21",
@@ -36,5 +39,5 @@
36
39
  "@types/lodash": "^4.14.179",
37
40
  "@types/react-resizable": "^1.7.4"
38
41
  },
39
- "gitHead": "4793be25184347a233655cd67038427b79767c46"
42
+ "gitHead": "e09da7cb5fdd4e183429f5e0b23444790386f861"
40
43
  }