@micromag/element-call-to-action 0.4.49 → 0.4.51

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 (2) hide show
  1. package/es/index.js +60 -50
  2. 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 React, { useMemo, useRef, useState, useCallback, useEffect } from 'react';
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__*/React.createElement("svg", {
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
- }, /*#__PURE__*/React.createElement("g", {
31
- transform: "matrix(1, 0, 0, 1, 0, 0)"
32
- }, /*#__PURE__*/React.createElement("path", {
33
- id: "b",
34
- fill: "none",
35
- stroke: color,
36
- strokeWidth: "3px",
37
- strokeLinejoin: "round",
38
- strokeLinecap: "round",
39
- d: "M1.5,10.88L24.26,1.5l22.77,9.38"
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__*/React.createElement("div", {
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
- }, leaving ? /*#__PURE__*/React.createElement("div", {
177
- className: styles.leavingFrame
178
- }) : null, !inWebView && swipeUpEnabled ? /*#__PURE__*/React.createElement("a", {
179
- className: styles.selfTargetLink,
180
- href: url,
181
- ref: selfTargetLinkRef,
182
- tabIndex: focusable ? '0' : '-1'
183
- }) : null, swipeUpEnabled ? /*#__PURE__*/React.createElement("div", {
184
- className: classNames([styles.arrow, arrowClassName]),
185
- style: arrowStyle
186
- }, arrow || /*#__PURE__*/React.createElement(Arrow, null)) : null, /*#__PURE__*/React.createElement("div", {
187
- className: classNames([styles.buttonBorder, buttonBorderClassName])
188
- }, /*#__PURE__*/React.createElement(Button, Object.assign({
189
- className: classNames([styles.button, buttonClassName, _defineProperty({}, styles.withoutLinkStyle, !inWebView)]),
190
- refButton: buttonRef,
191
- focusable: focusable,
192
- buttonStyle: boxStyle,
193
- inline: true,
194
- "aria-pressed": toggled,
195
- href: !inWebView ? url : null,
196
- external: !inWebView ? external : false,
197
- onClick: onClickLink
198
- }, swipeUpEnabled && !disabled ? bind() : null), /*#__PURE__*/React.createElement("span", {
199
- className: classNames([styles.label, labelClassName])
200
- }, icon !== null ? /*#__PURE__*/React.createElement("div", {
201
- className: styles.icon
202
- }, icon) : null, /*#__PURE__*/React.createElement(Text, Object.assign({}, label, {
203
- className: styles.text,
204
- textStyle: _objectSpread(_objectSpread({}, textStyle), {}, {
205
- lineHeight: lineHeight || 1
206
- }),
207
- inline: true
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__*/React.createElement(CallToAction, Object.assign({
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.49",
3
+ "version": "0.4.51",
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.49",
67
- "@micromag/element-button": "^0.4.49",
68
- "@micromag/element-text": "^0.4.49",
69
- "@micromag/element-webview": "^0.4.49",
66
+ "@micromag/core": "^0.4.51",
67
+ "@micromag/element-button": "^0.4.51",
68
+ "@micromag/element-text": "^0.4.51",
69
+ "@micromag/element-webview": "^0.4.51",
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": "0a225ff29387217cccb0fcc5a731e23c74bd202e",
82
+ "gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439",
83
83
  "types": "es/index.d.ts"
84
84
  }