mytek-components 1.0.0 → 1.0.2

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/index.js CHANGED
@@ -16797,7 +16797,6 @@ const CustomInput = ({
16797
16797
  const [error, setError] = useState("");
16798
16798
  const [showPassword, setShowPassword] = useState(false);
16799
16799
  const [amountInWords, setAmountInWords] = useState("");
16800
- const [touched, setTouched] = useState(true);
16801
16800
  const [enable, setEnable] = useState(button == null ? void 0 : button.disabled);
16802
16801
  const validate = (val) => {
16803
16802
  const raw = category === "amount" ? removeCommas(val) : val;
@@ -16941,7 +16940,7 @@ const CustomInput = ({
16941
16940
  formatted = val;
16942
16941
  }
16943
16942
  onChange(name, formatted);
16944
- if (touched) validate(formatted);
16943
+ validate(formatted);
16945
16944
  setAmountInWords(numberToWords(rawValue, format));
16946
16945
  break;
16947
16946
  case "number1":
@@ -16968,12 +16967,12 @@ const CustomInput = ({
16968
16967
  case "gst":
16969
16968
  val = val.toUpperCase().slice(0, 15);
16970
16969
  onChange(name, val);
16971
- if (touched) validate(val);
16970
+ validate(val);
16972
16971
  break;
16973
16972
  case "pan":
16974
16973
  val = val.toUpperCase().slice(0, 10);
16975
16974
  onChange(name, val);
16976
- if (touched) validate(val);
16975
+ validate(val);
16977
16976
  break;
16978
16977
  case "password":
16979
16978
  val = val.slice(0, maxLength || 20);
@@ -16983,10 +16982,6 @@ const CustomInput = ({
16983
16982
  onChange(name, val);
16984
16983
  }
16985
16984
  };
16986
- const handleBlur = () => {
16987
- setTouched(true);
16988
- validate(value);
16989
- };
16990
16985
  const handlePhoneChange = (value2, country) => {
16991
16986
  setError("");
16992
16987
  const selectedCountryCode = country.countryCode.toUpperCase();
@@ -17100,65 +17095,105 @@ const CustomInput = ({
17100
17095
  children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(MytekLoader, { inline: true }) : button.label
17101
17096
  }
17102
17097
  )
17103
- ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17104
- /* @__PURE__ */ jsxRuntimeExports.jsx(
17105
- FormControl$1,
17106
- {
17107
- type: isPassword ? showPassword ? "text" : "password" : type,
17108
- placeholder,
17109
- style: {
17110
- borderColor: "#12AB5B",
17111
- height: height2 || "40px",
17112
- borderTopRightRadius: !isPassword && !(button == null ? void 0 : button.label) && !suffix ? "0.375rem" : 0,
17113
- borderBottomRightRadius: !isPassword && !(button == null ? void 0 : button.label) && !suffix ? "0.375rem" : 0,
17114
- borderTopLeftRadius: prefix ? 0 : "0.375rem",
17115
- borderBottomLeftRadius: prefix ? 0 : "0.375rem"
17116
- },
17117
- name,
17118
- value,
17119
- onChange: handleChange,
17120
- onBlur: handleBlur,
17121
- isInvalid: !!error,
17122
- disabled
17123
- }
17124
- ),
17125
- suffix && /* @__PURE__ */ jsxRuntimeExports.jsx(
17126
- InputGroup$1.Text,
17127
- {
17128
- style: { backgroundColor: "#fff", borderColor: "#12AB5B" },
17129
- children: suffix
17130
- }
17131
- ),
17132
- isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
17133
- InputGroup$1.Text,
17134
- {
17135
- onClick: () => setShowPassword(!showPassword),
17136
- style: {
17137
- backgroundColor: "#fff",
17138
- borderColor: "#12AB5B",
17139
- cursor: "pointer",
17140
- userSelect: "none"
17141
- },
17142
- disabled,
17143
- children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
17144
- }
17145
- ),
17146
- (button == null ? void 0 : button.label) && /* @__PURE__ */ jsxRuntimeExports.jsx(
17147
- Button,
17148
- {
17149
- variant: "primary",
17150
- onClick: button == null ? void 0 : button.onClick,
17151
- disabled: enable,
17152
- style: {
17153
- backgroundColor: "#3B5AA1",
17154
- borderColor: "#12AB5B",
17155
- color: "white",
17156
- width: "80px"
17157
- },
17158
- children: "button.label"
17159
- }
17160
- )
17161
- ] })
17098
+ ] }) }) : (
17099
+ // <>
17100
+ // <FormControl
17101
+ // type={isPassword ? (showPassword ? "text" : "password") : type}
17102
+ // placeholder={placeholder}
17103
+ // style={{
17104
+ // borderColor: "#12AB5B",
17105
+ // height: height || "40px",
17106
+ // borderTopRightRadius:
17107
+ // !isPassword && !button?.label && !suffix ? "0.375rem" : 0,
17108
+ // borderBottomRightRadius:
17109
+ // !isPassword && !button?.label && !suffix ? "0.375rem" : 0,
17110
+ // borderTopLeftRadius: prefix ? 0 : "0.375rem",
17111
+ // borderBottomLeftRadius: prefix ? 0 : "0.375rem",
17112
+ // }}
17113
+ // name={name}
17114
+ // value={value}
17115
+ // onChange={handleChange}
17116
+ // onBlur={handleBlur}
17117
+ // isInvalid={!!error}
17118
+ // disabled={disabled}
17119
+ // />
17120
+ // {suffix && (
17121
+ // <InputGroup.Text
17122
+ // style={{ backgroundColor: "#fff", borderColor: "#12AB5B" }}
17123
+ // >
17124
+ // {suffix}
17125
+ // </InputGroup.Text>
17126
+ // )}
17127
+ // {isPassword && (
17128
+ // <InputGroup.Text
17129
+ // onClick={() => setShowPassword(!showPassword)}
17130
+ // style={{
17131
+ // backgroundColor: "#fff",
17132
+ // borderColor: "#12AB5B",
17133
+ // cursor: "pointer",
17134
+ // userSelect: "none",
17135
+ // }}
17136
+ // disabled={disabled}
17137
+ // >
17138
+ // {showPassword ? <FiEye /> : <FiEyeOff />}
17139
+ // </InputGroup.Text>
17140
+ // )}
17141
+ // {button?.label && (
17142
+ // <Button
17143
+ // variant="primary"
17144
+ // onClick={button?.onClick}
17145
+ // disabled={enable}
17146
+ // style={{
17147
+ // backgroundColor: "#3B5AA1",
17148
+ // borderColor: "#12AB5B",
17149
+ // color: "white",
17150
+ // width: "80px",
17151
+ // }}
17152
+ // >
17153
+ // button.label
17154
+ // {/* {button.loader ?
17155
+ // <MytekLoader inline={true} />
17156
+ // : button.label} */}
17157
+ // </Button>
17158
+ // )}
17159
+ // </>
17160
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-[#12AB5B] overflow-hidden rounded-md", children: [
17161
+ prefix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-r border-[#12AB5B]", children: prefix }),
17162
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17163
+ "input",
17164
+ {
17165
+ type: isPassword ? showPassword ? "text" : "password" : type,
17166
+ name,
17167
+ value,
17168
+ onChange: handleChange,
17169
+ disabled,
17170
+ placeholder,
17171
+ className: "flex-1 px-3 py-2 focus:outline-none",
17172
+ style: { height: height2 }
17173
+ }
17174
+ ),
17175
+ suffix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-l border-[#12AB5B]", children: suffix }),
17176
+ isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
17177
+ "button",
17178
+ {
17179
+ type: "button",
17180
+ onClick: () => setShowPassword(!showPassword),
17181
+ className: "px-2 bg-white text-gray-500 border-l border-[#12AB5B]",
17182
+ children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
17183
+ }
17184
+ ),
17185
+ (button == null ? void 0 : button.label) && /* @__PURE__ */ jsxRuntimeExports.jsx(
17186
+ "button",
17187
+ {
17188
+ onClick: button == null ? void 0 : button.onClick,
17189
+ disabled: enable,
17190
+ className: `px-4 py-2 text-white ${backgroundColor2 || "bg-blue-600"} border-l border-[#12AB5B] rounded-r-md`,
17191
+ style: { height: height2 },
17192
+ children: button.loader ? "..." : button.label
17193
+ }
17194
+ )
17195
+ ] })
17196
+ )
17162
17197
  }
17163
17198
  )
17164
17199
  ] }),