@gem-sdk/components 2.6.0-staging.22 → 2.6.0-staging.24

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.
@@ -23,6 +23,15 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
23
23
  hover: styles?.hasBoxShadowBtn?.hover,
24
24
  normal: styles?.hasBoxShadowBtn?.normal
25
25
  };
26
+ const handleSetDefaultState = ()=>{
27
+ setCurrentState({
28
+ backgroundColor,
29
+ textColor,
30
+ roundedBtn,
31
+ borderBtn,
32
+ boxShadowBtn
33
+ });
34
+ };
26
35
  const changeStateILP = ()=>{
27
36
  setDefaultLabelState(clickedLabel);
28
37
  navigator.clipboard.writeText(copyContent ?? '').catch(function(error) {
@@ -57,15 +66,19 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
57
66
  });
58
67
  setTimeout(()=>{
59
68
  setDefaultLabelState(defaultLabel);
60
- setCurrentState({
61
- backgroundColor,
62
- textColor,
63
- roundedBtn,
64
- borderBtn,
65
- boxShadowBtn
66
- });
69
+ handleSetDefaultState();
67
70
  }, 1000);
68
71
  };
72
+ React.useEffect(()=>{
73
+ handleSetDefaultState();
74
+ // eslint-disable-next-line react-hooks/exhaustive-deps
75
+ }, [
76
+ backgroundColor,
77
+ textColor,
78
+ roundedBtn,
79
+ borderBtn,
80
+ boxShadowBtn
81
+ ]);
69
82
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
70
83
  children: /*#__PURE__*/ jsxRuntime.jsx(Button.default, {
71
84
  builderProps: builderProps,
@@ -1,7 +1,7 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useEditorMode } from '@gem-sdk/core';
3
3
  import Button from '../../button/components/Button.js';
4
- import { useState } from 'react';
4
+ import { useState, useEffect } from 'react';
5
5
 
6
6
  const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced, children })=>{
7
7
  const mode = useEditorMode();
@@ -19,6 +19,15 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
19
19
  hover: styles?.hasBoxShadowBtn?.hover,
20
20
  normal: styles?.hasBoxShadowBtn?.normal
21
21
  };
22
+ const handleSetDefaultState = ()=>{
23
+ setCurrentState({
24
+ backgroundColor,
25
+ textColor,
26
+ roundedBtn,
27
+ borderBtn,
28
+ boxShadowBtn
29
+ });
30
+ };
22
31
  const changeStateILP = ()=>{
23
32
  setDefaultLabelState(clickedLabel);
24
33
  navigator.clipboard.writeText(copyContent ?? '').catch(function(error) {
@@ -53,15 +62,19 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
53
62
  });
54
63
  setTimeout(()=>{
55
64
  setDefaultLabelState(defaultLabel);
56
- setCurrentState({
57
- backgroundColor,
58
- textColor,
59
- roundedBtn,
60
- borderBtn,
61
- boxShadowBtn
62
- });
65
+ handleSetDefaultState();
63
66
  }, 1000);
64
67
  };
68
+ useEffect(()=>{
69
+ handleSetDefaultState();
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, [
72
+ backgroundColor,
73
+ textColor,
74
+ roundedBtn,
75
+ borderBtn,
76
+ boxShadowBtn
77
+ ]);
65
78
  return /*#__PURE__*/ jsx(Fragment, {
66
79
  children: /*#__PURE__*/ jsx(Button, {
67
80
  builderProps: builderProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.6.0-staging.22",
3
+ "version": "2.6.0-staging.24",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",