dhre-component-lib 0.6.8 → 0.7.0

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.
@@ -12,5 +12,6 @@ declare function Dropdown(props: {
12
12
  arrowDown: React.ReactNode;
13
13
  value?: value;
14
14
  className?: string;
15
+ onDropdownOpen?: (data: boolean) => void;
15
16
  }): React.JSX.Element;
16
17
  export default Dropdown;
@@ -14,6 +14,7 @@ interface OTPInputProps {
14
14
  inputClassName?: string;
15
15
  icon: React.ReactNode;
16
16
  disableResend?: boolean;
17
+ noResendButtonText?: string;
17
18
  }
18
19
  declare const OTPInput: React.FC<OTPInputProps>;
19
20
  export default OTPInput;
package/dist/index.d.ts CHANGED
@@ -207,6 +207,7 @@ interface OTPInputProps {
207
207
  inputClassName?: string;
208
208
  icon: React.ReactNode;
209
209
  disableResend?: boolean;
210
+ noResendButtonText?: string;
210
211
  }
211
212
  declare const OTPInput: React.FC<OTPInputProps>;
212
213
 
@@ -292,6 +293,7 @@ declare function Dropdown(props: {
292
293
  arrowDown: React.ReactNode;
293
294
  value?: value;
294
295
  className?: string;
296
+ onDropdownOpen?: (data: boolean) => void;
295
297
  }): React.JSX.Element;
296
298
 
297
299
  declare function TextArea(props: {
package/dist/index.esm.js CHANGED
@@ -9350,7 +9350,7 @@ const MapComponent = ({ containerClassName = "map-container", zoom = 18, mapOpti
9350
9350
  var css$e = ".otpMainContainer {\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 10px;\n width: 343px;\n}\n\n.otpInputDiv {\n flex-direction: row;\n gap: 12px;\n display: flex;\n}\n\n.otpInput {\n width: calc(25% - 9px);\n height: 48px;\n text-align: center;\n font-size: 18px;\n font-weight: 400;\n border-radius: 8px;\n}\n@media (max-width: 600px) {\n .otpInput {\n height: 40px;\n }\n}\n\n.resendContainer {\n display: flex;\n flex-direction: row;\n margin-top: 10px;\n justify-content: space-between;\n}\n\n.errorText {\n color: #EB0542;\n font-weight: 400;\n font-size: 14px;\n}\n\n.timerText {\n color: #0569C2;\n font-weight: 400;\n font-size: 14px;\n display: flex;\n align-items: center;\n}\n\n.resendText {\n color: #A7A7A7;\n font-weight: 700;\n font-size: 14px;\n}\n\n.enabledResendText {\n color: #000000;\n font-weight: 700;\n font-size: 14px;\n}";
9351
9351
  n(css$e,{});
9352
9352
 
9353
- const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDelay = 60, error = false, errorText, resendText, showResendButton = true, className, inputClassName, disableResend, icon }) => {
9353
+ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDelay = 60, error = false, errorText, resendText, showResendButton = true, className, inputClassName, disableResend, icon, noResendButtonText }) => {
9354
9354
  const [otp, setOtp] = useState(Array(length).fill(""));
9355
9355
  const [timer, setTimer] = useState(resendDelay);
9356
9356
  const [isComplete, setIsComplete] = useState(false);
@@ -9409,6 +9409,7 @@ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDel
9409
9409
  .map((_, index) => (React__default.createElement("input", { key: index, type: "text", id: `otp-input-${index}`, value: otp[index], "data-testid": `otp-input-${index}`, onChange: (e) => handleChange(e.target.value, index), onKeyDown: (e) => handleKeyDown(e, index), maxLength: 1, style: { border: `1px solid ${getReadableStatus()}` }, className: `${'otpInput'} ${inputClassName ? inputClassName : ''}`, autoFocus: autoFocus && index === 0 })))),
9410
9410
  React__default.createElement("div", { className: "resendContainer" },
9411
9411
  error && (React__default.createElement("div", { className: "errorText" }, errorText)),
9412
+ !showResendButton && !error && React__default.createElement("div", { className: "errorText" }, noResendButtonText),
9412
9413
  (showResendButton && !error) && (React__default.createElement(React__default.Fragment, null,
9413
9414
  React__default.createElement("div", { className: "timerText" },
9414
9415
  timer ? icon : "",
@@ -9590,11 +9591,11 @@ const Tabs = ({ tabs, onTabChange, selectedTabValue, dot }) => {
9590
9591
  React__default.createElement("div", { className: "counts" }, tab?.count))))))));
9591
9592
  };
9592
9593
 
9593
- var css$9 = ".dropdown {\n width: 100%;\n border: 0.0625rem solid #686868;\n height: 3.5rem;\n border-radius: 0.5rem;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding: 1rem;\n position: relative;\n cursor: pointer;\n z-index: 1;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.dropdownLabel {\n position: absolute;\n z-index: 2;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.placeholder {\n color: #686868;\n}\n\n.dropPosition {\n position: relative;\n}\n\n.dropdownValues {\n border: 0.0625rem solid #e1e1e1;\n box-shadow: 0px 0.25rem 0.5rem 0px rgba(0, 0, 0, 0.2509803922);\n border-radius: 0.5rem;\n margin-top: 0.3125rem;\n position: absolute;\n width: 100%;\n z-index: 9;\n}\n\n.unselectedText {\n background: #ffffff;\n height: 3.24rem;\n padding: 1rem;\n color: #686868;\n cursor: pointer;\n}\n\n.value {\n color: #000000;\n}\n\n.unselectedText:hover {\n background: #e1e1e1;\n color: #000000;\n font-weight: 700 !important;\n}\n\n.backdropDropdown {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n\n.dropdown select {\n background: transparent;\n width: 10.625rem;\n padding: 0.5rem;\n border: 0;\n border-radius: 0;\n height: 2.1875rem;\n}";
9594
+ var css$9 = ".dropdown {\n width: 100%;\n border: 0.0625rem solid #686868;\n height: 3.5rem;\n border-radius: 0.5rem;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding: 1rem;\n position: relative;\n cursor: pointer;\n z-index: 1;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.dropdownLabel {\n position: absolute;\n z-index: 2;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.placeholder {\n color: #686868;\n}\n\n.dropPosition {\n position: relative;\n}\n\n.zIndexProp {\n z-index: 0;\n}\n\n.dropdownValues {\n border: 0.0625rem solid #e1e1e1;\n box-shadow: 0px 0.25rem 0.5rem 0px rgba(0, 0, 0, 0.2509803922);\n border-radius: 0.5rem;\n margin-top: 0.3125rem;\n position: absolute;\n width: 100%;\n z-index: 9;\n}\n\n.unselectedText {\n background: #ffffff;\n height: 3.24rem;\n padding: 1rem;\n color: #686868;\n cursor: pointer;\n}\n\n.value {\n color: #000000;\n}\n\n.unselectedText:hover {\n background: #e1e1e1;\n color: #000000;\n font-weight: 700 !important;\n}\n\n.backdropDropdown {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 4;\n}\n\n.dropdown select {\n background: transparent;\n width: 10.625rem;\n padding: 0.5rem;\n border: 0;\n border-radius: 0;\n height: 2.1875rem;\n}";
9594
9595
  n(css$9,{});
9595
9596
 
9596
9597
  function Dropdown(props) {
9597
- const { placeholder, getSelectedValue, dropdownList, arrowUp, arrowDown, value, className, } = props;
9598
+ const { placeholder, getSelectedValue, dropdownList, arrowUp, arrowDown, value, className, onDropdownOpen } = props;
9598
9599
  const [openDropdown, setOpenDropdown] = useState(false);
9599
9600
  const [selectedValue, setSelectedValue] = useState(value);
9600
9601
  const selectedDropdwonValue = (value) => {
@@ -9602,6 +9603,14 @@ function Dropdown(props) {
9602
9603
  getSelectedValue(value);
9603
9604
  setOpenDropdown(!openDropdown);
9604
9605
  };
9606
+ useEffect(() => {
9607
+ if (openDropdown) {
9608
+ onDropdownOpen && onDropdownOpen(true);
9609
+ }
9610
+ else {
9611
+ onDropdownOpen && onDropdownOpen(false);
9612
+ }
9613
+ }, [openDropdown]);
9605
9614
  useEffect(() => {
9606
9615
  if (!value) {
9607
9616
  setSelectedValue(undefined);
@@ -9609,7 +9618,7 @@ function Dropdown(props) {
9609
9618
  }, [value]);
9610
9619
  return (React__default.createElement(React__default.Fragment, null,
9611
9620
  openDropdown && (React__default.createElement("div", { onClick: () => setOpenDropdown(!openDropdown), className: "backdropDropdown" })),
9612
- React__default.createElement("div", { className: "dropPosition" },
9621
+ React__default.createElement("div", { className: `dropPosition ${!openDropdown ? 'zIndexProp' : ''}` },
9613
9622
  placeholder && selectedValue && (React__default.createElement("label", { className: "dropdownLabel" },
9614
9623
  placeholder.replace("*", ""),
9615
9624
  placeholder.includes("*") && React__default.createElement("label", { className: 'astreik' }, "*"))),
@@ -9622,20 +9631,32 @@ function Dropdown(props) {
9622
9631
  React__default.createElement(Typography, { variant: "B3", weight: "SEMI_BOLD" }, val.name)))))))));
9623
9632
  }
9624
9633
 
9625
- 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.characters {\n color: #686868;\n}\n\n.textArea100 {\n height: 100%;\n width: 100%;\n position: relative;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\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}";
9634
+ 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}";
9626
9635
  n(css$8,{});
9627
9636
 
9628
9637
  function TextArea(props) {
9629
9638
  const { value, onChange, requiredLimit, placeholder, charText, property } = props;
9639
+ const [showLabelOnBorder, setShowLabelOnBorder] = useState(false);
9630
9640
  const checkSpecialChar = (e) => {
9631
9641
  if (!/[0-9a-zA-Z ]/.test(e.key)) {
9632
9642
  e.preventDefault();
9633
9643
  }
9634
9644
  console.log('textAraea');
9635
9645
  };
9636
- return (React__default.createElement(React__default.Fragment, null,
9646
+ const checkFieldValue = (e) => {
9647
+ if (!e.key) {
9648
+ setShowLabelOnBorder(false);
9649
+ }
9650
+ };
9651
+ useEffect(() => {
9652
+ setShowLabelOnBorder(!!value);
9653
+ }, [value]);
9654
+ return (React__default.createElement("div", { className: "positionRel" },
9637
9655
  React__default.createElement("div", { className: "textArea100" },
9638
- React__default.createElement("textarea", { value: value, onChange: (event) => onChange(event, property), onKeyDown: checkSpecialChar, maxLength: Number(requiredLimit), className: `textArea ${value && value?.length > Number(requiredLimit) ? "maxLimitArea" : ""}`, placeholder: placeholder })),
9656
+ ((placeholder && showLabelOnBorder) || (placeholder && value)) && React__default.createElement("label", { className: 'inputTextAreaLabel' },
9657
+ placeholder.replace("*", ""),
9658
+ placeholder.includes("*") && React__default.createElement("label", { className: 'astreik' }, "*")),
9659
+ React__default.createElement("textarea", { value: value, onChange: (event) => onChange(event, property), onKeyDown: checkSpecialChar, maxLength: Number(requiredLimit), className: `textArea ${value && value?.length > Number(requiredLimit) ? "maxLimitArea" : ""}`, placeholder: showLabelOnBorder ? "" : placeholder, onFocus: () => setShowLabelOnBorder(true), onBlur: checkFieldValue })),
9639
9660
  React__default.createElement(Typography, { className: `characters ${value &&
9640
9661
  value?.length > Number(requiredLimit) ? "maxLimit" : ""}`, variant: "L1", weight: "SEMI_BOLD" },
9641
9662
  value?.length ?? 0,