@gem-sdk/components 2.5.12 → 2.5.13

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,16 @@ 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
+ setDefaultLabelState(defaultLabel);
35
+ };
26
36
  const changeStateILP = ()=>{
27
37
  setDefaultLabelState(clickedLabel);
28
38
  navigator.clipboard.writeText(copyContent ?? '').catch(function(error) {
@@ -56,16 +66,20 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
56
66
  } : currentState.boxShadowBtn
57
67
  });
58
68
  setTimeout(()=>{
59
- 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
+ defaultLabel
82
+ ]);
69
83
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
70
84
  children: /*#__PURE__*/ jsxRuntime.jsx(Button.default, {
71
85
  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,16 @@ 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
+ setDefaultLabelState(defaultLabel);
31
+ };
22
32
  const changeStateILP = ()=>{
23
33
  setDefaultLabelState(clickedLabel);
24
34
  navigator.clipboard.writeText(copyContent ?? '').catch(function(error) {
@@ -52,16 +62,20 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
52
62
  } : currentState.boxShadowBtn
53
63
  });
54
64
  setTimeout(()=>{
55
- 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
+ defaultLabel
78
+ ]);
65
79
  return /*#__PURE__*/ jsx(Fragment, {
66
80
  children: /*#__PURE__*/ jsx(Button, {
67
81
  builderProps: builderProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.5.12",
3
+ "version": "2.5.13",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",