@rc-component/select 1.2.0-alpha.1 → 1.2.0-alpha.2

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.
@@ -3,7 +3,7 @@ import type { ScrollConfig, ScrollTo } from 'rc-virtual-list/lib/List';
3
3
  import * as React from 'react';
4
4
  import type { DisplayInfoType, DisplayValueType, Mode, Placement, RawValueType, RenderDOMFunc, RenderNode } from '../interface';
5
5
  import type { ComponentsConfig } from '../hooks/useComponents';
6
- export type BaseSelectSemanticName = 'prefix' | 'suffix' | 'input' | 'clear';
6
+ export type BaseSelectSemanticName = 'prefix' | 'suffix' | 'input' | 'clear' | 'placeholder' | 'content' | 'item' | 'itemContent' | 'itemRemove';
7
7
  /**
8
8
  * ZombieJ:
9
9
  * We are currently refactoring the semantic structure of the component. Changelog:
@@ -35,7 +35,9 @@ export default /*#__PURE__*/React.forwardRef(function MultipleContent({
35
35
  tagRender: tagRenderFromContext,
36
36
  maxTagPlaceholder: maxTagPlaceholderFromContext,
37
37
  maxTagTextLength,
38
- maxTagCount
38
+ maxTagCount,
39
+ classNames,
40
+ styles
39
41
  } = useBaseProps();
40
42
  const selectionItemPrefixCls = `${prefixCls}-selection-item`;
41
43
 
@@ -65,11 +67,14 @@ export default /*#__PURE__*/React.forwardRef(function MultipleContent({
65
67
  title: getTitle(item),
66
68
  className: clsx(selectionItemPrefixCls, {
67
69
  [`${selectionItemPrefixCls}-disabled`]: itemDisabled
68
- })
70
+ }, classNames?.item),
71
+ style: styles?.item
69
72
  }, /*#__PURE__*/React.createElement("span", {
70
- className: `${selectionItemPrefixCls}-content`
73
+ className: clsx(`${selectionItemPrefixCls}-content`, classNames?.itemContent),
74
+ style: styles?.itemContent
71
75
  }, content), closable && /*#__PURE__*/React.createElement(TransBtn, {
72
- className: `${selectionItemPrefixCls}-remove`,
76
+ className: clsx(`${selectionItemPrefixCls}-remove`, classNames?.itemRemove),
77
+ style: styles?.itemRemove,
73
78
  onMouseDown: onPreventMouseDown,
74
79
  onClick: onClose,
75
80
  customizeIcon: removeIcon
@@ -131,6 +136,8 @@ export default /*#__PURE__*/React.forwardRef(function MultipleContent({
131
136
  // ======================= Render =======================
132
137
  return /*#__PURE__*/React.createElement(Overflow, {
133
138
  prefixCls: `${prefixCls}-content`,
139
+ className: classNames?.content,
140
+ style: styles?.content,
134
141
  prefix: !displayValues.length && (!searchValue || !triggerOpen) ? /*#__PURE__*/React.createElement(Placeholder, null) : null,
135
142
  data: displayValues,
136
143
  renderItem: renderItem,
@@ -1,11 +1,17 @@
1
1
  import * as React from 'react';
2
+ import { clsx } from 'clsx';
2
3
  import { useSelectInputContext } from "../context";
4
+ import useBaseProps from "../../hooks/useBaseProps";
3
5
  export default function Placeholder(props) {
4
6
  const {
5
7
  prefixCls,
6
8
  placeholder,
7
9
  displayValues
8
10
  } = useSelectInputContext();
11
+ const {
12
+ classNames,
13
+ styles
14
+ } = useBaseProps();
9
15
  const {
10
16
  show = true
11
17
  } = props;
@@ -13,9 +19,10 @@ export default function Placeholder(props) {
13
19
  return null;
14
20
  }
15
21
  return /*#__PURE__*/React.createElement("div", {
16
- className: `${prefixCls}-placeholder`,
22
+ className: clsx(`${prefixCls}-placeholder`, classNames?.placeholder),
17
23
  style: {
18
- visibility: show ? 'visible' : 'hidden'
24
+ visibility: show ? 'visible' : 'hidden',
25
+ ...styles?.placeholder
19
26
  }
20
27
  }, placeholder);
21
28
  }
@@ -21,7 +21,9 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
21
21
  const {
22
22
  triggerOpen,
23
23
  title: rootTitle,
24
- showSearch
24
+ showSearch,
25
+ classNames,
26
+ styles
25
27
  } = useBaseProps();
26
28
  const selectContext = React.useContext(SelectContext);
27
29
  const [inputChanged, setInputChanged] = React.useState(false);
@@ -81,7 +83,8 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
81
83
  }
82
84
  }, [combobox, activeValue]);
83
85
  return /*#__PURE__*/React.createElement("div", {
84
- className: `${prefixCls}-content`
86
+ className: clsx(`${prefixCls}-content`, classNames?.content),
87
+ style: styles?.content
85
88
  }, displayValue ? /*#__PURE__*/React.createElement("div", optionProps, displayValue.label) : /*#__PURE__*/React.createElement(Placeholder, {
86
89
  show: !mergedSearchValue
87
90
  }), /*#__PURE__*/React.createElement(Input, _extends({
@@ -3,7 +3,7 @@ import type { ScrollConfig, ScrollTo } from 'rc-virtual-list/lib/List';
3
3
  import * as React from 'react';
4
4
  import type { DisplayInfoType, DisplayValueType, Mode, Placement, RawValueType, RenderDOMFunc, RenderNode } from '../interface';
5
5
  import type { ComponentsConfig } from '../hooks/useComponents';
6
- export type BaseSelectSemanticName = 'prefix' | 'suffix' | 'input' | 'clear';
6
+ export type BaseSelectSemanticName = 'prefix' | 'suffix' | 'input' | 'clear' | 'placeholder' | 'content' | 'item' | 'itemContent' | 'itemRemove';
7
7
  /**
8
8
  * ZombieJ:
9
9
  * We are currently refactoring the semantic structure of the component. Changelog:
@@ -44,7 +44,9 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function Multiple
44
44
  tagRender: tagRenderFromContext,
45
45
  maxTagPlaceholder: maxTagPlaceholderFromContext,
46
46
  maxTagTextLength,
47
- maxTagCount
47
+ maxTagCount,
48
+ classNames,
49
+ styles
48
50
  } = (0, _useBaseProps.default)();
49
51
  const selectionItemPrefixCls = `${prefixCls}-selection-item`;
50
52
 
@@ -74,11 +76,14 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function Multiple
74
76
  title: (0, _commonUtil.getTitle)(item),
75
77
  className: (0, _clsx.clsx)(selectionItemPrefixCls, {
76
78
  [`${selectionItemPrefixCls}-disabled`]: itemDisabled
77
- })
79
+ }, classNames?.item),
80
+ style: styles?.item
78
81
  }, /*#__PURE__*/React.createElement("span", {
79
- className: `${selectionItemPrefixCls}-content`
82
+ className: (0, _clsx.clsx)(`${selectionItemPrefixCls}-content`, classNames?.itemContent),
83
+ style: styles?.itemContent
80
84
  }, content), closable && /*#__PURE__*/React.createElement(_TransBtn.default, {
81
- className: `${selectionItemPrefixCls}-remove`,
85
+ className: (0, _clsx.clsx)(`${selectionItemPrefixCls}-remove`, classNames?.itemRemove),
86
+ style: styles?.itemRemove,
82
87
  onMouseDown: onPreventMouseDown,
83
88
  onClick: onClose,
84
89
  customizeIcon: removeIcon
@@ -140,6 +145,8 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function Multiple
140
145
  // ======================= Render =======================
141
146
  return /*#__PURE__*/React.createElement(_rcOverflow.default, {
142
147
  prefixCls: `${prefixCls}-content`,
148
+ className: classNames?.content,
149
+ style: styles?.content,
143
150
  prefix: !displayValues.length && (!searchValue || !triggerOpen) ? /*#__PURE__*/React.createElement(_Placeholder.default, null) : null,
144
151
  data: displayValues,
145
152
  renderItem: renderItem,
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = Placeholder;
7
7
  var React = _interopRequireWildcard(require("react"));
8
+ var _clsx = require("clsx");
8
9
  var _context = require("../context");
10
+ var _useBaseProps = _interopRequireDefault(require("../../hooks/useBaseProps"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
14
  function Placeholder(props) {
@@ -14,6 +17,10 @@ function Placeholder(props) {
14
17
  placeholder,
15
18
  displayValues
16
19
  } = (0, _context.useSelectInputContext)();
20
+ const {
21
+ classNames,
22
+ styles
23
+ } = (0, _useBaseProps.default)();
17
24
  const {
18
25
  show = true
19
26
  } = props;
@@ -21,9 +28,10 @@ function Placeholder(props) {
21
28
  return null;
22
29
  }
23
30
  return /*#__PURE__*/React.createElement("div", {
24
- className: `${prefixCls}-placeholder`,
31
+ className: (0, _clsx.clsx)(`${prefixCls}-placeholder`, classNames?.placeholder),
25
32
  style: {
26
- visibility: show ? 'visible' : 'hidden'
33
+ visibility: show ? 'visible' : 'hidden',
34
+ ...styles?.placeholder
27
35
  }
28
36
  }, placeholder);
29
37
  }
@@ -30,7 +30,9 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
30
30
  const {
31
31
  triggerOpen,
32
32
  title: rootTitle,
33
- showSearch
33
+ showSearch,
34
+ classNames,
35
+ styles
34
36
  } = (0, _useBaseProps.default)();
35
37
  const selectContext = React.useContext(_SelectContext.default);
36
38
  const [inputChanged, setInputChanged] = React.useState(false);
@@ -90,7 +92,8 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
90
92
  }
91
93
  }, [combobox, activeValue]);
92
94
  return /*#__PURE__*/React.createElement("div", {
93
- className: `${prefixCls}-content`
95
+ className: (0, _clsx.clsx)(`${prefixCls}-content`, classNames?.content),
96
+ style: styles?.content
94
97
  }, displayValue ? /*#__PURE__*/React.createElement("div", optionProps, displayValue.label) : /*#__PURE__*/React.createElement(_Placeholder.default, {
95
98
  show: !mergedSearchValue
96
99
  }), /*#__PURE__*/React.createElement(_Input.default, _extends({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/select",
3
- "version": "1.2.0-alpha.1",
3
+ "version": "1.2.0-alpha.2",
4
4
  "description": "React Select",
5
5
  "engines": {
6
6
  "node": ">=8.x"