@zohodesk/components 1.0.0-alpha-213 → 1.0.0-alpha-217
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 +21 -1
- package/es/Appearance/dark/mode/darkMode.module.css +3 -13
- package/es/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +17 -0
- package/es/Appearance/dark/themes/green/greenDarkCTATheme.module.css +1 -1
- package/es/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +17 -0
- package/es/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +17 -0
- package/es/Appearance/dark/themes/red/redDarkCTATheme.module.css +1 -1
- package/es/Appearance/dark/themes/red/redDarkComponentTheme.module.css +17 -0
- package/es/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +17 -0
- package/es/Appearance/default/mode/defaultMode.module.css +9 -17
- package/es/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +17 -0
- package/es/Appearance/default/themes/green/greenDefaultCTATheme.module.css +1 -1
- package/es/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +17 -0
- package/es/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +1 -1
- package/es/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +17 -0
- package/es/Appearance/default/themes/red/redDefaultCTATheme.module.css +1 -1
- package/es/Appearance/default/themes/red/redDefaultComponentTheme.module.css +17 -0
- package/es/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +17 -0
- package/es/ListItem/ListItemWithAvatar.js +11 -3
- package/es/ListItem/ListItemWithIcon.js +12 -4
- package/es/MultiSelect/AdvancedMultiSelect.js +21 -9
- package/es/MultiSelect/MultiSelect.js +1 -1
- package/es/MultiSelect/Suggestions.js +11 -2
- package/es/MultiSelect/docs/AdvancedMultiSelect__default.docs.js +18 -3
- package/es/Select/GroupSelect.js +4 -4
- package/es/Select/Select.js +37 -10
- package/es/Select/docs/Select__default.docs.js +79 -0
- package/es/Tag/Tag.module.css +1 -0
- package/es/TextBox/TextBox.js +7 -4
- package/es/TextBoxIcon/TextBoxIcon.js +13 -4
- package/es/utils/Common.js +1 -1
- package/es/utils/dropDownUtils.js +12 -5
- package/lib/Appearance/dark/mode/darkMode.module.css +3 -13
- package/lib/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +17 -0
- package/lib/Appearance/dark/themes/green/greenDarkCTATheme.module.css +1 -1
- package/lib/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +17 -0
- package/lib/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +17 -0
- package/lib/Appearance/dark/themes/red/redDarkCTATheme.module.css +1 -1
- package/lib/Appearance/dark/themes/red/redDarkComponentTheme.module.css +17 -0
- package/lib/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +17 -0
- package/lib/Appearance/default/mode/defaultMode.module.css +9 -17
- package/lib/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +17 -0
- package/lib/Appearance/default/themes/green/greenDefaultCTATheme.module.css +1 -1
- package/lib/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +17 -0
- package/lib/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +1 -1
- package/lib/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +17 -0
- package/lib/Appearance/default/themes/red/redDefaultCTATheme.module.css +1 -1
- package/lib/Appearance/default/themes/red/redDefaultComponentTheme.module.css +17 -0
- package/lib/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +17 -0
- package/lib/ListItem/ListItemWithAvatar.js +9 -3
- package/lib/ListItem/ListItemWithIcon.js +11 -4
- package/lib/MultiSelect/AdvancedMultiSelect.js +20 -8
- package/lib/MultiSelect/MultiSelect.js +1 -1
- package/lib/MultiSelect/Suggestions.js +16 -2
- package/lib/MultiSelect/docs/AdvancedMultiSelect__default.docs.js +18 -3
- package/lib/Select/GroupSelect.js +3 -3
- package/lib/Select/Select.js +37 -10
- package/lib/Select/docs/Select__default.docs.js +79 -0
- package/lib/Tag/Tag.module.css +1 -0
- package/lib/TextBox/TextBox.js +6 -4
- package/lib/TextBoxIcon/TextBoxIcon.js +12 -4
- package/lib/utils/Common.js +1 -1
- package/lib/utils/dropDownUtils.js +13 -4
- package/package.json +1 -1
|
@@ -65,8 +65,12 @@ export default class ListItemWithIcon extends React.Component {
|
|
|
65
65
|
isDisabled,
|
|
66
66
|
disableTitle,
|
|
67
67
|
a11y,
|
|
68
|
-
customClass
|
|
68
|
+
customClass,
|
|
69
|
+
customProps
|
|
69
70
|
} = this.props;
|
|
71
|
+
let {
|
|
72
|
+
ListItemProps = {}
|
|
73
|
+
} = customProps;
|
|
70
74
|
let {
|
|
71
75
|
role,
|
|
72
76
|
ariaSelected,
|
|
@@ -96,7 +100,7 @@ export default class ListItemWithIcon extends React.Component {
|
|
|
96
100
|
eleRef: this.getRef,
|
|
97
101
|
tagName: "li",
|
|
98
102
|
"data-title": isDisabled ? disableTitle : null
|
|
99
|
-
}, options), iconName && /*#__PURE__*/React.createElement(Box, {
|
|
103
|
+
}, options, ListItemProps), iconName && /*#__PURE__*/React.createElement(Box, {
|
|
100
104
|
"aria-hidden": true,
|
|
101
105
|
className: style.iconBox,
|
|
102
106
|
dataId: dataId ? `${dataId}_Icon` : `${value.toLowerCase().replace("'", '_')}_Icon`
|
|
@@ -135,7 +139,8 @@ ListItemWithIcon.defaultProps = {
|
|
|
135
139
|
value: 'List',
|
|
136
140
|
needBorder: true,
|
|
137
141
|
a11y: {},
|
|
138
|
-
customClass: ''
|
|
142
|
+
customClass: '',
|
|
143
|
+
customProps: {}
|
|
139
144
|
};
|
|
140
145
|
ListItemWithIcon.propTypes = {
|
|
141
146
|
active: PropTypes.bool,
|
|
@@ -163,7 +168,10 @@ ListItemWithIcon.propTypes = {
|
|
|
163
168
|
ariaSelected: PropTypes.bool,
|
|
164
169
|
ariaHidden: PropTypes.bool
|
|
165
170
|
}),
|
|
166
|
-
customClass: PropTypes.string
|
|
171
|
+
customClass: PropTypes.string,
|
|
172
|
+
customProps: PropTypes.shape({
|
|
173
|
+
ListItemProps: PropTypes.object
|
|
174
|
+
})
|
|
167
175
|
};
|
|
168
176
|
|
|
169
177
|
if (false) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
/**** Libraries ****/
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
@@ -20,7 +22,7 @@ import { getUniqueId } from '../Provider/IdProvider';
|
|
|
20
22
|
import style from './AdvancedMultiSelect.module.css';
|
|
21
23
|
/**** Methods ****/
|
|
22
24
|
|
|
23
|
-
import { getIsEmptyValue } from '../utils/Common.js';
|
|
25
|
+
import { getIsEmptyValue, getSearchString } from '../utils/Common.js';
|
|
24
26
|
import { filterSelectedOptions } from '../utils/dropDownUtils';
|
|
25
27
|
/* eslint-disable react/sort-prop-types */
|
|
26
28
|
|
|
@@ -67,7 +69,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
67
69
|
} = this.getFilterSuggestions({
|
|
68
70
|
options,
|
|
69
71
|
selectedOptions: dummyArray,
|
|
70
|
-
searchStr: searchStr
|
|
72
|
+
searchStr: getSearchString(searchStr),
|
|
71
73
|
needSearch: needLocalSearch
|
|
72
74
|
});
|
|
73
75
|
this.suggestionsOrder = suggestionIds;
|
|
@@ -346,8 +348,13 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
346
348
|
a11y,
|
|
347
349
|
borderColor,
|
|
348
350
|
isBoxPaddingNeed,
|
|
349
|
-
getFooter
|
|
351
|
+
getFooter,
|
|
352
|
+
customProps
|
|
350
353
|
} = this.props;
|
|
354
|
+
let {
|
|
355
|
+
SuggestionsProps = {},
|
|
356
|
+
DropBoxProps = {}
|
|
357
|
+
} = customProps;
|
|
351
358
|
const {
|
|
352
359
|
clearText = 'Clear all'
|
|
353
360
|
} = i18nKeys;
|
|
@@ -433,7 +440,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
433
440
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
434
441
|
name: "ZD-delete",
|
|
435
442
|
size: "15"
|
|
436
|
-
})) : null), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(DropBox, {
|
|
443
|
+
})) : null), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(DropBox, _extends({
|
|
437
444
|
animationStyle: animationStyle,
|
|
438
445
|
boxPosition: position || `${defaultDropBoxPosition}Center`,
|
|
439
446
|
getRef: getContainerRef,
|
|
@@ -448,7 +455,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
448
455
|
role: 'listbox',
|
|
449
456
|
ariaMultiselectable: true
|
|
450
457
|
}
|
|
451
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
458
|
+
}, DropBoxProps), /*#__PURE__*/React.createElement(Card, {
|
|
452
459
|
customClass: style.box,
|
|
453
460
|
onScroll: this.handleScroll
|
|
454
461
|
}, /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
@@ -460,7 +467,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
460
467
|
})), /*#__PURE__*/React.createElement(CardContent, {
|
|
461
468
|
customClass: dropBoxSize ? style[dropBoxSize] : '',
|
|
462
469
|
eleRef: this.suggestionContainerRef
|
|
463
|
-
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
|
|
470
|
+
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
|
|
464
471
|
suggestions: suggestions,
|
|
465
472
|
selectedOptions: allselectedOptionIds,
|
|
466
473
|
getRef: this.suggestionItemRef,
|
|
@@ -472,7 +479,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
472
479
|
a11y: {
|
|
473
480
|
role: 'option'
|
|
474
481
|
}
|
|
475
|
-
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
482
|
+
}, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
476
483
|
isLoading: isFetchingOptions,
|
|
477
484
|
options: options,
|
|
478
485
|
searchString: searchStr,
|
|
@@ -560,7 +567,11 @@ AdvancedMultiSelectComponent.propTypes = {
|
|
|
560
567
|
isBoxPaddingNeed: PropTypes.bool,
|
|
561
568
|
isSearchClearOnSelect: PropTypes.bool,
|
|
562
569
|
disabledOptions: PropTypes.arrayOf(PropTypes.string),
|
|
563
|
-
getFooter: PropTypes.func
|
|
570
|
+
getFooter: PropTypes.func,
|
|
571
|
+
customProps: PropTypes.shape({
|
|
572
|
+
SuggestionsProps: PropTypes.object,
|
|
573
|
+
DropBoxProps: PropTypes.object
|
|
574
|
+
})
|
|
564
575
|
};
|
|
565
576
|
AdvancedMultiSelectComponent.defaultProps = {
|
|
566
577
|
animationStyle: 'bounce',
|
|
@@ -587,7 +598,8 @@ AdvancedMultiSelectComponent.defaultProps = {
|
|
|
587
598
|
a11y: {},
|
|
588
599
|
borderColor: 'default',
|
|
589
600
|
isBoxPaddingNeed: true,
|
|
590
|
-
isSearchClearOnSelect: true
|
|
601
|
+
isSearchClearOnSelect: true,
|
|
602
|
+
customProps: {}
|
|
591
603
|
};
|
|
592
604
|
AdvancedMultiSelectComponent.displayName = 'AdvancedMultiSelect';
|
|
593
605
|
const AdvancedMultiSelect = Popup(AdvancedMultiSelectComponent);
|
|
@@ -260,7 +260,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
260
260
|
} = this.getFilterSuggestions({
|
|
261
261
|
options,
|
|
262
262
|
selectedOptions,
|
|
263
|
-
searchStr: searchStr
|
|
263
|
+
searchStr: getSearchString(searchStr),
|
|
264
264
|
needSearch: needLocalSearch
|
|
265
265
|
});
|
|
266
266
|
this.suggestionsOrder = suggestionIds;
|
|
@@ -51,7 +51,8 @@ export default class Suggestions extends React.PureComponent {
|
|
|
51
51
|
icon,
|
|
52
52
|
optionType,
|
|
53
53
|
iconSize,
|
|
54
|
-
isDisabled
|
|
54
|
+
isDisabled,
|
|
55
|
+
listItemProps
|
|
55
56
|
} = suggestion;
|
|
56
57
|
const isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
|
|
57
58
|
const isHighlight = hoverOption === index || id === hoverId ? true : false;
|
|
@@ -62,6 +63,13 @@ export default class Suggestions extends React.PureComponent {
|
|
|
62
63
|
isDisabled
|
|
63
64
|
};
|
|
64
65
|
|
|
66
|
+
if (listItemProps) {
|
|
67
|
+
commonProps.customProps = {
|
|
68
|
+
'ListItemProps': { ...listItemProps
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
65
73
|
if (optionType === 'avatar') {
|
|
66
74
|
return /*#__PURE__*/React.createElement(ListItemWithAvatar, _extends({}, commonProps, {
|
|
67
75
|
autoHover: false,
|
|
@@ -151,7 +159,8 @@ Suggestions.propTypes = {
|
|
|
151
159
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
152
160
|
photoURL: PropTypes.string,
|
|
153
161
|
logo: PropTypes.string,
|
|
154
|
-
optionType: PropTypes.string
|
|
162
|
+
optionType: PropTypes.string,
|
|
163
|
+
listItemProps: PropTypes.object
|
|
155
164
|
}))
|
|
156
165
|
};
|
|
157
166
|
Suggestions.defaultProps = {
|
|
@@ -9,10 +9,20 @@ export default class AdvancedMultiSelect__default extends Component {
|
|
|
9
9
|
this.state = {
|
|
10
10
|
options: [{
|
|
11
11
|
id: 2,
|
|
12
|
-
text: 'text2'
|
|
12
|
+
text: 'text2',
|
|
13
|
+
listItemProps: {
|
|
14
|
+
style: {
|
|
15
|
+
color: 'red'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
13
18
|
}, {
|
|
14
19
|
id: 3,
|
|
15
|
-
text: 'text3'
|
|
20
|
+
text: 'text3',
|
|
21
|
+
listItemProps: {
|
|
22
|
+
style: {
|
|
23
|
+
color: 'blue'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
16
26
|
}, {
|
|
17
27
|
id: 4,
|
|
18
28
|
text: 'text4'
|
|
@@ -85,7 +95,12 @@ export default class AdvancedMultiSelect__default extends Component {
|
|
|
85
95
|
noMoreText: 'No More Options .',
|
|
86
96
|
searchEmptyText: 'No Matches Found .'
|
|
87
97
|
},
|
|
88
|
-
getFooter: this.getFooter
|
|
98
|
+
getFooter: this.getFooter,
|
|
99
|
+
customProps: {
|
|
100
|
+
SuggestionsProps: {
|
|
101
|
+
needBorder: false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
89
104
|
});
|
|
90
105
|
}
|
|
91
106
|
|
package/es/Select/GroupSelect.js
CHANGED
|
@@ -18,7 +18,7 @@ import style from './Select.module.css';
|
|
|
18
18
|
/**** Methods ****/
|
|
19
19
|
|
|
20
20
|
import { makeGetGroupSelectOptions, optionIdGrouping, makeGetGroupSelectFilterSuggestions, extractOptionId } from '../utils/dropDownUtils';
|
|
21
|
-
import { getIsEmptyValue, scrollTo, debounce } from '../utils/Common';
|
|
21
|
+
import { getIsEmptyValue, scrollTo, debounce, getSearchString } from '../utils/Common';
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
24
24
|
/* eslint-disable react/sort-prop-types */
|
|
@@ -214,7 +214,7 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
214
214
|
} = this.state;
|
|
215
215
|
|
|
216
216
|
if (needSearch && searchStr && searchStr.trim().length) {
|
|
217
|
-
searchStr = searchStr
|
|
217
|
+
searchStr = getSearchString(searchStr);
|
|
218
218
|
let {
|
|
219
219
|
suggestionGroups,
|
|
220
220
|
suggestionOptionIds
|
|
@@ -253,8 +253,8 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
253
253
|
let {
|
|
254
254
|
onSearch
|
|
255
255
|
} = this.props;
|
|
256
|
-
let searchStrRegex = searchStr
|
|
257
|
-
let valueStrRegex = value
|
|
256
|
+
let searchStrRegex = getSearchString(searchStr);
|
|
257
|
+
let valueStrRegex = getSearchString(value);
|
|
258
258
|
let isSearch = searchStrRegex !== valueStrRegex ? true : false;
|
|
259
259
|
this.setState({
|
|
260
260
|
searchStr: value,
|
package/es/Select/Select.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
/**** Libraries ****/
|
|
2
4
|
import React, { Component } from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
@@ -246,12 +248,17 @@ export class SelectComponent extends Component {
|
|
|
246
248
|
let {
|
|
247
249
|
options,
|
|
248
250
|
valueField,
|
|
249
|
-
textField
|
|
251
|
+
textField,
|
|
252
|
+
customProps
|
|
250
253
|
} = props;
|
|
254
|
+
let {
|
|
255
|
+
listItemProps = {}
|
|
256
|
+
} = customProps;
|
|
251
257
|
return this.formatOptions({
|
|
252
258
|
options,
|
|
253
259
|
valueField,
|
|
254
|
-
textField
|
|
260
|
+
textField,
|
|
261
|
+
listItemProps
|
|
255
262
|
});
|
|
256
263
|
}
|
|
257
264
|
|
|
@@ -693,7 +700,8 @@ export class SelectComponent extends Component {
|
|
|
693
700
|
i18nKeys,
|
|
694
701
|
htmlId,
|
|
695
702
|
children,
|
|
696
|
-
iconOnHover
|
|
703
|
+
iconOnHover,
|
|
704
|
+
customProps
|
|
697
705
|
} = this.props;
|
|
698
706
|
let {
|
|
699
707
|
TextBoxIcon_i18n,
|
|
@@ -714,6 +722,11 @@ export class SelectComponent extends Component {
|
|
|
714
722
|
let suggestions = this.handleFilterSuggestions();
|
|
715
723
|
let setAriaId = this.getNextAriaId();
|
|
716
724
|
let ariaErrorId = this.getNextAriaId();
|
|
725
|
+
let {
|
|
726
|
+
TextBoxProps = {},
|
|
727
|
+
DropdownSearchTextBoxProps = {},
|
|
728
|
+
SuggestionsProps = {}
|
|
729
|
+
} = customProps;
|
|
717
730
|
return /*#__PURE__*/React.createElement("div", {
|
|
718
731
|
className: `${isParentBased || isReadOnly || isDisabled ? style.container : ''} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${iconOnHover && (isReadOnly || isDisabled) ? style.iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? style.iconOnHoverStyle : ''}`,
|
|
719
732
|
"data-title": isDisabled ? title : ''
|
|
@@ -756,7 +769,10 @@ export class SelectComponent extends Component {
|
|
|
756
769
|
borderColor: borderColor,
|
|
757
770
|
htmlId: htmlId,
|
|
758
771
|
isFocus: isPopupReady,
|
|
759
|
-
autoComplete: false
|
|
772
|
+
autoComplete: false,
|
|
773
|
+
customProps: {
|
|
774
|
+
TextBoxProps: TextBoxProps
|
|
775
|
+
}
|
|
760
776
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
761
777
|
alignBox: "row",
|
|
762
778
|
align: "both"
|
|
@@ -801,7 +817,8 @@ export class SelectComponent extends Component {
|
|
|
801
817
|
borderColor: borderColor,
|
|
802
818
|
htmlId: htmlId,
|
|
803
819
|
autoComplete: false,
|
|
804
|
-
isFocus: isPopupReady
|
|
820
|
+
isFocus: isPopupReady,
|
|
821
|
+
customProps: TextBoxProps
|
|
805
822
|
})), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(DropBox, {
|
|
806
823
|
animationStyle: animationStyle,
|
|
807
824
|
boxPosition: position || `${defaultDropBoxPosition}Center`,
|
|
@@ -834,11 +851,14 @@ export class SelectComponent extends Component {
|
|
|
834
851
|
onClear: this.handleClearSearch,
|
|
835
852
|
dataId: `${dataId}_search`,
|
|
836
853
|
i18nKeys: TextBoxIcon_i18n,
|
|
837
|
-
autoComplete: false
|
|
854
|
+
autoComplete: false,
|
|
855
|
+
customProps: {
|
|
856
|
+
TextBoxProps: DropdownSearchTextBoxProps
|
|
857
|
+
}
|
|
838
858
|
}))) : null, /*#__PURE__*/React.createElement(CardContent, {
|
|
839
859
|
customClass: dropBoxSize ? style[dropBoxSize] : '',
|
|
840
860
|
eleRef: this.suggestionContainerRef
|
|
841
|
-
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
|
|
861
|
+
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
|
|
842
862
|
activeId: selectedId,
|
|
843
863
|
suggestions: suggestions,
|
|
844
864
|
getRef: this.suggestionItemRef,
|
|
@@ -856,7 +876,7 @@ export class SelectComponent extends Component {
|
|
|
856
876
|
ariaParentRole: 'listbox',
|
|
857
877
|
role: 'option'
|
|
858
878
|
}
|
|
859
|
-
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
879
|
+
}, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
860
880
|
isLoading: isFetchingOptions,
|
|
861
881
|
options: options,
|
|
862
882
|
searchString: searchStr,
|
|
@@ -946,7 +966,13 @@ SelectComponent.propTypes = {
|
|
|
946
966
|
htmlId: PropTypes.string,
|
|
947
967
|
children: PropTypes.node,
|
|
948
968
|
onFocus: PropTypes.func,
|
|
949
|
-
iconOnHover: PropTypes.bool
|
|
969
|
+
iconOnHover: PropTypes.bool,
|
|
970
|
+
customProps: PropTypes.shape({
|
|
971
|
+
TextBoxProps: PropTypes.object,
|
|
972
|
+
DropdownSearchTextBoxProps: PropTypes.object,
|
|
973
|
+
listItemProps: PropTypes.object,
|
|
974
|
+
SuggestionsProps: PropTypes.object
|
|
975
|
+
})
|
|
950
976
|
};
|
|
951
977
|
SelectComponent.defaultProps = {
|
|
952
978
|
animationStyle: 'bounce',
|
|
@@ -978,7 +1004,8 @@ SelectComponent.defaultProps = {
|
|
|
978
1004
|
isParentBased: true,
|
|
979
1005
|
isSearchClearOnClose: true,
|
|
980
1006
|
i18nKeys: {},
|
|
981
|
-
iconOnHover: false
|
|
1007
|
+
iconOnHover: false,
|
|
1008
|
+
customProps: {}
|
|
982
1009
|
};
|
|
983
1010
|
SelectComponent.displayName = 'Select';
|
|
984
1011
|
let Select = Popup(SelectComponent);
|
|
@@ -37,6 +37,40 @@ let option = [{
|
|
|
37
37
|
text: 'Pineapple',
|
|
38
38
|
id: '10'
|
|
39
39
|
}];
|
|
40
|
+
let customOption = [{
|
|
41
|
+
text: 'Apple',
|
|
42
|
+
id: 0,
|
|
43
|
+
listItemProps: {
|
|
44
|
+
style: {
|
|
45
|
+
'color': 'red'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
text: 'Banana',
|
|
50
|
+
id: '1',
|
|
51
|
+
listItemProps: {
|
|
52
|
+
style: {
|
|
53
|
+
'color': 'orange'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
text: 'Blackberries',
|
|
58
|
+
id: '2',
|
|
59
|
+
listItemProps: {
|
|
60
|
+
style: {
|
|
61
|
+
'color': 'blue'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
text: 'Guava',
|
|
66
|
+
id: '3'
|
|
67
|
+
}, {
|
|
68
|
+
text: 'Grapes',
|
|
69
|
+
id: '4'
|
|
70
|
+
}, {
|
|
71
|
+
text: 'Jackfruit',
|
|
72
|
+
id: '5'
|
|
73
|
+
}];
|
|
40
74
|
export default class Select__default extends React.Component {
|
|
41
75
|
constructor(props) {
|
|
42
76
|
super(props);
|
|
@@ -94,6 +128,51 @@ export default class Select__default extends React.Component {
|
|
|
94
128
|
searchBoxPlaceHolder: "Search",
|
|
95
129
|
isDefaultSelectValue: false,
|
|
96
130
|
isDisabled: true
|
|
131
|
+
}), /*#__PURE__*/React.createElement("div", null, "Custom Props"), /*#__PURE__*/React.createElement(Select, {
|
|
132
|
+
options: customOption,
|
|
133
|
+
onChange: this.handleChange,
|
|
134
|
+
selectedValue: value,
|
|
135
|
+
needSearch: true,
|
|
136
|
+
emptyMessage: "No matches found",
|
|
137
|
+
placeHolder: "PlaceHolder",
|
|
138
|
+
searchBoxPlaceHolder: "Search",
|
|
139
|
+
isDefaultSelectValue: false,
|
|
140
|
+
i18nKeys: {
|
|
141
|
+
loadingText: 'Loading',
|
|
142
|
+
emptyText: 'emptyText',
|
|
143
|
+
noMoreText: 'noMoreText',
|
|
144
|
+
searchEmptyText: 'searchEmptyText',
|
|
145
|
+
TextBoxIcon_i18n: {
|
|
146
|
+
clearText: 'Clear Data'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
customProps: {
|
|
150
|
+
listItemProps: {
|
|
151
|
+
style: {
|
|
152
|
+
'color': 'green'
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
TextBoxProps: {
|
|
156
|
+
style: {
|
|
157
|
+
'color': 'brown'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
DropdownSearchTextBoxProps: {
|
|
161
|
+
style: {
|
|
162
|
+
'color': 'purple'
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}), /*#__PURE__*/React.createElement("div", null, "Disabled"), /*#__PURE__*/React.createElement(Select, {
|
|
167
|
+
options: option,
|
|
168
|
+
onChange: this.handleChange,
|
|
169
|
+
selectedValue: value,
|
|
170
|
+
needSearch: true,
|
|
171
|
+
emptyMessage: "No matches found",
|
|
172
|
+
placeHolder: "isDisabled",
|
|
173
|
+
searchBoxPlaceHolder: "Search",
|
|
174
|
+
isDefaultSelectValue: false,
|
|
175
|
+
isDisabled: true
|
|
97
176
|
}), /*#__PURE__*/React.createElement("div", null, "Readonly"), /*#__PURE__*/React.createElement(Select, {
|
|
98
177
|
options: option,
|
|
99
178
|
onChange: this.handleChange,
|
package/es/Tag/Tag.module.css
CHANGED
package/es/TextBox/TextBox.js
CHANGED
|
@@ -92,7 +92,8 @@ export default class Textbox extends React.PureComponent {
|
|
|
92
92
|
htmlId,
|
|
93
93
|
a11y,
|
|
94
94
|
customClass,
|
|
95
|
-
isFocus
|
|
95
|
+
isFocus,
|
|
96
|
+
customProps
|
|
96
97
|
} = this.props;
|
|
97
98
|
let {
|
|
98
99
|
ariaLabel,
|
|
@@ -162,7 +163,7 @@ export default class Textbox extends React.PureComponent {
|
|
|
162
163
|
value: value,
|
|
163
164
|
onKeyPress: onKeyPress,
|
|
164
165
|
onMouseDown: onMouseDown
|
|
165
|
-
}, options));
|
|
166
|
+
}, options, customProps));
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
}
|
|
@@ -182,7 +183,8 @@ Textbox.defaultProps = {
|
|
|
182
183
|
autoComplete: true,
|
|
183
184
|
borderColor: 'default',
|
|
184
185
|
a11y: {},
|
|
185
|
-
isFocus: false
|
|
186
|
+
isFocus: false,
|
|
187
|
+
customProps: {}
|
|
186
188
|
};
|
|
187
189
|
Textbox.propTypes = {
|
|
188
190
|
autofocus: PropTypes.bool,
|
|
@@ -233,7 +235,8 @@ Textbox.propTypes = {
|
|
|
233
235
|
ariaReadonly: PropTypes.bool,
|
|
234
236
|
ariaMultiselectable: PropTypes.bool
|
|
235
237
|
}),
|
|
236
|
-
isFocus: PropTypes.bool
|
|
238
|
+
isFocus: PropTypes.bool,
|
|
239
|
+
customProps: PropTypes.object
|
|
237
240
|
};
|
|
238
241
|
|
|
239
242
|
if (false) {
|
|
@@ -79,7 +79,8 @@ export default class TextBoxIcon extends React.Component {
|
|
|
79
79
|
customClass,
|
|
80
80
|
iconOnHover,
|
|
81
81
|
isFocus,
|
|
82
|
-
onClearMouseDown
|
|
82
|
+
onClearMouseDown,
|
|
83
|
+
customProps
|
|
83
84
|
} = this.props;
|
|
84
85
|
const {
|
|
85
86
|
isActive
|
|
@@ -93,6 +94,9 @@ export default class TextBoxIcon extends React.Component {
|
|
|
93
94
|
const {
|
|
94
95
|
clearText = 'Clear'
|
|
95
96
|
} = i18nKeys;
|
|
97
|
+
let {
|
|
98
|
+
TextBoxProps = {}
|
|
99
|
+
} = customProps;
|
|
96
100
|
return /*#__PURE__*/React.createElement(Container, {
|
|
97
101
|
alignBox: "row",
|
|
98
102
|
isCover: false,
|
|
@@ -125,7 +129,8 @@ export default class TextBoxIcon extends React.Component {
|
|
|
125
129
|
onKeyPress: onKeyPress,
|
|
126
130
|
onMouseDown: onMouseDown,
|
|
127
131
|
needBorder: false,
|
|
128
|
-
customClass: customTextBox
|
|
132
|
+
customClass: customTextBox,
|
|
133
|
+
customProps: TextBoxProps
|
|
129
134
|
}))), /*#__PURE__*/React.createElement(Box, {
|
|
130
135
|
className: `${style.iconContainer} ${customTBoxIcon}`
|
|
131
136
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
@@ -169,7 +174,8 @@ TextBoxIcon.defaultProps = {
|
|
|
169
174
|
i18nKeys: {},
|
|
170
175
|
customClass: {},
|
|
171
176
|
iconOnHover: false,
|
|
172
|
-
isFocus: false
|
|
177
|
+
isFocus: false,
|
|
178
|
+
customProps: {}
|
|
173
179
|
};
|
|
174
180
|
TextBoxIcon.propTypes = {
|
|
175
181
|
borderColor: PropTypes.oneOf(['transparent', 'default', 'error']),
|
|
@@ -214,7 +220,10 @@ TextBoxIcon.propTypes = {
|
|
|
214
220
|
}),
|
|
215
221
|
iconOnHover: PropTypes.bool,
|
|
216
222
|
isFocus: PropTypes.bool,
|
|
217
|
-
onClearMouseDown: PropTypes.func
|
|
223
|
+
onClearMouseDown: PropTypes.func,
|
|
224
|
+
customProps: PropTypes.shape({
|
|
225
|
+
TextBoxProps: PropTypes.object
|
|
226
|
+
})
|
|
218
227
|
};
|
|
219
228
|
|
|
220
229
|
if (false) {
|
package/es/utils/Common.js
CHANGED
|
@@ -365,5 +365,5 @@ export function getElementSpace(elementRef) {
|
|
|
365
365
|
}
|
|
366
366
|
export function getSearchString() {
|
|
367
367
|
let charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
368
|
-
return charachers.toLowerCase(); //.replace(/\s+/g, '');
|
|
368
|
+
return (charachers || '').toString().toLowerCase(); //.replace(/\s+/g, '');
|
|
369
369
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/***** Libraries *****/
|
|
2
2
|
import { createSelector } from 'reselect';
|
|
3
|
-
import { getIsEmptyValue } from './Common';
|
|
3
|
+
import { getIsEmptyValue, getSearchString } from './Common';
|
|
4
4
|
export const dummyArray = [];
|
|
5
5
|
export const dummyObj = {};
|
|
6
6
|
export const getOptions = props => props.options || dummyArray;
|
|
@@ -36,6 +36,8 @@ const getIsStartWithSearch = props => props.isStartsWithSearch;
|
|
|
36
36
|
|
|
37
37
|
const getDisabledOptions = props => props.disabledOptions || dummyArray;
|
|
38
38
|
|
|
39
|
+
const getListItemProps = props => props.listItemProps || '';
|
|
40
|
+
|
|
39
41
|
export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOptions, getSelectedOptionsSel, getSearchStr, getNeedSearch, getIsStartWithSearch], (options, selectedOptions, searchStr, needSearch, isStartsWithSearch) => {
|
|
40
42
|
const suggestions = [];
|
|
41
43
|
const suggestionIds = [];
|
|
@@ -44,8 +46,8 @@ export const makeGetMultiSelectFilterSuggestions = () => createSelector([getOpti
|
|
|
44
46
|
id,
|
|
45
47
|
value = ''
|
|
46
48
|
} = option;
|
|
47
|
-
const valueString = value
|
|
48
|
-
const searchString = searchStr
|
|
49
|
+
const valueString = getSearchString(value);
|
|
50
|
+
const searchString = getSearchString(searchStr);
|
|
49
51
|
const isMatch = needSearch ? isStartsWithSearch ? valueString.startsWith(searchString) : valueString.indexOf(searchString) !== -1 : true;
|
|
50
52
|
|
|
51
53
|
if (selectedOptions.indexOf(id) === -1 && isMatch) {
|
|
@@ -100,7 +102,7 @@ export const extractOptionId = id => {
|
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
};
|
|
103
|
-
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions) => {
|
|
105
|
+
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps) => {
|
|
104
106
|
const revampOptions = [];
|
|
105
107
|
const remvampOptionIds = [];
|
|
106
108
|
const normalizedAllOptions = {};
|
|
@@ -114,7 +116,8 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
114
116
|
imageField: impImageField,
|
|
115
117
|
optionType: impOptionType,
|
|
116
118
|
iconName: impIconName,
|
|
117
|
-
iconSize: impIconSize
|
|
119
|
+
iconSize: impIconSize,
|
|
120
|
+
listItemProps: listStyle
|
|
118
121
|
} = option;
|
|
119
122
|
let id = typeof option === 'object' ? option[impValueField || valueField] : option;
|
|
120
123
|
const value = typeof option === 'object' ? option[impTextField || textField] : option;
|
|
@@ -146,6 +149,10 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
146
149
|
optionDetails.isDisabled = disabledOptions.indexOf(id) >= 0;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
if (listStyle || listItemProps) {
|
|
153
|
+
optionDetails.listItemProps = listStyle || listItemProps;
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
normalizedFormatOptions[id] = optionDetails;
|
|
150
157
|
normalizedAllOptions[id] = option;
|
|
151
158
|
revampOptions.push(optionDetails);
|