@zohodesk/components 1.0.0-temp-239 → 1.0.0-temp-241
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 +3 -1
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +163 -163
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +8 -8
- package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +465 -465
- package/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css +31 -31
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +3 -3
- package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +465 -465
- package/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css +31 -31
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +3 -3
- package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +465 -465
- package/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css +31 -31
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +3 -3
- package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +465 -465
- package/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css +31 -31
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +3 -3
- package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +465 -465
- package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css +31 -31
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +3 -3
- package/assets/Appearance/light/mode/Component_LightMode.module.css +160 -160
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +8 -8
- package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +465 -465
- package/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css +31 -31
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +3 -3
- package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +465 -465
- package/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css +31 -31
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +3 -3
- package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +465 -465
- package/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css +31 -31
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +3 -3
- package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +465 -465
- package/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css +31 -31
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +3 -3
- package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +465 -465
- package/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css +31 -31
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +3 -3
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +165 -165
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +8 -8
- package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +465 -465
- package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css +31 -31
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +3 -3
- package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +465 -465
- package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css +31 -31
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +3 -3
- package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +465 -465
- package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css +31 -31
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +3 -3
- package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +465 -465
- package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css +31 -31
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +3 -3
- package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +465 -465
- package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css +31 -31
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +3 -3
- package/es/MultiSelect/MultiSelect.js +47 -22
- package/es/Popup/Popup.js +27 -50
- package/es/Select/Select.js +43 -21
- package/es/Select/props/defaultProps.js +1 -0
- package/es/Select/props/propTypes.js +1 -0
- package/lib/MultiSelect/MultiSelect.js +44 -22
- package/lib/Popup/Popup.js +50 -77
- package/lib/Select/Select.js +38 -19
- package/lib/Select/props/defaultProps.js +1 -0
- package/lib/Select/props/propTypes.js +1 -0
- package/package.json +3 -3
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
[data-mode='pureDark'][data-theme='yellow'] {
|
|
2
2
|
/* CTA variables */
|
|
3
|
-
--zdt_cta_primary_text: hsla(37, 66.94
|
|
4
|
-
--zdt_cta_primary_hover_text: hsla(37, 66.48
|
|
5
|
-
--zdt_cta_primary_bg: hsla(37, 66.94
|
|
6
|
-
--zdt_cta_primary_hover_bg: hsla(39, 90.18
|
|
7
|
-
--zdt_cta_primary_border: hsla(37, 66.94
|
|
8
|
-
--zdt_cta_primary_hover_border: hsla(39, 90.18
|
|
3
|
+
--zdt_cta_primary_text: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
4
|
+
--zdt_cta_primary_hover_text: hsla(37, calc(var(--zd-mc) * 66.48%), calc(64.90% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
5
|
+
--zdt_cta_primary_bg: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_darker_low)), calc(1 + var(--zdc_alpha_low)));
|
|
6
|
+
--zdt_cta_primary_hover_bg: hsla(39, calc(var(--zd-mc) * 90.18%), calc(31.96% + var(--zdc_darker_low)), calc(1 + var(--zdc_alpha_low)));
|
|
7
|
+
--zdt_cta_primary_border: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
8
|
+
--zdt_cta_primary_hover_border: hsla(39, calc(var(--zd-mc) * 90.18%), calc(31.96% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
9
9
|
--zdt_cta_primary_box_shadow: rgba(232, 185, 35, 0.2);
|
|
10
10
|
--zdt_cta_primary_hover_box_shadow: rgba(181, 145, 0, 0.25);
|
|
11
|
-
--zdt_cta_primary_light_bg: hsla(35, 15.00
|
|
12
|
-
--zdt_cta_primary_light_hover_bg: hsla(37, 12.70
|
|
13
|
-
--zdt_cta_primary_light_border: hsla(37, 12.70
|
|
14
|
-
--zdt_cta_secondary_bg: hsla(37, 66.94
|
|
15
|
-
--zdt_cta_secondary_text: hsla(0, 0.00
|
|
16
|
-
--zdt_cta_secondary_border: hsla(0, 0.00
|
|
17
|
-
--zdt_cta_secondary_light_border: hsla(38, 30.19
|
|
18
|
-
--zdt_cta_secondary_light_bg: hsla(38, 30.19
|
|
19
|
-
--zdt_cta_alpha_text: hsla(37, 66.94
|
|
20
|
-
--zdt_cta_alpha_hover_text: hsla(39, 90.18
|
|
21
|
-
--zdt_cta_alpha_border: hsla(37, 66.94
|
|
22
|
-
--zdt_cta_alpha_hover_border: hsla(39, 90.18
|
|
23
|
-
--zdt_cta_alpha_bg: hsla(220, 2.75
|
|
24
|
-
--zdt_cta_beta_border: hsla(37, 66.94
|
|
25
|
-
--zdt_cta_grey_10_bg: hsla(0, 0.00
|
|
26
|
-
--zdt_cta_grey_10_border: hsla(0, 0.00
|
|
27
|
-
--zdt_cta_grey_15_bg: hsla(0, 2.33
|
|
28
|
-
--zdt_cta_grey_15_border: hsla(0, 2.33
|
|
29
|
-
--zdt_cta_grey_20_bg: hsla(217, 22.81
|
|
30
|
-
--zdt_cta_grey_35_bg: hsla(0, 0.00
|
|
31
|
-
--zdt_cta_grey_35_text: hsla(0, 0.00
|
|
32
|
-
--zdt_cta_grey_35_border: hsla(0, 0.00
|
|
33
|
-
--zdt_cta_grey_40_bg: hsla(0, 0.00
|
|
34
|
-
--zdt_cta_grey_40_text: hsla(0, 0.00
|
|
35
|
-
--zdt_cta_grey_40_border: hsla(0, 0.00
|
|
11
|
+
--zdt_cta_primary_light_bg: hsla(35, calc(var(--zd-mc) * 15.00%), calc(15.69% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
12
|
+
--zdt_cta_primary_light_hover_bg: hsla(37, calc(var(--zd-mc) * 12.70%), calc(24.71% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
13
|
+
--zdt_cta_primary_light_border: hsla(37, calc(var(--zd-mc) * 12.70%), calc(24.71% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
14
|
+
--zdt_cta_secondary_bg: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
15
|
+
--zdt_cta_secondary_text: hsla(0, calc(var(--zd-mc) * 0.00%), calc(100.00% + var(--zdc_lighter_high)), calc(1 + var(--zdc_alpha_high)));
|
|
16
|
+
--zdt_cta_secondary_border: hsla(0, calc(var(--zd-mc) * 0.00%), calc(100.00% + var(--zdc_default_inverse_medium)), calc( 0.15 + var(--zdc_alpha_low)));
|
|
17
|
+
--zdt_cta_secondary_light_border: hsla(38, calc(var(--zd-mc) * 30.19%), calc(20.78% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
18
|
+
--zdt_cta_secondary_light_bg: hsla(38, calc(var(--zd-mc) * 30.19%), calc(20.78% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
19
|
+
--zdt_cta_alpha_text: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
20
|
+
--zdt_cta_alpha_hover_text: hsla(39, calc(var(--zd-mc) * 90.18%), calc(31.96% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
21
|
+
--zdt_cta_alpha_border: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
22
|
+
--zdt_cta_alpha_hover_border: hsla(39, calc(var(--zd-mc) * 90.18%), calc(31.96% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
23
|
+
--zdt_cta_alpha_bg: hsla(220, calc(var(--zd-mc) * 2.75%), calc(21.37% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
24
|
+
--zdt_cta_beta_border: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
25
|
+
--zdt_cta_grey_10_bg: hsla(0, calc(var(--zd-mc) * 0.00%), calc(14.90% + var(--zdc_darker_lowest)), calc(1 + var(--zdc_alpha_high)));
|
|
26
|
+
--zdt_cta_grey_10_border: hsla(0, calc(var(--zd-mc) * 0.00%), calc(14.90% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
27
|
+
--zdt_cta_grey_15_bg: hsla(0, calc(var(--zd-mc) * 2.33%), calc(8.43% + var(--zdc_darker_lowest)), calc(1 + var(--zdc_alpha_high)));
|
|
28
|
+
--zdt_cta_grey_15_border: hsla(0, calc(var(--zd-mc) * 2.33%), calc(8.43% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
29
|
+
--zdt_cta_grey_20_bg: hsla(217, calc(var(--zd-mc) * 22.81%), calc(11.18% + var(--zdc_darker_lowest)), calc(1 + var(--zdc_alpha_high)));
|
|
30
|
+
--zdt_cta_grey_35_bg: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_darker_lowest)), calc(1 + var(--zdc_alpha_high)));
|
|
31
|
+
--zdt_cta_grey_35_text: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
32
|
+
--zdt_cta_grey_35_border: hsla(0, calc(var(--zd-mc) * 0.00%), calc(21.96% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
33
|
+
--zdt_cta_grey_40_bg: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_darker_lowest)), calc(1 + var(--zdc_alpha_high)));
|
|
34
|
+
--zdt_cta_grey_40_text: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
35
|
+
--zdt_cta_grey_40_border: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
36
36
|
}
|
package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
--zdt_a11y_focusScope_focus_border: rgb(215,152,53);
|
|
45
45
|
|
|
46
46
|
/* button */
|
|
47
|
-
--zdt_button_primary_strike: hsla(37, 66.94
|
|
48
|
-
--zdt_button_primaryFilled_strike: hsla(0, 0.00
|
|
49
|
-
--zdt_button_secondaryFilled_strike: hsla(0, 0.00
|
|
47
|
+
--zdt_button_primary_strike: hsla(37, calc(var(--zd-mc) * 66.94%), calc(52.55% + var(--zdc_default_inverse_low)), calc( 0.33 + var(--zdc_alpha_low)));
|
|
48
|
+
--zdt_button_primaryFilled_strike: hsla(0, calc(var(--zd-mc) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.40 + var(--zdc_alpha_low)));
|
|
49
|
+
--zdt_button_secondaryFilled_strike: hsla(0, calc(var(--zd-mc) * 0.00%), calc(34.51% + var(--zdc_default_inverse)), calc( 0.7 + var(--zdc_alpha_high)));
|
|
50
50
|
}
|
|
@@ -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/Popup/Popup.js
CHANGED
|
@@ -159,7 +159,6 @@ const Popup = function (Component) {
|
|
|
159
159
|
this.handleScrollAndBlockEvents = this.handleScrollAndBlockEvents.bind(this);
|
|
160
160
|
this.handleIframeEventListeners = this.handleIframeEventListeners.bind(this);
|
|
161
161
|
this.handleDropElementStyleUpdate = this.handleDropElementStyleUpdate.bind(this);
|
|
162
|
-
this.waitForDropElement = this.waitForDropElement.bind(this);
|
|
163
162
|
this.positionRef = /*#__PURE__*/React.createRef();
|
|
164
163
|
this.rootElement = Registry.getRootElement();
|
|
165
164
|
this.popupObserver = new ResizeObserver(this.handlePopupResize);
|
|
@@ -385,25 +384,6 @@ const Popup = function (Component) {
|
|
|
385
384
|
});
|
|
386
385
|
}
|
|
387
386
|
|
|
388
|
-
waitForDropElement(callback) {
|
|
389
|
-
let maxRetries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
390
|
-
let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
391
|
-
|
|
392
|
-
if (this.dropElement) {
|
|
393
|
-
callback();
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (maxRetries <= 0) {
|
|
398
|
-
console.warn('Popup: dropElement not available after maximum retries');
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
setTimeout(() => {
|
|
403
|
-
this.waitForDropElement(callback, maxRetries - 1, Math.min(delay * 1.5, 1000));
|
|
404
|
-
}, delay);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
387
|
setContainerDynamicPositioning(betterPosition, needArrow) {
|
|
408
388
|
const {
|
|
409
389
|
dropElement
|
|
@@ -411,39 +391,32 @@ const Popup = function (Component) {
|
|
|
411
391
|
const {
|
|
412
392
|
isMobile
|
|
413
393
|
} = this.state;
|
|
394
|
+
const {
|
|
395
|
+
view,
|
|
396
|
+
viewsOffset
|
|
397
|
+
} = betterPosition || DUMMY_OBJECT;
|
|
398
|
+
const styleToApply = selectn(`${view}`, viewsOffset);
|
|
399
|
+
|
|
400
|
+
if (isMobile) {
|
|
401
|
+
this.handleDropElementStyleUpdate({
|
|
402
|
+
top: '',
|
|
403
|
+
left: '',
|
|
404
|
+
right: '',
|
|
405
|
+
bottom: ''
|
|
406
|
+
});
|
|
407
|
+
} else {
|
|
408
|
+
this.handleDropElementStyleUpdate(styleToApply);
|
|
414
409
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const {
|
|
419
|
-
view,
|
|
420
|
-
viewsOffset
|
|
421
|
-
} = betterPosition || DUMMY_OBJECT;
|
|
422
|
-
const styleToApply = selectn(`${view}`, viewsOffset);
|
|
423
|
-
|
|
424
|
-
if (isMobile) {
|
|
425
|
-
this.handleDropElementStyleUpdate({
|
|
426
|
-
top: '',
|
|
427
|
-
left: '',
|
|
428
|
-
right: '',
|
|
429
|
-
bottom: ''
|
|
430
|
-
});
|
|
431
|
-
} else {
|
|
432
|
-
this.handleDropElementStyleUpdate(styleToApply);
|
|
433
|
-
|
|
434
|
-
if (this.positionRef.current !== view) {
|
|
435
|
-
dropElement.setAttribute('data-position', `${view}`);
|
|
436
|
-
dropElement.setAttribute('data-box-direction', selectn(`${view}.direction`, positionMapping));
|
|
437
|
-
|
|
438
|
-
if (needArrow) {
|
|
439
|
-
dropElement.setAttribute('data-arrow-position', selectn(`${view}.arrowPosition`, positionMapping));
|
|
440
|
-
}
|
|
410
|
+
if (this.positionRef.current !== view) {
|
|
411
|
+
dropElement.setAttribute('data-position', `${view}`);
|
|
412
|
+
dropElement.setAttribute('data-box-direction', selectn(`${view}.direction`, positionMapping));
|
|
441
413
|
|
|
442
|
-
|
|
443
|
-
}
|
|
414
|
+
if (needArrow) {
|
|
415
|
+
dropElement.setAttribute('data-arrow-position', selectn(`${view}.arrowPosition`, positionMapping));
|
|
444
416
|
}
|
|
445
|
-
|
|
446
|
-
|
|
417
|
+
|
|
418
|
+
this.positionRef.current = view;
|
|
419
|
+
}
|
|
447
420
|
}
|
|
448
421
|
}
|
|
449
422
|
|
|
@@ -892,6 +865,10 @@ const Popup = function (Component) {
|
|
|
892
865
|
this.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
|
|
893
866
|
}
|
|
894
867
|
|
|
868
|
+
if (!dropElement) {
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
|
|
895
872
|
this.setContainerDynamicPositioning(betterPosition, needArrow);
|
|
896
873
|
} else {
|
|
897
874
|
if (position !== view || !isPopupReady) {
|
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,
|
|
@@ -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,
|