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/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # React + Vite
2
-
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
-
5
- Currently, two official plugins are available:
6
-
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
1
+ # React + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
package/dist/main.es.js CHANGED
@@ -23180,29 +23180,47 @@ const ComboDropdown = ({
23180
23180
  const handleInputChange = (e) => {
23181
23181
  const val = e.target.value;
23182
23182
  setInputValue(val);
23183
- if (mode !== "select" && onChange) {
23184
- onChange(name, val);
23185
- }
23186
- if (mode !== "type") {
23187
- const normalized = normalizeOptions2(options);
23188
- const filtered = normalized.filter(
23189
- (opt) => {
23190
- var _a;
23191
- return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
23192
- }
23193
- );
23194
- setFilteredOptions(filtered);
23195
- setShowDropdown(true);
23196
- setHighlightIndex(-1);
23197
- }
23183
+ const normalized = normalizeOptions2(options);
23184
+ const filtered = normalized.filter(
23185
+ (opt) => {
23186
+ var _a;
23187
+ return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
23188
+ }
23189
+ );
23190
+ setFilteredOptions(filtered);
23191
+ setShowDropdown(true);
23192
+ setHighlightIndex(-1);
23198
23193
  };
23199
23194
  const handleSelect = (val, label2) => {
23200
23195
  setInputValue(label2);
23201
- if (onChange) {
23196
+ onChange(name, val);
23197
+ setShowDropdown(false);
23198
+ setHighlightIndex(-1);
23199
+ };
23200
+ const handleBlur = () => {
23201
+ const val = inputValue.trim();
23202
+ const normalized = normalizeOptions2(options);
23203
+ const matchedOption = normalized.find(
23204
+ (opt) => opt.label.toLowerCase() === val.toLowerCase()
23205
+ );
23206
+ if (matchedOption) {
23207
+ setInputValue(matchedOption.label);
23208
+ onChange(name, matchedOption.value);
23209
+ } else if (mode === "both") {
23202
23210
  onChange(name, val);
23211
+ } else if (mode === "type") {
23212
+ onChange(name, val);
23213
+ } else {
23214
+ const selected = normalized.find(
23215
+ (opt) => opt.value === value
23216
+ );
23217
+ if (selected) {
23218
+ setInputValue(selected.label);
23219
+ } else {
23220
+ setInputValue("");
23221
+ }
23203
23222
  }
23204
23223
  setShowDropdown(false);
23205
- setHighlightIndex(-1);
23206
23224
  };
23207
23225
  const handleKeyDown = (e) => {
23208
23226
  if (!showDropdown || filteredOptions.length === 0) return;
@@ -23254,6 +23272,7 @@ const ComboDropdown = ({
23254
23272
  name,
23255
23273
  value: inputValue,
23256
23274
  onChange: handleInputChange,
23275
+ onBlur: handleBlur,
23257
23276
  onFocus: () => {
23258
23277
  if (mode !== "type") {
23259
23278
  setFilteredOptions(normalizeOptions2(options));
@@ -29242,6 +29261,11 @@ const CustomInput = ({
29242
29261
  const [showPassword, setShowPassword] = useState(false);
29243
29262
  const [amountInWords, setAmountInWords] = useState("");
29244
29263
  const [enable, setEnable] = useState(true);
29264
+ useEffect(() => {
29265
+ if (value) {
29266
+ validate(value);
29267
+ }
29268
+ }, [value]);
29245
29269
  console.log(enable);
29246
29270
  const validate = (val) => {
29247
29271
  const raw = category === "amount" ? removeCommas(val) : val;
@@ -29279,7 +29303,7 @@ const CustomInput = ({
29279
29303
  break;
29280
29304
  }
29281
29305
  case "mobile":
29282
- if (val.length !== 10) return setError("Invalid mobile number");
29306
+ if (val.length < 12) return setError("Invalid mobile number");
29283
29307
  if (val.length == 10) setEnable(true);
29284
29308
  break;
29285
29309
  case "aadhaar":
@@ -29465,7 +29489,6 @@ const CustomInput = ({
29465
29489
  const handleChange = (e) => {
29466
29490
  let val;
29467
29491
  if (category == "mobile") {
29468
- alert(val.length);
29469
29492
  console.log(e);
29470
29493
  val = e;
29471
29494
  validate(val);
@@ -31091,7 +31114,7 @@ function DynamicTabs({
31091
31114
  ))
31092
31115
  }
31093
31116
  ) }),
31094
- tabs.map((tab, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(CustomTabPanel, { value, index, className: "focus:outline-none !pl-0 !pb-0 !p-2 ", children: tab.content }, index))
31117
+ 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))
31095
31118
  ] });
31096
31119
  }
31097
31120
  const ArrowDropDownIcon = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {