@micromag/element-call-to-action 0.3.423 → 0.3.429
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/assets/css/styles.css +1 -1
- package/es/index.js +1 -2
- package/lib/index.js +44 -57
- package/package.json +12 -6
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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;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
|
@@ -97,7 +97,6 @@ var defaultProps = {
|
|
|
97
97
|
onClick: null
|
|
98
98
|
};
|
|
99
99
|
function CallToAction(_ref) {
|
|
100
|
-
var _ref7;
|
|
101
100
|
var type = _ref.type,
|
|
102
101
|
url = _ref.url,
|
|
103
102
|
label = _ref.label,
|
|
@@ -199,7 +198,7 @@ function CallToAction(_ref) {
|
|
|
199
198
|
};
|
|
200
199
|
}, [setLeaving]);
|
|
201
200
|
return /*#__PURE__*/React.createElement("div", {
|
|
202
|
-
className: classNames([styles.container, (
|
|
201
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.disabled, disabled), styles.animationDisabled, animationDisabled), styles.invalidUrl, !validUrl), styles.inWebView, inWebView)]),
|
|
203
202
|
ref: elRef
|
|
204
203
|
}, leaving ? /*#__PURE__*/React.createElement("div", {
|
|
205
204
|
className: styles.leavingFrame
|
package/lib/index.js
CHANGED
|
@@ -14,21 +14,9 @@ var utils = require('@micromag/core/utils');
|
|
|
14
14
|
var Button = require('@micromag/element-button');
|
|
15
15
|
var Text = require('@micromag/element-text');
|
|
16
16
|
|
|
17
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
-
|
|
19
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
21
|
-
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
22
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
23
|
-
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
24
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
-
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
27
|
-
var Text__default = /*#__PURE__*/_interopDefaultLegacy(Text);
|
|
28
|
-
|
|
29
17
|
var propTypes$1 = {
|
|
30
|
-
color:
|
|
31
|
-
className:
|
|
18
|
+
color: PropTypes.string,
|
|
19
|
+
className: PropTypes.string
|
|
32
20
|
};
|
|
33
21
|
var defaultProps$1 = {
|
|
34
22
|
color: 'currentColor',
|
|
@@ -37,7 +25,7 @@ var defaultProps$1 = {
|
|
|
37
25
|
var Arrow = function Arrow(_ref) {
|
|
38
26
|
var color = _ref.color,
|
|
39
27
|
className = _ref.className;
|
|
40
|
-
return /*#__PURE__*/
|
|
28
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
41
29
|
version: "1.1",
|
|
42
30
|
xmlns: "http://www.w3.org/2000/svg",
|
|
43
31
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -48,9 +36,9 @@ var Arrow = function Arrow(_ref) {
|
|
|
48
36
|
viewBox: "0 0 48.53 12.38",
|
|
49
37
|
className: className,
|
|
50
38
|
xmlSpace: "preserve"
|
|
51
|
-
}, /*#__PURE__*/
|
|
39
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
52
40
|
transform: "matrix(1, 0, 0, 1, 0, 0)"
|
|
53
|
-
}, /*#__PURE__*/
|
|
41
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
54
42
|
id: "b",
|
|
55
43
|
fill: "none",
|
|
56
44
|
stroke: color,
|
|
@@ -66,28 +54,28 @@ Arrow.defaultProps = defaultProps$1;
|
|
|
66
54
|
var styles = {"container":"micromag-element-call-to-action-container","arrow":"micromag-element-call-to-action-arrow","upAndDown":"micromag-element-call-to-action-upAndDown","icon":"micromag-element-call-to-action-icon","label":"micromag-element-call-to-action-label","button":"micromag-element-call-to-action-button","selfTargetLink":"micromag-element-call-to-action-selfTargetLink","leavingFrame":"micromag-element-call-to-action-leavingFrame","appear":"micromag-element-call-to-action-appear","animationDisabled":"micromag-element-call-to-action-animationDisabled","invalidUrl":"micromag-element-call-to-action-invalidUrl","withMargin":"micromag-element-call-to-action-withMargin"};
|
|
67
55
|
|
|
68
56
|
var propTypes = {
|
|
69
|
-
type:
|
|
70
|
-
url:
|
|
57
|
+
type: PropTypes.oneOf(['click', 'swipe-up', null]),
|
|
58
|
+
url: PropTypes.string,
|
|
71
59
|
label: core.PropTypes.textElement,
|
|
72
60
|
boxStyle: core.PropTypes.boxStyle,
|
|
73
|
-
inWebView:
|
|
74
|
-
elRef:
|
|
75
|
-
current:
|
|
61
|
+
inWebView: PropTypes.bool,
|
|
62
|
+
elRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
63
|
+
current: PropTypes.any // eslint-disable-line
|
|
76
64
|
})]),
|
|
77
65
|
|
|
78
|
-
disabled:
|
|
79
|
-
animationDisabled:
|
|
80
|
-
icon:
|
|
81
|
-
arrow:
|
|
82
|
-
dragAmount:
|
|
83
|
-
className:
|
|
84
|
-
buttonClassName:
|
|
85
|
-
buttonBorderClassName:
|
|
86
|
-
labelClassName:
|
|
87
|
-
arrowClassName:
|
|
88
|
-
focusable:
|
|
89
|
-
openWebView:
|
|
90
|
-
onClick:
|
|
66
|
+
disabled: PropTypes.bool,
|
|
67
|
+
animationDisabled: PropTypes.bool,
|
|
68
|
+
icon: PropTypes.node,
|
|
69
|
+
arrow: PropTypes.node,
|
|
70
|
+
dragAmount: PropTypes.number,
|
|
71
|
+
className: PropTypes.string,
|
|
72
|
+
buttonClassName: PropTypes.string,
|
|
73
|
+
buttonBorderClassName: PropTypes.string,
|
|
74
|
+
labelClassName: PropTypes.string,
|
|
75
|
+
arrowClassName: PropTypes.string,
|
|
76
|
+
focusable: PropTypes.bool,
|
|
77
|
+
openWebView: PropTypes.func,
|
|
78
|
+
onClick: PropTypes.func
|
|
91
79
|
};
|
|
92
80
|
var defaultProps = {
|
|
93
81
|
type: null,
|
|
@@ -111,7 +99,6 @@ var defaultProps = {
|
|
|
111
99
|
onClick: null
|
|
112
100
|
};
|
|
113
101
|
function CallToAction(_ref) {
|
|
114
|
-
var _ref7;
|
|
115
102
|
var type = _ref.type,
|
|
116
103
|
url = _ref.url,
|
|
117
104
|
label = _ref.label,
|
|
@@ -151,7 +138,7 @@ function CallToAction(_ref) {
|
|
|
151
138
|
_ref4$backgroundColor = _ref4.backgroundColor,
|
|
152
139
|
backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
|
|
153
140
|
var arrowStyle = React.useMemo(function () {
|
|
154
|
-
return
|
|
141
|
+
return _objectSpread(_objectSpread({}, {
|
|
155
142
|
fontSize: fontSize
|
|
156
143
|
}), backgroundColor === null ? utils.getStyleFromColor(color, 'color') : utils.getStyleFromColor(backgroundColor, 'color'));
|
|
157
144
|
}, [fontSize, backgroundColor, color]);
|
|
@@ -159,7 +146,7 @@ function CallToAction(_ref) {
|
|
|
159
146
|
// MobileSafari blocks popup no matter what
|
|
160
147
|
var selfTargetLinkRef = React.useRef(null);
|
|
161
148
|
var _useState = React.useState(false),
|
|
162
|
-
_useState2 =
|
|
149
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
163
150
|
leaving = _useState2[0],
|
|
164
151
|
setLeaving = _useState2[1];
|
|
165
152
|
|
|
@@ -175,7 +162,7 @@ function CallToAction(_ref) {
|
|
|
175
162
|
onClick(e);
|
|
176
163
|
}
|
|
177
164
|
if (trackEvent !== null) {
|
|
178
|
-
trackEvent('call_to_action',
|
|
165
|
+
trackEvent('call_to_action', isString(action) ? action : 'click', url);
|
|
179
166
|
}
|
|
180
167
|
}, [url, onClick, trackEvent, inWebView, openWebView]);
|
|
181
168
|
var onDrag = React.useCallback(function (_ref5) {
|
|
@@ -184,7 +171,7 @@ function CallToAction(_ref) {
|
|
|
184
171
|
event.preventDefault();
|
|
185
172
|
}, []);
|
|
186
173
|
var onDragEnd = React.useCallback(function (_ref6) {
|
|
187
|
-
var _ref6$movement =
|
|
174
|
+
var _ref6$movement = _slicedToArray(_ref6.movement, 2),
|
|
188
175
|
my = _ref6$movement[1];
|
|
189
176
|
if (my < -dragAmount) {
|
|
190
177
|
if (inWebView) {
|
|
@@ -212,23 +199,23 @@ function CallToAction(_ref) {
|
|
|
212
199
|
window.removeEventListener('pagehide', onPageHide);
|
|
213
200
|
};
|
|
214
201
|
}, [setLeaving]);
|
|
215
|
-
return /*#__PURE__*/
|
|
216
|
-
className:
|
|
202
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.disabled, disabled), styles.animationDisabled, animationDisabled), styles.invalidUrl, !validUrl), styles.inWebView, inWebView)]),
|
|
217
204
|
ref: elRef
|
|
218
|
-
}, leaving ? /*#__PURE__*/
|
|
205
|
+
}, leaving ? /*#__PURE__*/React.createElement("div", {
|
|
219
206
|
className: styles.leavingFrame
|
|
220
|
-
}) : null, !inWebView && swipeUpEnabled ? /*#__PURE__*/
|
|
207
|
+
}) : null, !inWebView && swipeUpEnabled ? /*#__PURE__*/React.createElement("a", {
|
|
221
208
|
className: styles.selfTargetLink,
|
|
222
209
|
href: url,
|
|
223
210
|
ref: selfTargetLinkRef,
|
|
224
211
|
tabIndex: focusable ? '0' : '-1'
|
|
225
|
-
}) : null, swipeUpEnabled ? /*#__PURE__*/
|
|
226
|
-
className:
|
|
212
|
+
}) : null, swipeUpEnabled ? /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: classNames([styles.arrow, _defineProperty({}, arrowClassName, arrowClassName !== null)]),
|
|
227
214
|
style: arrowStyle
|
|
228
|
-
}, arrow || /*#__PURE__*/
|
|
229
|
-
className:
|
|
230
|
-
}, /*#__PURE__*/
|
|
231
|
-
className:
|
|
215
|
+
}, arrow || /*#__PURE__*/React.createElement(Arrow, null)) : null, /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: classNames([styles.buttonBorder, _defineProperty({}, buttonBorderClassName, buttonBorderClassName !== null)])
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
218
|
+
className: classNames([styles.button, _defineProperty({}, buttonClassName, buttonClassName !== null)]),
|
|
232
219
|
refButton: buttonRef,
|
|
233
220
|
focusable: focusable,
|
|
234
221
|
buttonStyle: boxStyle,
|
|
@@ -236,12 +223,12 @@ function CallToAction(_ref) {
|
|
|
236
223
|
href: !inWebView ? url : null,
|
|
237
224
|
external: true,
|
|
238
225
|
onClick: onClickLink
|
|
239
|
-
}, swipeUpEnabled && !disabled ? bind() : null), /*#__PURE__*/
|
|
240
|
-
className:
|
|
241
|
-
}, icon !== null ? /*#__PURE__*/
|
|
226
|
+
}, swipeUpEnabled && !disabled ? bind() : null), /*#__PURE__*/React.createElement("span", {
|
|
227
|
+
className: classNames([styles.label, _defineProperty({}, labelClassName, labelClassName !== null)])
|
|
228
|
+
}, icon !== null ? /*#__PURE__*/React.createElement("div", {
|
|
242
229
|
className: styles.icon
|
|
243
|
-
}, icon) : null, /*#__PURE__*/
|
|
244
|
-
textStyle:
|
|
230
|
+
}, icon) : null, /*#__PURE__*/React.createElement(Text, Object.assign({}, label, {
|
|
231
|
+
textStyle: _objectSpread(_objectSpread({}, textStyle), {}, {
|
|
245
232
|
lineHeight: lineHeight || 1
|
|
246
233
|
}),
|
|
247
234
|
inline: true
|
|
@@ -249,8 +236,8 @@ function CallToAction(_ref) {
|
|
|
249
236
|
}
|
|
250
237
|
CallToAction.propTypes = propTypes;
|
|
251
238
|
CallToAction.defaultProps = defaultProps;
|
|
252
|
-
var CallToAction$1 = /*#__PURE__*/
|
|
253
|
-
return /*#__PURE__*/
|
|
239
|
+
var CallToAction$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
240
|
+
return /*#__PURE__*/React.createElement(CallToAction, Object.assign({
|
|
254
241
|
elRef: ref
|
|
255
242
|
}, props));
|
|
256
243
|
});
|
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.429",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -53,10 +59,10 @@
|
|
|
53
59
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
54
60
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
55
61
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
56
|
-
"@micromag/core": "^0.3.
|
|
57
|
-
"@micromag/element-button": "^0.3.
|
|
58
|
-
"@micromag/element-text": "^0.3.
|
|
59
|
-
"@micromag/element-webview": "^0.3.
|
|
62
|
+
"@micromag/core": "^0.3.429",
|
|
63
|
+
"@micromag/element-button": "^0.3.429",
|
|
64
|
+
"@micromag/element-text": "^0.3.429",
|
|
65
|
+
"@micromag/element-webview": "^0.3.429",
|
|
60
66
|
"@react-spring/core": "^9.6.1",
|
|
61
67
|
"@react-spring/web": "^9.6.1",
|
|
62
68
|
"@use-gesture/react": "^10.2.4",
|
|
@@ -70,5 +76,5 @@
|
|
|
70
76
|
"access": "public",
|
|
71
77
|
"registry": "https://registry.npmjs.org/"
|
|
72
78
|
},
|
|
73
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
|
|
74
80
|
}
|