@zohodesk/components 1.4.16 → 1.4.17
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/README.md +8 -2
- package/es/MultiSelect/MultiSelect.js +47 -22
- package/es/Select/Select.js +43 -21
- package/es/Select/props/defaultProps.js +1 -0
- package/es/Select/props/propTypes.js +1 -0
- package/es/v1/Switch/css/Switch_v1.module.css +7 -1
- package/lib/MultiSelect/MultiSelect.js +44 -22
- package/lib/Select/Select.js +38 -19
- package/lib/Select/props/defaultProps.js +1 -0
- package/lib/Select/props/propTypes.js +1 -0
- package/lib/v1/Switch/css/Switch_v1.module.css +7 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
|
|
4
4
|
|
|
5
|
-
# 1.4.
|
|
5
|
+
# 1.4.17
|
|
6
|
+
|
|
7
|
+
- **Select, MultiSelect** - Fixed scroll jitter for the highlighted option when the virtualizer is enabled.
|
|
8
|
+
- **Select** - `isAnimate` prop supported
|
|
9
|
+
- `Switch_v1 css` - RTL issue on thumb position fixed.
|
|
10
|
+
|
|
11
|
+
# 1.4.14, 1.4.15 , 1.4.16
|
|
6
12
|
|
|
7
13
|
- `Common Css`
|
|
8
14
|
- added ltr class renamed to ltr-zone.
|
|
@@ -17,7 +23,7 @@ Dot UI is a customizable React component library built to deliver a clean, acces
|
|
|
17
23
|
# 1.4.12
|
|
18
24
|
|
|
19
25
|
- `TextBox`
|
|
20
|
-
- The event is passed as the 4th argument to both
|
|
26
|
+
- The event is passed as the 4th argument to both onBlur and onFocus
|
|
21
27
|
- `Common Css`
|
|
22
28
|
- added ltr class for change direction to ltr in rtl mode.
|
|
23
29
|
|
|
@@ -82,6 +82,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
82
82
|
this.handleScroll = this.handleScroll.bind(this);
|
|
83
83
|
this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
|
|
84
84
|
this.getVirtualizerPublicMethods = this.getVirtualizerPublicMethods.bind(this);
|
|
85
|
+
this.scrollToHighlightedIndex = this.scrollToHighlightedIndex.bind(this);
|
|
85
86
|
this.setSuggestionsVirtualizerContainerRefFunction = this.setSuggestionsVirtualizerContainerRefFunction.bind(this);
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -141,11 +142,49 @@ export class MultiSelectComponent extends React.Component {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
scrollToHighlightedIndex() {
|
|
146
|
+
const {
|
|
147
|
+
suggestionContainer,
|
|
148
|
+
selectedOptionContainer,
|
|
149
|
+
suggestionsOrder
|
|
150
|
+
} = this;
|
|
151
|
+
|
|
152
|
+
if (!suggestionContainer) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
const {
|
|
146
157
|
hoverOption,
|
|
147
158
|
highLightedSelectOptions,
|
|
148
|
-
selectedOptions
|
|
159
|
+
selectedOptions
|
|
160
|
+
} = this.state;
|
|
161
|
+
const {
|
|
162
|
+
isVirtualizerEnabled
|
|
163
|
+
} = this.props;
|
|
164
|
+
const hoverId = suggestionsOrder[hoverOption] || '';
|
|
165
|
+
const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
166
|
+
const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
|
|
167
|
+
selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
|
|
168
|
+
const selectedSuggestion = this[`suggestion_${hoverId}`];
|
|
169
|
+
|
|
170
|
+
if (selectedSuggestion) {
|
|
171
|
+
scrollTo(suggestionContainer, selectedSuggestion);
|
|
172
|
+
} else {
|
|
173
|
+
// Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
|
|
174
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
175
|
+
this.virtualizerMethods.scrollToIndex(hoverOption, 'auto', {
|
|
176
|
+
speed: 0,
|
|
177
|
+
duration: 0,
|
|
178
|
+
onComplete: () => {
|
|
179
|
+
scrollTo(suggestionContainer, selectedSuggestion);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
componentDidUpdate(prevProps, prevState) {
|
|
187
|
+
const {
|
|
149
188
|
searchStr
|
|
150
189
|
} = this.state;
|
|
151
190
|
const {
|
|
@@ -153,8 +192,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
153
192
|
isPopupOpen,
|
|
154
193
|
onDropBoxClose,
|
|
155
194
|
onDropBoxOpen,
|
|
156
|
-
isSearchClearOnClose
|
|
157
|
-
isVirtualizerEnabled
|
|
195
|
+
isSearchClearOnClose
|
|
158
196
|
} = this.props; //handle dropbox open & close
|
|
159
197
|
|
|
160
198
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
@@ -167,24 +205,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
167
205
|
isSearchClearOnClose && searchStr && this.handleSearch('');
|
|
168
206
|
onDropBoxClose && onDropBoxClose();
|
|
169
207
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
208
|
+
}
|
|
172
209
|
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverOption) < 50 && this.virtualizerMethods.scrollToIndex(hoverOption, position);
|
|
176
|
-
} else {
|
|
177
|
-
const {
|
|
178
|
-
suggestionContainer,
|
|
179
|
-
selectedOptionContainer,
|
|
180
|
-
suggestionsOrder
|
|
181
|
-
} = this;
|
|
182
|
-
const hoverId = suggestionsOrder[hoverOption] || '';
|
|
183
|
-
const selectedSuggestion = this[`suggestion_${hoverId}`];
|
|
184
|
-
const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
185
|
-
const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
|
|
186
|
-
isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
|
|
187
|
-
selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
|
|
210
|
+
if (isPopupOpen) {
|
|
211
|
+
this.scrollToHighlightedIndex();
|
|
188
212
|
} //When suggestions length less than 5, getNextOptions function call
|
|
189
213
|
|
|
190
214
|
|
|
@@ -1097,7 +1121,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1097
1121
|
boxPosition: position || `${defaultDropBoxPosition}`,
|
|
1098
1122
|
getRef: getContainerRef,
|
|
1099
1123
|
isActive: isPopupReady,
|
|
1100
|
-
isAnimate: isAnimate
|
|
1124
|
+
isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
|
|
1125
|
+
,
|
|
1101
1126
|
isArrow: false,
|
|
1102
1127
|
onClick: removeClose,
|
|
1103
1128
|
needResponsive: needResponsive,
|
package/es/Select/Select.js
CHANGED
|
@@ -107,6 +107,7 @@ export class SelectComponent extends Component {
|
|
|
107
107
|
this.handleExposePopupHandlers = this.handleExposePopupHandlers.bind(this);
|
|
108
108
|
this.handleGetAddNewOptionText = this.handleGetAddNewOptionText.bind(this);
|
|
109
109
|
this.getVirtualizerPublicMethods = this.getVirtualizerPublicMethods.bind(this);
|
|
110
|
+
this.scrollToHighlightedIndex = this.scrollToHighlightedIndex.bind(this);
|
|
110
111
|
this.setSuggestionsVirtualizerContainerRefFunction = this.setSuggestionsVirtualizerContainerRefFunction.bind(this);
|
|
111
112
|
this.valueInputTypeString = '';
|
|
112
113
|
this.valueInputSearchString = '';
|
|
@@ -175,9 +176,43 @@ export class SelectComponent extends Component {
|
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
scrollToHighlightedIndex() {
|
|
180
|
+
let {
|
|
181
|
+
suggestionContainer,
|
|
182
|
+
optionsOrder
|
|
183
|
+
} = this;
|
|
184
|
+
|
|
185
|
+
if (!suggestionContainer) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let {
|
|
190
|
+
hoverIndex
|
|
191
|
+
} = this.state;
|
|
192
|
+
let {
|
|
193
|
+
isVirtualizerEnabled
|
|
194
|
+
} = this.props;
|
|
195
|
+
let hoverId = getIsEmptyValue(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
|
|
196
|
+
let selSuggestion = this[`suggestion_${hoverId}`];
|
|
197
|
+
|
|
198
|
+
if (selSuggestion) {
|
|
199
|
+
scrollTo(suggestionContainer, selSuggestion);
|
|
200
|
+
} else {
|
|
201
|
+
// Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
|
|
202
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
203
|
+
this.virtualizerMethods.scrollToIndex(hoverIndex, 'auto', {
|
|
204
|
+
speed: 0,
|
|
205
|
+
duration: 0,
|
|
206
|
+
onComplete: () => {
|
|
207
|
+
scrollTo(suggestionContainer, selSuggestion);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
componentDidUpdate(prevProps) {
|
|
179
215
|
let {
|
|
180
|
-
hoverIndex,
|
|
181
216
|
searchStr,
|
|
182
217
|
selectedValueIndex
|
|
183
218
|
} = this.state;
|
|
@@ -188,31 +223,16 @@ export class SelectComponent extends Component {
|
|
|
188
223
|
needSearch,
|
|
189
224
|
onSearch,
|
|
190
225
|
isPopupOpen,
|
|
191
|
-
isSearchClearOnClose
|
|
192
|
-
isVirtualizerEnabled
|
|
226
|
+
isSearchClearOnClose
|
|
193
227
|
} = this.props;
|
|
194
228
|
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex, position);
|
|
198
|
-
} else {
|
|
199
|
-
let {
|
|
200
|
-
suggestionContainer,
|
|
201
|
-
optionsOrder
|
|
202
|
-
} = this;
|
|
203
|
-
let hoverId = getIsEmptyValue(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
|
|
204
|
-
let selSuggestion = this[`suggestion_${hoverId}`];
|
|
205
|
-
isPopupOpen && scrollTo(suggestionContainer, selSuggestion);
|
|
229
|
+
if (isPopupOpen) {
|
|
230
|
+
this.scrollToHighlightedIndex();
|
|
206
231
|
}
|
|
207
232
|
|
|
208
233
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
209
234
|
if (isPopupOpen) {
|
|
210
235
|
onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
211
|
-
|
|
212
|
-
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
213
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
236
|
setTimeout(() => {
|
|
217
237
|
this.searchInput && this.searchInput.focus({
|
|
218
238
|
preventScroll: true
|
|
@@ -713,6 +733,7 @@ export class SelectComponent extends Component {
|
|
|
713
733
|
getTargetRef,
|
|
714
734
|
getContainerRef,
|
|
715
735
|
removeClose,
|
|
736
|
+
isAnimate,
|
|
716
737
|
isPopupOpen,
|
|
717
738
|
isPopupReady,
|
|
718
739
|
animationStyle,
|
|
@@ -907,7 +928,8 @@ export class SelectComponent extends Component {
|
|
|
907
928
|
boxPosition: position || `${defaultDropBoxPosition}`,
|
|
908
929
|
getRef: getContainerRef,
|
|
909
930
|
isActive: isPopupReady,
|
|
910
|
-
isAnimate:
|
|
931
|
+
isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
|
|
932
|
+
,
|
|
911
933
|
isArrow: false,
|
|
912
934
|
onClick: removeClose,
|
|
913
935
|
needResponsive: needResponsive,
|
|
@@ -126,7 +126,13 @@
|
|
|
126
126
|
}
|
|
127
127
|
.checked {
|
|
128
128
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_bg);
|
|
129
|
-
|
|
129
|
+
}
|
|
130
|
+
[dir=ltr] .checked {
|
|
131
|
+
--local-switch-thumb-translateX: calc(var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px)
|
|
132
|
+
/*rtl: calc(-1 * (var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px))*/;
|
|
133
|
+
}
|
|
134
|
+
[dir=rtl] .checked {
|
|
135
|
+
--local-switch-thumb-translateX: calc(-1 * (var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px));
|
|
130
136
|
}
|
|
131
137
|
.unChecked {
|
|
132
138
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_bg);
|
|
@@ -163,6 +163,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
163
163
|
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
|
164
164
|
_this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
|
|
165
165
|
_this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
|
|
166
|
+
_this.scrollToHighlightedIndex = _this.scrollToHighlightedIndex.bind(_assertThisInitialized(_this));
|
|
166
167
|
_this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
|
|
167
168
|
return _this;
|
|
168
169
|
}
|
|
@@ -227,20 +228,52 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
}, {
|
|
230
|
-
key: "
|
|
231
|
-
value: function
|
|
231
|
+
key: "scrollToHighlightedIndex",
|
|
232
|
+
value: function scrollToHighlightedIndex() {
|
|
233
|
+
var suggestionContainer = this.suggestionContainer,
|
|
234
|
+
selectedOptionContainer = this.selectedOptionContainer,
|
|
235
|
+
suggestionsOrder = this.suggestionsOrder;
|
|
236
|
+
|
|
237
|
+
if (!suggestionContainer) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
232
241
|
var _this$state = this.state,
|
|
233
242
|
hoverOption = _this$state.hoverOption,
|
|
234
243
|
highLightedSelectOptions = _this$state.highLightedSelectOptions,
|
|
235
|
-
selectedOptions = _this$state.selectedOptions
|
|
236
|
-
|
|
244
|
+
selectedOptions = _this$state.selectedOptions;
|
|
245
|
+
var isVirtualizerEnabled = this.props.isVirtualizerEnabled;
|
|
246
|
+
var hoverId = suggestionsOrder[hoverOption] || '';
|
|
247
|
+
var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
248
|
+
var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
|
|
249
|
+
selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
|
|
250
|
+
var selectedSuggestion = this["suggestion_".concat(hoverId)];
|
|
251
|
+
|
|
252
|
+
if (selectedSuggestion) {
|
|
253
|
+
(0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
|
|
254
|
+
} else {
|
|
255
|
+
// Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
|
|
256
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
257
|
+
this.virtualizerMethods.scrollToIndex(hoverOption, 'auto', {
|
|
258
|
+
speed: 0,
|
|
259
|
+
duration: 0,
|
|
260
|
+
onComplete: function onComplete() {
|
|
261
|
+
(0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
key: "componentDidUpdate",
|
|
269
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
270
|
+
var searchStr = this.state.searchStr;
|
|
237
271
|
var _this$props2 = this.props,
|
|
238
272
|
needLocalSearch = _this$props2.needLocalSearch,
|
|
239
273
|
isPopupOpen = _this$props2.isPopupOpen,
|
|
240
274
|
onDropBoxClose = _this$props2.onDropBoxClose,
|
|
241
275
|
onDropBoxOpen = _this$props2.onDropBoxOpen,
|
|
242
|
-
isSearchClearOnClose = _this$props2.isSearchClearOnClose
|
|
243
|
-
isVirtualizerEnabled = _this$props2.isVirtualizerEnabled; //handle dropbox open & close
|
|
276
|
+
isSearchClearOnClose = _this$props2.isSearchClearOnClose; //handle dropbox open & close
|
|
244
277
|
|
|
245
278
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
246
279
|
isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
@@ -252,22 +285,10 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
252
285
|
isSearchClearOnClose && searchStr && this.handleSearch('');
|
|
253
286
|
onDropBoxClose && onDropBoxClose();
|
|
254
287
|
}
|
|
255
|
-
}
|
|
256
|
-
|
|
288
|
+
}
|
|
257
289
|
|
|
258
|
-
if (
|
|
259
|
-
|
|
260
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverOption) < 50 && this.virtualizerMethods.scrollToIndex(hoverOption, position);
|
|
261
|
-
} else {
|
|
262
|
-
var suggestionContainer = this.suggestionContainer,
|
|
263
|
-
selectedOptionContainer = this.selectedOptionContainer,
|
|
264
|
-
suggestionsOrder = this.suggestionsOrder;
|
|
265
|
-
var hoverId = suggestionsOrder[hoverOption] || '';
|
|
266
|
-
var selectedSuggestion = this["suggestion_".concat(hoverId)];
|
|
267
|
-
var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
268
|
-
var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
|
|
269
|
-
isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
|
|
270
|
-
selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
|
|
290
|
+
if (isPopupOpen) {
|
|
291
|
+
this.scrollToHighlightedIndex();
|
|
271
292
|
} //When suggestions length less than 5, getNextOptions function call
|
|
272
293
|
|
|
273
294
|
|
|
@@ -1175,7 +1196,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1175
1196
|
boxPosition: position || "".concat(defaultDropBoxPosition),
|
|
1176
1197
|
getRef: getContainerRef,
|
|
1177
1198
|
isActive: isPopupReady,
|
|
1178
|
-
isAnimate: isAnimate
|
|
1199
|
+
isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
|
|
1200
|
+
,
|
|
1179
1201
|
isArrow: false,
|
|
1180
1202
|
onClick: removeClose,
|
|
1181
1203
|
needResponsive: needResponsive,
|
package/lib/Select/Select.js
CHANGED
|
@@ -169,6 +169,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
169
169
|
_this.handleExposePopupHandlers = _this.handleExposePopupHandlers.bind(_assertThisInitialized(_this));
|
|
170
170
|
_this.handleGetAddNewOptionText = _this.handleGetAddNewOptionText.bind(_assertThisInitialized(_this));
|
|
171
171
|
_this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
|
|
172
|
+
_this.scrollToHighlightedIndex = _this.scrollToHighlightedIndex.bind(_assertThisInitialized(_this));
|
|
172
173
|
_this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
|
|
173
174
|
_this.valueInputTypeString = '';
|
|
174
175
|
_this.valueInputSearchString = '';
|
|
@@ -234,13 +235,42 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
234
235
|
selectedValueIndex: hoverIndex
|
|
235
236
|
});
|
|
236
237
|
}
|
|
238
|
+
}, {
|
|
239
|
+
key: "scrollToHighlightedIndex",
|
|
240
|
+
value: function scrollToHighlightedIndex() {
|
|
241
|
+
var suggestionContainer = this.suggestionContainer,
|
|
242
|
+
optionsOrder = this.optionsOrder;
|
|
243
|
+
|
|
244
|
+
if (!suggestionContainer) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var hoverIndex = this.state.hoverIndex;
|
|
249
|
+
var isVirtualizerEnabled = this.props.isVirtualizerEnabled;
|
|
250
|
+
var hoverId = (0, _Common.getIsEmptyValue)(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
|
|
251
|
+
var selSuggestion = this["suggestion_".concat(hoverId)];
|
|
252
|
+
|
|
253
|
+
if (selSuggestion) {
|
|
254
|
+
(0, _Common.scrollTo)(suggestionContainer, selSuggestion);
|
|
255
|
+
} else {
|
|
256
|
+
// Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
|
|
257
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
258
|
+
this.virtualizerMethods.scrollToIndex(hoverIndex, 'auto', {
|
|
259
|
+
speed: 0,
|
|
260
|
+
duration: 0,
|
|
261
|
+
onComplete: function onComplete() {
|
|
262
|
+
(0, _Common.scrollTo)(suggestionContainer, selSuggestion);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
237
268
|
}, {
|
|
238
269
|
key: "componentDidUpdate",
|
|
239
|
-
value: function componentDidUpdate(prevProps
|
|
270
|
+
value: function componentDidUpdate(prevProps) {
|
|
240
271
|
var _this2 = this;
|
|
241
272
|
|
|
242
273
|
var _this$state = this.state,
|
|
243
|
-
hoverIndex = _this$state.hoverIndex,
|
|
244
274
|
searchStr = _this$state.searchStr,
|
|
245
275
|
selectedValueIndex = _this$state.selectedValueIndex;
|
|
246
276
|
var _this$props = this.props,
|
|
@@ -250,28 +280,15 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
250
280
|
needSearch = _this$props.needSearch,
|
|
251
281
|
onSearch = _this$props.onSearch,
|
|
252
282
|
isPopupOpen = _this$props.isPopupOpen,
|
|
253
|
-
isSearchClearOnClose = _this$props.isSearchClearOnClose
|
|
254
|
-
isVirtualizerEnabled = _this$props.isVirtualizerEnabled;
|
|
283
|
+
isSearchClearOnClose = _this$props.isSearchClearOnClose;
|
|
255
284
|
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex, position);
|
|
259
|
-
} else {
|
|
260
|
-
var suggestionContainer = this.suggestionContainer,
|
|
261
|
-
optionsOrder = this.optionsOrder;
|
|
262
|
-
var hoverId = (0, _Common.getIsEmptyValue)(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
|
|
263
|
-
var selSuggestion = this["suggestion_".concat(hoverId)];
|
|
264
|
-
isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
|
|
285
|
+
if (isPopupOpen) {
|
|
286
|
+
this.scrollToHighlightedIndex();
|
|
265
287
|
}
|
|
266
288
|
|
|
267
289
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
268
290
|
if (isPopupOpen) {
|
|
269
291
|
onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
270
|
-
|
|
271
|
-
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
272
|
-
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
292
|
setTimeout(function () {
|
|
276
293
|
_this2.searchInput && _this2.searchInput.focus({
|
|
277
294
|
preventScroll: true
|
|
@@ -764,6 +781,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
764
781
|
getTargetRef = _this$props11.getTargetRef,
|
|
765
782
|
getContainerRef = _this$props11.getContainerRef,
|
|
766
783
|
removeClose = _this$props11.removeClose,
|
|
784
|
+
isAnimate = _this$props11.isAnimate,
|
|
767
785
|
isPopupOpen = _this$props11.isPopupOpen,
|
|
768
786
|
isPopupReady = _this$props11.isPopupReady,
|
|
769
787
|
animationStyle = _this$props11.animationStyle,
|
|
@@ -953,7 +971,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
953
971
|
boxPosition: position || "".concat(defaultDropBoxPosition),
|
|
954
972
|
getRef: getContainerRef,
|
|
955
973
|
isActive: isPopupReady,
|
|
956
|
-
isAnimate:
|
|
974
|
+
isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
|
|
975
|
+
,
|
|
957
976
|
isArrow: false,
|
|
958
977
|
onClick: removeClose,
|
|
959
978
|
needResponsive: needResponsive,
|
|
@@ -44,6 +44,7 @@ var Select_propTypes = {
|
|
|
44
44
|
noMoreText: _propTypes["default"].string,
|
|
45
45
|
searchEmptyText: _propTypes["default"].string
|
|
46
46
|
}),
|
|
47
|
+
isAnimate: _propTypes["default"].bool,
|
|
47
48
|
isDefaultSelectValue: _propTypes["default"].bool,
|
|
48
49
|
isDisabled: _propTypes["default"].bool,
|
|
49
50
|
isNextOptions: _propTypes["default"].bool,
|
|
@@ -126,7 +126,13 @@
|
|
|
126
126
|
}
|
|
127
127
|
.checked {
|
|
128
128
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_bg);
|
|
129
|
-
|
|
129
|
+
}
|
|
130
|
+
[dir=ltr] .checked {
|
|
131
|
+
--local-switch-thumb-translateX: calc(var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px)
|
|
132
|
+
/*rtl: calc(-1 * (var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px))*/;
|
|
133
|
+
}
|
|
134
|
+
[dir=rtl] .checked {
|
|
135
|
+
--local-switch-thumb-translateX: calc(-1 * (var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px));
|
|
130
136
|
}
|
|
131
137
|
.unChecked {
|
|
132
138
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_bg);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.17",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@zohodesk-private/css-variable-migrator": "1.0.9",
|
|
79
79
|
"@zohodesk-private/node-plugins": "1.1.13",
|
|
80
80
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
81
|
-
"@zohodesk/a11y": "2.3.
|
|
81
|
+
"@zohodesk/a11y": "2.3.8",
|
|
82
82
|
"@zohodesk/docstool": "1.0.0-alpha-2",
|
|
83
83
|
"@zohodesk/dotkit": "1.0.3",
|
|
84
84
|
"@zohodesk/hooks": "2.0.5",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"react-sortable-hoc": "^0.8.3",
|
|
108
108
|
"@zohodesk/hooks": "2.0.5",
|
|
109
109
|
"@zohodesk/utils": "1.3.14",
|
|
110
|
-
"@zohodesk/a11y": "2.3.
|
|
110
|
+
"@zohodesk/a11y": "2.3.8",
|
|
111
111
|
"@zohodesk/layout": "3.1.0",
|
|
112
112
|
"@zohodesk/dotkit": "1.0.3"
|
|
113
113
|
}
|