dhre-component-lib 0.8.3 → 0.8.4
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/dist/components/Search/Search.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,9 +19,11 @@ interface CustomSearchFieldProps {
|
|
|
19
19
|
suggestions: Suggestion[] | null | undefined;
|
|
20
20
|
placeholder: string;
|
|
21
21
|
className?: string;
|
|
22
|
+
suggestionClassName?: string;
|
|
22
23
|
onSearchIconClick?: () => void;
|
|
23
24
|
onHandleClear?: () => void;
|
|
24
25
|
isWhiteBackgound?: boolean;
|
|
26
|
+
shouldShowAll?: boolean;
|
|
25
27
|
}
|
|
26
28
|
declare const Search: React.FC<CustomSearchFieldProps>;
|
|
27
29
|
export default Search;
|
package/dist/index.d.ts
CHANGED
|
@@ -244,9 +244,11 @@ interface CustomSearchFieldProps {
|
|
|
244
244
|
suggestions: Suggestion[] | null | undefined;
|
|
245
245
|
placeholder: string;
|
|
246
246
|
className?: string;
|
|
247
|
+
suggestionClassName?: string;
|
|
247
248
|
onSearchIconClick?: () => void;
|
|
248
249
|
onHandleClear?: () => void;
|
|
249
250
|
isWhiteBackgound?: boolean;
|
|
251
|
+
shouldShowAll?: boolean;
|
|
250
252
|
}
|
|
251
253
|
declare const Search: React.FC<CustomSearchFieldProps>;
|
|
252
254
|
|
package/dist/index.esm.js
CHANGED
|
@@ -21678,7 +21678,7 @@ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDel
|
|
|
21678
21678
|
var css$d = ".search-field-container {\n display: flex;\n align-items: center;\n padding: 8px;\n border-radius: 10px;\n background-color: #ffffff;\n transition: border-color 0.3s ease;\n}\n.search-field-container.default-border {\n border: 1px solid #a7a7a7;\n}\n.search-field-container.typing-border {\n border: 1px solid #ffffff;\n}\n.search-field-container.typing-dark-border {\n border: 1px solid #a7a7a7;\n}\n.search-field-container.stopped-border {\n border: 1px solid #000000;\n}\n.search-field-container.disabled-border {\n border: 1px solid #4f4f4f;\n background-color: #e1e1e1;\n}\n\n.search-icon {\n margin-right: 8px;\n}\n\n.search-input {\n flex: 1;\n border: none;\n background-color: transparent;\n outline: none;\n height: 2rem;\n}\n\n.cross-icon {\n cursor: pointer;\n margin: 4px 0 0 8px;\n}\n\n.suggestions-dropdown {\n border: 1px solid #ccc;\n background-color: white;\n position: absolute;\n width: 600px;\n z-index: 10;\n top: 13.5rem;\n border-radius: 10px;\n}\n@media (max-width: 767px) {\n .suggestions-dropdown {\n width: 94%;\n top: 10rem;\n }\n}\n\n.suggestion-item {\n padding: 16px 8px 16px 8px;\n cursor: pointer;\n text-align: left;\n}\n\n.underline {\n height: 1px;\n background-color: #cecece;\n margin-left: 24px;\n margin-right: 24px;\n}\n\n.suggestion-item:hover {\n background-color: none;\n}\n\n.row {\n flex-direction: row;\n display: flex;\n background: none;\n border: none;\n align-items: center;\n padding-left: 10px;\n}\n\n.no-suggestions {\n padding: 20px;\n}\n\n.search-input::placeholder {\n color: #686868;\n font-size: 16px;\n font-family: \"Meraas Aktiv\", sans-serif;\n font-weight: 400;\n line-height: 22.4px;\n}";
|
|
21679
21679
|
n(css$d,{});
|
|
21680
21680
|
|
|
21681
|
-
const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSuggestion, suggestions, placeholder, className =
|
|
21681
|
+
const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSuggestion, suggestions, placeholder, className = "", suggestionClassName = "", onSearchIconClick, onHandleClear, isWhiteBackgound = false, shouldShowAll = false, }) => {
|
|
21682
21682
|
const [query, setQuery] = useState("");
|
|
21683
21683
|
const [borderClass, setBorderClass] = useState("default-border");
|
|
21684
21684
|
const [timeoutId, setTimeoutId] = useState(null);
|
|
@@ -21719,7 +21719,7 @@ const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSug
|
|
|
21719
21719
|
}, 500);
|
|
21720
21720
|
setTimeoutId(newTimeoutId);
|
|
21721
21721
|
if (suggestions && value) {
|
|
21722
|
-
const filtered = suggestions.filter((suggestion) => suggestion.title.toLowerCase().includes(value.toLowerCase()));
|
|
21722
|
+
const filtered = shouldShowAll ? suggestions : suggestions.filter((suggestion) => suggestion.title.toLowerCase().includes(value.toLowerCase()));
|
|
21723
21723
|
setFilteredSuggestions(filtered);
|
|
21724
21724
|
setShowSuggestions(true);
|
|
21725
21725
|
}
|
|
@@ -21757,7 +21757,7 @@ const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSug
|
|
|
21757
21757
|
React__default.createElement("span", { className: "search-icon", onClick: onSearchIconClick }, searchIcon),
|
|
21758
21758
|
React__default.createElement("input", { type: "text", value: query, onChange: handleChange, disabled: disabled, className: "search-input", placeholder: placeholder }),
|
|
21759
21759
|
query && !disabled && (React__default.createElement("span", { onClick: handleClear, className: "cross-icon" }, crossIcon))),
|
|
21760
|
-
showSuggestions && (React__default.createElement("div", { className:
|
|
21760
|
+
showSuggestions && (React__default.createElement("div", { className: `suggestions-dropdown ${suggestionClassName}`.trim() }, filteredSuggestions.length > 0 ? (filteredSuggestions.map((suggestion) => (React__default.createElement(React__default.Fragment, { key: suggestion.id },
|
|
21761
21761
|
React__default.createElement("button", { onClick: () => handleSelectSuggestion(suggestion), className: "row" },
|
|
21762
21762
|
React__default.createElement("div", null, searchIcon),
|
|
21763
21763
|
React__default.createElement(Typography, { variant: "B4", weight: "SEMI_BOLD", className: "suggestion-item" }, suggestion.title)),
|