mytek-components 2.0.1 → 2.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/main.umd.js CHANGED
@@ -23196,29 +23196,47 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
23196
23196
  const handleInputChange = (e) => {
23197
23197
  const val = e.target.value;
23198
23198
  setInputValue(val);
23199
- if (mode !== "select" && onChange) {
23200
- onChange(name, val);
23201
- }
23202
- if (mode !== "type") {
23203
- const normalized = normalizeOptions2(options2);
23204
- const filtered = normalized.filter(
23205
- (opt) => {
23206
- var _a;
23207
- return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
23208
- }
23209
- );
23210
- setFilteredOptions(filtered);
23211
- setShowDropdown(true);
23212
- setHighlightIndex(-1);
23213
- }
23199
+ const normalized = normalizeOptions2(options2);
23200
+ const filtered = normalized.filter(
23201
+ (opt) => {
23202
+ var _a;
23203
+ return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
23204
+ }
23205
+ );
23206
+ setFilteredOptions(filtered);
23207
+ setShowDropdown(true);
23208
+ setHighlightIndex(-1);
23214
23209
  };
23215
23210
  const handleSelect = (val, label2) => {
23216
23211
  setInputValue(label2);
23217
- if (onChange) {
23212
+ onChange(name, val);
23213
+ setShowDropdown(false);
23214
+ setHighlightIndex(-1);
23215
+ };
23216
+ const handleBlur = () => {
23217
+ const val = inputValue.trim();
23218
+ const normalized = normalizeOptions2(options2);
23219
+ const matchedOption = normalized.find(
23220
+ (opt) => opt.label.toLowerCase() === val.toLowerCase()
23221
+ );
23222
+ if (matchedOption) {
23223
+ setInputValue(matchedOption.label);
23224
+ onChange(name, matchedOption.value);
23225
+ } else if (mode === "both") {
23218
23226
  onChange(name, val);
23227
+ } else if (mode === "type") {
23228
+ onChange(name, val);
23229
+ } else {
23230
+ const selected = normalized.find(
23231
+ (opt) => opt.value === value
23232
+ );
23233
+ if (selected) {
23234
+ setInputValue(selected.label);
23235
+ } else {
23236
+ setInputValue("");
23237
+ }
23219
23238
  }
23220
23239
  setShowDropdown(false);
23221
- setHighlightIndex(-1);
23222
23240
  };
23223
23241
  const handleKeyDown = (e) => {
23224
23242
  if (!showDropdown || filteredOptions.length === 0) return;
@@ -23270,6 +23288,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
23270
23288
  name,
23271
23289
  value: inputValue,
23272
23290
  onChange: handleInputChange,
23291
+ onBlur: handleBlur,
23273
23292
  onFocus: () => {
23274
23293
  if (mode !== "type") {
23275
23294
  setFilteredOptions(normalizeOptions2(options2));
@@ -29258,6 +29277,11 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
29258
29277
  const [showPassword, setShowPassword] = React.useState(false);
29259
29278
  const [amountInWords, setAmountInWords] = React.useState("");
29260
29279
  const [enable, setEnable] = React.useState(true);
29280
+ React.useEffect(() => {
29281
+ if (value) {
29282
+ validate(value);
29283
+ }
29284
+ }, [value]);
29261
29285
  console.log(enable);
29262
29286
  const validate = (val) => {
29263
29287
  const raw = category === "amount" ? removeCommas(val) : val;
@@ -29295,7 +29319,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
29295
29319
  break;
29296
29320
  }
29297
29321
  case "mobile":
29298
- if (val.length !== 10) return setError("Invalid mobile number");
29322
+ if (val.length < 12) return setError("Invalid mobile number");
29299
29323
  if (val.length == 10) setEnable(true);
29300
29324
  break;
29301
29325
  case "aadhaar":
@@ -29481,7 +29505,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
29481
29505
  const handleChange = (e) => {
29482
29506
  let val;
29483
29507
  if (category == "mobile") {
29484
- alert(val.length);
29485
29508
  console.log(e);
29486
29509
  val = e;
29487
29510
  validate(val);
@@ -31107,7 +31130,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
31107
31130
  ))
31108
31131
  }
31109
31132
  ) }),
31110
- tabs.map((tab, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(CustomTabPanel, { value, index, className: "focus:outline-none !pl-0 !pb-0 !p-2 ", children: tab.content }, index))
31133
+ tabs.map((tab, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(CustomTabPanel, { value, index, className: "focus:outline-none !pr-0 !pt-0 !pl-0 !pb-0 sm:!pr-2 ", children: tab.content }, index))
31111
31134
  ] });
31112
31135
  }
31113
31136
  const ArrowDropDownIcon = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {