tp-react-elements-dev 1.4.14 → 1.4.16

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
@@ -52060,14 +52060,11 @@ const SingleSelect = ({ props }) => {
52060
52060
  }, onBlur: (e) => {
52061
52061
  var _a, _b;
52062
52062
  ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onBlurFn) && ((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.onBlurFn(e));
52063
- }, size: "small", sx: {
52064
- "& .MuiAutocomplete-input": {
52063
+ }, size: "small", sx: Object.assign({ "& .MuiAutocomplete-input": {
52065
52064
  padding: "0px 0px 0px 5px !important",
52066
- },
52067
- "& .css-erkti9-MuiFormLabel-root-MuiInputLabel-root,.css-8edmr2-MuiFormLabel-root-MuiInputLabel-root": {
52065
+ }, "& .css-erkti9-MuiFormLabel-root-MuiInputLabel-root,.css-8edmr2-MuiFormLabel-root-MuiInputLabel-root": {
52068
52066
  top: "-3px",
52069
- },
52070
- }, ListboxProps: {
52067
+ } }, props.item.sx), ListboxProps: {
52071
52068
  onScroll: (event) => {
52072
52069
  const listboxNode = event.currentTarget;
52073
52070
  if (listboxNode.scrollTop + listboxNode.clientHeight ===
@@ -52321,28 +52318,21 @@ const RenderForm = (props) => {
52321
52318
  fontFamily: "Roboto-Reg",
52322
52319
  border: "none",
52323
52320
  },
52324
- }, sx: {
52325
- fontFamily: "Roboto-Reg",
52326
- "& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
52321
+ }, sx: Object.assign({ fontFamily: "Roboto-Reg", "& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
52327
52322
  top: "-10px",
52328
52323
  // fontSize:'14px !important'
52329
- },
52330
- "& .css-2rul56-MuiFormLabel-root-MuiInputLabel-root": {
52324
+ }, "& .css-2rul56-MuiFormLabel-root-MuiInputLabel-root": {
52331
52325
  top: "-10px",
52332
52326
  fontFamily: "Roboto-Reg",
52333
- },
52334
- "& .css-12ciryo-MuiFormLabel-root-MuiInputLabel-root ": {
52327
+ }, "& .css-12ciryo-MuiFormLabel-root-MuiInputLabel-root ": {
52335
52328
  fontFamily: "Roboto-Reg",
52336
- },
52337
- "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input ": {
52329
+ }, "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input ": {
52338
52330
  outline: "none",
52339
52331
  border: "1px solid #ced4da", // Add this line to set border to none
52340
- },
52341
- "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input:focus ": {
52332
+ }, "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input:focus ": {
52342
52333
  outline: "none",
52343
52334
  border: "none", // Set border to none when input is focused
52344
- },
52345
- },
52335
+ } }, props.item.sx),
52346
52336
  // classes={{ option: { color: "red !important" } }}
52347
52337
  value: field.value || "", size: "small", disabled: props.item.disable, onBlur: (e) => {
52348
52338
  var _a, _b;
@@ -52381,28 +52371,21 @@ const RenderForm = (props) => {
52381
52371
  e.target.value = e.target.value
52382
52372
  .replace(/\s/g, "")
52383
52373
  .replace(/[^a-zA-Z0-9!@#$%^&*()_+{}\[\]:;<>,.?/~`|\\-]/g, "");
52384
- }, sx: {
52385
- fontFamily: "Roboto-Reg",
52386
- "& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
52374
+ }, sx: Object.assign({ fontFamily: "Roboto-Reg", "& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
52387
52375
  top: "-10px",
52388
52376
  // fontSize:'14px !important'
52389
- },
52390
- "& .css-2rul56-MuiFormLabel-root-MuiInputLabel-root": {
52377
+ }, "& .css-2rul56-MuiFormLabel-root-MuiInputLabel-root": {
52391
52378
  top: "-10px",
52392
52379
  fontFamily: "Roboto-Reg",
52393
- },
52394
- "& .css-12ciryo-MuiFormLabel-root-MuiInputLabel-root ": {
52380
+ }, "& .css-12ciryo-MuiFormLabel-root-MuiInputLabel-root ": {
52395
52381
  fontFamily: "Roboto-Reg",
52396
- },
52397
- "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input ": {
52382
+ }, "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input ": {
52398
52383
  outline: "none",
52399
52384
  border: "1px solid #ced4da", // Add this line to set border to none
52400
- },
52401
- "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input:focus ": {
52385
+ }, "& .css-1gq5vhi-MuiInputBase-root-MuiOutlinedInput-root input:focus ": {
52402
52386
  outline: "none",
52403
52387
  border: "none", // Set border to none when input is focused
52404
- },
52405
- },
52388
+ } }, props.item.sx),
52406
52389
  // classes={{ option: { color: "red !important" } }}
52407
52390
  value: field.value || "", disabled: props.item.disable })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
52408
52391
  fontFamily: "Roboto-Reg",
@@ -55136,6 +55119,14 @@ create$3.prototype = ObjectSchema.prototype;
55136
55119
  const useFormValidatingContext = (formArray) => {
55137
55120
  const initialValues = {};
55138
55121
  const validationShape = {};
55122
+ console.log(formArray, 'formArrayformArray');
55123
+ const renderCustomError = (field) => {
55124
+ if (field.customErrorMessage) {
55125
+ validationShape[field.name] = validationShape[field.name].test("custom-check", field.customErrorMessage, // Use the actual custom message
55126
+ (value) => field.customErrorMessage && field.customErrorMessage > 0 // No additional validation logic required
55127
+ );
55128
+ }
55129
+ };
55139
55130
  formArray.forEach((field) => {
55140
55131
  var _a;
55141
55132
  switch (field.inputType) {
@@ -55145,7 +55136,9 @@ const useFormValidatingContext = (formArray) => {
55145
55136
  validationShape[field.name] = create$6()
55146
55137
  .typeError(field.errorMessage)
55147
55138
  .required(field.errorMessage);
55139
+ renderCustomError(field);
55148
55140
  }
55141
+ renderCustomError(field);
55149
55142
  break;
55150
55143
  case "password":
55151
55144
  initialValues[field.name] = "";
@@ -55153,7 +55146,9 @@ const useFormValidatingContext = (formArray) => {
55153
55146
  validationShape[field.name] = create$6()
55154
55147
  .typeError(field.errorMessage)
55155
55148
  .required(field.errorMessage);
55149
+ renderCustomError(field);
55156
55150
  }
55151
+ renderCustomError(field);
55157
55152
  break;
55158
55153
  case "email":
55159
55154
  initialValues[field.name] = "";
@@ -55164,6 +55159,7 @@ const useFormValidatingContext = (formArray) => {
55164
55159
  .test("valid-email", `Please enter valid Email`, (value) => {
55165
55160
  return /\@.*\..+/.test(value);
55166
55161
  });
55162
+ renderCustomError(field);
55167
55163
  }
55168
55164
  else {
55169
55165
  validationShape[field.name] = create$6()
@@ -55172,7 +55168,9 @@ const useFormValidatingContext = (formArray) => {
55172
55168
  // Custom validation to check for at least one period after '@'
55173
55169
  return !value || /\@.*\..+/.test(value);
55174
55170
  });
55171
+ renderCustomError(field);
55175
55172
  }
55173
+ renderCustomError(field);
55176
55174
  break;
55177
55175
  case "file":
55178
55176
  initialValues[field.name] = null;
@@ -55183,7 +55181,9 @@ const useFormValidatingContext = (formArray) => {
55183
55181
  (typeof value === "string" && value.trim() !== ""));
55184
55182
  })
55185
55183
  .required(field.errorMessage);
55184
+ renderCustomError(field);
55186
55185
  }
55186
+ renderCustomError(field);
55187
55187
  break;
55188
55188
  case "number":
55189
55189
  initialValues[field.name] = null;
@@ -55192,7 +55192,9 @@ const useFormValidatingContext = (formArray) => {
55192
55192
  .nullable()
55193
55193
  .typeError(field.errorMessage)
55194
55194
  .required(field.errorMessage);
55195
+ renderCustomError(field);
55195
55196
  }
55197
+ renderCustomError(field);
55196
55198
  break;
55197
55199
  case "pincode":
55198
55200
  initialValues[field.name] = null;
@@ -55208,7 +55210,9 @@ const useFormValidatingContext = (formArray) => {
55208
55210
  }
55209
55211
  return false;
55210
55212
  });
55213
+ renderCustomError(field);
55211
55214
  }
55215
+ renderCustomError(field);
55212
55216
  break;
55213
55217
  case "phoneNumber":
55214
55218
  initialValues[field.name] = null;
@@ -55224,6 +55228,7 @@ const useFormValidatingContext = (formArray) => {
55224
55228
  }
55225
55229
  return false;
55226
55230
  });
55231
+ renderCustomError(field);
55227
55232
  }
55228
55233
  else {
55229
55234
  validationShape[field.name] = create$5()
@@ -55232,6 +55237,7 @@ const useFormValidatingContext = (formArray) => {
55232
55237
  .test("is-two-digits", `Please enter a 10-digit Mobile Number`, (value) => {
55233
55238
  return !value || (value === null || value === void 0 ? void 0 : value.toString().length) === 2;
55234
55239
  });
55240
+ renderCustomError(field);
55235
55241
  }
55236
55242
  break;
55237
55243
  case "select":
@@ -55240,7 +55246,9 @@ const useFormValidatingContext = (formArray) => {
55240
55246
  validationShape[field.name] = create$6()
55241
55247
  .typeError(`Select ${field.label}`)
55242
55248
  .required(field.errorMessage);
55249
+ renderCustomError(field);
55243
55250
  }
55251
+ renderCustomError(field);
55244
55252
  break;
55245
55253
  case "multiselect":
55246
55254
  initialValues[field.name] = null;
@@ -55249,7 +55257,9 @@ const useFormValidatingContext = (formArray) => {
55249
55257
  create$6()
55250
55258
  .typeError(`Select atleast one ${field.label}`)
55251
55259
  .required(field.errorMessage);
55260
+ renderCustomError(field);
55252
55261
  }
55262
+ renderCustomError(field);
55253
55263
  break;
55254
55264
  case "datepicker":
55255
55265
  initialValues[field.name] = null;
@@ -55258,7 +55268,9 @@ const useFormValidatingContext = (formArray) => {
55258
55268
  create$6()
55259
55269
  .typeError(`Select ${field.label}`)
55260
55270
  .required(field.errorMessage);
55271
+ renderCustomError(field);
55261
55272
  }
55273
+ renderCustomError(field);
55262
55274
  break;
55263
55275
  case "yearpicker":
55264
55276
  initialValues[field.name] = null;
@@ -55267,7 +55279,9 @@ const useFormValidatingContext = (formArray) => {
55267
55279
  create$6()
55268
55280
  .typeError(`Select ${field.label}`)
55269
55281
  .required(field.errorMessage);
55282
+ renderCustomError(field);
55270
55283
  }
55284
+ renderCustomError(field);
55271
55285
  break;
55272
55286
  case "monthpicker":
55273
55287
  initialValues[field.name] = null;
@@ -55276,10 +55290,13 @@ const useFormValidatingContext = (formArray) => {
55276
55290
  create$6()
55277
55291
  .typeError(`Select ${field.label}`)
55278
55292
  .required(field.errorMessage);
55293
+ renderCustomError(field);
55279
55294
  }
55295
+ renderCustomError(field);
55280
55296
  break;
55281
55297
  case "toggleSwitch":
55282
55298
  initialValues[field.name] = true;
55299
+ renderCustomError(field);
55283
55300
  break;
55284
55301
  case "dateRangePicker":
55285
55302
  const today = new Date();
@@ -55300,13 +55317,17 @@ const useFormValidatingContext = (formArray) => {
55300
55317
  create$6()
55301
55318
  .typeError(`Select ${field.label}`)
55302
55319
  .required(field.errorMessage);
55320
+ renderCustomError(field);
55303
55321
  }
55322
+ renderCustomError(field);
55304
55323
  break;
55305
55324
  default:
55306
55325
  initialValues[field.name] = null; // default value if inputType is not recognized
55307
55326
  if (field.required && field.errorMessage) {
55308
55327
  validationShape[field.name] = create$8().required(field.errorMessage);
55328
+ renderCustomError(field);
55309
55329
  }
55330
+ renderCustomError(field);
55310
55331
  break;
55311
55332
  }
55312
55333
  });