pixelize-design-library 1.1.71 → 1.1.74
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.
|
@@ -55,7 +55,12 @@ var RenderOptions = function (_a) {
|
|
|
55
55
|
react_1.default.createElement(react_2.Text, { color: "blue.500" }, loadingText)));
|
|
56
56
|
}
|
|
57
57
|
if (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) {
|
|
58
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, filteredOptions.map(function (option) { return (react_1.default.createElement(react_2.Box, { key: option.id, px: 4, py: 2, cursor: "pointer", _hover: { backgroundColor: "blue.50" }, onClick: function () { return handleOptionClick(option); }
|
|
58
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, filteredOptions.map(function (option) { return (react_1.default.createElement(react_2.Box, { key: option.id, px: 4, py: 2, cursor: "pointer", _hover: { backgroundColor: "blue.50" }, onClick: function () { return handleOptionClick(option); }, display: "flex", alignItems: "center", gap: "0.5rem" },
|
|
59
|
+
option.profileUrl && (react_1.default.createElement(react_2.Box, null,
|
|
60
|
+
react_1.default.createElement(react_2.Avatar, { size: "sm", name: option.label.toLocaleUpperCase(), src: option.profileUrl || undefined }))),
|
|
61
|
+
react_1.default.createElement(react_2.Box, null,
|
|
62
|
+
react_1.default.createElement(react_2.Box, null, option.label),
|
|
63
|
+
option.email && (react_1.default.createElement(react_2.Box, { fontSize: 12, color: "gray.400" }, option.email))))); })));
|
|
59
64
|
}
|
|
60
65
|
return (react_1.default.createElement(react_2.Text, { px: 4, py: 2, color: "gray.500" }, "No options found"));
|
|
61
66
|
};
|
|
@@ -76,19 +81,19 @@ function SelectSearch(_a) {
|
|
|
76
81
|
// });
|
|
77
82
|
// }, [options, inputValue]);
|
|
78
83
|
var filteredOptions = (0, react_1.useMemo)(function () {
|
|
79
|
-
return options
|
|
80
|
-
.filter(function (option) {
|
|
84
|
+
return options.filter(function (option) {
|
|
81
85
|
// First filter out already selected options
|
|
82
86
|
// const isNotSelected = !selectedOptions.some(
|
|
83
87
|
// (selected) => selected.id === option.id
|
|
84
88
|
// );
|
|
85
|
-
var isNotSelected = isMultipleSelect
|
|
86
|
-
!selectedOptions.some(function (selected) { return selected.id === option.id; })
|
|
87
|
-
true;
|
|
89
|
+
var isNotSelected = isMultipleSelect
|
|
90
|
+
? !selectedOptions.some(function (selected) { return selected.id === option.id; })
|
|
91
|
+
: true;
|
|
88
92
|
// Then apply the search filter
|
|
89
|
-
var optionLabel = option.label ||
|
|
90
|
-
var searchValue = inputValue ||
|
|
91
|
-
return isNotSelected &&
|
|
93
|
+
var optionLabel = option.label || "";
|
|
94
|
+
var searchValue = inputValue || "";
|
|
95
|
+
return (isNotSelected &&
|
|
96
|
+
optionLabel.toLowerCase().includes(searchValue.toLowerCase()));
|
|
92
97
|
});
|
|
93
98
|
}, [options, inputValue, selectedOptions]);
|
|
94
99
|
// const filteredOptions = useMemo(() => {
|
|
@@ -207,7 +212,7 @@ function SelectSearch(_a) {
|
|
|
207
212
|
react_1.default.createElement(react_2.TagLabel, { width: "50px" }, option.label),
|
|
208
213
|
react_1.default.createElement(react_2.TagCloseButton, { onClick: function () { return handleRemoveOption(option); } }))); }))),
|
|
209
214
|
react_1.default.createElement(react_2.InputGroup, null,
|
|
210
|
-
react_1.default.createElement(react_2.Input, { ref: inputRef, border: error ? "1px solid #DC143C" : "1px solid #e2e8f0", variant: "flushed", value: inputValue ? inputValue : "", onClick: function () { return setIsOpen(true); }, onChange: function (e) { return handleInputChange(e.target.value); }, placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, cursor: "pointer", borderColor: "gray.300", _hover: { borderColor: "blue.500" }, _focus: { borderColor: "blue.500" }, style: __assign(__assign({}, inputStyle), { backgroundColor: theme.colors.backgroundColor.main, fontWeight: 800, color: theme.colors.gray[700], padding: "0 0.5rem", fontSize: 15, letterSpacing: 0.7, border: error ? "1px solid #DC143C" : "1px solid #e2e8f0" }) }),
|
|
215
|
+
react_1.default.createElement(react_2.Input, { ref: inputRef, border: error ? "1px solid #DC143C" : "1px solid #e2e8f0", variant: "flushed", value: inputValue ? inputValue : "", onClick: function () { return setIsOpen(true); }, onFocus: function () { return setIsOpen(true); }, onChange: function (e) { return handleInputChange(e.target.value); }, placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, cursor: "pointer", borderColor: "gray.300", _hover: { borderColor: "blue.500" }, _focus: { borderColor: "blue.500" }, style: __assign(__assign({}, inputStyle), { backgroundColor: theme.colors.backgroundColor.main, fontWeight: 800, color: theme.colors.gray[700], padding: "0 0.5rem", fontSize: 15, letterSpacing: 0.7, border: error ? "1px solid #DC143C" : "1px solid #e2e8f0" }) }),
|
|
211
216
|
rightIcon && (react_1.default.createElement(react_2.InputRightElement, { pointerEvents: "none", children: rightIcon, style: __assign({}, rightElementStyle) }))),
|
|
212
217
|
isOpen && (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: "gray.300", borderRadius: "md", bg: "white", maxHeight: "150px", overflowY: "auto", zIndex: 10 },
|
|
213
218
|
react_1.default.createElement(RenderOptions, { isOptionLoading: isOptionLoading, filteredOptions: filteredOptions, loadingText: loadingText, handleOptionClick: handleOptionClick })))));
|
|
@@ -31,15 +31,36 @@ var SelectSearch_1 = __importDefault(require("../Components/SelectSearch/SelectS
|
|
|
31
31
|
var lucide_react_1 = require("lucide-react");
|
|
32
32
|
var SelectSearchs = function () {
|
|
33
33
|
var _a = (0, react_1.useState)("Option 1"), selectSearchText = _a[0], setSelectSearchText = _a[1];
|
|
34
|
-
var _b = (0, react_1.useState)({
|
|
34
|
+
var _b = (0, react_1.useState)({
|
|
35
|
+
id: "1",
|
|
36
|
+
label: "Option 1",
|
|
37
|
+
}), selectedOption = _b[0], setSelectedOption = _b[1];
|
|
35
38
|
var _c = (0, react_1.useState)("Option 1"), multiSelectSearchText = _c[0], setMultiSelectSearchText = _c[1];
|
|
36
|
-
var _d = (0, react_1.useState)({
|
|
39
|
+
var _d = (0, react_1.useState)({
|
|
40
|
+
id: "1",
|
|
41
|
+
label: "Option 1",
|
|
42
|
+
}), multiselectedOption = _d[0], setMultiSelectedOption = _d[1];
|
|
37
43
|
return (react_1.default.createElement("div", null,
|
|
38
44
|
react_1.default.createElement("div", null,
|
|
39
45
|
react_1.default.createElement(SelectSearch_1.default, { options: [
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
{
|
|
47
|
+
id: "1",
|
|
48
|
+
label: "Option 1",
|
|
49
|
+
profileUrl: "https://play-lh.googleusercontent.com/Fro4e_osoDhhrjgiZ_Y2C5FNXBMWvrb4rGpmkM1PDAcUPXeiAlPCq7NeaT4Q6NRUxRqo",
|
|
50
|
+
email: "kavinKumar0298@gggmail.com",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "2",
|
|
54
|
+
label: "select 2",
|
|
55
|
+
profileUrl: "https://play-lh.googleusercontent.com/Fro4e_osoDhhrjgiZ_Y2C5FNXBMWvrb4rGpmkM1PDAcUPXeiAlPCq7NeaT4Q6NRUxRqo",
|
|
56
|
+
email: "kavinKumar0298@gggmail.com",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "3",
|
|
60
|
+
label: "clone 3",
|
|
61
|
+
profileUrl: "https://play-lh.googleusercontent.com/Fro4e_osoDhhrjgiZ_Y2C5FNXBMWvrb4rGpmkM1PDAcUPXeiAlPCq7NeaT4Q6NRUxRqo",
|
|
62
|
+
email: "kavinKumar0298@gggmail.com",
|
|
63
|
+
},
|
|
43
64
|
], inputOnchange: function (value) {
|
|
44
65
|
setSelectSearchText(value.toString());
|
|
45
66
|
console.log(value);
|
|
@@ -57,7 +78,7 @@ var SelectSearchs = function () {
|
|
|
57
78
|
react_1.default.createElement(SelectSearch_1.default, { options: [
|
|
58
79
|
{ id: "1", label: "Option 1" },
|
|
59
80
|
{ id: "2", label: "select 2" },
|
|
60
|
-
{ id: "3", label: "clone 3"
|
|
81
|
+
{ id: "3", label: "clone 3" },
|
|
61
82
|
], inputOnchange: function (value) {
|
|
62
83
|
setMultiSelectSearchText(value.toString());
|
|
63
84
|
// console.log(value);
|