@micromag/element-call-to-action 0.3.63 → 0.3.66

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.
Files changed (3) hide show
  1. package/es/index.js +18 -12
  2. package/lib/index.js +18 -12
  3. package/package.json +6 -6
package/es/index.js CHANGED
@@ -92,7 +92,7 @@ var defaultProps = {
92
92
  };
93
93
 
94
94
  function CallToAction(_ref) {
95
- var _ref8;
95
+ var _ref9;
96
96
 
97
97
  var elRef = _ref.elRef,
98
98
  disabled = _ref.disabled,
@@ -147,11 +147,16 @@ function CallToAction(_ref) {
147
147
  fontSize = _ref3$textStyle$fontS === void 0 ? null : _ref3$textStyle$fontS,
148
148
  _ref3$textStyle$color = _ref3$textStyle.color,
149
149
  color = _ref3$textStyle$color === void 0 ? null : _ref3$textStyle$color;
150
+
151
+ var _ref4 = boxStyle || {},
152
+ _ref4$backgroundColor = _ref4.backgroundColor,
153
+ backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
154
+
150
155
  var arrowStyle = useMemo(function () {
151
156
  return _objectSpread(_objectSpread({}, {
152
157
  fontSize: fontSize
153
- }), getStyleFromColor(color, 'color'));
154
- }, [fontSize, color]); // MobileSafari blocks popup no matter what
158
+ }), backgroundColor === null ? getStyleFromColor(color, 'color') : getStyleFromColor(backgroundColor, 'color'));
159
+ }, [fontSize, backgroundColor, color]); // MobileSafari blocks popup no matter what
155
160
 
156
161
  var selfTargetLinkRef = useRef(null);
157
162
 
@@ -161,14 +166,14 @@ function CallToAction(_ref) {
161
166
  setLeaving = _useState6[1];
162
167
 
163
168
  var bind = useGesture({
164
- onDrag: function onDrag(_ref4) {
165
- var event = _ref4.event;
169
+ onDrag: function onDrag(_ref5) {
170
+ var event = _ref5.event;
166
171
  // fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
167
172
  event.preventDefault();
168
173
  },
169
- onDragEnd: function onDragEnd(_ref5) {
170
- var _ref5$movement = _slicedToArray(_ref5.movement, 2),
171
- my = _ref5$movement[1];
174
+ onDragEnd: function onDragEnd(_ref6) {
175
+ var _ref6$movement = _slicedToArray(_ref6.movement, 2),
176
+ my = _ref6$movement[1];
172
177
 
173
178
  if (my < -dragAmount) {
174
179
  if (inWebView) {
@@ -218,13 +223,14 @@ function CallToAction(_ref) {
218
223
  setShowWebView(false);
219
224
  }, [setShowWebView]);
220
225
  var ArrowElement = arrow !== null ? /*#__PURE__*/React.createElement("div", {
221
- className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)])
222
- }, arrow) : /*#__PURE__*/React.createElement(Arrow, {
223
226
  className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)]),
224
227
  style: arrowStyle
225
- });
228
+ }, arrow) : /*#__PURE__*/React.createElement("div", {
229
+ className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)]),
230
+ style: arrowStyle
231
+ }, /*#__PURE__*/React.createElement(Arrow, null));
226
232
  return active ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
227
- className: classNames([styles.container, (_ref8 = {}, _defineProperty(_ref8, className, className !== null), _defineProperty(_ref8, styles.disabled, disabled), _defineProperty(_ref8, styles.animationDisabled, animationDisabled), _defineProperty(_ref8, styles.invalidUrl, !validUrl), _defineProperty(_ref8, styles.inWebView, inWebView), _ref8)]),
233
+ className: classNames([styles.container, (_ref9 = {}, _defineProperty(_ref9, className, className !== null), _defineProperty(_ref9, styles.disabled, disabled), _defineProperty(_ref9, styles.animationDisabled, animationDisabled), _defineProperty(_ref9, styles.invalidUrl, !validUrl), _defineProperty(_ref9, styles.inWebView, inWebView), _ref9)]),
228
234
  ref: elRef
229
235
  }, leaving ? /*#__PURE__*/React.createElement("div", {
230
236
  className: styles.leavingFrame
package/lib/index.js CHANGED
@@ -106,7 +106,7 @@ var defaultProps = {
106
106
  };
107
107
 
108
108
  function CallToAction(_ref) {
109
- var _ref8;
109
+ var _ref9;
110
110
 
111
111
  var elRef = _ref.elRef,
112
112
  disabled = _ref.disabled,
@@ -161,11 +161,16 @@ function CallToAction(_ref) {
161
161
  fontSize = _ref3$textStyle$fontS === void 0 ? null : _ref3$textStyle$fontS,
162
162
  _ref3$textStyle$color = _ref3$textStyle.color,
163
163
  color = _ref3$textStyle$color === void 0 ? null : _ref3$textStyle$color;
164
+
165
+ var _ref4 = boxStyle || {},
166
+ _ref4$backgroundColor = _ref4.backgroundColor,
167
+ backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
168
+
164
169
  var arrowStyle = React.useMemo(function () {
165
170
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, {
166
171
  fontSize: fontSize
167
- }), utils.getStyleFromColor(color, 'color'));
168
- }, [fontSize, color]); // MobileSafari blocks popup no matter what
172
+ }), backgroundColor === null ? utils.getStyleFromColor(color, 'color') : utils.getStyleFromColor(backgroundColor, 'color'));
173
+ }, [fontSize, backgroundColor, color]); // MobileSafari blocks popup no matter what
169
174
 
170
175
  var selfTargetLinkRef = React.useRef(null);
171
176
 
@@ -175,14 +180,14 @@ function CallToAction(_ref) {
175
180
  setLeaving = _useState6[1];
176
181
 
177
182
  var bind = react.useGesture({
178
- onDrag: function onDrag(_ref4) {
179
- var event = _ref4.event;
183
+ onDrag: function onDrag(_ref5) {
184
+ var event = _ref5.event;
180
185
  // fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
181
186
  event.preventDefault();
182
187
  },
183
- onDragEnd: function onDragEnd(_ref5) {
184
- var _ref5$movement = _slicedToArray__default["default"](_ref5.movement, 2),
185
- my = _ref5$movement[1];
188
+ onDragEnd: function onDragEnd(_ref6) {
189
+ var _ref6$movement = _slicedToArray__default["default"](_ref6.movement, 2),
190
+ my = _ref6$movement[1];
186
191
 
187
192
  if (my < -dragAmount) {
188
193
  if (inWebView) {
@@ -232,13 +237,14 @@ function CallToAction(_ref) {
232
237
  setShowWebView(false);
233
238
  }, [setShowWebView]);
234
239
  var ArrowElement = arrow !== null ? /*#__PURE__*/React__default["default"].createElement("div", {
235
- className: classNames__default["default"]([styles.arrow, _defineProperty__default["default"]({}, arrowClassName, arrowClassName !== null)])
236
- }, arrow) : /*#__PURE__*/React__default["default"].createElement(Arrow, {
237
240
  className: classNames__default["default"]([styles.arrow, _defineProperty__default["default"]({}, arrowClassName, arrowClassName !== null)]),
238
241
  style: arrowStyle
239
- });
242
+ }, arrow) : /*#__PURE__*/React__default["default"].createElement("div", {
243
+ className: classNames__default["default"]([styles.arrow, _defineProperty__default["default"]({}, arrowClassName, arrowClassName !== null)]),
244
+ style: arrowStyle
245
+ }, /*#__PURE__*/React__default["default"].createElement(Arrow, null));
240
246
  return active ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
241
- className: classNames__default["default"]([styles.container, (_ref8 = {}, _defineProperty__default["default"](_ref8, className, className !== null), _defineProperty__default["default"](_ref8, styles.disabled, disabled), _defineProperty__default["default"](_ref8, styles.animationDisabled, animationDisabled), _defineProperty__default["default"](_ref8, styles.invalidUrl, !validUrl), _defineProperty__default["default"](_ref8, styles.inWebView, inWebView), _ref8)]),
247
+ className: classNames__default["default"]([styles.container, (_ref9 = {}, _defineProperty__default["default"](_ref9, className, className !== null), _defineProperty__default["default"](_ref9, styles.disabled, disabled), _defineProperty__default["default"](_ref9, styles.animationDisabled, animationDisabled), _defineProperty__default["default"](_ref9, styles.invalidUrl, !validUrl), _defineProperty__default["default"](_ref9, styles.inWebView, inWebView), _ref9)]),
242
248
  ref: elRef
243
249
  }, leaving ? /*#__PURE__*/React__default["default"].createElement("div", {
244
250
  className: styles.leavingFrame
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-call-to-action",
3
- "version": "0.3.63",
3
+ "version": "0.3.66",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -52,10 +52,10 @@
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.63",
56
- "@micromag/element-button": "^0.3.63",
57
- "@micromag/element-text": "^0.3.63",
58
- "@micromag/element-webview": "^0.3.63",
55
+ "@micromag/core": "^0.3.66",
56
+ "@micromag/element-button": "^0.3.66",
57
+ "@micromag/element-text": "^0.3.66",
58
+ "@micromag/element-webview": "^0.3.66",
59
59
  "@react-spring/core": "^9.1.1",
60
60
  "@react-spring/web": "^9.1.1",
61
61
  "@use-gesture/react": "^10.2.4",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "002ba9d6db19aa37ea77a2465942060661f19dcf"
71
+ "gitHead": "264bfc8506d254073e1d55ffb9d8dd97e5b78c0b"
72
72
  }