dhre-component-lib 0.8.2 → 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.
|
@@ -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
|
|
|
@@ -313,6 +315,7 @@ declare function TextArea(props: {
|
|
|
313
315
|
placeholder: string;
|
|
314
316
|
charText: string;
|
|
315
317
|
property?: any;
|
|
318
|
+
isShortTextBox?: boolean;
|
|
316
319
|
}): React.JSX.Element;
|
|
317
320
|
|
|
318
321
|
interface DrawerProps {
|
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)),
|
|
@@ -21884,11 +21884,11 @@ function Dropdown(props) {
|
|
|
21884
21884
|
React__default.createElement(Typography, { variant: "B3", weight: "SEMI_BOLD" }, val.name)))))))));
|
|
21885
21885
|
}
|
|
21886
21886
|
|
|
21887
|
-
var css$8 = ".textArea {\n min-width: 70%;\n width: 100%;\n height: 8.875rem;\n border-radius: 0.5rem;\n padding: 1rem;\n font-size: 1rem;\n font-family: Meraas Aktiv;\n font-weight: 400;\n line-height: 1.4rem;\n text-align: left;\n outline: none;\n resize: none;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.inputTextAreaLabel {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.characters {\n color: #686868;\n}\n\n.textArea100 {\n height: 100%;\n width: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n}\n\n.positionRel {\n position: relative;\n z-index: 0;\n}\n\n.label {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.textArea::placeholder {\n font-family: Meraas Aktiv, sans-serif;\n font-size: 16px;\n font-weight: 400;\n line-height: 22.4px;\n text-align: left;\n color: #686868;\n}\n\n.maxLimit {\n color: #eb0542 !important;\n}\n\n.maxLimitArea {\n border: 1px solid #eb0542 !important;\n}";
|
|
21887
|
+
var css$8 = ".textArea {\n min-width: 70%;\n width: 100%;\n height: 8.875rem;\n border-radius: 0.5rem;\n padding: 1rem;\n font-size: 1rem;\n font-family: Meraas Aktiv;\n font-weight: 400;\n line-height: 1.4rem;\n text-align: left;\n outline: none;\n resize: none;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.shortTextBox {\n min-width: 70%;\n width: 100%;\n border-radius: 0.5rem;\n padding: 1rem;\n font-size: 1rem;\n font-family: Meraas Aktiv;\n font-weight: 400;\n line-height: 1.4rem;\n text-align: left;\n outline: none;\n resize: none;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.inputTextAreaLabel {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.characters {\n color: #686868;\n}\n\n.textArea100 {\n height: 100%;\n width: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n}\n\n.positionRel {\n position: relative;\n z-index: 0;\n}\n\n.label {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.textArea::placeholder {\n font-family: Meraas Aktiv, sans-serif;\n font-size: 16px;\n font-weight: 400;\n line-height: 22.4px;\n text-align: left;\n color: #686868;\n}\n\n.maxLimit {\n color: #eb0542 !important;\n}\n\n.maxLimitArea {\n border: 1px solid #eb0542 !important;\n}";
|
|
21888
21888
|
n(css$8,{});
|
|
21889
21889
|
|
|
21890
21890
|
function TextArea(props) {
|
|
21891
|
-
const { value, onChange, requiredLimit, placeholder, charText, property } = props;
|
|
21891
|
+
const { value, onChange, requiredLimit, placeholder, charText, property, isShortTextBox } = props;
|
|
21892
21892
|
const [showLabelOnBorder, setShowLabelOnBorder] = useState(false);
|
|
21893
21893
|
const checkSpecialChar = (e) => {
|
|
21894
21894
|
if (!/[0-9a-zA-Z ]/.test(e.key)) {
|
|
@@ -21909,7 +21909,7 @@ function TextArea(props) {
|
|
|
21909
21909
|
((placeholder && showLabelOnBorder) || (placeholder && value)) && React__default.createElement("label", { className: 'inputTextAreaLabel' },
|
|
21910
21910
|
placeholder.replace("*", ""),
|
|
21911
21911
|
placeholder.includes("*") && React__default.createElement("label", { className: 'astreik' }, "*")),
|
|
21912
|
-
React__default.createElement("textarea", { value: value, onChange: (event) => onChange(event, property), onKeyDown: checkSpecialChar, maxLength: Number(requiredLimit), className:
|
|
21912
|
+
React__default.createElement("textarea", { value: value, onChange: (event) => onChange(event, property), onKeyDown: checkSpecialChar, maxLength: Number(requiredLimit), className: `${isShortTextBox ? "shortTextBox" : "textArea"} ${value && value.length > Number(requiredLimit) ? "maxLimitArea" : ""}`, placeholder: showLabelOnBorder ? "" : placeholder, onFocus: () => setShowLabelOnBorder(true), onBlur: checkFieldValue })),
|
|
21913
21913
|
React__default.createElement(Typography, { className: `characters ${value &&
|
|
21914
21914
|
value?.length > Number(requiredLimit) ? "maxLimit" : ""}`, variant: "L1", weight: "SEMI_BOLD" },
|
|
21915
21915
|
value?.length ?? 0,
|