intelicoreact 0.0.46 → 0.0.48
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.
|
@@ -86,6 +86,8 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
86
86
|
var filteredOptions = [].concat((0, _toConsumableArray2.default)(filteredItems), (0, _toConsumableArray2.default)(filteredGroups));
|
|
87
87
|
|
|
88
88
|
var handleClickOutside = function handleClickOutside(event) {
|
|
89
|
+
console.log(dropdownRef.current.contains(event.target));
|
|
90
|
+
|
|
89
91
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
90
92
|
setIsOpen(false);
|
|
91
93
|
setSearchValue(null);
|
|
@@ -118,6 +120,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
118
120
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
119
121
|
className: (0, _classnames.default)("".concat(RC, "__active-icon"), (0, _defineProperty2.default)({}, "".concat(RC, "__active-icon_active"), item.value === value))
|
|
120
122
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: item.className || '',
|
|
121
124
|
dangerouslySetInnerHTML: {
|
|
122
125
|
__html: hightlightedText(item.label)
|
|
123
126
|
}
|
|
@@ -157,21 +160,27 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
157
160
|
className: (0, _classnames.default)(RC, className),
|
|
158
161
|
ref: dropdownRef
|
|
159
162
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
160
|
-
className: "".concat(RC, "__trigger input__wrap ").concat(!value ? 'placeholder' : '', " ").concat(error ? 'error' : '')
|
|
161
|
-
onClick: function onClick() {
|
|
162
|
-
return setIsOpen(!isOpen);
|
|
163
|
-
}
|
|
163
|
+
className: "".concat(RC, "__trigger input__wrap ").concat(!value ? 'placeholder' : '', " ").concat(error ? 'error' : '')
|
|
164
164
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
|
|
165
165
|
className: "".concat(RC, "__input"),
|
|
166
166
|
value: searchValue !== null && searchValue !== void 0 ? searchValue : selectedLabel,
|
|
167
167
|
onChange: function onChange(e) {
|
|
168
168
|
return onSearchHandler(e.target.value);
|
|
169
169
|
},
|
|
170
|
-
placeholder: placeholder
|
|
170
|
+
placeholder: placeholder,
|
|
171
|
+
onFocus: function onFocus() {
|
|
172
|
+
return setIsOpen(true);
|
|
173
|
+
}
|
|
171
174
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
172
|
-
className: "text"
|
|
175
|
+
className: "text",
|
|
176
|
+
onClick: function onClick() {
|
|
177
|
+
return setIsOpen(!isOpen);
|
|
178
|
+
}
|
|
173
179
|
}, selectedLabel || placeholder), /*#__PURE__*/_react.default.createElement("span", {
|
|
174
|
-
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
|
|
180
|
+
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen)),
|
|
181
|
+
onClick: function onClick() {
|
|
182
|
+
return setIsOpen(!isOpen);
|
|
183
|
+
}
|
|
175
184
|
}, isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && filteredOptions.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
176
185
|
className: "".concat(RC, "__list")
|
|
177
186
|
}, filteredOptions.map(function (filteredOption) {
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ const Dropdown = ({ options, value, error, onChange, placeholder, className, isS
|
|
|
24
24
|
const filteredOptions = [...filteredItems, ...filteredGroups];
|
|
25
25
|
|
|
26
26
|
const handleClickOutside = event => {
|
|
27
|
+
console.log(dropdownRef.current.contains(event.target));
|
|
27
28
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
28
29
|
setIsOpen(false);
|
|
29
30
|
setSearchValue(null);
|
|
@@ -53,7 +54,7 @@ const Dropdown = ({ options, value, error, onChange, placeholder, className, isS
|
|
|
53
54
|
<span className={cn(`${RC}__active-icon`, { [`${RC}__active-icon_active`]: item.value === value })}>
|
|
54
55
|
<Check />
|
|
55
56
|
</span>
|
|
56
|
-
<div dangerouslySetInnerHTML={{ __html: hightlightedText(item.label) }} />
|
|
57
|
+
<div className={item.className || ''} dangerouslySetInnerHTML={{ __html: hightlightedText(item.label) }} />
|
|
57
58
|
</button>
|
|
58
59
|
) : null;
|
|
59
60
|
|
|
@@ -75,18 +76,23 @@ const Dropdown = ({ options, value, error, onChange, placeholder, className, isS
|
|
|
75
76
|
|
|
76
77
|
return (
|
|
77
78
|
<div className={cn(RC, className)} ref={dropdownRef}>
|
|
78
|
-
<button className={`${RC}__trigger input__wrap ${!value ? 'placeholder' : ''} ${error ? 'error' : ''}`}
|
|
79
|
+
<button className={`${RC}__trigger input__wrap ${!value ? 'placeholder' : ''} ${error ? 'error' : ''}`} >
|
|
79
80
|
{isSearchable ? (
|
|
80
81
|
<input
|
|
81
82
|
className={`${RC}__input`}
|
|
82
83
|
value={searchValue ?? selectedLabel}
|
|
83
84
|
onChange={e => onSearchHandler(e.target.value)}
|
|
84
85
|
placeholder={placeholder}
|
|
86
|
+
onFocus={() => setIsOpen(true)}
|
|
85
87
|
/>
|
|
86
88
|
) : (
|
|
87
|
-
<span className="text"
|
|
89
|
+
<span className="text" onClick={() => setIsOpen(!isOpen)}>
|
|
90
|
+
{selectedLabel || placeholder}
|
|
91
|
+
</span>
|
|
88
92
|
)}
|
|
89
|
-
<span className={cn(`${RC}__arrow`, { [`${RC}__arrow_active`]: isOpen })}
|
|
93
|
+
<span className={cn(`${RC}__arrow`, { [`${RC}__arrow_active`]: isOpen })} onClick={() => setIsOpen(!isOpen)}>
|
|
94
|
+
{isOpen ? <ChevronUp /> : <ChevronDown />}
|
|
95
|
+
</span>
|
|
90
96
|
</button>
|
|
91
97
|
{isOpen && filteredOptions.length > 0 && (
|
|
92
98
|
<div className={`${RC}__list`}>
|
|
@@ -32,7 +32,7 @@ DropdownTemplate.args = {
|
|
|
32
32
|
placeholder: 'Placeholder',
|
|
33
33
|
isSearchable: true,
|
|
34
34
|
options: [
|
|
35
|
-
{ label: 'Dropdown1', value: 'drop1' },
|
|
35
|
+
{ label: 'Dropdown1', value: 'drop1', className: 'status status--approved' },
|
|
36
36
|
{ label: 'Dropdown2', value: 'drop2' },
|
|
37
37
|
{ label: 'Dropdown3', value: 'drop3', disabled: true },
|
|
38
38
|
{ label: 'Dropdown4', value: 'drop4' },
|