@smart-react-components/ui 2.1.1 → 2.1.3
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/Select/SelectBox.d.ts +5 -2
- package/Select/SelectBox.js +3 -2
- package/hooks/useSelectSearch.js +1 -1
- package/package.json +1 -1
package/Select/SelectBox.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { GenericProps } from '../types/form';
|
|
2
|
-
import { JSXElementProps, PaletteProp } from '@smart-react-components/core/types';
|
|
2
|
+
import { JSXElementProps, PaletteProp, ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export interface Props extends GenericProps {
|
|
4
|
+
export interface Props extends GenericProps, Partial<ResponsiveProp<'searchInputSize', SizeProp>> {
|
|
5
5
|
dropdownArrowIconElementProps?: JSXElementProps;
|
|
6
6
|
dropdownPalette?: PaletteProp;
|
|
7
7
|
hasSearch?: boolean;
|
|
8
8
|
isDropdownOutline?: boolean;
|
|
9
|
+
isSearchInputOutline?: boolean;
|
|
9
10
|
placeholder?: string;
|
|
11
|
+
searchInputPalette?: PaletteProp;
|
|
12
|
+
searchInputPlaceholder?: string;
|
|
10
13
|
}
|
|
11
14
|
declare const SelectBox: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
12
15
|
export default SelectBox;
|
package/Select/SelectBox.js
CHANGED
|
@@ -32,7 +32,7 @@ const DropdownItem_1 = __importDefault(require("../Dropdown/DropdownItem"));
|
|
|
32
32
|
const Input_1 = __importDefault(require("../Input"));
|
|
33
33
|
const SelectAddon_1 = __importDefault(require("./SelectAddon"));
|
|
34
34
|
const SelectBox = react_1.default.forwardRef((props, forwardRef) => {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
36
36
|
const theme = (0, styled_components_1.useTheme)();
|
|
37
37
|
const formEl = react_1.default.useRef(null);
|
|
38
38
|
const { itemList } = (0, useSelectBoxItemList_1.default)({ children: props.children });
|
|
@@ -130,7 +130,7 @@ const SelectBox = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
130
130
|
palette: (_k = props.dropdownPalette) !== null && _k !== void 0 ? _k : props.palette,
|
|
131
131
|
setStatus: () => { },
|
|
132
132
|
}),
|
|
133
|
-
react_1.default.createElement(Input_1.default, {
|
|
133
|
+
react_1.default.createElement(Input_1.default, { isOutline: (_m = (_l = props.isSearchInputOutline) !== null && _l !== void 0 ? _l : props.isDropdownOutline) !== null && _m !== void 0 ? _m : props.isOutline, palette: (_p = (_o = props.searchInputPalette) !== null && _o !== void 0 ? _o : props.dropdownPalette) !== null && _p !== void 0 ? _p : props.palette, placeholder: props.searchInputPlaceholder, setValue: setSearchValue, size: (_q = props.searchInputSize) !== null && _q !== void 0 ? _q : props.size, sizeSm: (_r = props.searchInputSizeSm) !== null && _r !== void 0 ? _r : props.sizeSm, sizeMd: (_s = props.searchInputSizeMd) !== null && _s !== void 0 ? _s : props.sizeMd, sizeLg: (_t = props.searchInputSizeLg) !== null && _t !== void 0 ? _t : props.sizeLg, sizeXl: (_u = props.searchInputSizeLg) !== null && _u !== void 0 ? _u : props.sizeXl, value: searchValue }))),
|
|
134
134
|
optionList.map((item, idx) => {
|
|
135
135
|
var _a, _b, _c;
|
|
136
136
|
return item && react_1.default.cloneElement(item, Object.assign({ key: (_a = item.key) !== null && _a !== void 0 ? _a : idx, active: props.active, cursorKey: 'selectBox', hasHover: false, hasWaveEffect: props.hasWaveEffect, hovered, isEmbedded: false, isOutline: (_b = props.isDropdownOutline) !== null && _b !== void 0 ? _b : props.isOutline, isSoft: props.isSoft, palette: (_c = props.dropdownPalette) !== null && _c !== void 0 ? _c : props.palette, setActive: handleOptionClick, setHovered: props.hasHover ? setHovered : null, waveEffectPalette }, (props.isDisabled && { isDisabled: true })));
|
|
@@ -146,6 +146,7 @@ SelectBox.defaultProps = {
|
|
|
146
146
|
isBlock: true,
|
|
147
147
|
isOutline: true,
|
|
148
148
|
palette: 'primary',
|
|
149
|
+
searchInputPlaceholder: 'Search...',
|
|
149
150
|
shape: 'rectangle',
|
|
150
151
|
size: 'medium',
|
|
151
152
|
};
|
package/hooks/useSelectSearch.js
CHANGED
|
@@ -8,7 +8,7 @@ const useSelectSearch = (props) => {
|
|
|
8
8
|
switch (item.type.displayName) {
|
|
9
9
|
case 'Option':
|
|
10
10
|
if (!value
|
|
11
|
-
|| item.props.value.trim().toLowerCase().includes(value)
|
|
11
|
+
|| (typeof item.props.value === 'string' && item.props.value.trim().toLowerCase().includes(value))
|
|
12
12
|
|| (typeof item.props.children === 'string' && item.props.children.trim().toLowerCase().includes(value))) {
|
|
13
13
|
list.push(item);
|
|
14
14
|
}
|