@hi-ui/layout 4.0.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 (105) hide show
  1. package/README.md +11 -0
  2. package/lib/cjs/Content.js +48 -0
  3. package/lib/cjs/Layout.js +48 -0
  4. package/lib/cjs/SearchTrigger.js +55 -0
  5. package/lib/cjs/Sider.js +100 -0
  6. package/lib/cjs/_virtual/Draggable.js +16 -0
  7. package/lib/cjs/_virtual/DraggableCore.js +16 -0
  8. package/lib/cjs/_virtual/Resizable.js +16 -0
  9. package/lib/cjs/_virtual/ResizableBox.js +16 -0
  10. package/lib/cjs/_virtual/cjs.js +18 -0
  11. package/lib/cjs/_virtual/domFns.js +16 -0
  12. package/lib/cjs/_virtual/getPrefix.js +16 -0
  13. package/lib/cjs/_virtual/index.js +18 -0
  14. package/lib/cjs/_virtual/index2.js +18 -0
  15. package/lib/cjs/_virtual/index3.js +18 -0
  16. package/lib/cjs/_virtual/index4.js +18 -0
  17. package/lib/cjs/_virtual/log.js +16 -0
  18. package/lib/cjs/_virtual/positionFns.js +16 -0
  19. package/lib/cjs/_virtual/propTypes.js +16 -0
  20. package/lib/cjs/_virtual/react-is.development.js +16 -0
  21. package/lib/cjs/_virtual/react-is.production.min.js +16 -0
  22. package/lib/cjs/_virtual/shims.js +16 -0
  23. package/lib/cjs/_virtual/utils.js +16 -0
  24. package/lib/cjs/index.js +24 -0
  25. package/lib/cjs/node_modules/classnames/index.js +62 -0
  26. package/lib/cjs/node_modules/object-assign/index.js +94 -0
  27. package/lib/cjs/node_modules/prop-types/checkPropTypes.js +101 -0
  28. package/lib/cjs/node_modules/prop-types/factoryWithThrowingShims.js +68 -0
  29. package/lib/cjs/node_modules/prop-types/factoryWithTypeCheckers.js +553 -0
  30. package/lib/cjs/node_modules/prop-types/index.js +36 -0
  31. package/lib/cjs/node_modules/prop-types/lib/ReactPropTypesSecret.js +25 -0
  32. package/lib/cjs/node_modules/react-draggable/build/cjs/Draggable.js +655 -0
  33. package/lib/cjs/node_modules/react-draggable/build/cjs/DraggableCore.js +670 -0
  34. package/lib/cjs/node_modules/react-draggable/build/cjs/cjs.js +23 -0
  35. package/lib/cjs/node_modules/react-draggable/build/cjs/utils/domFns.js +366 -0
  36. package/lib/cjs/node_modules/react-draggable/build/cjs/utils/getPrefix.js +69 -0
  37. package/lib/cjs/node_modules/react-draggable/build/cjs/utils/log.js +19 -0
  38. package/lib/cjs/node_modules/react-draggable/build/cjs/utils/positionFns.js +176 -0
  39. package/lib/cjs/node_modules/react-draggable/build/cjs/utils/shims.js +57 -0
  40. package/lib/cjs/node_modules/react-is/cjs/react-is.development.js +182 -0
  41. package/lib/cjs/node_modules/react-is/cjs/react-is.production.min.js +132 -0
  42. package/lib/cjs/node_modules/react-is/index.js +21 -0
  43. package/lib/cjs/node_modules/react-resizable/build/Resizable.js +366 -0
  44. package/lib/cjs/node_modules/react-resizable/build/ResizableBox.js +244 -0
  45. package/lib/cjs/node_modules/react-resizable/build/propTypes.js +115 -0
  46. package/lib/cjs/node_modules/react-resizable/build/utils.js +86 -0
  47. package/lib/cjs/node_modules/react-resizable/index.js +25 -0
  48. package/lib/cjs/packages/icons/lib/esm/components/common/search-outlined.js +65 -0
  49. package/lib/cjs/packages/icons/lib/esm/styles/index.scss.js +35 -0
  50. package/lib/cjs/styles/index.scss.js +18 -0
  51. package/lib/esm/Content.js +36 -0
  52. package/lib/esm/Layout.js +36 -0
  53. package/lib/esm/SearchTrigger.js +43 -0
  54. package/lib/esm/Sider.js +88 -0
  55. package/lib/esm/_virtual/Draggable.js +11 -0
  56. package/lib/esm/_virtual/DraggableCore.js +11 -0
  57. package/lib/esm/_virtual/Resizable.js +11 -0
  58. package/lib/esm/_virtual/ResizableBox.js +11 -0
  59. package/lib/esm/_virtual/cjs.js +13 -0
  60. package/lib/esm/_virtual/domFns.js +11 -0
  61. package/lib/esm/_virtual/getPrefix.js +11 -0
  62. package/lib/esm/_virtual/index.js +13 -0
  63. package/lib/esm/_virtual/index2.js +13 -0
  64. package/lib/esm/_virtual/index3.js +13 -0
  65. package/lib/esm/_virtual/index4.js +13 -0
  66. package/lib/esm/_virtual/log.js +11 -0
  67. package/lib/esm/_virtual/positionFns.js +11 -0
  68. package/lib/esm/_virtual/propTypes.js +11 -0
  69. package/lib/esm/_virtual/react-is.development.js +11 -0
  70. package/lib/esm/_virtual/react-is.production.min.js +11 -0
  71. package/lib/esm/_virtual/shims.js +11 -0
  72. package/lib/esm/_virtual/utils.js +11 -0
  73. package/lib/esm/index.js +14 -0
  74. package/lib/esm/node_modules/classnames/index.js +60 -0
  75. package/lib/esm/node_modules/object-assign/index.js +88 -0
  76. package/lib/esm/node_modules/prop-types/checkPropTypes.js +96 -0
  77. package/lib/esm/node_modules/prop-types/factoryWithThrowingShims.js +63 -0
  78. package/lib/esm/node_modules/prop-types/factoryWithTypeCheckers.js +548 -0
  79. package/lib/esm/node_modules/prop-types/index.js +34 -0
  80. package/lib/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js +19 -0
  81. package/lib/esm/node_modules/react-draggable/build/cjs/Draggable.js +645 -0
  82. package/lib/esm/node_modules/react-draggable/build/cjs/DraggableCore.js +660 -0
  83. package/lib/esm/node_modules/react-draggable/build/cjs/cjs.js +21 -0
  84. package/lib/esm/node_modules/react-draggable/build/cjs/utils/domFns.js +361 -0
  85. package/lib/esm/node_modules/react-draggable/build/cjs/utils/getPrefix.js +67 -0
  86. package/lib/esm/node_modules/react-draggable/build/cjs/utils/log.js +17 -0
  87. package/lib/esm/node_modules/react-draggable/build/cjs/utils/positionFns.js +171 -0
  88. package/lib/esm/node_modules/react-draggable/build/cjs/utils/shims.js +52 -0
  89. package/lib/esm/node_modules/react-is/cjs/react-is.development.js +177 -0
  90. package/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +127 -0
  91. package/lib/esm/node_modules/react-is/index.js +19 -0
  92. package/lib/esm/node_modules/react-resizable/build/Resizable.js +358 -0
  93. package/lib/esm/node_modules/react-resizable/build/ResizableBox.js +236 -0
  94. package/lib/esm/node_modules/react-resizable/build/propTypes.js +110 -0
  95. package/lib/esm/node_modules/react-resizable/build/utils.js +74 -0
  96. package/lib/esm/node_modules/react-resizable/index.js +20 -0
  97. package/lib/esm/packages/icons/lib/esm/components/common/search-outlined.js +53 -0
  98. package/lib/esm/packages/icons/lib/esm/styles/index.scss.js +23 -0
  99. package/lib/esm/styles/index.scss.js +13 -0
  100. package/lib/types/Content.d.ts +8 -0
  101. package/lib/types/Layout.d.ts +8 -0
  102. package/lib/types/SearchTrigger.d.ts +10 -0
  103. package/lib/types/Sider.d.ts +10 -0
  104. package/lib/types/index.d.ts +6 -0
  105. package/package.json +61 -0
@@ -0,0 +1,236 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ /** @LICENSE
3
+ * @hi-ui/layout
4
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#readme
5
+ *
6
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ import { __exports as ResizableBox$1 } from '../../../_virtual/ResizableBox.js';
12
+ import React$1 from 'react';
13
+ import '../../prop-types/index.js';
14
+ import './Resizable.js';
15
+ import './propTypes.js';
16
+ import { __exports as propTypes } from '../../../_virtual/propTypes.js';
17
+ import { p as propTypes$1 } from '../../../_virtual/index2.js';
18
+ import { __exports as Resizable } from '../../../_virtual/Resizable.js';
19
+ ResizableBox$1.__esModule = true;
20
+ ResizableBox$1["default"] = void 0;
21
+ var React = _interopRequireWildcard(React$1);
22
+ var _propTypes = _interopRequireDefault(propTypes$1.exports);
23
+ var _Resizable = _interopRequireDefault(Resizable);
24
+ var _propTypes2 = propTypes;
25
+ var _excluded = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
26
+ function _interopRequireDefault(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ "default": obj
29
+ };
30
+ }
31
+ function _getRequireWildcardCache(nodeInterop) {
32
+ if (typeof WeakMap !== "function") return null;
33
+ var cacheBabelInterop = new WeakMap();
34
+ var cacheNodeInterop = new WeakMap();
35
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
36
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
37
+ })(nodeInterop);
38
+ }
39
+ function _interopRequireWildcard(obj, nodeInterop) {
40
+ if (!nodeInterop && obj && obj.__esModule) {
41
+ return obj;
42
+ }
43
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
44
+ return {
45
+ "default": obj
46
+ };
47
+ }
48
+ var cache = _getRequireWildcardCache(nodeInterop);
49
+ if (cache && cache.has(obj)) {
50
+ return cache.get(obj);
51
+ }
52
+ var newObj = {};
53
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
54
+ for (var key in obj) {
55
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
56
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
57
+ if (desc && (desc.get || desc.set)) {
58
+ Object.defineProperty(newObj, key, desc);
59
+ } else {
60
+ newObj[key] = obj[key];
61
+ }
62
+ }
63
+ }
64
+ newObj["default"] = obj;
65
+ if (cache) {
66
+ cache.set(obj, newObj);
67
+ }
68
+ return newObj;
69
+ }
70
+ function _extends() {
71
+ _extends = Object.assign || function (target) {
72
+ for (var i = 1; i < arguments.length; i++) {
73
+ var source = arguments[i];
74
+ for (var key in source) {
75
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
76
+ target[key] = source[key];
77
+ }
78
+ }
79
+ }
80
+ return target;
81
+ };
82
+ return _extends.apply(this, arguments);
83
+ }
84
+ function ownKeys(object, enumerableOnly) {
85
+ var keys = Object.keys(object);
86
+ if (Object.getOwnPropertySymbols) {
87
+ var symbols = Object.getOwnPropertySymbols(object);
88
+ if (enumerableOnly) {
89
+ symbols = symbols.filter(function (sym) {
90
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
91
+ });
92
+ }
93
+ keys.push.apply(keys, symbols);
94
+ }
95
+ return keys;
96
+ }
97
+ function _objectSpread(target) {
98
+ for (var i = 1; i < arguments.length; i++) {
99
+ var source = arguments[i] != null ? arguments[i] : {};
100
+ if (i % 2) {
101
+ ownKeys(Object(source), true).forEach(function (key) {
102
+ _defineProperty(target, key, source[key]);
103
+ });
104
+ } else if (Object.getOwnPropertyDescriptors) {
105
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
106
+ } else {
107
+ ownKeys(Object(source)).forEach(function (key) {
108
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
109
+ });
110
+ }
111
+ }
112
+ return target;
113
+ }
114
+ function _defineProperty(obj, key, value) {
115
+ if (key in obj) {
116
+ Object.defineProperty(obj, key, {
117
+ value: value,
118
+ enumerable: true,
119
+ configurable: true,
120
+ writable: true
121
+ });
122
+ } else {
123
+ obj[key] = value;
124
+ }
125
+ return obj;
126
+ }
127
+ function _objectWithoutPropertiesLoose(source, excluded) {
128
+ if (source == null) return {};
129
+ var target = {};
130
+ var sourceKeys = Object.keys(source);
131
+ var key, i;
132
+ for (i = 0; i < sourceKeys.length; i++) {
133
+ key = sourceKeys[i];
134
+ if (excluded.indexOf(key) >= 0) continue;
135
+ target[key] = source[key];
136
+ }
137
+ return target;
138
+ }
139
+ function _inheritsLoose(subClass, superClass) {
140
+ subClass.prototype = Object.create(superClass.prototype);
141
+ subClass.prototype.constructor = subClass;
142
+ _setPrototypeOf(subClass, superClass);
143
+ }
144
+ function _setPrototypeOf(o, p) {
145
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
146
+ o.__proto__ = p;
147
+ return o;
148
+ };
149
+ return _setPrototypeOf(o, p);
150
+ }
151
+ var ResizableBox = /*#__PURE__*/function (_React$Component) {
152
+ _inheritsLoose(ResizableBox, _React$Component);
153
+ function ResizableBox() {
154
+ var _this;
155
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
156
+ args[_key] = arguments[_key];
157
+ }
158
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
159
+ _this.state = {
160
+ width: _this.props.width,
161
+ height: _this.props.height,
162
+ propsWidth: _this.props.width,
163
+ propsHeight: _this.props.height
164
+ };
165
+ _this.onResize = function (e, data) {
166
+ var size = data.size;
167
+ if (_this.props.onResize) {
168
+ e.persist == null ? void 0 : e.persist();
169
+ _this.setState(size, function () {
170
+ return _this.props.onResize && _this.props.onResize(e, data);
171
+ });
172
+ } else {
173
+ _this.setState(size);
174
+ }
175
+ };
176
+ return _this;
177
+ }
178
+ ResizableBox.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
179
+ // If parent changes height/width, set that in our state.
180
+ if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
181
+ return {
182
+ width: props.width,
183
+ height: props.height,
184
+ propsWidth: props.width,
185
+ propsHeight: props.height
186
+ };
187
+ }
188
+ return null;
189
+ };
190
+ var _proto = ResizableBox.prototype;
191
+ _proto.render = function render() {
192
+ // Basic wrapper around a Resizable instance.
193
+ // If you use Resizable directly, you are responsible for updating the child component
194
+ // with a new width and height.
195
+ var _this$props = this.props,
196
+ handle = _this$props.handle,
197
+ handleSize = _this$props.handleSize,
198
+ onResizeStart = _this$props.onResizeStart,
199
+ onResizeStop = _this$props.onResizeStop,
200
+ draggableOpts = _this$props.draggableOpts,
201
+ minConstraints = _this$props.minConstraints,
202
+ maxConstraints = _this$props.maxConstraints,
203
+ lockAspectRatio = _this$props.lockAspectRatio,
204
+ axis = _this$props.axis,
205
+ resizeHandles = _this$props.resizeHandles,
206
+ style = _this$props.style,
207
+ transformScale = _this$props.transformScale,
208
+ props = _objectWithoutPropertiesLoose(_this$props, _excluded);
209
+ return /*#__PURE__*/React.createElement(_Resizable["default"], {
210
+ axis: axis,
211
+ draggableOpts: draggableOpts,
212
+ handle: handle,
213
+ handleSize: handleSize,
214
+ height: this.state.height,
215
+ lockAspectRatio: lockAspectRatio,
216
+ maxConstraints: maxConstraints,
217
+ minConstraints: minConstraints,
218
+ onResizeStart: onResizeStart,
219
+ onResize: this.onResize,
220
+ onResizeStop: onResizeStop,
221
+ resizeHandles: resizeHandles,
222
+ transformScale: transformScale,
223
+ width: this.state.width
224
+ }, /*#__PURE__*/React.createElement("div", _extends({}, props, {
225
+ style: _objectSpread(_objectSpread({}, style), {}, {
226
+ width: this.state.width + 'px',
227
+ height: this.state.height + 'px'
228
+ })
229
+ })));
230
+ };
231
+ return ResizableBox;
232
+ }(React.Component);
233
+ ResizableBox$1["default"] = ResizableBox;
234
+ ResizableBox.propTypes = _objectSpread(_objectSpread({}, _propTypes2.resizableProps), {}, {
235
+ children: _propTypes["default"].element
236
+ });
@@ -0,0 +1,110 @@
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 { __exports as propTypes } from '../../../_virtual/propTypes.js';
11
+ import '../../prop-types/index.js';
12
+ import '../../react-draggable/build/cjs/cjs.js';
13
+ import { p as propTypes$1 } from '../../../_virtual/index2.js';
14
+ propTypes.__esModule = true;
15
+ propTypes.resizableProps = void 0;
16
+ var _propTypes = _interopRequireDefault(propTypes$1.exports);
17
+ function _interopRequireDefault(obj) {
18
+ return obj && obj.__esModule ? obj : {
19
+ "default": obj
20
+ };
21
+ }
22
+ var resizableProps = {
23
+ /*
24
+ * Restricts resizing to a particular axis (default: 'both')
25
+ * 'both' - allows resizing by width or height
26
+ * 'x' - only allows the width to be changed
27
+ * 'y' - only allows the height to be changed
28
+ * 'none' - disables resizing altogether
29
+ * */
30
+ axis: _propTypes["default"].oneOf(['both', 'x', 'y', 'none']),
31
+ className: _propTypes["default"].string,
32
+ /*
33
+ * Require that one and only one child be present.
34
+ * */
35
+ children: _propTypes["default"].element.isRequired,
36
+ /*
37
+ * These will be passed wholesale to react-draggable's DraggableCore
38
+ * */
39
+ draggableOpts: _propTypes["default"].shape({
40
+ allowAnyClick: _propTypes["default"].bool,
41
+ cancel: _propTypes["default"].string,
42
+ children: _propTypes["default"].node,
43
+ disabled: _propTypes["default"].bool,
44
+ enableUserSelectHack: _propTypes["default"].bool,
45
+ offsetParent: _propTypes["default"].node,
46
+ grid: _propTypes["default"].arrayOf(_propTypes["default"].number),
47
+ handle: _propTypes["default"].string,
48
+ nodeRef: _propTypes["default"].object,
49
+ onStart: _propTypes["default"].func,
50
+ onDrag: _propTypes["default"].func,
51
+ onStop: _propTypes["default"].func,
52
+ onMouseDown: _propTypes["default"].func,
53
+ scale: _propTypes["default"].number
54
+ }),
55
+ /*
56
+ * Initial height
57
+ * */
58
+ height: _propTypes["default"].number.isRequired,
59
+ /*
60
+ * Customize cursor resize handle
61
+ * */
62
+ handle: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
63
+ /*
64
+ * If you change this, be sure to update your css
65
+ * */
66
+ handleSize: _propTypes["default"].arrayOf(_propTypes["default"].number),
67
+ lockAspectRatio: _propTypes["default"].bool,
68
+ /*
69
+ * Max X & Y measure
70
+ * */
71
+ maxConstraints: _propTypes["default"].arrayOf(_propTypes["default"].number),
72
+ /*
73
+ * Min X & Y measure
74
+ * */
75
+ minConstraints: _propTypes["default"].arrayOf(_propTypes["default"].number),
76
+ /*
77
+ * Called on stop resize event
78
+ * */
79
+ onResizeStop: _propTypes["default"].func,
80
+ /*
81
+ * Called on start resize event
82
+ * */
83
+ onResizeStart: _propTypes["default"].func,
84
+ /*
85
+ * Called on resize event
86
+ * */
87
+ onResize: _propTypes["default"].func,
88
+ /*
89
+ * Defines which resize handles should be rendered (default: 'se')
90
+ * 's' - South handle (bottom-center)
91
+ * 'w' - West handle (left-center)
92
+ * 'e' - East handle (right-center)
93
+ * 'n' - North handle (top-center)
94
+ * 'sw' - Southwest handle (bottom-left)
95
+ * 'nw' - Northwest handle (top-left)
96
+ * 'se' - Southeast handle (bottom-right)
97
+ * 'ne' - Northeast handle (top-center)
98
+ * */
99
+ resizeHandles: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
100
+ /*
101
+ * If `transform: scale(n)` is set on the parent, this should be set to `n`.
102
+ * */
103
+ transformScale: _propTypes["default"].number,
104
+ /*
105
+ * Initial width
106
+ */
107
+ width: _propTypes["default"].number.isRequired
108
+ };
109
+ propTypes.resizableProps = resizableProps;
110
+ export { propTypes as default };
@@ -0,0 +1,74 @@
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 { __exports as utils } from '../../../_virtual/utils.js';
11
+ import React from 'react';
12
+ utils.__esModule = true;
13
+ utils.cloneElement = cloneElement;
14
+ var _react = _interopRequireDefault(React);
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ "default": obj
18
+ };
19
+ }
20
+ function ownKeys(object, enumerableOnly) {
21
+ var keys = Object.keys(object);
22
+ if (Object.getOwnPropertySymbols) {
23
+ var symbols = Object.getOwnPropertySymbols(object);
24
+ if (enumerableOnly) {
25
+ symbols = symbols.filter(function (sym) {
26
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
27
+ });
28
+ }
29
+ keys.push.apply(keys, symbols);
30
+ }
31
+ return keys;
32
+ }
33
+ function _objectSpread(target) {
34
+ for (var i = 1; i < arguments.length; i++) {
35
+ var source = arguments[i] != null ? arguments[i] : {};
36
+ if (i % 2) {
37
+ ownKeys(Object(source), true).forEach(function (key) {
38
+ _defineProperty(target, key, source[key]);
39
+ });
40
+ } else if (Object.getOwnPropertyDescriptors) {
41
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
42
+ } else {
43
+ ownKeys(Object(source)).forEach(function (key) {
44
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
45
+ });
46
+ }
47
+ }
48
+ return target;
49
+ }
50
+ function _defineProperty(obj, key, value) {
51
+ if (key in obj) {
52
+ Object.defineProperty(obj, key, {
53
+ value: value,
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true
57
+ });
58
+ } else {
59
+ obj[key] = value;
60
+ }
61
+ return obj;
62
+ }
63
+
64
+ // React.addons.cloneWithProps look-alike that merges style & className.
65
+ function cloneElement(element, props) {
66
+ if (props.style && element.props.style) {
67
+ props.style = _objectSpread(_objectSpread({}, element.props.style), props.style);
68
+ }
69
+ if (props.className && element.props.className) {
70
+ props.className = element.props.className + " " + props.className;
71
+ }
72
+ return /*#__PURE__*/_react["default"].cloneElement(element, props);
73
+ }
74
+ export { utils as default };
@@ -0,0 +1,20 @@
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 { r as reactResizable } from '../../_virtual/index.js';
11
+ import './build/Resizable.js';
12
+ import './build/ResizableBox.js';
13
+ import { __exports as Resizable$1 } from '../../_virtual/Resizable.js';
14
+ import { __exports as ResizableBox } from '../../_virtual/ResizableBox.js';
15
+ reactResizable.exports = function () {
16
+ throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
17
+ };
18
+ var Resizable = reactResizable.exports.Resizable = Resizable$1["default"];
19
+ reactResizable.exports.ResizableBox = ResizableBox["default"];
20
+ export { Resizable };
@@ -0,0 +1,53 @@
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 React, { forwardRef } from 'react';
12
+ import { getPrefixCls, cx } from '@hi-ui/classname';
13
+ import { __DEV__ } from '@hi-ui/env';
14
+
15
+ /** @LICENSE
16
+ * @hi-ui/icons
17
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/icons#readme
18
+ *
19
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */
24
+ var _prefix = getPrefixCls('icon-search-outlined');
25
+ var SearchOutlined = /*#__PURE__*/forwardRef(function (_a, ref) {
26
+ var _a$prefixCls = _a.prefixCls,
27
+ prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
28
+ className = _a.className,
29
+ size = _a.size,
30
+ styleProp = _a.style,
31
+ rest = __rest(_a, ["prefixCls", "className", "children", "size", "style"]);
32
+ var cls = cx(prefixCls, className);
33
+ var style = Object.assign({
34
+ fontSize: size
35
+ }, styleProp);
36
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
37
+ className: cls,
38
+ ref: ref,
39
+ role: "icon",
40
+ style: style
41
+ }, rest, {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ viewBox: "0 0 1024 1024",
44
+ version: "1.1"
45
+ }), /*#__PURE__*/React.createElement("path", {
46
+ d: "M469.333333 106.666667c200.298667 0 362.666667 162.368 362.666667 362.666666 0 84.757333-29.077333 162.730667-77.802667 224.490667l150.634667 150.677333a42.666667 42.666667 0 0 1-57.621333 62.826667l-2.709334-2.496-150.677333-150.634667A361.109333 361.109333 0 0 1 469.333333 832c-200.298667 0-362.666667-162.368-362.666666-362.666667S269.034667 106.666667 469.333333 106.666667z m0 85.333333C316.16 192 192 316.16 192 469.333333s124.16 277.333333 277.333333 277.333334 277.333333-124.16 277.333334-277.333334S622.506667 192 469.333333 192z",
47
+ "p-id": "38915"
48
+ }));
49
+ });
50
+ if (__DEV__) {
51
+ SearchOutlined.displayName = 'SearchOutlined';
52
+ }
53
+ export { SearchOutlined };
@@ -0,0 +1,23 @@
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 __styleInject__ from '@hi-ui/style-inject';
11
+
12
+ /** @LICENSE
13
+ * @hi-ui/icons
14
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/icons#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 css_248z = "svg[class^=hi-v5-icon] {font-size: inherit;width: 1em;height: 1em;fill: currentColor;stroke: currentColor;display: inline-block;vertical-align: -0.15em;-ms-flex-negative: 0;flex-shrink: 0;}";
22
+ __styleInject__(css_248z);
23
+ export { css_248z as default };
@@ -0,0 +1,13 @@
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 __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);}";
12
+ __styleInject__(css_248z);
13
+ export { css_248z as default };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ /**
4
+ * 内容区域组件
5
+ */
6
+ export declare const Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<HTMLDivElement | null>>;
7
+ export interface ContentProps extends HiBaseHTMLProps<'div'> {
8
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ /**
4
+ * 布局组件,用于布局页面结构
5
+ */
6
+ export declare const Layout: React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<HTMLDivElement | null>>;
7
+ export interface LayoutProps extends HiBaseHTMLProps<'div'> {
8
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ /**
4
+ * 搜索触发器组件
5
+ */
6
+ export declare const SearchTrigger: React.ForwardRefExoticComponent<SearchTriggerProps & React.RefAttributes<HTMLDivElement | null>>;
7
+ export interface SearchTriggerProps extends HiBaseHTMLProps<'div'> {
8
+ mini?: boolean;
9
+ placeholder?: string;
10
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { HiBaseHTMLProps } from '@hi-ui/core';
3
+ /**
4
+ * 侧边栏组件
5
+ */
6
+ export declare const Sider: React.ForwardRefExoticComponent<SiderProps & React.RefAttributes<HTMLDivElement | null>>;
7
+ export interface SiderProps extends HiBaseHTMLProps<'div'> {
8
+ collapsed?: boolean;
9
+ onCollapse?: (collapsed: boolean) => void;
10
+ }
@@ -0,0 +1,6 @@
1
+ import './styles/index.scss';
2
+ export * from './Layout';
3
+ export { Layout as default } from './Layout';
4
+ export * from './Sider';
5
+ export * from './Content';
6
+ export * from './SearchTrigger';
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@hi-ui/layout",
3
+ "version": "4.0.0",
4
+ "description": "A sub-package for @hi-ui/hiui.",
5
+ "keywords": [],
6
+ "author": "HiUI <mi-hiui@xiaomi.com>",
7
+ "homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#readme",
8
+ "license": "MIT",
9
+ "directories": {
10
+ "lib": "lib",
11
+ "test": "__tests__"
12
+ },
13
+ "files": [
14
+ "lib"
15
+ ],
16
+ "main": "lib/cjs/index.js",
17
+ "module": "lib/esm/index.js",
18
+ "types": "lib/types/index.d.ts",
19
+ "typings": "lib/types/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "require": "./lib/cjs/index.js",
23
+ "default": "./lib/esm/index.js"
24
+ }
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/XiaoMi/hiui.git"
32
+ },
33
+ "scripts": {
34
+ "test": "jest",
35
+ "clean": "rimraf lib",
36
+ "prebuild": "yarn clean",
37
+ "build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm",
38
+ "build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs",
39
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
40
+ "build": "concurrently yarn:build:*"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/XiaoMi/hiui/issues"
44
+ },
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"
49
+ },
50
+ "peerDependencies": {
51
+ "@hi-ui/core": ">=4.0.0",
52
+ "react": ">=16.8.6",
53
+ "react-dom": ">=16.8.6"
54
+ },
55
+ "devDependencies": {
56
+ "@hi-ui/core": "^4.0.0",
57
+ "@hi-ui/core-css": "^4.0.0",
58
+ "react": "^17.0.1",
59
+ "react-dom": "^17.0.1"
60
+ }
61
+ }