@hi-ui/hiui 4.10.0 → 4.10.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hi-ui/hiui
2
2
 
3
+ ## 4.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3070](https://github.com/XiaoMi/hiui/pull/3070) [`e3ce5be`](https://github.com/XiaoMi/hiui/commit/e3ce5be69208fa6fcd3ea9e1c8b7badb2744e055) Thanks [@zyprepare](https://github.com/zyprepare)! - chore(hiui): add portal-context package
8
+
3
9
  ## 4.10.0
4
10
 
5
11
  ### Minor Changes
package/lib/cjs/index.js CHANGED
@@ -41,6 +41,8 @@ var list = require('@hi-ui/list');
41
41
  var loading = require('@hi-ui/loading');
42
42
  var LocaleContext = require('./ui/locale-context/lib/esm/LocaleContext.js');
43
43
  var LocaleProvider = require('./ui/locale-context/lib/esm/LocaleProvider.js');
44
+ var PortalContext = require('./ui/portal-context/lib/esm/PortalContext.js');
45
+ var PortalProvider = require('./ui/portal-context/lib/esm/PortalProvider.js');
44
46
  var menu = require('@hi-ui/menu');
45
47
  var message = require('@hi-ui/message');
46
48
  var modal = require('@hi-ui/modal');
@@ -245,6 +247,9 @@ exports.getLanguage = LocaleContext.getLanguage;
245
247
  exports.useLocaleContext = LocaleContext.useLocaleContext;
246
248
  exports.LocaleContext = LocaleProvider.LocaleProvider;
247
249
  exports.LocaleProvider = LocaleProvider.LocaleProvider;
250
+ exports.usePortalContext = PortalContext.usePortalContext;
251
+ exports.PortalContext = PortalProvider.PortalProvider;
252
+ exports.PortalProvider = PortalProvider.PortalProvider;
248
253
  Object.defineProperty(exports, 'Menu', {
249
254
  enumerable: true,
250
255
  get: function get() {
@@ -0,0 +1,32 @@
1
+ /** @LICENSE
2
+ * @hi-ui/hiui
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+ var React = require('react');
16
+
17
+ /** @LICENSE
18
+ * @hi-ui/portal-context
19
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/container-context#readme
20
+ *
21
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+ var PortalContext = /*#__PURE__*/React.createContext(null);
27
+ var usePortalContext = function usePortalContext() {
28
+ var context = React.useContext(PortalContext);
29
+ return context;
30
+ };
31
+ exports.PortalContext = PortalContext;
32
+ exports.usePortalContext = usePortalContext;
@@ -0,0 +1,45 @@
1
+ /** @LICENSE
2
+ * @hi-ui/hiui
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var PortalContext = require('./PortalContext.js');
18
+ var index = require('../../../../utils/env/lib/esm/index.js');
19
+ function _interopDefaultCompat(e) {
20
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
21
+ 'default': e
22
+ };
23
+ }
24
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
25
+
26
+ /** @LICENSE
27
+ * @hi-ui/portal-context
28
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/container-context#readme
29
+ *
30
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */
35
+ var PortalProvider = function PortalProvider(_ref) {
36
+ var children = _ref.children,
37
+ portal = _ref.portal;
38
+ return /*#__PURE__*/React__default["default"].createElement(PortalContext.PortalContext.Provider, {
39
+ value: portal
40
+ }, children);
41
+ };
42
+ if (index.__DEV__) {
43
+ PortalProvider.displayName = 'PortalProvider';
44
+ }
45
+ exports.PortalProvider = PortalProvider;
package/lib/esm/index.js CHANGED
@@ -63,6 +63,8 @@ export * from '@hi-ui/loading';
63
63
  export { default as Loading } from '@hi-ui/loading';
64
64
  export { getLanguage, useLocaleContext } from './ui/locale-context/lib/esm/LocaleContext.js';
65
65
  export { LocaleProvider as LocaleContext, LocaleProvider } from './ui/locale-context/lib/esm/LocaleProvider.js';
66
+ export { usePortalContext } from './ui/portal-context/lib/esm/PortalContext.js';
67
+ export { PortalProvider as PortalContext, PortalProvider } from './ui/portal-context/lib/esm/PortalProvider.js';
66
68
  export * from '@hi-ui/menu';
67
69
  export { default as Menu } from '@hi-ui/menu';
68
70
  export * from '@hi-ui/message';
@@ -0,0 +1,26 @@
1
+ /** @LICENSE
2
+ * @hi-ui/hiui
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { useContext, createContext } from 'react';
11
+
12
+ /** @LICENSE
13
+ * @hi-ui/portal-context
14
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/container-context#readme
15
+ *
16
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ var PortalContext = /*#__PURE__*/createContext(null);
22
+ var usePortalContext = function usePortalContext() {
23
+ var context = useContext(PortalContext);
24
+ return context;
25
+ };
26
+ export { PortalContext, usePortalContext };
@@ -0,0 +1,33 @@
1
+ /** @LICENSE
2
+ * @hi-ui/hiui
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import React from 'react';
11
+ import { PortalContext } from './PortalContext.js';
12
+ import { __DEV__ } from '../../../../utils/env/lib/esm/index.js';
13
+
14
+ /** @LICENSE
15
+ * @hi-ui/portal-context
16
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/container-context#readme
17
+ *
18
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */
23
+ var PortalProvider = function PortalProvider(_ref) {
24
+ var children = _ref.children,
25
+ portal = _ref.portal;
26
+ return /*#__PURE__*/React.createElement(PortalContext.Provider, {
27
+ value: portal
28
+ }, children);
29
+ };
30
+ if (__DEV__) {
31
+ PortalProvider.displayName = 'PortalProvider';
32
+ }
33
+ export { PortalProvider };
@@ -60,6 +60,8 @@ export * from '@hi-ui/locale-context';
60
60
  * @deprecated Please use the `Provider` instead of it.
61
61
  */
62
62
  export { default as LocaleContext } from '@hi-ui/locale-context';
63
+ export * from '@hi-ui/portal-context';
64
+ export { default as PortalContext } from '@hi-ui/portal-context';
63
65
  export * from '@hi-ui/menu';
64
66
  export { default as Menu } from '@hi-ui/menu';
65
67
  export * from '@hi-ui/message';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/hiui",
3
- "version": "4.10.0",
3
+ "version": "4.10.1",
4
4
  "description": "The root-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",