@ucloud-fe/react-components 1.4.6 → 1.5.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 (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/icon.min.js +1 -1
  3. package/dist/main.min.js +4 -4
  4. package/lib/components/Form/ControllerContext.d.ts +1 -1
  5. package/lib/components/Input/.recodo/interaction.js +2 -2
  6. package/lib/components/Input/Input.js +12 -60
  7. package/lib/components/Input/Search.js +1 -0
  8. package/lib/components/Input/style/index.d.ts +23 -8
  9. package/lib/components/Input/style/index.js +97 -17
  10. package/lib/components/Menu/Item.js +9 -2
  11. package/lib/components/Menu/Menu.d.ts +11 -3
  12. package/lib/components/Menu/Menu.js +23 -9
  13. package/lib/components/Menu/MenuContext.d.ts +1 -0
  14. package/lib/components/Menu/index.d.ts +2 -2
  15. package/lib/components/Menu/style/index.d.ts +3 -0
  16. package/lib/components/Menu/style/index.js +14 -8
  17. package/lib/components/Notice/index.d.ts +1 -1
  18. package/lib/components/Select/Group.d.ts +3 -0
  19. package/lib/components/Select/Group.js +4 -0
  20. package/lib/components/Select/Overflow.d.ts +19 -0
  21. package/lib/components/Select/Overflow.js +155 -0
  22. package/lib/components/Select/Select.d.ts +15 -9
  23. package/lib/components/Select/Select.js +1149 -322
  24. package/lib/components/Select/SelectContext.d.ts +1 -1
  25. package/lib/components/Select/index.d.ts +3 -1
  26. package/lib/components/Select/locale/en_US.js +2 -1
  27. package/lib/components/Select/locale/zh_CN.d.ts +1 -0
  28. package/lib/components/Select/locale/zh_CN.js +2 -1
  29. package/lib/components/Select/style/index.d.ts +43 -6
  30. package/lib/components/Select/style/index.js +128 -42
  31. package/lib/components/SvgIcon/icons/ArrowDown.js +2 -2
  32. package/lib/components/SvgIcon/icons/ArrowLeft.js +3 -2
  33. package/lib/components/SvgIcon/icons/ArrowRight.js +2 -2
  34. package/lib/components/SvgIcon/icons/ArrowUp.js +2 -2
  35. package/lib/components/SvgIcon/icons/DoubleArrowLeft.js +4 -7
  36. package/lib/components/SvgIcon/icons/DoubleArrowRight.js +4 -6
  37. package/lib/components/SvgIcon/style/index.js +2 -2
  38. package/lib/hooks/group.d.ts +1 -1
  39. package/lib/hooks/group.js +5 -9
  40. package/lib/hooks/useUncontrolled.d.ts +1 -1
  41. package/lib/hooks/useUncontrolled.js +1 -1
  42. package/lib/libs/rc-table/Table.js +2 -3
  43. package/lib/sharedComponents/InputWrap.d.ts +16 -0
  44. package/lib/sharedComponents/InputWrap.js +66 -0
  45. package/lib/utils/pick.d.ts +1 -1
  46. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  declare const ControllerContext: React.Context<{
3
- status?: "loading" | "default" | "success" | "warning" | "error" | undefined;
3
+ status?: "loading" | "default" | "error" | "success" | "warning" | undefined;
4
4
  }>;
5
5
  export default ControllerContext;
@@ -24,8 +24,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
26
  var config = {
27
- size: _interactionDemo.USE_DEFINE,
28
- clearable: _interactionDemo.USE_DEFINE,
27
+ size: ['sm', 'md', 'lg'],
28
+ clearable: 'boolean',
29
29
  disabled: 'boolean',
30
30
  block: _interactionDemo.USE_DEFINE,
31
31
  status: _interactionDemo.USE_DEFINE,
@@ -19,16 +19,8 @@ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/new
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
- var _classnames = _interopRequireDefault(require("classnames"));
23
-
24
- var _Icon = _interopRequireDefault(require("../../components/Icon"));
25
-
26
- var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
27
-
28
22
  var _ControllerContext = _interopRequireDefault(require("../../components/Form/ControllerContext"));
29
23
 
30
- var _deprecatedLog = _interopRequireDefault(require("../../utils/deprecatedLog"));
31
-
32
24
  var _noop = _interopRequireDefault(require("../../utils/noop"));
33
25
 
34
26
  var _useUncontrolled3 = _interopRequireDefault(require("../../hooks/useUncontrolled"));
@@ -43,7 +35,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
43
35
 
44
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
37
 
46
- var deprecatedLogForIcon = (0, _deprecatedLog.default)('Input icon', 'suffix');
47
38
  var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
48
39
  var _this2 = this;
49
40
 
@@ -76,7 +67,7 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
76
67
  }.bind(this), []);
77
68
 
78
69
  var _useUncontrolled = (0, _useUncontrolled3.default)(_value, defaultValue || '', _onChange, {
79
- setter: valueGetter
70
+ getter: valueGetter
80
71
  }),
81
72
  _useUncontrolled2 = (0, _slicedToArray2.default)(_useUncontrolled, 2),
82
73
  value = _useUncontrolled2[0],
@@ -144,67 +135,22 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
144
135
  e.preventDefault();
145
136
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
146
137
  }.bind(this), []);
147
- var renderClear = (0, _react.useMemo)(function () {
148
- (0, _newArrowCheck2.default)(this, _this2);
149
-
150
- if (clearable) {
151
- return /*#__PURE__*/_react.default.createElement("span", {
152
- className: _style.clearCls,
153
- onClick: handleClear,
154
- onMouseDown: handleClearMouseDown
155
- }, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
156
- type: "cross-circle-filled"
157
- }));
158
- }
159
- }.bind(this), [clearable, handleClear, handleClearMouseDown]);
160
- var renderPrefix = (0, _react.useMemo)(function () {
161
- (0, _newArrowCheck2.default)(this, _this2);
162
- return prefix && /*#__PURE__*/_react.default.createElement("span", {
163
- className: _style.inputPrefixCls
164
- }, prefix);
165
- }.bind(this), [prefix]);
166
- var renderSuffix = (0, _react.useMemo)(function () {
167
- (0, _newArrowCheck2.default)(this, _this2);
168
-
169
- if (icon) {
170
- deprecatedLogForIcon();
171
- }
172
-
173
- var renderSuffix = null;
174
-
175
- if (suffix) {
176
- renderSuffix = suffix;
177
- } else if (typeof icon === 'string') {
178
- renderSuffix = /*#__PURE__*/_react.default.createElement(_Icon.default, {
179
- type: icon
180
- });
181
- } else if ( /*#__PURE__*/_react.default.isValidElement(icon)) {
182
- renderSuffix = icon;
183
- }
184
-
185
- if (renderSuffix) {
186
- return /*#__PURE__*/_react.default.createElement("span", {
187
- className: _style.inputSuffixCls
188
- }, renderSuffix);
189
- }
190
- }.bind(this), [icon, suffix]);
191
138
 
192
139
  var _useContext = (0, _react.useContext)(_ControllerContext.default),
193
140
  status = _useContext.status;
194
141
 
195
- return /*#__PURE__*/_react.default.createElement(_style.SWrap, {
196
- className: (0, _classnames.default)(block && _style.blockCls, className),
142
+ return /*#__PURE__*/_react.default.createElement(_style.InputWrap, {
197
143
  size: size,
198
144
  focused: focused,
199
145
  style: style,
200
146
  disabled: disabled,
201
147
  status: _status || status,
202
148
  customStyle: customStyle,
149
+ block: block,
150
+ className: className,
203
151
  empty: !value,
204
152
  onMouseDown: handleWrapMouseDown
205
- }, /*#__PURE__*/_react.default.createElement("span", {
206
- className: _style.inputWrapCls
207
- }, renderPrefix, /*#__PURE__*/_react.default.createElement("span", {
153
+ }, /*#__PURE__*/_react.default.createElement(_style.Prefix, null, prefix), /*#__PURE__*/_react.default.createElement("span", {
208
154
  className: _style.inputBlockWrapCls
209
155
  }, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, rest, {
210
156
  value: value,
@@ -213,7 +159,13 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
213
159
  onFocus: handleFocus,
214
160
  onBlur: handleBlur,
215
161
  disabled: disabled
216
- })), renderClear), renderSuffix));
162
+ })), /*#__PURE__*/_react.default.createElement(_style.Clear, {
163
+ clearable: clearable,
164
+ onMouseDown: handleClearMouseDown,
165
+ onClick: handleClear
166
+ })), /*#__PURE__*/_react.default.createElement(_style.Suffix, {
167
+ icon: icon
168
+ }, suffix));
217
169
  }.bind(void 0));
218
170
 
219
171
  var _default = /*#__PURE__*/_react.default.memo(Input);
@@ -71,6 +71,7 @@ var Search = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
71
71
  ref: inputRef,
72
72
  suffix: /*#__PURE__*/_react.default.createElement(_style.SearchIcon, {
73
73
  type: "search",
74
+ disabled: disabled,
74
75
  onClick: onSearch
75
76
  })
76
77
  }));
@@ -1,19 +1,34 @@
1
- /// <reference types="react" />
1
+ import React, { CSSProperties, ReactNode } from 'react';
2
2
  import SvgIcon from '../../../components/SvgIcon';
3
3
  import { InputProps } from '../Input';
4
4
  export declare const prefixCls: string;
5
5
  export declare const focusedCls: string;
6
6
  export declare const disabledCls: string;
7
7
  export declare const blockCls: string;
8
- export declare const inputWrapCls: string;
9
8
  export declare const inputPrefixCls: string;
10
9
  export declare const inputSuffixCls: string;
11
10
  export declare const clearCls: string;
12
11
  export declare const inputBlockWrapCls: string;
13
- export declare const SearchIcon: import("@emotion/styled-base").StyledComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<SvgIcon>, Pick<Pick<any, string | number | symbol> & import("react").RefAttributes<SvgIcon>, string | number | symbol>, object>;
14
- export declare const SWrap: import("react").ForwardRefExoticComponent<Pick<InputProps, "customStyle" | "disabled" | "status"> & Required<Pick<InputProps, "size">> & {
15
- focused: boolean;
16
- empty: boolean;
17
- } & import("react").HTMLAttributes<HTMLSpanElement> & {
12
+ export declare const SearchIcon: import("@emotion/styled-base").StyledComponent<Pick<any, string | number | symbol> & React.RefAttributes<SvgIcon>, Pick<Pick<any, string | number | symbol> & React.RefAttributes<SvgIcon>, string | number | symbol>, object>;
13
+ export declare const Prefix: React.NamedExoticComponent<object>;
14
+ export declare const Suffix: React.NamedExoticComponent<{
15
+ icon?: string | ReactNode;
16
+ children?: ReactNode;
17
+ }>;
18
+ export declare const Clear: React.NamedExoticComponent<Pick<InputProps, "clearable"> & React.HTMLAttributes<HTMLSpanElement>>;
19
+ export declare const InputPart: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
20
+ stretch?: boolean | undefined;
21
+ visible?: boolean | undefined;
22
+ }, object>;
23
+ export declare type InputWrapProps = Pick<InputProps, 'block' | 'disabled' | 'status' | 'customStyle'> & Required<Pick<InputProps, 'size'>> & {
24
+ focused?: boolean;
25
+ empty?: boolean;
26
+ cursor?: CSSProperties['cursor'];
27
+ };
28
+ export declare const InputWrap: React.ForwardRefExoticComponent<Pick<InputProps, "block" | "customStyle" | "disabled" | "status"> & Required<Pick<InputProps, "size">> & {
29
+ focused?: boolean | undefined;
30
+ empty?: boolean | undefined;
31
+ cursor?: CSSProperties['cursor'];
32
+ } & React.HTMLAttributes<HTMLSpanElement> & {
18
33
  theme?: import("../../../style").Theme | undefined;
19
- } & import("react").RefAttributes<HTMLSpanElement>>;
34
+ } & React.RefAttributes<HTMLSpanElement>>;