diy-template-components 2.0.14 → 2.0.15

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/build/index.es.js CHANGED
@@ -362,9 +362,10 @@ const buttonStyles = createUseStyles(theme => ({
362
362
  color: ({
363
363
  disabled
364
364
  } = {}) => disabled ? colorMixer(theme?.palette?.background?.default, 0.5).color : theme?.colors?.CtaTextColor,
365
- background: ({
365
+ background: theme?.colors?.ctaColor,
366
+ opacity: ({
366
367
  disabled
367
- } = {}) => disabled ? colorMixer(theme?.palette?.primary.main, 0.5).color : theme?.colors?.ctaColor,
368
+ } = {}) => disabled ? 0.5 : 1,
368
369
  border: 'none',
369
370
  textDecoration: 'none',
370
371
  cursor: ({
@@ -388,9 +389,10 @@ const buttonStyles = createUseStyles(theme => ({
388
389
  color: ({
389
390
  disabled
390
391
  } = {}) => disabled ? colorMixer(theme.palette.primary.main, 0.5).color : theme?.colors?.CtaTextColor,
391
- background: ({
392
+ background: theme?.colors?.ctaColor,
393
+ opacity: ({
392
394
  disabled
393
- } = {}) => disabled ? colorMixer(theme?.palette?.parimar?.default, 0.5).color : theme?.colors?.ctaColor,
395
+ } = {}) => disabled ? 0.5 : 1,
394
396
  border: ({
395
397
  disabled
396
398
  } = {}) => disabled ? `1px solid ${colorMixer(theme.palette.primary.main, 0.5).color}` : `1px solid ${theme?.colors?.ctaColor}`,
@@ -7340,6 +7342,7 @@ function Contact({
7340
7342
  extraProps
7341
7343
  } = useContext(PageContext);
7342
7344
  let [btnDisabled, setBtnDisabled] = useState(false);
7345
+ const [isSubmitted, setIsSubmitted] = useState(false);
7343
7346
  const [nodeData] = sectionData.components;
7344
7347
  const classes = useSectionStyles({
7345
7348
  containerWidth,
@@ -7372,14 +7375,15 @@ function Contact({
7372
7375
  if (!(isPreview || isEdit)) postApiCall(baseURLs, data);
7373
7376
  setBtnDisabled(true);
7374
7377
  setInputVal(formInitialValue);
7378
+ setIsSubmitted(true);
7375
7379
  };
7376
7380
  useEffect(() => {
7377
- if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid) {
7381
+ if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid && inputVal?.email && inputVal?.name && inputVal?.phone && inputVal?.message) {
7378
7382
  setBtnDisabled(false);
7379
7383
  } else {
7380
7384
  setBtnDisabled(true);
7381
7385
  }
7382
- }, [validData]);
7386
+ }, [validData, inputVal]);
7383
7387
  const checkValidity = (regexField, fieldname, fieldValidity) => {
7384
7388
  if (validations?.[regexField]?.length) {
7385
7389
  let regex = new RegExp(validations[regexField]);
@@ -7522,7 +7526,7 @@ function Contact({
7522
7526
  className: classes.btnContainer
7523
7527
  }, /*#__PURE__*/React.createElement(Button, {
7524
7528
  ref: nodeData?.cta?.refSetter,
7525
- data: btnDisabled && validData?.messageValid && validData?.emailValid && validData?.nameValid && validData?.phoneValid ? {
7529
+ data: isSubmitted ? {
7526
7530
  value: 'Submitted'
7527
7531
  } : {
7528
7532
  value: nodeData.cta.metadata.value