@micromag/element-call-to-action 0.4.49 → 0.4.50
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 +60 -50
- package/package.json +6 -6
package/es/index.js
CHANGED
|
@@ -5,18 +5,19 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
5
5
|
import { useGesture } from '@use-gesture/react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import isString from 'lodash/isString';
|
|
8
|
-
import
|
|
8
|
+
import { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
9
9
|
import { useTrackEvent } from '@micromag/core/hooks';
|
|
10
10
|
import { isValidUrl, getStyleFromColor, isIos } from '@micromag/core/utils';
|
|
11
11
|
import Button from '@micromag/element-button';
|
|
12
12
|
import Text from '@micromag/element-text';
|
|
13
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
14
|
|
|
14
15
|
function Arrow(_ref) {
|
|
15
16
|
var _ref$color = _ref.color,
|
|
16
17
|
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
17
18
|
_ref$className = _ref.className,
|
|
18
19
|
className = _ref$className === void 0 ? null : _ref$className;
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/jsx("svg", {
|
|
20
21
|
version: "1.1",
|
|
21
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
23
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -26,18 +27,20 @@ function Arrow(_ref) {
|
|
|
26
27
|
height: "12.38px",
|
|
27
28
|
viewBox: "0 0 48.53 12.38",
|
|
28
29
|
className: className,
|
|
29
|
-
xmlSpace: "preserve"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
xmlSpace: "preserve",
|
|
31
|
+
children: /*#__PURE__*/jsx("g", {
|
|
32
|
+
transform: "matrix(1, 0, 0, 1, 0, 0)",
|
|
33
|
+
children: /*#__PURE__*/jsx("path", {
|
|
34
|
+
id: "b",
|
|
35
|
+
fill: "none",
|
|
36
|
+
stroke: color,
|
|
37
|
+
strokeWidth: "3px",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
d: "M1.5,10.88L24.26,1.5l22.77,9.38"
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
});
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
var styles = {"container":"micromag-element-call-to-action-container","arrow":"micromag-element-call-to-action-arrow","button":"micromag-element-call-to-action-button","withoutLinkStyle":"micromag-element-call-to-action-withoutLinkStyle","label":"micromag-element-call-to-action-label","icon":"micromag-element-call-to-action-icon","text":"micromag-element-call-to-action-text","selfTargetLink":"micromag-element-call-to-action-selfTargetLink","leavingFrame":"micromag-element-call-to-action-leavingFrame","animationDisabled":"micromag-element-call-to-action-animationDisabled","invalidUrl":"micromag-element-call-to-action-invalidUrl"};
|
|
@@ -170,47 +173,54 @@ function CallToAction(_ref) {
|
|
|
170
173
|
window.removeEventListener('pagehide', onPageHide);
|
|
171
174
|
};
|
|
172
175
|
}, [setLeaving]);
|
|
173
|
-
return /*#__PURE__*/
|
|
176
|
+
return /*#__PURE__*/jsxs("div", {
|
|
174
177
|
className: classNames([styles.container, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.disabled, disabled), styles.animationDisabled, animationDisabled), styles.invalidUrl, !validUrl), styles.inWebView, inWebView)]),
|
|
175
|
-
ref: elRef
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
178
|
+
ref: elRef,
|
|
179
|
+
children: [leaving ? /*#__PURE__*/jsx("div", {
|
|
180
|
+
className: styles.leavingFrame
|
|
181
|
+
}) : null, !inWebView && swipeUpEnabled ? /*#__PURE__*/jsx("a", {
|
|
182
|
+
className: styles.selfTargetLink,
|
|
183
|
+
href: url,
|
|
184
|
+
ref: selfTargetLinkRef,
|
|
185
|
+
tabIndex: focusable ? '0' : '-1'
|
|
186
|
+
}) : null, swipeUpEnabled ? /*#__PURE__*/jsx("div", {
|
|
187
|
+
className: classNames([styles.arrow, arrowClassName]),
|
|
188
|
+
style: arrowStyle,
|
|
189
|
+
children: arrow || /*#__PURE__*/jsx(Arrow, {})
|
|
190
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
191
|
+
className: classNames([styles.buttonBorder, buttonBorderClassName]),
|
|
192
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
193
|
+
className: classNames([styles.button, buttonClassName, _defineProperty({}, styles.withoutLinkStyle, !inWebView)]),
|
|
194
|
+
refButton: buttonRef,
|
|
195
|
+
focusable: focusable,
|
|
196
|
+
buttonStyle: boxStyle,
|
|
197
|
+
inline: true,
|
|
198
|
+
"aria-pressed": toggled,
|
|
199
|
+
href: !inWebView ? url : null,
|
|
200
|
+
external: !inWebView ? external : false,
|
|
201
|
+
onClick: onClickLink
|
|
202
|
+
}, swipeUpEnabled && !disabled ? bind() : null), {}, {
|
|
203
|
+
children: /*#__PURE__*/jsxs("span", {
|
|
204
|
+
className: classNames([styles.label, labelClassName]),
|
|
205
|
+
children: [icon !== null ? /*#__PURE__*/jsx("div", {
|
|
206
|
+
className: styles.icon,
|
|
207
|
+
children: icon
|
|
208
|
+
}) : null, /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, label), {}, {
|
|
209
|
+
className: styles.text,
|
|
210
|
+
textStyle: _objectSpread(_objectSpread({}, textStyle), {}, {
|
|
211
|
+
lineHeight: lineHeight || 1
|
|
212
|
+
}),
|
|
213
|
+
inline: true
|
|
214
|
+
}))]
|
|
215
|
+
})
|
|
216
|
+
}))
|
|
217
|
+
})]
|
|
218
|
+
});
|
|
209
219
|
}
|
|
210
220
|
var CallToAction_default = (function (_ref9) {
|
|
211
221
|
var ref = _ref9.ref,
|
|
212
222
|
props = _objectWithoutProperties(_ref9, _excluded);
|
|
213
|
-
return /*#__PURE__*/
|
|
223
|
+
return /*#__PURE__*/jsx(CallToAction, _objectSpread({
|
|
214
224
|
elRef: ref
|
|
215
225
|
}, props));
|
|
216
226
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-call-to-action",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
64
64
|
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
65
65
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
66
|
-
"@micromag/core": "^0.4.
|
|
67
|
-
"@micromag/element-button": "^0.4.
|
|
68
|
-
"@micromag/element-text": "^0.4.
|
|
69
|
-
"@micromag/element-webview": "^0.4.
|
|
66
|
+
"@micromag/core": "^0.4.50",
|
|
67
|
+
"@micromag/element-button": "^0.4.50",
|
|
68
|
+
"@micromag/element-text": "^0.4.50",
|
|
69
|
+
"@micromag/element-webview": "^0.4.50",
|
|
70
70
|
"@react-spring/core": "^10.0.3",
|
|
71
71
|
"@react-spring/web": "^10.0.3",
|
|
72
72
|
"@use-gesture/react": "^10.3.0",
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
"access": "public",
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
83
83
|
"types": "es/index.d.ts"
|
|
84
84
|
}
|