@hi-ui/layout 4.0.0 → 5.0.0-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.
Files changed (83) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/lib/cjs/AppList.js +163 -0
  3. package/lib/cjs/CollapseIcon.js +56 -0
  4. package/lib/cjs/Content.js +1 -4
  5. package/lib/cjs/FloatMenuContainer.js +93 -0
  6. package/lib/cjs/Footer.js +45 -0
  7. package/lib/cjs/Header.js +45 -0
  8. package/lib/cjs/Layout.js +4 -2
  9. package/lib/cjs/Profile.js +165 -0
  10. package/lib/cjs/SearchTrigger.js +71 -8
  11. package/lib/cjs/Sider.js +32 -18
  12. package/lib/cjs/index.js +26 -3
  13. package/lib/cjs/packages/hooks/use-id/lib/esm/index.js +51 -0
  14. package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +16 -0
  15. package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +33 -0
  16. package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +41 -0
  17. package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +33 -0
  18. package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +19 -0
  19. package/lib/cjs/packages/hooks/use-latest/lib/esm/index.js +56 -0
  20. package/lib/cjs/packages/hooks/use-timeout/lib/esm/index.js +50 -0
  21. package/lib/cjs/packages/hooks/use-toggle/lib/esm/index.js +71 -0
  22. package/lib/cjs/packages/hooks/use-unmount-effect/lib/esm/index.js +44 -0
  23. package/lib/cjs/packages/icons/lib/esm/components/alert/check-outlined.js +65 -0
  24. package/lib/cjs/packages/icons/lib/esm/components/direction/right-outlined.js +65 -0
  25. package/lib/cjs/packages/ui/popover/lib/esm/Popover.js +111 -0
  26. package/lib/cjs/packages/ui/popover/lib/esm/index.js +31 -0
  27. package/lib/cjs/packages/ui/popover/lib/esm/styles/index.scss.js +35 -0
  28. package/lib/cjs/packages/ui/popover/lib/esm/types.js +31 -0
  29. package/lib/cjs/packages/ui/popover/lib/esm/use-popover.js +187 -0
  30. package/lib/cjs/packages/ui/popover/lib/esm/utils/container/lib/esm/index.js +67 -0
  31. package/lib/cjs/packages/ui/popover/lib/esm/with-api.js +84 -0
  32. package/lib/cjs/packages/utils/array-utils/lib/esm/index.js +33 -0
  33. package/lib/cjs/packages/utils/dom-utils/lib/esm/index.js +47 -0
  34. package/lib/cjs/packages/utils/react-utils/lib/esm/index.js +72 -0
  35. package/lib/cjs/packages/utils/type-assertion/lib/esm/index.js +36 -0
  36. package/lib/cjs/styles/index.scss.js +1 -1
  37. package/lib/esm/AppList.js +149 -0
  38. package/lib/esm/CollapseIcon.js +44 -0
  39. package/lib/esm/Content.js +1 -4
  40. package/lib/esm/FloatMenuContainer.js +81 -0
  41. package/lib/esm/Footer.js +33 -0
  42. package/lib/esm/Header.js +33 -0
  43. package/lib/esm/Layout.js +4 -2
  44. package/lib/esm/Profile.js +152 -0
  45. package/lib/esm/SearchTrigger.js +70 -8
  46. package/lib/esm/Sider.js +32 -18
  47. package/lib/esm/index.js +22 -4
  48. package/lib/esm/packages/hooks/use-id/lib/esm/index.js +45 -0
  49. package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +11 -0
  50. package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +27 -0
  51. package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +36 -0
  52. package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +28 -0
  53. package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +14 -0
  54. package/lib/esm/packages/hooks/use-latest/lib/esm/index.js +50 -0
  55. package/lib/esm/packages/hooks/use-timeout/lib/esm/index.js +45 -0
  56. package/lib/esm/packages/hooks/use-toggle/lib/esm/index.js +66 -0
  57. package/lib/esm/packages/hooks/use-unmount-effect/lib/esm/index.js +39 -0
  58. package/lib/esm/packages/icons/lib/esm/components/alert/check-outlined.js +53 -0
  59. package/lib/esm/packages/icons/lib/esm/components/direction/right-outlined.js +53 -0
  60. package/lib/esm/packages/ui/popover/lib/esm/Popover.js +97 -0
  61. package/lib/esm/packages/ui/popover/lib/esm/index.js +25 -0
  62. package/lib/esm/packages/ui/popover/lib/esm/styles/index.scss.js +23 -0
  63. package/lib/esm/packages/ui/popover/lib/esm/types.js +25 -0
  64. package/lib/esm/packages/ui/popover/lib/esm/use-popover.js +175 -0
  65. package/lib/esm/packages/ui/popover/lib/esm/utils/container/lib/esm/index.js +60 -0
  66. package/lib/esm/packages/ui/popover/lib/esm/with-api.js +79 -0
  67. package/lib/esm/packages/utils/array-utils/lib/esm/index.js +28 -0
  68. package/lib/esm/packages/utils/dom-utils/lib/esm/index.js +42 -0
  69. package/lib/esm/packages/utils/react-utils/lib/esm/index.js +65 -0
  70. package/lib/esm/packages/utils/type-assertion/lib/esm/index.js +29 -0
  71. package/lib/esm/styles/index.scss.js +1 -1
  72. package/lib/types/AppList.d.ts +71 -0
  73. package/lib/types/CollapseIcon.d.ts +1 -0
  74. package/lib/types/Content.d.ts +0 -3
  75. package/lib/types/FloatMenuContainer.d.ts +28 -0
  76. package/lib/types/Footer.d.ts +5 -0
  77. package/lib/types/Header.d.ts +5 -0
  78. package/lib/types/Layout.d.ts +4 -0
  79. package/lib/types/Profile.d.ts +24 -0
  80. package/lib/types/SearchTrigger.d.ts +11 -0
  81. package/lib/types/Sider.d.ts +21 -0
  82. package/lib/types/index.d.ts +17 -1
  83. package/package.json +9 -7
@@ -0,0 +1,79 @@
1
+ /** @LICENSE
2
+ * @hi-ui/layout
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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 { __rest } from 'tslib';
11
+ import { createElement, createRef } from 'react';
12
+ import { unmountComponentAtNode, render } from 'react-dom';
13
+ import { getContainer, removeContainer } from './utils/container/lib/esm/index.js';
14
+ import { uuid } from '../../../../hooks/use-id/lib/esm/index.js';
15
+ import { Popover, prefix } from './Popover.js';
16
+
17
+ /** @LICENSE
18
+ * @hi-ui/popover
19
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/popover#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 prefixCls = prefix;
27
+ var selector = "." + prefixCls + "-wrapper";
28
+ var popoverInstanceCache = {};
29
+ var open = function open(target, _a) {
30
+ var key = _a.key,
31
+ disabledPortal = _a.disabledPortal,
32
+ rest = __rest(_a, ["key", "disabledPortal"]);
33
+ if (!key) {
34
+ key = uuid();
35
+ }
36
+ var selectId = selector + "__" + key;
37
+ var container = getContainer(selectId, undefined, disabledPortal ? target.parentNode : undefined);
38
+ var popoverRef = /*#__PURE__*/createRef();
39
+ var ClonedPopover = /*#__PURE__*/createElement(Popover, Object.assign({
40
+ innerRef: popoverRef,
41
+ container: container,
42
+ attachEl: target,
43
+ closeOnOutsideClick: false,
44
+ shouldWrapChildren: true,
45
+ onExited: function onExited() {
46
+ // 卸载
47
+ if (container) {
48
+ unmountComponentAtNode(container);
49
+ removeContainer(selectId);
50
+ }
51
+ container = undefined;
52
+ }
53
+ }, rest));
54
+ requestAnimationFrame(function () {
55
+ render(ClonedPopover, container);
56
+ popoverRef.current.open();
57
+ });
58
+ var close = function close() {
59
+ var _a;
60
+ (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
61
+ };
62
+ if (key) {
63
+ popoverInstanceCache[key] = close;
64
+ }
65
+ return key;
66
+ };
67
+ var close = function close(key) {
68
+ if (typeof popoverInstanceCache[key] === 'function') {
69
+ popoverInstanceCache[key]();
70
+ }
71
+ delete popoverInstanceCache[key];
72
+ };
73
+ function withPopover(instance) {
74
+ return Object.assign(instance, {
75
+ open: open,
76
+ close: close
77
+ });
78
+ }
79
+ export { withPopover };
@@ -0,0 +1,28 @@
1
+ /** @LICENSE
2
+ * @hi-ui/layout
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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 { isNullish, isArray } from '../../../type-assertion/lib/esm/index.js';
11
+
12
+ /** @LICENSE
13
+ * @hi-ui/array-utils
14
+ * https://github.com/XiaoMi/hiui/tree/master/packages/utils/array-utils#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
+ /**
22
+ * 抹平结构为数组
23
+ */
24
+ var normalizeArray = function normalizeArray(arg) {
25
+ if (isNullish(arg)) return [];
26
+ return isArray(arg) ? arg : [arg];
27
+ };
28
+ export { normalizeArray };
@@ -0,0 +1,42 @@
1
+ /** @LICENSE
2
+ * @hi-ui/layout
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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 '@hi-ui/env';
11
+
12
+ /** @LICENSE
13
+ * @hi-ui/dom-utils
14
+ * https://github.com/XiaoMi/hiui/tree/master/packages/utils/dom-utils#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
+ /**
22
+ * 模拟事件默认事件处理机制,以此执行传入的事件处理器
23
+ *
24
+ * @param handlers
25
+ * @returns
26
+ * @ref https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
27
+ */
28
+ function mockDefaultHandlers() {
29
+ for (var _len = arguments.length, handlers = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ handlers[_key] = arguments[_key];
31
+ }
32
+ return function mockedDefaultHandler(event) {
33
+ handlers.some(function (handler) {
34
+ if (handler) {
35
+ // handler 执行中,可以阻止默认行为,即将 `defaultPrevented` 置为 `true`
36
+ handler(event);
37
+ }
38
+ return event.defaultPrevented;
39
+ });
40
+ };
41
+ }
42
+ export { mockDefaultHandlers };
@@ -0,0 +1,65 @@
1
+ /** @LICENSE
2
+ * @hi-ui/layout
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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';
11
+ import '@babel/runtime/helpers/esm/typeof';
12
+ import '@hi-ui/env';
13
+
14
+ /** @LICENSE
15
+ * @hi-ui/react-utils
16
+ * https://github.com/XiaoMi/hiui/tree/master/packages/utils/react-utils#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
+ /**
24
+ * Merge defaultProps into props
25
+ */
26
+ var withDefaultProps = function withDefaultProps(props, defaultProps) {
27
+ if (!defaultProps) return props || {};
28
+ var mergedProps = Object.assign({}, props);
29
+ var propName;
30
+ for (propName in defaultProps) {
31
+ if (mergedProps[propName] === undefined) {
32
+ // @ts-ignore
33
+ mergedProps[propName] = defaultProps[propName];
34
+ }
35
+ }
36
+ return mergedProps;
37
+ };
38
+ /**
39
+ * Set ref into a React element.
40
+ */
41
+ function setRef(ref, value) {
42
+ if (typeof ref === 'function') {
43
+ ref(value);
44
+ } else if (ref) {
45
+ ref.current = value;
46
+ }
47
+ }
48
+ /**
49
+ * Merges multiple refs into a single function ref.
50
+ */
51
+ var mergeRefs = function mergeRefs() {
52
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
53
+ refs[_key] = arguments[_key];
54
+ }
55
+ // Empty check
56
+ if (refs.some(function (ref) {
57
+ return ref;
58
+ }) === false) return null;
59
+ return function (value) {
60
+ refs.forEach(function (ref) {
61
+ setRef(ref, value);
62
+ });
63
+ };
64
+ };
65
+ export { mergeRefs, setRef, withDefaultProps };
@@ -0,0 +1,29 @@
1
+ /** @LICENSE
2
+ * @hi-ui/layout
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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 '@babel/runtime/helpers/esm/typeof';
11
+
12
+ /**
13
+ * Assert is Nullish
14
+ */
15
+ var isNullish = function isNullish(arg) {
16
+ return arg === null || arg === undefined;
17
+ };
18
+ /**
19
+ * Assert is an array
20
+ */
21
+ var isArray = Array.isArray;
22
+ var toString = Object.prototype.toString;
23
+ /**
24
+ * Assert is string
25
+ */
26
+ var isString = function isString(arg) {
27
+ return toString.call(arg) === '[object String]';
28
+ };
29
+ export { isArray, isNullish, isString };
@@ -8,6 +8,6 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import __styleInject__ from '@hi-ui/style-inject';
11
- var css_248z = ".hi-v5-layout {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;min-width: 0;min-height: 0;}.hi-v5-sider {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: relative;width: auto;height: 100%;overflow: auto;}.hi-v5-sider--collapsed {-webkit-transition: width 0.4s;transition: width 0.4s;}.hi-v5-sider__resizable-handler {position: absolute;z-index: 9;top: 0;right: 0;width: 2px;height: 100%;border-left: 2px solid transparent;border-right: 2px solid transparent;cursor: col-resize;background-color: #2b64ff;background-clip: content-box;opacity: 0;-webkit-transition: opacity 0.2s;transition: opacity 0.2s;}.hi-v5-sider__resizable-handler:hover {opacity: 1;}.hi-v5-sider .hi-v5-scrollbar__wrapper {width: auto;}.hi-v5-sider .hi-v5-menu {width: auto;height: auto;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner {margin-bottom: var(--hi-v5-spacing-4, 8px) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner:not(.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active):hover {background-color: rgba(124, 135, 166, 0.15);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active {background-color: #fff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__icon {color: #7c87a6;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__arrow {color: #60636b;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-submenu .hi-v5-menu-item__inner {margin-bottom: 0 !important;}.hi-v5-menu-popmenu {width: 160px !important;}.hi-v5-content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: 0 16px;overflow: auto;}.hi-v5-search-trigger {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;height: 32px;margin: 0 8px 12px;font-size: 16px;color: var(--hi-v5-color-gray-500, #91959e);background-color: rgba(113, 126, 163, 0.1);cursor: pointer;border-radius: 9999px;}.hi-v5-search-trigger:not(.hi-v5-search-trigger--mini) {padding: 0 12px;}.hi-v5-search-trigger--mini {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;width: 32px;margin-left: auto;margin-right: auto;}.hi-v5-search-trigger__placeholder {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}";
11
+ var css_248z = ".hi-v5-layout {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;min-width: 0;min-height: 0;}.hi-v5-layout--direction-row {-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;}.hi-v5-layout--direction-column {-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;}.hi-v5-header {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 0;-ms-flex: 0 0 auto;flex: 0 0 auto;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-sider {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: relative;width: auto;height: 100%;overflow: hidden;-webkit-box-shadow: 1px 0 0 0 var(--hi-v5-color-gray-200, #e6e8eb);box-shadow: 1px 0 0 0 var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-sider--collapsed {-webkit-transition: width 0.4s;transition: width 0.4s;}.hi-v5-sider__resizable-handler {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;z-index: 9;top: 0;right: -2px;width: 2px;height: 100%;border-left: 2px solid transparent;border-right: 2px solid transparent;cursor: col-resize;background-color: #2b64ff;background-clip: content-box;opacity: 0;-webkit-transition: opacity 0.2s;transition: opacity 0.2s;}.hi-v5-sider__resizable-handler:hover {opacity: 1;}.hi-v5-sider .hi-v5-scrollbar__wrapper {width: auto;}.hi-v5-sider .hi-v5-menu {width: auto;height: auto;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner {margin-bottom: var(--hi-v5-spacing-4, 8px) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner:not(.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active):hover {background-color: rgba(124, 135, 166, 0.15);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active {background-color: #fff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p {background-color: var(--hi-v5-color-static-white, #fff);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p:hover {background-color: var(--hi-v5-color-static-white, #fff) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__icon {color: #7c87a6;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__arrow {color: #60636b;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-submenu .hi-v5-menu-item__inner {margin-bottom: 0 !important;}.hi-v5-menu-popmenu {width: 160px !important;}.hi-v5-content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: 0 16px;overflow: auto;}.hi-v5-footer {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 0;-ms-flex: 0 0 auto;flex: 0 0 auto;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-search-trigger {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;height: 32px;margin: 0 8px 12px;font-size: 16px;color: var(--hi-v5-color-gray-500, #91959e);background-color: rgba(113, 126, 163, 0.1);cursor: pointer;border-radius: 9999px;}.hi-v5-search-trigger:not(.hi-v5-search-trigger--mini) {padding: 0 12px;}.hi-v5-search-trigger--mini {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;width: 32px;margin-left: auto;margin-right: auto;}.hi-v5-search-trigger__placeholder {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-search-trigger__popper-container {border-radius: var(--hi-v5-border-radius-xl, 8px) !important;border: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-100, #edeff2);}.hi-v5-float-menu-container {-webkit-box-sizing: border-box;box-sizing: border-box;position: relative;width: 0;height: 100%;background: transparent;}.hi-v5-float-menu-container-content {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: absolute;top: 0;left: 0;height: 100%;padding: var(--hi-v5-spacing-6, 12px) 0;background-color: #f5f8fc;opacity: 0;-webkit-transition: opacity 0.3s;transition: opacity 0.3s;}.hi-v5-float-menu-container-content-wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto;}.hi-v5-float-menu-container-content--show {opacity: 1;}.hi-v5-float-menu-container-content--collapsed {z-index: 2000;border-top-right-radius: 12px;border-bottom-right-radius: 12px;-webkit-box-shadow: 6px 0 18px 6px rgba(26, 29, 38, 0.03), 4px 0 4px 0 rgba(26, 29, 38, 0.03);box-shadow: 6px 0 18px 6px rgba(26, 29, 38, 0.03), 4px 0 4px 0 rgba(26, 29, 38, 0.03);}.hi-v5-float-menu-container-content--collapsed .hi-v5-float-menu-container-collapse-icon {-webkit-transform: scaleX(-1);transform: scaleX(-1);}.hi-v5-float-menu-container-collapse {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: var(--hi-v5-height-6, 24px);padding: 0 var(--hi-v5-spacing-4, 8px);color: var(--hi-v5-color-gray-600, #60636b);cursor: pointer;white-space: nowrap;}.hi-v5-float-menu-container-collapse:hover {border-radius: var(--hi-v5-border-radius-lg, 6px);color: #565a66;background-color: var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-float-menu-container-collapse-wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;padding: var(--hi-v5-spacing-4, 8px) var(--hi-v5-spacing-8, 16px);}.hi-v5-float-menu-container-collapse-icon {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;font-size: var(--hi-v5-text-size-lg, 1rem);}.hi-v5-float-menu-container-collapse-text {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);margin-left: var(--hi-v5-spacing-2, 4px);}.hi-v5-app-list-wrapper {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;gap: 8px;}.hi-v5-app-list-item {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;width: 256px;height: var(--hi-v5-height-12, 48px);padding: 0 var(--hi-v5-spacing-6, 12px);border: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-100, #edeff2);border-radius: var(--hi-v5-border-radius-lg, 6px);overflow: hidden;cursor: pointer;}.hi-v5-app-list-item:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-app-list-item__icon {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;overflow: hidden;width: var(--hi-v5-height-6, 24px);height: var(--hi-v5-height-6, 24px);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);border-radius: var(--hi-v5-border-radius-lg, 6px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-medium, 500);color: var(--hi-v5-color-static-white, #fff);background-color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-app-list-item__title {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-app-list-item__checked {display: none;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-app-list-item--active .hi-v5-app-list-item__title {font-weight: var(--hi-v5-text-weight-medium, 500);}.hi-v5-app-list-item--active .hi-v5-app-list-item__checked {display: block;}.hi-v5-profile {width: 240px;}.hi-v5-profile__header {padding: var(--hi-v5-spacing-8, 16px) var(--hi-v5-spacing-8, 16px) var(--hi-v5-spacing-4, 8px);font-size: var(--hi-v5-text-size-lg, 1rem);line-height: var(--hi-v5-text-lineheight-lg, 1.5rem);font-weight: var(--hi-v5-text-weight-medium, 500);}.hi-v5-profile__settings {padding: var(--hi-v5-spacing-4, 8px);}.hi-v5-profile__settings-item {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: start;-ms-flex-align: start;align-items: flex-start;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-lg, 6px);cursor: pointer;}.hi-v5-profile__settings-item:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-profile__settings-item__title {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__settings-item__subtitle {font-size: var(--hi-v5-text-size-sm, 0.75rem);line-height: var(--hi-v5-text-lineheight-sm, 1.25rem);font-weight: var(--hi-v5-text-weight-medium, 500);color: var(--hi-v5-color-gray-500, #91959e);}.hi-v5-profile__settings-item__arrow {font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-500, #91959e);}.hi-v5-profile__settings-item-leaf {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;height: 40px;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-md, 4px);cursor: pointer;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__settings-item-leaf:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-profile__settings-item-leaf--checked {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-profile__footer {padding: var(--hi-v5-spacing-4, 8px);border-top: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-profile__footer__content {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-lg, 6px);cursor: pointer;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__footer__content:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}";
12
12
  __styleInject__(css_248z);
13
13
  export { css_248z as default };
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ import { PopoverProps } from '@hi-ui/popover';
4
+ /**
5
+ * 应用列表组件
6
+ */
7
+ export declare const AppList: React.ForwardRefExoticComponent<AppListProps & React.RefAttributes<HTMLDivElement | null>>;
8
+ export declare const IconBgColorMap: {
9
+ readonly BLUE: "#2660ff";
10
+ readonly SKYBLUE: "#0aadff";
11
+ readonly CYAN: "#04c2ac";
12
+ readonly GREEN: "#24b237";
13
+ readonly PURPLE: "#7f3df2";
14
+ readonly YELLOW: "#ffbe0a";
15
+ readonly ORANGE: "#ff7700";
16
+ };
17
+ export interface AppListItem {
18
+ /**
19
+ * 应用图标
20
+ */
21
+ icon?: React.ReactNode;
22
+ /**
23
+ * 应用图标背景颜色
24
+ */
25
+ iconBgColor?: keyof typeof IconBgColorMap;
26
+ /**
27
+ * 应用 id
28
+ */
29
+ id: React.ReactText;
30
+ /**
31
+ * 应用标题
32
+ */
33
+ title?: React.ReactNode;
34
+ }
35
+ export interface AppListProps extends HiBaseHTMLProps<'div'> {
36
+ /**
37
+ * 应用列表数据
38
+ */
39
+ data?: AppListItem[];
40
+ /**
41
+ * 默认激活的应用 id
42
+ */
43
+ defaultActiveId?: React.ReactText;
44
+ /**
45
+ * 激活的应用 id
46
+ */
47
+ activeId?: React.ReactText;
48
+ /**
49
+ * 应用标题渲染
50
+ */
51
+ titleRender?: (item: AppListItem) => React.ReactNode;
52
+ /**
53
+ * 应用列表点击回调
54
+ */
55
+ onItemClick?: (item: AppListItem, event: React.MouseEvent<HTMLDivElement>) => void;
56
+ }
57
+ export declare const AppListPopover: React.ForwardRefExoticComponent<AppListPopoverProps & React.RefAttributes<HTMLDivElement | null>>;
58
+ export interface AppListPopoverProps extends AppListProps, Omit<PopoverProps, 'content'> {
59
+ /**
60
+ * 应用列表是否可见
61
+ */
62
+ visible?: boolean;
63
+ /**
64
+ * 应用列表打开回调
65
+ */
66
+ onOpen?: () => void;
67
+ /**
68
+ * 应用列表关闭回调
69
+ */
70
+ onClose?: () => void;
71
+ }
@@ -0,0 +1 @@
1
+ export declare const CollapseIcon: () => JSX.Element;
@@ -1,8 +1,5 @@
1
1
  import React from 'react';
2
2
  import { HiBaseHTMLProps } from '@hi-ui/core';
3
- /**
4
- * 内容区域组件
5
- */
6
3
  export declare const Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<HTMLDivElement | null>>;
7
4
  export interface ContentProps extends HiBaseHTMLProps<'div'> {
8
5
  }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ /**
4
+ * 浮动菜单容器组件
5
+ */
6
+ export declare const FloatMenuContainer: React.ForwardRefExoticComponent<FloatMenuContainerProps & React.RefAttributes<HTMLDivElement | null>>;
7
+ export interface FloatMenuContainerProps extends HiBaseHTMLProps<'div'> {
8
+ /**
9
+ * 浮动宽度
10
+ */
11
+ width?: number;
12
+ /**
13
+ * 层级
14
+ */
15
+ zIndex?: number;
16
+ /**
17
+ * 是否显示
18
+ */
19
+ visible?: boolean;
20
+ /**
21
+ * 是否折叠
22
+ */
23
+ collapsed?: boolean;
24
+ /**
25
+ * 折叠回调
26
+ */
27
+ onCollapse?: (collapsed: boolean) => void;
28
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ export declare const Footer: React.ForwardRefExoticComponent<FooterProps & React.RefAttributes<HTMLDivElement | null>>;
4
+ export interface FooterProps extends HiBaseHTMLProps<'div'> {
5
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ export declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLDivElement | null>>;
4
+ export interface HeaderProps extends HiBaseHTMLProps<'div'> {
5
+ }
@@ -5,4 +5,8 @@ import { HiBaseHTMLProps } from '@hi-ui/core';
5
5
  */
6
6
  export declare const Layout: React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<HTMLDivElement | null>>;
7
7
  export interface LayoutProps extends HiBaseHTMLProps<'div'> {
8
+ /**
9
+ * 布局方向
10
+ */
11
+ direction?: 'row' | 'column';
8
12
  }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ import { PopoverProps } from '@hi-ui/popover';
4
+ export declare const Profile: React.ForwardRefExoticComponent<ProfileProps & React.RefAttributes<HTMLDivElement | null>>;
5
+ export interface ProfileSettingsItem {
6
+ id?: React.ReactText;
7
+ title?: string;
8
+ subtitle?: string;
9
+ children?: ProfileSettingsItem[];
10
+ }
11
+ export interface ProfileProps extends HiBaseHTMLProps<'div'> {
12
+ header?: React.ReactNode;
13
+ footer?: React.ReactNode;
14
+ settings?: {
15
+ value?: Record<string, React.ReactText>;
16
+ data: ProfileSettingsItem[];
17
+ placement?: PopoverProps['placement'];
18
+ onItemClick?: (evt: React.MouseEvent, item: ProfileSettingsItem) => void;
19
+ onChange?: (value: Record<string, React.ReactText>, targetItem: ProfileSettingsItem) => void;
20
+ };
21
+ }
22
+ export declare const ProfilePopover: React.ForwardRefExoticComponent<ProfilePopoverProps & React.RefAttributes<HTMLDivElement | null>>;
23
+ export interface ProfilePopoverProps extends ProfileProps, Omit<PopoverProps, 'content'> {
24
+ }
@@ -1,10 +1,21 @@
1
1
  import React from 'react';
2
2
  import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ import { MenuDataItem } from '@hi-ui/menu';
3
4
  /**
4
5
  * 搜索触发器组件
5
6
  */
6
7
  export declare const SearchTrigger: React.ForwardRefExoticComponent<SearchTriggerProps & React.RefAttributes<HTMLDivElement | null>>;
7
8
  export interface SearchTriggerProps extends HiBaseHTMLProps<'div'> {
9
+ /**
10
+ * 迷你模式
11
+ */
8
12
  mini?: boolean;
13
+ /**
14
+ * 占位符
15
+ */
9
16
  placeholder?: string;
17
+ /**
18
+ * 菜单数据
19
+ */
20
+ data?: MenuDataItem[];
10
21
  }
@@ -5,6 +5,27 @@ import { HiBaseHTMLProps } from '@hi-ui/core';
5
5
  */
6
6
  export declare const Sider: React.ForwardRefExoticComponent<SiderProps & React.RefAttributes<HTMLDivElement | null>>;
7
7
  export interface SiderProps extends HiBaseHTMLProps<'div'> {
8
+ /**
9
+ * 宽度
10
+ */
11
+ width?: number;
12
+ /**
13
+ * 最大宽度
14
+ */
15
+ maxWidth?: number;
16
+ /**
17
+ * 最小宽度
18
+ */
19
+ /**
20
+ * 是否可调整宽度
21
+ */
22
+ resizable?: boolean;
23
+ /**
24
+ * 是否折叠
25
+ */
8
26
  collapsed?: boolean;
27
+ /**
28
+ * 折叠回调
29
+ */
9
30
  onCollapse?: (collapsed: boolean) => void;
10
31
  }
@@ -1,6 +1,22 @@
1
+ /// <reference types="react" />
1
2
  import './styles/index.scss';
3
+ declare const Layout: import("react").ForwardRefExoticComponent<import("./Layout").LayoutProps & import("react").RefAttributes<HTMLDivElement | null>> & {
4
+ Header: import("react").ForwardRefExoticComponent<import("./Header").HeaderProps & import("react").RefAttributes<HTMLDivElement | null>>;
5
+ Sider: import("react").ForwardRefExoticComponent<import("./Sider").SiderProps & import("react").RefAttributes<HTMLDivElement | null>>;
6
+ Content: import("react").ForwardRefExoticComponent<import("./Content").ContentProps & import("react").RefAttributes<HTMLDivElement | null>>;
7
+ Footer: import("react").ForwardRefExoticComponent<import("./Footer").FooterProps & import("react").RefAttributes<HTMLDivElement | null>>;
8
+ SearchTrigger: import("react").ForwardRefExoticComponent<import("./SearchTrigger").SearchTriggerProps & import("react").RefAttributes<HTMLDivElement | null>>;
9
+ FloatMenuContainer: import("react").ForwardRefExoticComponent<import("./FloatMenuContainer").FloatMenuContainerProps & import("react").RefAttributes<HTMLDivElement | null>>;
10
+ AppListPopover: import("react").ForwardRefExoticComponent<import("./AppList").AppListPopoverProps & import("react").RefAttributes<HTMLDivElement | null>>;
11
+ ProfilePopover: import("react").ForwardRefExoticComponent<import("./Profile").ProfilePopoverProps & import("react").RefAttributes<HTMLDivElement | null>>;
12
+ };
13
+ export default Layout;
2
14
  export * from './Layout';
3
- export { Layout as default } from './Layout';
15
+ export * from './Header';
4
16
  export * from './Sider';
5
17
  export * from './Content';
18
+ export * from './Footer';
6
19
  export * from './SearchTrigger';
20
+ export * from './FloatMenuContainer';
21
+ export * from './AppList';
22
+ export * from './Profile';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/layout",
3
- "version": "4.0.0",
3
+ "version": "5.0.0-alpha.0",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -43,18 +43,20 @@
43
43
  "url": "https://github.com/XiaoMi/hiui/issues"
44
44
  },
45
45
  "dependencies": {
46
- "@hi-ui/classname": "^4.0.0",
47
- "@hi-ui/env": "^4.0.0",
48
- "@hi-ui/use-uncontrolled-state": "^4.0.4"
46
+ "@hi-ui/classname": "^5.0.0-alpha.0",
47
+ "@hi-ui/env": "^5.0.0-alpha.0",
48
+ "@hi-ui/menu": "^5.0.0-alpha.0",
49
+ "@hi-ui/popper": "^5.0.0-alpha.0",
50
+ "@hi-ui/use-uncontrolled-state": "^5.0.0-alpha.0"
49
51
  },
50
52
  "peerDependencies": {
51
- "@hi-ui/core": ">=4.0.0",
53
+ "@hi-ui/core": ">=5.0.0-alpha.0",
52
54
  "react": ">=16.8.6",
53
55
  "react-dom": ">=16.8.6"
54
56
  },
55
57
  "devDependencies": {
56
- "@hi-ui/core": "^4.0.0",
57
- "@hi-ui/core-css": "^4.0.0",
58
+ "@hi-ui/core": "^5.0.0-alpha.0",
59
+ "@hi-ui/core-css": "^5.0.0-alpha.0",
58
60
  "react": "^17.0.1",
59
61
  "react-dom": "^17.0.1"
60
62
  }