@micromag/element-call-to-action 0.3.311 → 0.3.322

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.
@@ -1 +1 @@
1
- @-webkit-keyframes micromag-element-call-to-action-appear{0%{-webkit-transform:scale(0);transform:scale(0);opacity:1}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes micromag-element-call-to-action-appear{0%{-webkit-transform:scale(0);transform:scale(0);opacity:1}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.micromag-element-call-to-action-container{position:relative;z-index:100;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease;opacity:1;text-align:center}.micromag-element-call-to-action-container .micromag-element-call-to-action-arrow{display:block;margin:0 auto 3px;-webkit-animation:micromag-element-call-to-action-upAndDown .5s ease-in-out infinite alternate;animation:micromag-element-call-to-action-upAndDown .5s ease-in-out infinite alternate}.micromag-element-call-to-action-container .micromag-element-call-to-action-icon,.micromag-element-call-to-action-container .micromag-element-call-to-action-label{display:inline-block;vertical-align:middle}.micromag-element-call-to-action-container .micromag-element-call-to-action-label{line-height:1}.micromag-element-call-to-action-container .micromag-element-call-to-action-button{display:block;margin:0 auto;padding:5px 10px;background-color:rgba(0,0,0,0);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none;-webkit-user-drag:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-button:hover{text-decoration:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-selfTargetLink{display:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-leavingFrame{position:fixed;top:0;left:0;width:100vw;height:100vh;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:micromag-element-call-to-action-appear .5s ease both;animation:micromag-element-call-to-action-appear .5s ease both;opacity:0;background-color:#fff}.micromag-element-call-to-action-container.micromag-element-call-to-action-animationDisabled .micromag-element-call-to-action-arrow{-webkit-animation:none;animation:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-invalidUrl{opacity:.5;pointer-events:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-invalidUrl .micromag-element-call-to-action-arrow{-webkit-animation:none;animation:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-withMargin{margin-bottom:5px}
1
+ @-webkit-keyframes micromag-element-call-to-action-appear{0%{opacity:1;-webkit-transform:scale(0);transform:scale(0)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes micromag-element-call-to-action-appear{0%{opacity:1;-webkit-transform:scale(0);transform:scale(0)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.micromag-element-call-to-action-container{opacity:1;position:relative;text-align:center;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease;z-index:100}.micromag-element-call-to-action-container .micromag-element-call-to-action-arrow{-webkit-animation:micromag-element-call-to-action-upAndDown .5s ease-in-out infinite alternate;animation:micromag-element-call-to-action-upAndDown .5s ease-in-out infinite alternate;display:block;margin:0 auto 3px}.micromag-element-call-to-action-container .micromag-element-call-to-action-icon{display:inline-block;vertical-align:middle}.micromag-element-call-to-action-container .micromag-element-call-to-action-label{display:inline-block;line-height:1;vertical-align:middle}.micromag-element-call-to-action-container .micromag-element-call-to-action-button{-webkit-user-drag:none;background-color:rgba(0,0,0,0);display:block;margin:0 auto;padding:5px 10px;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-button:hover{text-decoration:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-selfTargetLink{display:none}.micromag-element-call-to-action-container .micromag-element-call-to-action-leavingFrame{-webkit-animation:micromag-element-call-to-action-appear .5s ease both;animation:micromag-element-call-to-action-appear .5s ease both;background-color:#fff;height:100vh;left:0;opacity:0;position:fixed;top:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);width:100vw}.micromag-element-call-to-action-container.micromag-element-call-to-action-animationDisabled .micromag-element-call-to-action-arrow{-webkit-animation:none;animation:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-invalidUrl{opacity:.5;pointer-events:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-invalidUrl .micromag-element-call-to-action-arrow{-webkit-animation:none;animation:none}.micromag-element-call-to-action-container.micromag-element-call-to-action-withMargin{margin-bottom:5px}
package/es/index.js CHANGED
@@ -20,10 +20,9 @@ var defaultProps$1 = {
20
20
  color: 'currentColor',
21
21
  className: null
22
22
  };
23
-
24
23
  var Arrow = function Arrow(_ref) {
25
24
  var color = _ref.color,
26
- className = _ref.className;
25
+ className = _ref.className;
27
26
  return /*#__PURE__*/React.createElement("svg", {
28
27
  version: "1.1",
29
28
  xmlns: "http://www.w3.org/2000/svg",
@@ -47,7 +46,6 @@ var Arrow = function Arrow(_ref) {
47
46
  d: "M1.5,10.88L24.26,1.5l22.77,9.38"
48
47
  })));
49
48
  };
50
-
51
49
  Arrow.propTypes = propTypes$1;
52
50
  Arrow.defaultProps = defaultProps$1;
53
51
 
@@ -61,8 +59,8 @@ var propTypes = {
61
59
  inWebView: PropTypes.bool,
62
60
  elRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
63
61
  current: PropTypes.any // eslint-disable-line
64
-
65
62
  })]),
63
+
66
64
  animationDisabled: PropTypes.bool,
67
65
  icon: PropTypes.node,
68
66
  arrow: PropTypes.node,
@@ -96,79 +94,70 @@ var defaultProps = {
96
94
  openWebView: null,
97
95
  onClick: null
98
96
  };
99
-
100
97
  function CallToAction(_ref) {
101
98
  var _ref7;
102
-
103
99
  var type = _ref.type,
104
- url = _ref.url,
105
- label = _ref.label,
106
- boxStyle = _ref.boxStyle,
107
- inWebView = _ref.inWebView,
108
- elRef = _ref.elRef,
109
- disabled = _ref.disabled,
110
- animationDisabled = _ref.animationDisabled,
111
- icon = _ref.icon,
112
- arrow = _ref.arrow,
113
- dragAmount = _ref.dragAmount,
114
- className = _ref.className,
115
- buttonClassName = _ref.buttonClassName,
116
- buttonBorderClassName = _ref.buttonBorderClassName,
117
- labelClassName = _ref.labelClassName,
118
- arrowClassName = _ref.arrowClassName,
119
- focusable = _ref.focusable,
120
- openWebView = _ref.openWebView,
121
- onClick = _ref.onClick;
100
+ url = _ref.url,
101
+ label = _ref.label,
102
+ boxStyle = _ref.boxStyle,
103
+ inWebView = _ref.inWebView,
104
+ elRef = _ref.elRef,
105
+ disabled = _ref.disabled,
106
+ animationDisabled = _ref.animationDisabled,
107
+ icon = _ref.icon,
108
+ arrow = _ref.arrow,
109
+ dragAmount = _ref.dragAmount,
110
+ className = _ref.className,
111
+ buttonClassName = _ref.buttonClassName,
112
+ buttonBorderClassName = _ref.buttonBorderClassName,
113
+ labelClassName = _ref.labelClassName,
114
+ arrowClassName = _ref.arrowClassName,
115
+ focusable = _ref.focusable,
116
+ openWebView = _ref.openWebView,
117
+ onClick = _ref.onClick;
122
118
  var trackEvent = useTrackEvent();
123
119
  var swipeUpEnabled = type === null || type === 'swipe-up';
124
120
  var validUrl = useMemo(function () {
125
121
  return isValidUrl(url);
126
122
  }, [url]);
127
123
  var buttonRef = useRef(null);
128
-
129
124
  var _ref2 = label || {},
130
- _ref2$textStyle = _ref2.textStyle,
131
- textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
132
-
125
+ _ref2$textStyle = _ref2.textStyle,
126
+ textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
133
127
  var _ref3 = textStyle || {},
134
- _ref3$fontSize = _ref3.fontSize,
135
- fontSize = _ref3$fontSize === void 0 ? null : _ref3$fontSize,
136
- _ref3$color = _ref3.color,
137
- color = _ref3$color === void 0 ? null : _ref3$color,
138
- _ref3$lineHeight = _ref3.lineHeight,
139
- lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
140
-
128
+ _ref3$fontSize = _ref3.fontSize,
129
+ fontSize = _ref3$fontSize === void 0 ? null : _ref3$fontSize,
130
+ _ref3$color = _ref3.color,
131
+ color = _ref3$color === void 0 ? null : _ref3$color,
132
+ _ref3$lineHeight = _ref3.lineHeight,
133
+ lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
141
134
  var _ref4 = boxStyle || {},
142
- _ref4$backgroundColor = _ref4.backgroundColor,
143
- backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
144
-
135
+ _ref4$backgroundColor = _ref4.backgroundColor,
136
+ backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
145
137
  var arrowStyle = useMemo(function () {
146
138
  return _objectSpread(_objectSpread({}, {
147
139
  fontSize: fontSize
148
140
  }), backgroundColor === null ? getStyleFromColor(color, 'color') : getStyleFromColor(backgroundColor, 'color'));
149
- }, [fontSize, backgroundColor, color]); // MobileSafari blocks popup no matter what
141
+ }, [fontSize, backgroundColor, color]);
150
142
 
143
+ // MobileSafari blocks popup no matter what
151
144
  var selfTargetLinkRef = useRef(null);
152
-
153
145
  var _useState = useState(false),
154
- _useState2 = _slicedToArray(_useState, 2),
155
- leaving = _useState2[0],
156
- setLeaving = _useState2[1]; // On click
157
-
146
+ _useState2 = _slicedToArray(_useState, 2),
147
+ leaving = _useState2[0],
148
+ setLeaving = _useState2[1];
158
149
 
150
+ // On click
159
151
  var onClickLink = useCallback(function (e) {
160
152
  var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'click';
161
-
162
153
  if (inWebView && openWebView !== null) {
163
154
  openWebView({
164
155
  url: url
165
156
  });
166
157
  }
167
-
168
158
  if (onClick !== null && action === 'cllick') {
169
159
  onClick(e);
170
160
  }
171
-
172
161
  if (trackEvent !== null) {
173
162
  trackEvent('call_to_action', isString(action) ? action : 'click', url);
174
163
  }
@@ -180,8 +169,7 @@ function CallToAction(_ref) {
180
169
  }, []);
181
170
  var onDragEnd = useCallback(function (_ref6) {
182
171
  var _ref6$movement = _slicedToArray(_ref6.movement, 2),
183
- my = _ref6$movement[1];
184
-
172
+ my = _ref6$movement[1];
185
173
  if (my < -dragAmount) {
186
174
  if (inWebView) {
187
175
  onClickLink(null, 'swipe');
@@ -203,7 +191,6 @@ function CallToAction(_ref) {
203
191
  var onPageHide = function onPageHide() {
204
192
  setLeaving(false);
205
193
  };
206
-
207
194
  window.addEventListener('pagehide', onPageHide);
208
195
  return function () {
209
196
  window.removeEventListener('pagehide', onPageHide);
@@ -244,7 +231,6 @@ function CallToAction(_ref) {
244
231
  inline: true
245
232
  }))))));
246
233
  }
247
-
248
234
  CallToAction.propTypes = propTypes;
249
235
  CallToAction.defaultProps = defaultProps;
250
236
  var CallToAction$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
package/lib/index.js CHANGED
@@ -34,10 +34,9 @@ var defaultProps$1 = {
34
34
  color: 'currentColor',
35
35
  className: null
36
36
  };
37
-
38
37
  var Arrow = function Arrow(_ref) {
39
38
  var color = _ref.color,
40
- className = _ref.className;
39
+ className = _ref.className;
41
40
  return /*#__PURE__*/React__default["default"].createElement("svg", {
42
41
  version: "1.1",
43
42
  xmlns: "http://www.w3.org/2000/svg",
@@ -61,7 +60,6 @@ var Arrow = function Arrow(_ref) {
61
60
  d: "M1.5,10.88L24.26,1.5l22.77,9.38"
62
61
  })));
63
62
  };
64
-
65
63
  Arrow.propTypes = propTypes$1;
66
64
  Arrow.defaultProps = defaultProps$1;
67
65
 
@@ -75,8 +73,8 @@ var propTypes = {
75
73
  inWebView: PropTypes__default["default"].bool,
76
74
  elRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
77
75
  current: PropTypes__default["default"].any // eslint-disable-line
78
-
79
76
  })]),
77
+
80
78
  animationDisabled: PropTypes__default["default"].bool,
81
79
  icon: PropTypes__default["default"].node,
82
80
  arrow: PropTypes__default["default"].node,
@@ -110,79 +108,70 @@ var defaultProps = {
110
108
  openWebView: null,
111
109
  onClick: null
112
110
  };
113
-
114
111
  function CallToAction(_ref) {
115
112
  var _ref7;
116
-
117
113
  var type = _ref.type,
118
- url = _ref.url,
119
- label = _ref.label,
120
- boxStyle = _ref.boxStyle,
121
- inWebView = _ref.inWebView,
122
- elRef = _ref.elRef,
123
- disabled = _ref.disabled,
124
- animationDisabled = _ref.animationDisabled,
125
- icon = _ref.icon,
126
- arrow = _ref.arrow,
127
- dragAmount = _ref.dragAmount,
128
- className = _ref.className,
129
- buttonClassName = _ref.buttonClassName,
130
- buttonBorderClassName = _ref.buttonBorderClassName,
131
- labelClassName = _ref.labelClassName,
132
- arrowClassName = _ref.arrowClassName,
133
- focusable = _ref.focusable,
134
- openWebView = _ref.openWebView,
135
- onClick = _ref.onClick;
114
+ url = _ref.url,
115
+ label = _ref.label,
116
+ boxStyle = _ref.boxStyle,
117
+ inWebView = _ref.inWebView,
118
+ elRef = _ref.elRef,
119
+ disabled = _ref.disabled,
120
+ animationDisabled = _ref.animationDisabled,
121
+ icon = _ref.icon,
122
+ arrow = _ref.arrow,
123
+ dragAmount = _ref.dragAmount,
124
+ className = _ref.className,
125
+ buttonClassName = _ref.buttonClassName,
126
+ buttonBorderClassName = _ref.buttonBorderClassName,
127
+ labelClassName = _ref.labelClassName,
128
+ arrowClassName = _ref.arrowClassName,
129
+ focusable = _ref.focusable,
130
+ openWebView = _ref.openWebView,
131
+ onClick = _ref.onClick;
136
132
  var trackEvent = hooks.useTrackEvent();
137
133
  var swipeUpEnabled = type === null || type === 'swipe-up';
138
134
  var validUrl = React.useMemo(function () {
139
135
  return utils.isValidUrl(url);
140
136
  }, [url]);
141
137
  var buttonRef = React.useRef(null);
142
-
143
138
  var _ref2 = label || {},
144
- _ref2$textStyle = _ref2.textStyle,
145
- textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
146
-
139
+ _ref2$textStyle = _ref2.textStyle,
140
+ textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
147
141
  var _ref3 = textStyle || {},
148
- _ref3$fontSize = _ref3.fontSize,
149
- fontSize = _ref3$fontSize === void 0 ? null : _ref3$fontSize,
150
- _ref3$color = _ref3.color,
151
- color = _ref3$color === void 0 ? null : _ref3$color,
152
- _ref3$lineHeight = _ref3.lineHeight,
153
- lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
154
-
142
+ _ref3$fontSize = _ref3.fontSize,
143
+ fontSize = _ref3$fontSize === void 0 ? null : _ref3$fontSize,
144
+ _ref3$color = _ref3.color,
145
+ color = _ref3$color === void 0 ? null : _ref3$color,
146
+ _ref3$lineHeight = _ref3.lineHeight,
147
+ lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
155
148
  var _ref4 = boxStyle || {},
156
- _ref4$backgroundColor = _ref4.backgroundColor,
157
- backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
158
-
149
+ _ref4$backgroundColor = _ref4.backgroundColor,
150
+ backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
159
151
  var arrowStyle = React.useMemo(function () {
160
152
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, {
161
153
  fontSize: fontSize
162
154
  }), backgroundColor === null ? utils.getStyleFromColor(color, 'color') : utils.getStyleFromColor(backgroundColor, 'color'));
163
- }, [fontSize, backgroundColor, color]); // MobileSafari blocks popup no matter what
155
+ }, [fontSize, backgroundColor, color]);
164
156
 
157
+ // MobileSafari blocks popup no matter what
165
158
  var selfTargetLinkRef = React.useRef(null);
166
-
167
159
  var _useState = React.useState(false),
168
- _useState2 = _slicedToArray__default["default"](_useState, 2),
169
- leaving = _useState2[0],
170
- setLeaving = _useState2[1]; // On click
171
-
160
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
161
+ leaving = _useState2[0],
162
+ setLeaving = _useState2[1];
172
163
 
164
+ // On click
173
165
  var onClickLink = React.useCallback(function (e) {
174
166
  var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'click';
175
-
176
167
  if (inWebView && openWebView !== null) {
177
168
  openWebView({
178
169
  url: url
179
170
  });
180
171
  }
181
-
182
172
  if (onClick !== null && action === 'cllick') {
183
173
  onClick(e);
184
174
  }
185
-
186
175
  if (trackEvent !== null) {
187
176
  trackEvent('call_to_action', isString__default["default"](action) ? action : 'click', url);
188
177
  }
@@ -194,8 +183,7 @@ function CallToAction(_ref) {
194
183
  }, []);
195
184
  var onDragEnd = React.useCallback(function (_ref6) {
196
185
  var _ref6$movement = _slicedToArray__default["default"](_ref6.movement, 2),
197
- my = _ref6$movement[1];
198
-
186
+ my = _ref6$movement[1];
199
187
  if (my < -dragAmount) {
200
188
  if (inWebView) {
201
189
  onClickLink(null, 'swipe');
@@ -217,7 +205,6 @@ function CallToAction(_ref) {
217
205
  var onPageHide = function onPageHide() {
218
206
  setLeaving(false);
219
207
  };
220
-
221
208
  window.addEventListener('pagehide', onPageHide);
222
209
  return function () {
223
210
  window.removeEventListener('pagehide', onPageHide);
@@ -258,7 +245,6 @@ function CallToAction(_ref) {
258
245
  inline: true
259
246
  }))))));
260
247
  }
261
-
262
248
  CallToAction.propTypes = propTypes;
263
249
  CallToAction.defaultProps = defaultProps;
264
250
  var CallToAction$1 = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-call-to-action",
3
- "version": "0.3.311",
3
+ "version": "0.3.322",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -52,21 +52,21 @@
52
52
  "@fortawesome/fontawesome-svg-core": "^1.2.32",
53
53
  "@fortawesome/free-solid-svg-icons": "^5.15.1",
54
54
  "@fortawesome/react-fontawesome": "^0.1.13",
55
- "@micromag/core": "^0.3.311",
56
- "@micromag/element-button": "^0.3.311",
57
- "@micromag/element-text": "^0.3.311",
58
- "@micromag/element-webview": "^0.3.311",
59
- "@react-spring/core": "^9.1.1",
60
- "@react-spring/web": "^9.1.1",
55
+ "@micromag/core": "^0.3.322",
56
+ "@micromag/element-button": "^0.3.322",
57
+ "@micromag/element-text": "^0.3.322",
58
+ "@micromag/element-webview": "^0.3.322",
59
+ "@react-spring/core": "^9.6.1",
60
+ "@react-spring/web": "^9.6.1",
61
61
  "@use-gesture/react": "^10.2.4",
62
62
  "classnames": "^2.2.6",
63
63
  "lodash": "^4.17.21",
64
64
  "prop-types": "^15.7.2",
65
65
  "react-intl": "^5.12.1",
66
- "uuid": "^8.3.2"
66
+ "uuid": "^9.0.0"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "fab297a7ad204611597c749b969f14d992d35d47"
71
+ "gitHead": "2dfe09ad5a9ac720e4bfbffcb6371fc31c24fa9f"
72
72
  }