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.
@@ -16813,7 +16813,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
16813
16813
  const [error, setError] = React.useState("");
16814
16814
  const [showPassword, setShowPassword] = React.useState(false);
16815
16815
  const [amountInWords, setAmountInWords] = React.useState("");
16816
- const [touched, setTouched] = React.useState(true);
16817
16816
  const [enable, setEnable] = React.useState(button == null ? void 0 : button.disabled);
16818
16817
  const validate = (val) => {
16819
16818
  const raw = category === "amount" ? removeCommas(val) : val;
@@ -16957,7 +16956,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
16957
16956
  formatted = val;
16958
16957
  }
16959
16958
  onChange(name, formatted);
16960
- if (touched) validate(formatted);
16959
+ validate(formatted);
16961
16960
  setAmountInWords(numberToWords(rawValue, format));
16962
16961
  break;
16963
16962
  case "number1":
@@ -16984,12 +16983,12 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
16984
16983
  case "gst":
16985
16984
  val = val.toUpperCase().slice(0, 15);
16986
16985
  onChange(name, val);
16987
- if (touched) validate(val);
16986
+ validate(val);
16988
16987
  break;
16989
16988
  case "pan":
16990
16989
  val = val.toUpperCase().slice(0, 10);
16991
16990
  onChange(name, val);
16992
- if (touched) validate(val);
16991
+ validate(val);
16993
16992
  break;
16994
16993
  case "password":
16995
16994
  val = val.slice(0, maxLength || 20);
@@ -16999,10 +16998,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
16999
16998
  onChange(name, val);
17000
16999
  }
17001
17000
  };
17002
- const handleBlur = () => {
17003
- setTouched(true);
17004
- validate(value);
17005
- };
17006
17001
  const handlePhoneChange = (value2, country) => {
17007
17002
  setError("");
17008
17003
  const selectedCountryCode = country.countryCode.toUpperCase();
@@ -17116,65 +17111,105 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
17116
17111
  children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(MytekLoader, { inline: true }) : button.label
17117
17112
  }
17118
17113
  )
17119
- ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17120
- /* @__PURE__ */ jsxRuntimeExports.jsx(
17121
- FormControl$1,
17122
- {
17123
- type: isPassword ? showPassword ? "text" : "password" : type,
17124
- placeholder,
17125
- style: {
17126
- borderColor: "#12AB5B",
17127
- height: height2 || "40px",
17128
- borderTopRightRadius: !isPassword && !(button == null ? void 0 : button.label) && !suffix ? "0.375rem" : 0,
17129
- borderBottomRightRadius: !isPassword && !(button == null ? void 0 : button.label) && !suffix ? "0.375rem" : 0,
17130
- borderTopLeftRadius: prefix ? 0 : "0.375rem",
17131
- borderBottomLeftRadius: prefix ? 0 : "0.375rem"
17132
- },
17133
- name,
17134
- value,
17135
- onChange: handleChange,
17136
- onBlur: handleBlur,
17137
- isInvalid: !!error,
17138
- disabled
17139
- }
17140
- ),
17141
- suffix && /* @__PURE__ */ jsxRuntimeExports.jsx(
17142
- InputGroup$1.Text,
17143
- {
17144
- style: { backgroundColor: "#fff", borderColor: "#12AB5B" },
17145
- children: suffix
17146
- }
17147
- ),
17148
- isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
17149
- InputGroup$1.Text,
17150
- {
17151
- onClick: () => setShowPassword(!showPassword),
17152
- style: {
17153
- backgroundColor: "#fff",
17154
- borderColor: "#12AB5B",
17155
- cursor: "pointer",
17156
- userSelect: "none"
17157
- },
17158
- disabled,
17159
- children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
17160
- }
17161
- ),
17162
- (button == null ? void 0 : button.label) && /* @__PURE__ */ jsxRuntimeExports.jsx(
17163
- Button,
17164
- {
17165
- variant: "primary",
17166
- onClick: button == null ? void 0 : button.onClick,
17167
- disabled: enable,
17168
- style: {
17169
- backgroundColor: "#3B5AA1",
17170
- borderColor: "#12AB5B",
17171
- color: "white",
17172
- width: "80px"
17173
- },
17174
- children: "button.label"
17175
- }
17176
- )
17177
- ] })
17114
+ ] }) }) : (
17115
+ // <>
17116
+ // <FormControl
17117
+ // type={isPassword ? (showPassword ? "text" : "password") : type}
17118
+ // placeholder={placeholder}
17119
+ // style={{
17120
+ // borderColor: "#12AB5B",
17121
+ // height: height || "40px",
17122
+ // borderTopRightRadius:
17123
+ // !isPassword && !button?.label && !suffix ? "0.375rem" : 0,
17124
+ // borderBottomRightRadius:
17125
+ // !isPassword && !button?.label && !suffix ? "0.375rem" : 0,
17126
+ // borderTopLeftRadius: prefix ? 0 : "0.375rem",
17127
+ // borderBottomLeftRadius: prefix ? 0 : "0.375rem",
17128
+ // }}
17129
+ // name={name}
17130
+ // value={value}
17131
+ // onChange={handleChange}
17132
+ // onBlur={handleBlur}
17133
+ // isInvalid={!!error}
17134
+ // disabled={disabled}
17135
+ // />
17136
+ // {suffix && (
17137
+ // <InputGroup.Text
17138
+ // style={{ backgroundColor: "#fff", borderColor: "#12AB5B" }}
17139
+ // >
17140
+ // {suffix}
17141
+ // </InputGroup.Text>
17142
+ // )}
17143
+ // {isPassword && (
17144
+ // <InputGroup.Text
17145
+ // onClick={() => setShowPassword(!showPassword)}
17146
+ // style={{
17147
+ // backgroundColor: "#fff",
17148
+ // borderColor: "#12AB5B",
17149
+ // cursor: "pointer",
17150
+ // userSelect: "none",
17151
+ // }}
17152
+ // disabled={disabled}
17153
+ // >
17154
+ // {showPassword ? <FiEye /> : <FiEyeOff />}
17155
+ // </InputGroup.Text>
17156
+ // )}
17157
+ // {button?.label && (
17158
+ // <Button
17159
+ // variant="primary"
17160
+ // onClick={button?.onClick}
17161
+ // disabled={enable}
17162
+ // style={{
17163
+ // backgroundColor: "#3B5AA1",
17164
+ // borderColor: "#12AB5B",
17165
+ // color: "white",
17166
+ // width: "80px",
17167
+ // }}
17168
+ // >
17169
+ // button.label
17170
+ // {/* {button.loader ?
17171
+ // <MytekLoader inline={true} />
17172
+ // : button.label} */}
17173
+ // </Button>
17174
+ // )}
17175
+ // </>
17176
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-[#12AB5B] overflow-hidden rounded-md", children: [
17177
+ prefix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-r border-[#12AB5B]", children: prefix }),
17178
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17179
+ "input",
17180
+ {
17181
+ type: isPassword ? showPassword ? "text" : "password" : type,
17182
+ name,
17183
+ value,
17184
+ onChange: handleChange,
17185
+ disabled,
17186
+ placeholder,
17187
+ className: "flex-1 px-3 py-2 focus:outline-none",
17188
+ style: { height: height2 }
17189
+ }
17190
+ ),
17191
+ suffix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-l border-[#12AB5B]", children: suffix }),
17192
+ isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
17193
+ "button",
17194
+ {
17195
+ type: "button",
17196
+ onClick: () => setShowPassword(!showPassword),
17197
+ className: "px-2 bg-white text-gray-500 border-l border-[#12AB5B]",
17198
+ children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
17199
+ }
17200
+ ),
17201
+ (button == null ? void 0 : button.label) && /* @__PURE__ */ jsxRuntimeExports.jsx(
17202
+ "button",
17203
+ {
17204
+ onClick: button == null ? void 0 : button.onClick,
17205
+ disabled: enable,
17206
+ className: `px-4 py-2 text-white ${backgroundColor2 || "bg-blue-600"} border-l border-[#12AB5B] rounded-r-md`,
17207
+ style: { height: height2 },
17208
+ children: button.loader ? "..." : button.label
17209
+ }
17210
+ )
17211
+ ] })
17212
+ )
17178
17213
  }
17179
17214
  )
17180
17215
  ] }),