@micromag/element-call-to-action 0.3.61 → 0.3.65
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/es/index.js +21 -16
- package/lib/index.js +21 -16
- 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
|
|
95
|
+
var _ref9;
|
|
96
96
|
|
|
97
97
|
var elRef = _ref.elRef,
|
|
98
98
|
disabled = _ref.disabled,
|
|
@@ -118,8 +118,8 @@ function CallToAction(_ref) {
|
|
|
118
118
|
url = _ref2$url === void 0 ? null : _ref2$url,
|
|
119
119
|
_ref2$label = _ref2.label,
|
|
120
120
|
label = _ref2$label === void 0 ? null : _ref2$label,
|
|
121
|
-
_ref2$
|
|
122
|
-
|
|
121
|
+
_ref2$boxStyle = _ref2.boxStyle,
|
|
122
|
+
boxStyle = _ref2$boxStyle === void 0 ? null : _ref2$boxStyle,
|
|
123
123
|
_ref2$inWebView = _ref2.inWebView,
|
|
124
124
|
inWebView = _ref2$inWebView === void 0 ? false : _ref2$inWebView;
|
|
125
125
|
|
|
@@ -147,12 +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]);
|
|
155
|
-
console.log(buttonStyle); // 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
|
|
156
160
|
|
|
157
161
|
var selfTargetLinkRef = useRef(null);
|
|
158
162
|
|
|
@@ -162,14 +166,14 @@ function CallToAction(_ref) {
|
|
|
162
166
|
setLeaving = _useState6[1];
|
|
163
167
|
|
|
164
168
|
var bind = useGesture({
|
|
165
|
-
onDrag: function onDrag(
|
|
166
|
-
var event =
|
|
169
|
+
onDrag: function onDrag(_ref5) {
|
|
170
|
+
var event = _ref5.event;
|
|
167
171
|
// fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
|
|
168
172
|
event.preventDefault();
|
|
169
173
|
},
|
|
170
|
-
onDragEnd: function onDragEnd(
|
|
171
|
-
var
|
|
172
|
-
my =
|
|
174
|
+
onDragEnd: function onDragEnd(_ref6) {
|
|
175
|
+
var _ref6$movement = _slicedToArray(_ref6.movement, 2),
|
|
176
|
+
my = _ref6$movement[1];
|
|
173
177
|
|
|
174
178
|
if (my < -dragAmount) {
|
|
175
179
|
if (inWebView) {
|
|
@@ -219,13 +223,14 @@ function CallToAction(_ref) {
|
|
|
219
223
|
setShowWebView(false);
|
|
220
224
|
}, [setShowWebView]);
|
|
221
225
|
var ArrowElement = arrow !== null ? /*#__PURE__*/React.createElement("div", {
|
|
222
|
-
className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)])
|
|
223
|
-
}, arrow) : /*#__PURE__*/React.createElement(Arrow, {
|
|
224
226
|
className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)]),
|
|
225
227
|
style: arrowStyle
|
|
226
|
-
})
|
|
228
|
+
}, arrow) : /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)]),
|
|
230
|
+
style: arrowStyle
|
|
231
|
+
}, /*#__PURE__*/React.createElement(Arrow, null));
|
|
227
232
|
return active ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
228
|
-
className: classNames([styles.container, (
|
|
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)]),
|
|
229
234
|
ref: elRef
|
|
230
235
|
}, leaving ? /*#__PURE__*/React.createElement("div", {
|
|
231
236
|
className: styles.leavingFrame
|
|
@@ -242,7 +247,7 @@ function CallToAction(_ref) {
|
|
|
242
247
|
focusable: focusable,
|
|
243
248
|
buttonStyle: _objectSpread({
|
|
244
249
|
marginBottom: 10
|
|
245
|
-
},
|
|
250
|
+
}, boxStyle)
|
|
246
251
|
}, swipeUpEnabled && !disabled ? bind() : null, inWebView ? {
|
|
247
252
|
onClick: onOpenWebView
|
|
248
253
|
} : {
|
package/lib/index.js
CHANGED
|
@@ -106,7 +106,7 @@ var defaultProps = {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
function CallToAction(_ref) {
|
|
109
|
-
var
|
|
109
|
+
var _ref9;
|
|
110
110
|
|
|
111
111
|
var elRef = _ref.elRef,
|
|
112
112
|
disabled = _ref.disabled,
|
|
@@ -132,8 +132,8 @@ function CallToAction(_ref) {
|
|
|
132
132
|
url = _ref2$url === void 0 ? null : _ref2$url,
|
|
133
133
|
_ref2$label = _ref2.label,
|
|
134
134
|
label = _ref2$label === void 0 ? null : _ref2$label,
|
|
135
|
-
_ref2$
|
|
136
|
-
|
|
135
|
+
_ref2$boxStyle = _ref2.boxStyle,
|
|
136
|
+
boxStyle = _ref2$boxStyle === void 0 ? null : _ref2$boxStyle,
|
|
137
137
|
_ref2$inWebView = _ref2.inWebView,
|
|
138
138
|
inWebView = _ref2$inWebView === void 0 ? false : _ref2$inWebView;
|
|
139
139
|
|
|
@@ -161,12 +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]);
|
|
169
|
-
console.log(buttonStyle); // 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
|
|
170
174
|
|
|
171
175
|
var selfTargetLinkRef = React.useRef(null);
|
|
172
176
|
|
|
@@ -176,14 +180,14 @@ function CallToAction(_ref) {
|
|
|
176
180
|
setLeaving = _useState6[1];
|
|
177
181
|
|
|
178
182
|
var bind = react.useGesture({
|
|
179
|
-
onDrag: function onDrag(
|
|
180
|
-
var event =
|
|
183
|
+
onDrag: function onDrag(_ref5) {
|
|
184
|
+
var event = _ref5.event;
|
|
181
185
|
// fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
|
|
182
186
|
event.preventDefault();
|
|
183
187
|
},
|
|
184
|
-
onDragEnd: function onDragEnd(
|
|
185
|
-
var
|
|
186
|
-
my =
|
|
188
|
+
onDragEnd: function onDragEnd(_ref6) {
|
|
189
|
+
var _ref6$movement = _slicedToArray__default["default"](_ref6.movement, 2),
|
|
190
|
+
my = _ref6$movement[1];
|
|
187
191
|
|
|
188
192
|
if (my < -dragAmount) {
|
|
189
193
|
if (inWebView) {
|
|
@@ -233,13 +237,14 @@ function CallToAction(_ref) {
|
|
|
233
237
|
setShowWebView(false);
|
|
234
238
|
}, [setShowWebView]);
|
|
235
239
|
var ArrowElement = arrow !== null ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
236
|
-
className: classNames__default["default"]([styles.arrow, _defineProperty__default["default"]({}, arrowClassName, arrowClassName !== null)])
|
|
237
|
-
}, arrow) : /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
238
240
|
className: classNames__default["default"]([styles.arrow, _defineProperty__default["default"]({}, arrowClassName, arrowClassName !== null)]),
|
|
239
241
|
style: arrowStyle
|
|
240
|
-
})
|
|
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));
|
|
241
246
|
return active ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
242
|
-
className: classNames__default["default"]([styles.container, (
|
|
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)]),
|
|
243
248
|
ref: elRef
|
|
244
249
|
}, leaving ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
245
250
|
className: styles.leavingFrame
|
|
@@ -256,7 +261,7 @@ function CallToAction(_ref) {
|
|
|
256
261
|
focusable: focusable,
|
|
257
262
|
buttonStyle: _objectSpread__default["default"]({
|
|
258
263
|
marginBottom: 10
|
|
259
|
-
},
|
|
264
|
+
}, boxStyle)
|
|
260
265
|
}, swipeUpEnabled && !disabled ? bind() : null, inWebView ? {
|
|
261
266
|
onClick: onOpenWebView
|
|
262
267
|
} : {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-call-to-action",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.65",
|
|
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.
|
|
56
|
-
"@micromag/element-button": "^0.3.
|
|
57
|
-
"@micromag/element-text": "^0.3.
|
|
58
|
-
"@micromag/element-webview": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.64",
|
|
56
|
+
"@micromag/element-button": "^0.3.64",
|
|
57
|
+
"@micromag/element-text": "^0.3.64",
|
|
58
|
+
"@micromag/element-webview": "^0.3.64",
|
|
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": "
|
|
71
|
+
"gitHead": "aa150c0fbb32c481b04e4c98863b7656db714845"
|
|
72
72
|
}
|