@lemon-fe/components 1.3.5 → 1.3.7-alpha.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.
@@ -14,5 +14,9 @@ declare namespace Portal {
14
14
  slot: string;
15
15
  render?: ((children: React.ReactNode) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) | undefined;
16
16
  }>;
17
+ var usePortal: (slot: string) => {
18
+ add: (node: React.ReactNode) => void;
19
+ remove: () => void;
20
+ };
17
21
  }
18
22
  export default Portal;
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { createContext, memo, useContext, useEffect, useMemo, useState, Fragment } from 'react';
11
+ import React, { createContext, memo, useContext, useEffect, useMemo, useState, Fragment, useCallback } from 'react';
12
12
  import { uniqueId } from 'lodash';
13
13
  var Slot = /*#__PURE__*/memo(function Content(props) {
14
14
  var children = props.children;
@@ -152,6 +152,28 @@ function Portal(props) {
152
152
  }, [slot, children]);
153
153
  return null;
154
154
  }
155
+ function usePortal(slot) {
156
+ var portal = useContext(Context);
157
+ var id = useMemo(function () {
158
+ return uniqueId('slot');
159
+ }, []);
160
+ useEffect(function () {
161
+ return function () {
162
+ portal.delete(slot, id);
163
+ };
164
+ }, [slot]);
165
+ var add = useCallback(function (node) {
166
+ portal.set(slot, id, node);
167
+ }, [slot]);
168
+ var remove = useCallback(function () {
169
+ portal.delete(slot, id);
170
+ }, [slot]);
171
+ return {
172
+ add: add,
173
+ remove: remove
174
+ };
175
+ }
155
176
  Portal.Host = PortalHost;
156
177
  Portal.Slot = PortalSlot;
178
+ Portal.usePortal = usePortal;
157
179
  export default Portal;
@@ -8,22 +8,42 @@ html {
8
8
  --lemon-primary-color: 35, 87, 223;
9
9
  }
10
10
 
11
- .@{prefixCls}-thin-scroll-bar {
12
- ::-webkit-scrollbar {
13
- width: 8px;
14
- height: 8px;
15
- }
11
+ * {
12
+ scrollbar-width: thin;
13
+ }
14
+
15
+ &::-webkit-scrollbar {
16
+ width: 8px;
17
+ height: 8px;
18
+ }
19
+
20
+ &::-webkit-scrollbar-track {
21
+ background-color: transparent;
22
+ }
16
23
 
17
- ::-webkit-scrollbar-track {
18
- background-color: transparent;
24
+ &::-webkit-scrollbar-thumb {
25
+ background-color: rgba(0, 0, 0, 0.3);
26
+ border-radius: 4px;
27
+
28
+ &:hover {
29
+ background-color: rgba(0, 0, 0, 0.5);
19
30
  }
31
+ }
32
+
33
+ ::-webkit-scrollbar {
34
+ width: 8px;
35
+ height: 8px;
36
+ }
37
+
38
+ ::-webkit-scrollbar-track {
39
+ background-color: transparent;
40
+ }
20
41
 
21
- ::-webkit-scrollbar-thumb {
22
- background-color: rgba(0, 0, 0, 0.3);
23
- border-radius: 4px;
42
+ ::-webkit-scrollbar-thumb {
43
+ background-color: rgba(0, 0, 0, 0.3);
44
+ border-radius: 4px;
24
45
 
25
- &:hover {
26
- background-color: rgba(0, 0, 0, 0.5);
27
- }
46
+ &:hover {
47
+ background-color: rgba(0, 0, 0, 0.5);
28
48
  }
29
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.3.5",
3
+ "version": "1.3.7-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "a8f1bfed49912fd902159ef408b19299880951c2"
61
+ "gitHead": "d028d80cfa4608351b34c1804ee709c659b86889"
62
62
  }