@rescui/select 0.11.7 → 0.11.9-RUI-226-Update-card-cn-6e43cc89.60
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/lib/_virtual/check.js +90 -21
- package/lib/_virtual/close.js +90 -21
- package/lib/_virtual/down.js +90 -21
- package/lib/_virtual/index.css.js +12 -7
- package/lib/_virtual/loading.js +106 -29
- package/lib/_virtual/warning.js +90 -21
- package/lib/common-prop-types.js +6 -6
- package/lib/index.css +287 -303
- package/lib/key-codes.js +7 -7
- package/lib/parts/common-select.p.module.css.js +12 -12
- package/lib/parts/foldable.js +158 -220
- package/lib/parts/form-trigger-wrapper.js +22 -17
- package/lib/parts/form-trigger.p.module.css.js +10 -10
- package/lib/parts/multiselect.js +132 -202
- package/lib/parts/native-select.js +85 -117
- package/lib/parts/native-select.p.module.css.js +6 -6
- package/lib/parts/throttle.js +9 -12
- package/lib/parts/trigger.js +94 -122
- package/lib/parts/trigger.p.module.css.js +27 -27
- package/lib/parts/use-observable-force-rerender.js +5 -12
- package/lib/public-api.p.css +181 -112
- package/lib/public-api.pcss +181 -112
- package/lib/select.js +118 -195
- package/lib/utils.js +44 -90
- package/package.json +12 -12
package/lib/key-codes.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const ARROW_UP = 'ArrowUp';
|
|
2
|
+
const ARROW_DOWN = 'ArrowDown';
|
|
3
|
+
const SPACE = ' ';
|
|
4
|
+
const ESCAPE = 'Escape';
|
|
5
|
+
const ENTER = 'Enter';
|
|
6
|
+
const TAB = 'Tab';
|
|
7
|
+
const BACKSPACE = 'Backspace';
|
|
8
8
|
export { ARROW_DOWN, ARROW_UP, BACKSPACE, ENTER, ESCAPE, SPACE, TAB };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"sizeS": "
|
|
3
|
-
"sizeM": "
|
|
4
|
-
"sizeL": "
|
|
5
|
-
"menu": "
|
|
6
|
-
"menuSizeS": "
|
|
7
|
-
"menuSizeM": "
|
|
8
|
-
"menuSizeL": "
|
|
9
|
-
"withGroupsLabel": "
|
|
10
|
-
"lastOption": "
|
|
11
|
-
"divider": "
|
|
12
|
-
"checkIcon": "
|
|
13
|
-
"observable": "
|
|
2
|
+
"sizeS": "_sizeS_vvka4z_3",
|
|
3
|
+
"sizeM": "_sizeM_vvka4z_6",
|
|
4
|
+
"sizeL": "_sizeL_vvka4z_9",
|
|
5
|
+
"menu": "_menu_vvka4z_13",
|
|
6
|
+
"menuSizeS": "_menuSizeS_vvka4z_26",
|
|
7
|
+
"menuSizeM": "_menuSizeM_vvka4z_30",
|
|
8
|
+
"menuSizeL": "_menuSizeL_vvka4z_34",
|
|
9
|
+
"withGroupsLabel": "_withGroupsLabel_vvka4z_40",
|
|
10
|
+
"lastOption": "_lastOption_vvka4z_39",
|
|
11
|
+
"divider": "_divider_vvka4z_45",
|
|
12
|
+
"checkIcon": "_checkIcon_vvka4z_51",
|
|
13
|
+
"observable": "_observable_vvka4z_56"
|
|
14
14
|
};
|
|
15
15
|
export { styles as default };
|
package/lib/parts/foldable.js
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
3
|
-
import _classCallCheck from "@babel/runtime-corejs3/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime-corejs3/helpers/esm/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/esm/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime-corejs3/helpers/esm/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/esm/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
10
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
11
|
-
import _toConsumableArray from "@babel/runtime-corejs3/helpers/esm/toConsumableArray";
|
|
12
|
-
var _excluded = ["children"];
|
|
13
|
-
|
|
14
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
15
|
-
|
|
16
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
|
-
|
|
18
|
-
import "core-js/modules/es.object.to-string.js";
|
|
19
|
-
import "core-js/modules/es.promise.js";
|
|
20
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
21
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
22
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
23
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
24
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
|
|
25
1
|
import React, { Component } from 'react';
|
|
26
2
|
import { throttle } from './throttle.js';
|
|
27
3
|
|
|
28
4
|
function lastVisibleIndex(lens, maxLen, gap) {
|
|
29
|
-
|
|
30
|
-
|
|
5
|
+
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
6
|
+
let currentLen = 0;
|
|
31
7
|
|
|
32
|
-
for (
|
|
33
|
-
|
|
8
|
+
for (let i = 0; i < lens.length; ++i) {
|
|
9
|
+
const gapIfNeeded = i === 0 ? 0 : gap;
|
|
34
10
|
|
|
35
11
|
if (currentLen + lens[i] + gapIfNeeded > maxLen - extra) {
|
|
36
12
|
return [i - 1, maxLen - currentLen];
|
|
@@ -50,12 +26,9 @@ function measureElement(element) {
|
|
|
50
26
|
} // Flattens all child elements into a single list
|
|
51
27
|
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var flat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
57
|
-
|
|
58
|
-
var newFlat = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(flat), _toConsumableArray(React.Children.toArray(children)));
|
|
29
|
+
const flatten = function (children) {
|
|
30
|
+
let flat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
31
|
+
const newFlat = [...flat, ...React.Children.toArray(children)];
|
|
59
32
|
|
|
60
33
|
if (children.props && children.props.children) {
|
|
61
34
|
return flatten(children.props.children, newFlat);
|
|
@@ -65,234 +38,199 @@ var flatten = function flatten(children) {
|
|
|
65
38
|
}; // Strips all circular references and internal fields
|
|
66
39
|
|
|
67
40
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
const simplify = children => {
|
|
42
|
+
const flat = flatten(children);
|
|
43
|
+
return flat.map(_ref => {
|
|
44
|
+
let {
|
|
45
|
+
key,
|
|
46
|
+
type,
|
|
47
|
+
props: {
|
|
48
|
+
children: flattenChildren,
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
} = _ref;
|
|
77
52
|
return {
|
|
78
|
-
key
|
|
79
|
-
type
|
|
80
|
-
props
|
|
53
|
+
key,
|
|
54
|
+
type,
|
|
55
|
+
props
|
|
81
56
|
};
|
|
82
57
|
});
|
|
83
58
|
};
|
|
84
59
|
|
|
85
|
-
|
|
86
|
-
|
|
60
|
+
class Foldable extends Component {
|
|
61
|
+
// eslint-disable-next-line react/sort-comp
|
|
62
|
+
containerRef;
|
|
63
|
+
plusNRef;
|
|
64
|
+
childrenEls;
|
|
65
|
+
childrenWidths;
|
|
66
|
+
resizeObserver;
|
|
67
|
+
tagsResizeObserver;
|
|
68
|
+
|
|
69
|
+
constructor(props) {
|
|
70
|
+
super(props);
|
|
71
|
+
this.state = {
|
|
72
|
+
lastVisible: props.children.length - 1,
|
|
73
|
+
renderingStage: 0,
|
|
74
|
+
prevChildren: props.children
|
|
75
|
+
};
|
|
76
|
+
this.containerRef = /*#__PURE__*/React.createRef();
|
|
77
|
+
this.plusNRef = /*#__PURE__*/React.createRef();
|
|
78
|
+
this.childrenEls = [];
|
|
79
|
+
this.childrenWidths = [];
|
|
80
|
+
}
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
static getDerivedStateFromProps(props, state) {
|
|
83
|
+
if (JSON.stringify(simplify(props.children)) !== JSON.stringify(simplify(state.prevChildren))) {
|
|
84
|
+
return {
|
|
85
|
+
prevChildren: props.children,
|
|
86
|
+
renderingStage: 0
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _this;
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
observeChildren() {
|
|
94
|
+
let isInitialized = false;
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
const onTagsSizeChangedThrottled = () => {
|
|
97
|
+
if (isInitialized && // skip updating if the container is not displayed on the page
|
|
98
|
+
this.containerRef.current.offsetParent !== null) {
|
|
99
|
+
this.setState({
|
|
100
|
+
renderingStage: 0
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
isInitialized = true;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
if (this.tagsResizeObserver) {
|
|
108
|
+
this.tagsResizeObserver.disconnect();
|
|
109
|
+
}
|
|
97
110
|
|
|
98
|
-
|
|
111
|
+
this.tagsResizeObserver = new ResizeObserver(onTagsSizeChangedThrottled);
|
|
112
|
+
this.childrenEls.forEach(child => this.tagsResizeObserver.observe(child));
|
|
113
|
+
}
|
|
99
114
|
|
|
100
|
-
|
|
115
|
+
componentDidMount() {
|
|
116
|
+
const {
|
|
117
|
+
renderingStage
|
|
118
|
+
} = this.state;
|
|
101
119
|
|
|
102
|
-
|
|
120
|
+
if (renderingStage === 0) {
|
|
121
|
+
this.measureChildren();
|
|
122
|
+
this.observeChildren();
|
|
123
|
+
this.recalculateLastVisibleAndSetStage(1);
|
|
124
|
+
}
|
|
103
125
|
|
|
104
|
-
|
|
126
|
+
const onSizeChangedThrottled = throttle(() => {
|
|
127
|
+
if (this.state.renderingStage === 2) {
|
|
128
|
+
this.recalculateLastVisibleAndSetStage();
|
|
129
|
+
}
|
|
130
|
+
}, 50);
|
|
131
|
+
this.resizeObserver = new ResizeObserver(onSizeChangedThrottled);
|
|
132
|
+
this.resizeObserver.observe(this.containerRef.current);
|
|
133
|
+
}
|
|
105
134
|
|
|
106
|
-
|
|
135
|
+
componentDidUpdate() {
|
|
136
|
+
const {
|
|
137
|
+
renderingStage
|
|
138
|
+
} = this.state;
|
|
139
|
+
|
|
140
|
+
if (renderingStage === 0) {
|
|
141
|
+
this.measureChildren();
|
|
142
|
+
this.observeChildren();
|
|
143
|
+
this.recalculateLastVisibleAndSetStage(1);
|
|
144
|
+
} else if (renderingStage === 1) {
|
|
145
|
+
this.recalculateLastVisibleAndSetStage(2);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
107
148
|
|
|
108
|
-
|
|
149
|
+
componentWillUnmount() {
|
|
150
|
+
if (this.resizeObserver) {
|
|
151
|
+
this.resizeObserver.disconnect();
|
|
152
|
+
}
|
|
109
153
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
154
|
+
if (this.tagsResizeObserver) {
|
|
155
|
+
this.tagsResizeObserver.disconnect();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
113
158
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
159
|
+
measureChildren = () => {
|
|
160
|
+
const {
|
|
161
|
+
childrenEls
|
|
162
|
+
} = this;
|
|
119
163
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
164
|
+
if (childrenEls.some(r => r === null)) {
|
|
165
|
+
throw new Error('childrenEls should be all not nulls');
|
|
166
|
+
}
|
|
124
167
|
|
|
125
|
-
|
|
126
|
-
|
|
168
|
+
this.childrenWidths = childrenEls.map(r => measureElement(r).width);
|
|
169
|
+
};
|
|
170
|
+
recalculateLastVisibleAndSetStage = (() => {
|
|
171
|
+
var _this = this;
|
|
127
172
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
173
|
+
return function () {
|
|
174
|
+
let nextStage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
175
|
+
const {
|
|
176
|
+
containerRef,
|
|
177
|
+
plusNRef
|
|
178
|
+
} = _this;
|
|
131
179
|
|
|
132
180
|
if (!containerRef.current) {
|
|
133
181
|
throw new Error('containerRef should be not null during recalculate');
|
|
134
182
|
}
|
|
135
183
|
|
|
136
|
-
|
|
137
|
-
|
|
184
|
+
const containerWidth = measureElement(containerRef.current).width;
|
|
185
|
+
let plusNWidth = 0;
|
|
138
186
|
|
|
139
187
|
if (plusNRef.current) {
|
|
140
188
|
plusNWidth = measureElement(plusNRef.current).width;
|
|
141
189
|
}
|
|
142
190
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var children = React.Children.toArray(_this.props.children);
|
|
152
|
-
var showLastChildIfFit = index === children.length - 2 && extra - gap - 1 > _this.childrenWidths[_this.childrenWidths.length - 1];
|
|
153
|
-
var newLastVisible = index + (showLastChildIfFit ? 1 : 0);
|
|
154
|
-
var newState = {
|
|
191
|
+
const containerStyles = getComputedStyle(containerRef.current);
|
|
192
|
+
const gap = parseInt(containerStyles.getPropertyValue('--_rs-select-trigger-foldable-gap'), 10) || 0;
|
|
193
|
+
const [index, extra] = lastVisibleIndex(_this.childrenWidths, containerWidth, gap, plusNWidth + gap + 1);
|
|
194
|
+
const children = React.Children.toArray(_this.props.children);
|
|
195
|
+
const showLastChildIfFit = index === children.length - 2 && extra - gap - 1 > _this.childrenWidths[_this.childrenWidths.length - 1];
|
|
196
|
+
const newLastVisible = index + (showLastChildIfFit ? 1 : 0);
|
|
197
|
+
const newState = {
|
|
155
198
|
lastVisible: newLastVisible,
|
|
156
199
|
renderingStage: nextStage ? nextStage : _this.state.renderingStage
|
|
157
200
|
};
|
|
158
201
|
|
|
159
202
|
_this.setState(newState);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
_this.state = {
|
|
163
|
-
lastVisible: props.children.length - 1,
|
|
164
|
-
renderingStage: 0,
|
|
165
|
-
prevChildren: props.children
|
|
166
203
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
key: "observeChildren",
|
|
176
|
-
value: function observeChildren() {
|
|
177
|
-
var _this2 = this;
|
|
178
|
-
|
|
179
|
-
var isInitialized = false;
|
|
180
|
-
|
|
181
|
-
var onTagsSizeChangedThrottled = function onTagsSizeChangedThrottled() {
|
|
182
|
-
if (isInitialized && // skip updating if the container is not displayed on the page
|
|
183
|
-
_this2.containerRef.current.offsetParent !== null) {
|
|
184
|
-
_this2.setState({
|
|
185
|
-
renderingStage: 0
|
|
186
|
-
});
|
|
187
|
-
} else {
|
|
188
|
-
isInitialized = true;
|
|
204
|
+
})();
|
|
205
|
+
|
|
206
|
+
renderChildren(lastVisible) {
|
|
207
|
+
const children = React.Children.toArray(this.props.children);
|
|
208
|
+
return children.slice(0, lastVisible + 1).map((child, i) => /*#__PURE__*/React.cloneElement(child, {
|
|
209
|
+
ref: el => {
|
|
210
|
+
if (el) {
|
|
211
|
+
this.childrenEls[i] = el;
|
|
189
212
|
}
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
if (this.tagsResizeObserver) {
|
|
193
|
-
this.tagsResizeObserver.disconnect();
|
|
194
213
|
}
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
195
216
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
key: "componentDidMount",
|
|
203
|
-
value: function componentDidMount() {
|
|
204
|
-
var _this3 = this;
|
|
205
|
-
|
|
206
|
-
var renderingStage = this.state.renderingStage;
|
|
207
|
-
|
|
208
|
-
if (renderingStage === 0) {
|
|
209
|
-
this.measureChildren();
|
|
210
|
-
this.observeChildren();
|
|
211
|
-
this.recalculateLastVisibleAndSetStage(1);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
var onSizeChangedThrottled = throttle(function () {
|
|
215
|
-
if (_this3.state.renderingStage === 2) {
|
|
216
|
-
_this3.recalculateLastVisibleAndSetStage();
|
|
217
|
-
}
|
|
218
|
-
}, 50);
|
|
219
|
-
this.resizeObserver = new ResizeObserver(onSizeChangedThrottled);
|
|
220
|
-
this.resizeObserver.observe(this.containerRef.current);
|
|
221
|
-
}
|
|
222
|
-
}, {
|
|
223
|
-
key: "componentDidUpdate",
|
|
224
|
-
value: function componentDidUpdate() {
|
|
225
|
-
var renderingStage = this.state.renderingStage;
|
|
226
|
-
|
|
227
|
-
if (renderingStage === 0) {
|
|
228
|
-
this.measureChildren();
|
|
229
|
-
this.observeChildren();
|
|
230
|
-
this.recalculateLastVisibleAndSetStage(1);
|
|
231
|
-
} else if (renderingStage === 1) {
|
|
232
|
-
this.recalculateLastVisibleAndSetStage(2);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}, {
|
|
236
|
-
key: "componentWillUnmount",
|
|
237
|
-
value: function componentWillUnmount() {
|
|
238
|
-
if (this.resizeObserver) {
|
|
239
|
-
this.resizeObserver.disconnect();
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (this.tagsResizeObserver) {
|
|
243
|
-
this.tagsResizeObserver.disconnect();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}, {
|
|
247
|
-
key: "renderChildren",
|
|
248
|
-
value: function renderChildren(lastVisible) {
|
|
249
|
-
var _context2,
|
|
250
|
-
_this4 = this;
|
|
251
|
-
|
|
252
|
-
var children = React.Children.toArray(this.props.children);
|
|
253
|
-
return _mapInstanceProperty(_context2 = _sliceInstanceProperty(children).call(children, 0, lastVisible + 1)).call(_context2, function (child, i) {
|
|
254
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
255
|
-
ref: function ref(el) {
|
|
256
|
-
if (el) {
|
|
257
|
-
_this4.childrenEls[i] = el;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "render",
|
|
265
|
-
value: function render() {
|
|
266
|
-
var renderHiddenCounter = this.props.renderHiddenCounter;
|
|
267
|
-
var children = React.Children.toArray(this.props.children);
|
|
268
|
-
var lastVisible = this.state.renderingStage === 0 ? children.length - 1 : this.state.lastVisible;
|
|
269
|
-
|
|
270
|
-
if (children.length !== this.childrenEls.length) {
|
|
271
|
-
var _context3;
|
|
272
|
-
|
|
273
|
-
this.childrenEls = _sliceInstanceProperty(_context3 = this.childrenEls).call(_context3, 0, children.length);
|
|
274
|
-
}
|
|
217
|
+
render() {
|
|
218
|
+
const {
|
|
219
|
+
renderHiddenCounter
|
|
220
|
+
} = this.props;
|
|
221
|
+
const children = React.Children.toArray(this.props.children);
|
|
222
|
+
const lastVisible = this.state.renderingStage === 0 ? children.length - 1 : this.state.lastVisible;
|
|
275
223
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
ref: this.containerRef
|
|
279
|
-
}, this.renderChildren(lastVisible), lastVisible !== children.length - 1 ? renderHiddenCounter(children.length - lastVisible - 1, this.plusNRef) : null);
|
|
224
|
+
if (children.length !== this.childrenEls.length) {
|
|
225
|
+
this.childrenEls = this.childrenEls.slice(0, children.length);
|
|
280
226
|
}
|
|
281
|
-
}], [{
|
|
282
|
-
key: "getDerivedStateFromProps",
|
|
283
|
-
value: function getDerivedStateFromProps(props, state) {
|
|
284
|
-
if (_JSON$stringify(simplify(props.children)) !== _JSON$stringify(simplify(state.prevChildren))) {
|
|
285
|
-
return {
|
|
286
|
-
prevChildren: props.children,
|
|
287
|
-
renderingStage: 0
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
227
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
228
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: this.props.className,
|
|
230
|
+
ref: this.containerRef
|
|
231
|
+
}, this.renderChildren(lastVisible), lastVisible !== children.length - 1 ? renderHiddenCounter(children.length - lastVisible - 1, this.plusNRef) : null);
|
|
232
|
+
}
|
|
294
233
|
|
|
295
|
-
|
|
296
|
-
}(Component);
|
|
234
|
+
}
|
|
297
235
|
|
|
298
236
|
export { Foldable as default };
|
|
@@ -3,19 +3,21 @@ import cn from 'classnames';
|
|
|
3
3
|
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
4
4
|
import WarningIcon from '../_virtual/warning.js';
|
|
5
5
|
import styles from './form-trigger.p.module.css.js';
|
|
6
|
-
|
|
6
|
+
const SIZE_STYLES = {
|
|
7
7
|
l: styles.sizeL,
|
|
8
8
|
m: styles.sizeM,
|
|
9
9
|
s: styles.sizeS
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
const THEME_STYLES = {
|
|
12
12
|
light: styles.themeLight,
|
|
13
13
|
dark: styles.themeDark
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const Label = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
boldLabel
|
|
20
|
+
} = _ref;
|
|
19
21
|
|
|
20
22
|
if (!children) {
|
|
21
23
|
return null;
|
|
@@ -27,17 +29,19 @@ var Label = function Label(_ref) {
|
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
const FormTriggerWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
33
|
+
let {
|
|
34
|
+
size,
|
|
35
|
+
theme: themeFromProps,
|
|
36
|
+
className,
|
|
37
|
+
error,
|
|
38
|
+
label,
|
|
39
|
+
note,
|
|
40
|
+
children,
|
|
41
|
+
onKeyDown,
|
|
42
|
+
boldLabel
|
|
43
|
+
} = _ref2;
|
|
44
|
+
const theme = useThemeWithUndefined(themeFromProps);
|
|
41
45
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
46
|
className: cn(className, styles.main, SIZE_STYLES[size], THEME_STYLES[theme]),
|
|
43
47
|
ref: ref,
|
|
@@ -52,7 +56,8 @@ var FormTriggerWrapper = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
52
56
|
"data-rs-internal": 'select-form-trigger-wrapper__error-message'
|
|
53
57
|
}, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
54
58
|
className: styles.errorIcon,
|
|
55
|
-
"data-rs-internal": 'select-form-trigger-wrapper__error-icon'
|
|
59
|
+
"data-rs-internal": 'select-form-trigger-wrapper__error-icon',
|
|
60
|
+
"data-render-all-sizes": true
|
|
56
61
|
}), /*#__PURE__*/React.createElement("span", null, error)), note && /*#__PURE__*/React.createElement("div", {
|
|
57
62
|
className: styles.note,
|
|
58
63
|
"data-rs-internal": 'select-form-trigger-wrapper__note'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"themeLight": "
|
|
3
|
-
"themeDark": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"main": "
|
|
8
|
-
"label": "
|
|
9
|
-
"errorMessage": "
|
|
10
|
-
"errorIcon": "
|
|
11
|
-
"note": "
|
|
2
|
+
"themeLight": "_themeLight_bn5t9y_7",
|
|
3
|
+
"themeDark": "_themeDark_bn5t9y_10",
|
|
4
|
+
"sizeS": "_sizeS_bn5t9y_14",
|
|
5
|
+
"sizeM": "_sizeM_bn5t9y_17",
|
|
6
|
+
"sizeL": "_sizeL_bn5t9y_20",
|
|
7
|
+
"main": "_main_bn5t9y_24",
|
|
8
|
+
"label": "_label_bn5t9y_28",
|
|
9
|
+
"errorMessage": "_errorMessage_bn5t9y_34",
|
|
10
|
+
"errorIcon": "_errorIcon_bn5t9y_45",
|
|
11
|
+
"note": "_note_bn5t9y_50"
|
|
12
12
|
};
|
|
13
13
|
export { styles as default };
|