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.js CHANGED
@@ -378,9 +378,10 @@ const buttonStyles = createUseStyles(theme => ({
378
378
  color: ({
379
379
  disabled
380
380
  } = {}) => disabled ? colorMixer(theme?.palette?.background?.default, 0.5).color : theme?.colors?.CtaTextColor,
381
- background: ({
381
+ background: theme?.colors?.ctaColor,
382
+ opacity: ({
382
383
  disabled
383
- } = {}) => disabled ? colorMixer(theme?.palette?.primary.main, 0.5).color : theme?.colors?.ctaColor,
384
+ } = {}) => disabled ? 0.5 : 1,
384
385
  border: 'none',
385
386
  textDecoration: 'none',
386
387
  cursor: ({
@@ -404,9 +405,10 @@ const buttonStyles = createUseStyles(theme => ({
404
405
  color: ({
405
406
  disabled
406
407
  } = {}) => disabled ? colorMixer(theme.palette.primary.main, 0.5).color : theme?.colors?.CtaTextColor,
407
- background: ({
408
+ background: theme?.colors?.ctaColor,
409
+ opacity: ({
408
410
  disabled
409
- } = {}) => disabled ? colorMixer(theme?.palette?.parimar?.default, 0.5).color : theme?.colors?.ctaColor,
411
+ } = {}) => disabled ? 0.5 : 1,
410
412
  border: ({
411
413
  disabled
412
414
  } = {}) => disabled ? `1px solid ${colorMixer(theme.palette.primary.main, 0.5).color}` : `1px solid ${theme?.colors?.ctaColor}`,
@@ -7356,6 +7358,7 @@ function Contact({
7356
7358
  extraProps
7357
7359
  } = React.useContext(PageContext);
7358
7360
  let [btnDisabled, setBtnDisabled] = React.useState(false);
7361
+ const [isSubmitted, setIsSubmitted] = React.useState(false);
7359
7362
  const [nodeData] = sectionData.components;
7360
7363
  const classes = useSectionStyles({
7361
7364
  containerWidth,
@@ -7388,14 +7391,15 @@ function Contact({
7388
7391
  if (!(isPreview || isEdit)) postApiCall(baseURLs, data);
7389
7392
  setBtnDisabled(true);
7390
7393
  setInputVal(formInitialValue);
7394
+ setIsSubmitted(true);
7391
7395
  };
7392
7396
  React.useEffect(() => {
7393
- if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid) {
7397
+ if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid && inputVal?.email && inputVal?.name && inputVal?.phone && inputVal?.message) {
7394
7398
  setBtnDisabled(false);
7395
7399
  } else {
7396
7400
  setBtnDisabled(true);
7397
7401
  }
7398
- }, [validData]);
7402
+ }, [validData, inputVal]);
7399
7403
  const checkValidity = (regexField, fieldname, fieldValidity) => {
7400
7404
  if (validations?.[regexField]?.length) {
7401
7405
  let regex = new RegExp(validations[regexField]);
@@ -7538,7 +7542,7 @@ function Contact({
7538
7542
  className: classes.btnContainer
7539
7543
  }, /*#__PURE__*/React__default["default"].createElement(Button, {
7540
7544
  ref: nodeData?.cta?.refSetter,
7541
- data: btnDisabled && validData?.messageValid && validData?.emailValid && validData?.nameValid && validData?.phoneValid ? {
7545
+ data: isSubmitted ? {
7542
7546
  value: 'Submitted'
7543
7547
  } : {
7544
7548
  value: nodeData.cta.metadata.value