@rc-component/select 1.2.0-alpha.0 → 1.2.0-alpha.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/assets/index.css CHANGED
@@ -57,6 +57,12 @@
57
57
  border-radius: 8px;
58
58
  margin-right: 4px;
59
59
  }
60
+ .rc-select.rc-select-multiple .rc-select-placeholder {
61
+ position: absolute;
62
+ left: 0;
63
+ top: 50%;
64
+ transform: translateY(-50%);
65
+ }
60
66
  .rc-select.rc-select-multiple .rc-select-input {
61
67
  width: calc(var(--select-input-width, 10) * 1px);
62
68
  min-width: 4px;
package/assets/patch.less CHANGED
@@ -75,6 +75,13 @@
75
75
  margin-right: 4px;
76
76
  }
77
77
 
78
+ .@{select-prefix}-placeholder {
79
+ position: absolute;
80
+ left: 0;
81
+ top: 50%;
82
+ transform: translateY(-50%);
83
+ }
84
+
78
85
  .@{select-prefix}-input {
79
86
  width: calc(var(--select-input-width, 10) * 1px);
80
87
  min-width: 4px;
package/es/Select.d.ts CHANGED
@@ -125,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
125
125
  classNames?: Partial<Record<SemanticName, string>>;
126
126
  styles?: Partial<Record<SemanticName, React.CSSProperties>>;
127
127
  }
128
- declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
128
+ declare const TypedSelect: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
129
129
  Option: typeof Option;
130
130
  OptGroup: typeof OptGroup;
131
131
  };
@@ -129,15 +129,12 @@ export default /*#__PURE__*/React.forwardRef(function MultipleContent({
129
129
  };
130
130
 
131
131
  // ======================= Render =======================
132
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Placeholder, {
133
- show: !searchValue || !triggerOpen
134
- }), /*#__PURE__*/React.createElement(Overflow, {
132
+ return /*#__PURE__*/React.createElement(Overflow, {
135
133
  prefixCls: `${prefixCls}-content`,
134
+ prefix: !displayValues.length && (!searchValue || !triggerOpen) ? /*#__PURE__*/React.createElement(Placeholder, null) : null,
136
135
  data: displayValues,
137
136
  renderItem: renderItem,
138
- renderRest: renderRest
139
- // suffix={inputNode}
140
- ,
137
+ renderRest: renderRest,
141
138
  suffix: /*#__PURE__*/React.createElement(Input, _extends({
142
139
  ref: ref,
143
140
  disabled: disabled,
@@ -148,5 +145,5 @@ export default /*#__PURE__*/React.forwardRef(function MultipleContent({
148
145
  })),
149
146
  itemKey: itemKey,
150
147
  maxCount: maxTagCount
151
- }));
148
+ });
152
149
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  export interface PlaceholderProps {
3
- show: boolean;
3
+ show?: boolean;
4
4
  }
5
5
  export default function Placeholder(props: PlaceholderProps): React.JSX.Element;
@@ -7,7 +7,7 @@ export default function Placeholder(props) {
7
7
  displayValues
8
8
  } = useSelectInputContext();
9
9
  const {
10
- show
10
+ show = true
11
11
  } = props;
12
12
  if (displayValues.length) {
13
13
  return null;
package/lib/Select.d.ts CHANGED
@@ -125,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
125
125
  classNames?: Partial<Record<SemanticName, string>>;
126
126
  styles?: Partial<Record<SemanticName, React.CSSProperties>>;
127
127
  }
128
- declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
128
+ declare const TypedSelect: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
129
129
  Option: typeof Option;
130
130
  OptGroup: typeof OptGroup;
131
131
  };
@@ -138,15 +138,12 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function Multiple
138
138
  };
139
139
 
140
140
  // ======================= Render =======================
141
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Placeholder.default, {
142
- show: !searchValue || !triggerOpen
143
- }), /*#__PURE__*/React.createElement(_rcOverflow.default, {
141
+ return /*#__PURE__*/React.createElement(_rcOverflow.default, {
144
142
  prefixCls: `${prefixCls}-content`,
143
+ prefix: !displayValues.length && (!searchValue || !triggerOpen) ? /*#__PURE__*/React.createElement(_Placeholder.default, null) : null,
145
144
  data: displayValues,
146
145
  renderItem: renderItem,
147
- renderRest: renderRest
148
- // suffix={inputNode}
149
- ,
146
+ renderRest: renderRest,
150
147
  suffix: /*#__PURE__*/React.createElement(_Input.default, _extends({
151
148
  ref: ref,
152
149
  disabled: disabled,
@@ -157,5 +154,5 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function Multiple
157
154
  })),
158
155
  itemKey: itemKey,
159
156
  maxCount: maxTagCount
160
- }));
157
+ });
161
158
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  export interface PlaceholderProps {
3
- show: boolean;
3
+ show?: boolean;
4
4
  }
5
5
  export default function Placeholder(props: PlaceholderProps): React.JSX.Element;
@@ -15,7 +15,7 @@ function Placeholder(props) {
15
15
  displayValues
16
16
  } = (0, _context.useSelectInputContext)();
17
17
  const {
18
- show
18
+ show = true
19
19
  } = props;
20
20
  if (displayValues.length) {
21
21
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/select",
3
- "version": "1.2.0-alpha.0",
3
+ "version": "1.2.0-alpha.1",
4
4
  "description": "React Select",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -53,7 +53,7 @@
53
53
  "@rc-component/trigger": "^3.0.0",
54
54
  "@rc-component/util": "^1.3.0",
55
55
  "clsx": "^2.1.1",
56
- "rc-overflow": "^1.4.0",
56
+ "rc-overflow": "^1.5.0",
57
57
  "rc-virtual-list": "^3.5.2"
58
58
  },
59
59
  "devDependencies": {