@micromag/element-call-to-action 0.4.71 → 0.4.74

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 +475 -191
  2. package/package.json +12 -10
package/es/index.js CHANGED
@@ -1,34 +1,25 @@
1
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
+ import { c } from 'react/compiler-runtime';
5
2
  import { useGesture } from '@use-gesture/react';
6
3
  import classNames from 'classnames';
7
4
  import isString from 'lodash/isString';
8
- import { useMemo, useRef, useState, useCallback, useEffect } from 'react';
5
+ import { useRef, useState, useEffect } from 'react';
9
6
  import { useTrackEvent } from '@micromag/core/hooks';
10
7
  import { isValidUrl, getStyleFromColor, isIos } from '@micromag/core/utils';
11
8
  import Button from '@micromag/element-button';
12
9
  import Text from '@micromag/element-text';
13
10
  import { jsx, jsxs } from 'react/jsx-runtime';
14
11
 
15
- function Arrow(_ref) {
16
- var _ref$color = _ref.color,
17
- color = _ref$color === void 0 ? 'currentColor' : _ref$color,
18
- _ref$className = _ref.className,
19
- className = _ref$className === void 0 ? null : _ref$className;
20
- return /*#__PURE__*/jsx("svg", {
21
- version: "1.1",
22
- xmlns: "http://www.w3.org/2000/svg",
23
- xmlnsXlink: "http://www.w3.org/1999/xlink",
24
- x: "0",
25
- y: "0px",
26
- width: "48.53px",
27
- height: "12.38px",
28
- viewBox: "0 0 48.53 12.38",
29
- className: className,
30
- xmlSpace: "preserve",
31
- children: /*#__PURE__*/jsx("g", {
12
+ function Arrow(t0) {
13
+ const $ = c(5);
14
+ const {
15
+ color: t1,
16
+ className: t2
17
+ } = t0;
18
+ const color = t1 === undefined ? "currentColor" : t1;
19
+ const className = t2 === undefined ? null : t2;
20
+ let t3;
21
+ if ($[0] !== color) {
22
+ t3 = /*#__PURE__*/jsx("g", {
32
23
  transform: "matrix(1, 0, 0, 1, 0, 0)",
33
24
  children: /*#__PURE__*/jsx("path", {
34
25
  id: "b",
@@ -39,190 +30,483 @@ function Arrow(_ref) {
39
30
  strokeLinecap: "round",
40
31
  d: "M1.5,10.88L24.26,1.5l22.77,9.38"
41
32
  })
42
- })
43
- });
33
+ });
34
+ $[0] = color;
35
+ $[1] = t3;
36
+ } else {
37
+ t3 = $[1];
38
+ }
39
+ let t4;
40
+ if ($[2] !== className || $[3] !== t3) {
41
+ t4 = /*#__PURE__*/jsx("svg", {
42
+ version: "1.1",
43
+ xmlns: "http://www.w3.org/2000/svg",
44
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
45
+ x: "0",
46
+ y: "0px",
47
+ width: "48.53px",
48
+ height: "12.38px",
49
+ viewBox: "0 0 48.53 12.38",
50
+ className: className,
51
+ xmlSpace: "preserve",
52
+ children: t3
53
+ });
54
+ $[2] = className;
55
+ $[3] = t3;
56
+ $[4] = t4;
57
+ } else {
58
+ t4 = $[4];
59
+ }
60
+ return t4;
44
61
  }
45
62
 
46
63
  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"};
47
64
 
48
- var _excluded = ["ref"];
49
- function CallToAction(_ref) {
50
- var _ref$type = _ref.type,
51
- type = _ref$type === void 0 ? null : _ref$type,
52
- _ref$url = _ref.url,
53
- url = _ref$url === void 0 ? null : _ref$url,
54
- _ref$label = _ref.label,
55
- label = _ref$label === void 0 ? null : _ref$label,
56
- _ref$boxStyle = _ref.boxStyle,
57
- boxStyle = _ref$boxStyle === void 0 ? null : _ref$boxStyle,
58
- _ref$inWebView = _ref.inWebView,
59
- inWebView = _ref$inWebView === void 0 ? false : _ref$inWebView,
60
- _ref$elRef = _ref.elRef,
61
- elRef = _ref$elRef === void 0 ? null : _ref$elRef,
62
- _ref$disabled = _ref.disabled,
63
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
64
- _ref$animationDisable = _ref.animationDisabled,
65
- animationDisabled = _ref$animationDisable === void 0 ? false : _ref$animationDisable,
66
- _ref$icon = _ref.icon,
67
- icon = _ref$icon === void 0 ? null : _ref$icon,
68
- _ref$arrow = _ref.arrow,
69
- arrow = _ref$arrow === void 0 ? null : _ref$arrow,
70
- _ref$dragAmount = _ref.dragAmount,
71
- dragAmount = _ref$dragAmount === void 0 ? 50 : _ref$dragAmount,
72
- _ref$className = _ref.className,
73
- className = _ref$className === void 0 ? null : _ref$className,
74
- _ref$buttonClassName = _ref.buttonClassName,
75
- buttonClassName = _ref$buttonClassName === void 0 ? null : _ref$buttonClassName,
76
- _ref$buttonBorderClas = _ref.buttonBorderClassName,
77
- buttonBorderClassName = _ref$buttonBorderClas === void 0 ? null : _ref$buttonBorderClas,
78
- _ref$labelClassName = _ref.labelClassName,
79
- labelClassName = _ref$labelClassName === void 0 ? null : _ref$labelClassName,
80
- _ref$arrowClassName = _ref.arrowClassName,
81
- arrowClassName = _ref$arrowClassName === void 0 ? null : _ref$arrowClassName,
82
- _ref$focusable = _ref.focusable,
83
- focusable = _ref$focusable === void 0 ? true : _ref$focusable,
84
- _ref$external = _ref.external,
85
- external = _ref$external === void 0 ? true : _ref$external,
86
- _ref$openWebView = _ref.openWebView,
87
- openWebView = _ref$openWebView === void 0 ? null : _ref$openWebView,
88
- _ref$onClick = _ref.onClick,
89
- onClick = _ref$onClick === void 0 ? null : _ref$onClick;
90
- var trackEvent = useTrackEvent();
91
- var swipeUpEnabled = type === null || type === 'swipe-up';
92
- var validUrl = useMemo(function () {
93
- return isValidUrl(url);
94
- }, [url]);
95
- var buttonRef = useRef(null);
96
- var _ref2 = label || {},
97
- _ref2$textStyle = _ref2.textStyle,
98
- textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
99
- var _ref3 = textStyle || {},
100
- _ref3$fontSize = _ref3.fontSize,
101
- fontSize = _ref3$fontSize === void 0 ? null : _ref3$fontSize,
102
- _ref3$color = _ref3.color,
103
- color = _ref3$color === void 0 ? null : _ref3$color,
104
- _ref3$lineHeight = _ref3.lineHeight,
105
- lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
106
- var _ref4 = boxStyle || {},
107
- _ref4$backgroundColor = _ref4.backgroundColor,
108
- backgroundColor = _ref4$backgroundColor === void 0 ? null : _ref4$backgroundColor;
109
- var arrowStyle = useMemo(function () {
110
- return _objectSpread(_objectSpread({}, {
111
- fontSize: fontSize
112
- }), backgroundColor === null ? getStyleFromColor(color, 'color') : getStyleFromColor(backgroundColor, 'color'));
113
- }, [fontSize, backgroundColor, color]);
114
-
115
- // MobileSafari blocks popup no matter what
116
- var selfTargetLinkRef = useRef(null);
117
- var _useState = useState(false),
118
- _useState2 = _slicedToArray(_useState, 2),
119
- leaving = _useState2[0],
120
- setLeaving = _useState2[1];
121
- var _useState3 = useState(false),
122
- _useState4 = _slicedToArray(_useState3, 2),
123
- toggled = _useState4[0],
124
- setToggled = _useState4[1];
125
-
126
- // On click
127
- var onClickLink = useCallback(function (e) {
128
- var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'click';
129
- setToggled(!toggled);
130
- if (inWebView && openWebView !== null) {
131
- openWebView({
132
- url: url
133
- });
134
- }
135
- if (onClick !== null && action === 'click') {
136
- onClick(e);
137
- }
138
- if (trackEvent !== null) {
139
- trackEvent('call_to_action', isString(action) ? action : 'click', url);
140
- }
141
- }, [toggled, url, onClick, trackEvent, inWebView, openWebView]);
142
- var onDrag = useCallback(function (_ref5) {
143
- var event = _ref5.event;
144
- // fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
145
- event.preventDefault();
146
- }, []);
147
- var onDragEnd = useCallback(function (_ref6) {
148
- var _ref6$movement = _slicedToArray(_ref6.movement, 2),
149
- my = _ref6$movement[1];
150
- if (my < -dragAmount) {
151
- if (inWebView) {
152
- onClickLink(null, 'swipe');
153
- } else if (isIos() && selfTargetLinkRef.current !== null) {
154
- selfTargetLinkRef.current.click();
155
- setLeaving(true);
156
- onClickLink(null, 'swipe');
157
- } else if (buttonRef.current) {
158
- buttonRef.current.click();
159
- onClickLink(null, 'swipe');
65
+ function CallToAction(t0) {
66
+ const $ = c(92);
67
+ const {
68
+ type: t1,
69
+ url: t2,
70
+ label: t3,
71
+ boxStyle: t4,
72
+ inWebView: t5,
73
+ elRef: t6,
74
+ disabled: t7,
75
+ animationDisabled: t8,
76
+ icon: t9,
77
+ arrow: t10,
78
+ dragAmount: t11,
79
+ className: t12,
80
+ buttonClassName: t13,
81
+ buttonBorderClassName: t14,
82
+ labelClassName: t15,
83
+ arrowClassName: t16,
84
+ focusable: t17,
85
+ external: t18,
86
+ openWebView: t19,
87
+ onClick: t20
88
+ } = t0;
89
+ const type = t1 === undefined ? null : t1;
90
+ const url = t2 === undefined ? null : t2;
91
+ const label = t3 === undefined ? null : t3;
92
+ const boxStyle = t4 === undefined ? null : t4;
93
+ const inWebView = t5 === undefined ? false : t5;
94
+ const elRef = t6 === undefined ? null : t6;
95
+ const disabled = t7 === undefined ? false : t7;
96
+ const animationDisabled = t8 === undefined ? false : t8;
97
+ const icon = t9 === undefined ? null : t9;
98
+ const arrow = t10 === undefined ? null : t10;
99
+ const dragAmount = t11 === undefined ? 50 : t11;
100
+ const className = t12 === undefined ? null : t12;
101
+ const buttonClassName = t13 === undefined ? null : t13;
102
+ const buttonBorderClassName = t14 === undefined ? null : t14;
103
+ const labelClassName = t15 === undefined ? null : t15;
104
+ const arrowClassName = t16 === undefined ? null : t16;
105
+ const focusable = t17 === undefined ? true : t17;
106
+ const external = t18 === undefined ? true : t18;
107
+ const openWebView = t19 === undefined ? null : t19;
108
+ const onClick = t20 === undefined ? null : t20;
109
+ const trackEvent = useTrackEvent();
110
+ const swipeUpEnabled = type === null || type === "swipe-up";
111
+ let t21;
112
+ if ($[0] !== url) {
113
+ t21 = isValidUrl(url);
114
+ $[0] = url;
115
+ $[1] = t21;
116
+ } else {
117
+ t21 = $[1];
118
+ }
119
+ const validUrl = t21;
120
+ const buttonRef = useRef(null);
121
+ let t22;
122
+ if ($[2] !== label) {
123
+ t22 = label || {};
124
+ $[2] = label;
125
+ $[3] = t22;
126
+ } else {
127
+ t22 = $[3];
128
+ }
129
+ const {
130
+ textStyle: t23
131
+ } = t22;
132
+ const textStyle = t23 === undefined ? null : t23;
133
+ let t24;
134
+ if ($[4] !== textStyle) {
135
+ t24 = textStyle || {};
136
+ $[4] = textStyle;
137
+ $[5] = t24;
138
+ } else {
139
+ t24 = $[5];
140
+ }
141
+ const {
142
+ fontSize: t25,
143
+ color: t26,
144
+ lineHeight: t27
145
+ } = t24;
146
+ const fontSize = t25 === undefined ? null : t25;
147
+ const color = t26 === undefined ? null : t26;
148
+ const lineHeight = t27 === undefined ? null : t27;
149
+ let t28;
150
+ if ($[6] !== boxStyle) {
151
+ t28 = boxStyle || {};
152
+ $[6] = boxStyle;
153
+ $[7] = t28;
154
+ } else {
155
+ t28 = $[7];
156
+ }
157
+ const {
158
+ backgroundColor: t29
159
+ } = t28;
160
+ const backgroundColor = t29 === undefined ? null : t29;
161
+ let t30;
162
+ if ($[8] !== fontSize) {
163
+ t30 = {
164
+ fontSize
165
+ };
166
+ $[8] = fontSize;
167
+ $[9] = t30;
168
+ } else {
169
+ t30 = $[9];
170
+ }
171
+ let t31;
172
+ if ($[10] !== backgroundColor || $[11] !== color) {
173
+ t31 = backgroundColor === null ? getStyleFromColor(color, "color") : getStyleFromColor(backgroundColor, "color");
174
+ $[10] = backgroundColor;
175
+ $[11] = color;
176
+ $[12] = t31;
177
+ } else {
178
+ t31 = $[12];
179
+ }
180
+ let t32;
181
+ if ($[13] !== t30 || $[14] !== t31) {
182
+ t32 = {
183
+ ...t30,
184
+ ...t31
185
+ };
186
+ $[13] = t30;
187
+ $[14] = t31;
188
+ $[15] = t32;
189
+ } else {
190
+ t32 = $[15];
191
+ }
192
+ const arrowStyle = t32;
193
+ const selfTargetLinkRef = useRef(null);
194
+ const [leaving, setLeaving] = useState(false);
195
+ const [toggled, setToggled] = useState(false);
196
+ let t33;
197
+ if ($[16] !== inWebView || $[17] !== onClick || $[18] !== openWebView || $[19] !== toggled || $[20] !== trackEvent || $[21] !== url) {
198
+ t33 = (e, t34) => {
199
+ const action = t34 === undefined ? "click" : t34;
200
+ setToggled(!toggled);
201
+ if (inWebView && openWebView !== null) {
202
+ openWebView({
203
+ url
204
+ });
205
+ }
206
+ if (onClick !== null && action === "click") {
207
+ onClick(e);
208
+ }
209
+ if (trackEvent !== null) {
210
+ trackEvent("call_to_action", isString(action) ? action : "click", url);
160
211
  }
161
- }
162
- }, [dragAmount, inWebView, onClickLink, setLeaving]);
163
- var bind = useGesture({
164
- onDrag: onDrag,
165
- onDragEnd: onDragEnd
166
- });
167
- useEffect(function () {
168
- var onPageHide = function onPageHide() {
169
- setLeaving(false);
170
212
  };
171
- window.addEventListener('pagehide', onPageHide);
172
- return function () {
173
- window.removeEventListener('pagehide', onPageHide);
213
+ $[16] = inWebView;
214
+ $[17] = onClick;
215
+ $[18] = openWebView;
216
+ $[19] = toggled;
217
+ $[20] = trackEvent;
218
+ $[21] = url;
219
+ $[22] = t33;
220
+ } else {
221
+ t33 = $[22];
222
+ }
223
+ const onClickLink = t33;
224
+ const onDrag = _temp;
225
+ let t34;
226
+ if ($[23] !== dragAmount || $[24] !== inWebView || $[25] !== onClickLink) {
227
+ t34 = t35 => {
228
+ const {
229
+ movement: t36
230
+ } = t35;
231
+ const [, my] = t36;
232
+ if (my < -dragAmount) {
233
+ if (inWebView) {
234
+ onClickLink(null, "swipe");
235
+ } else {
236
+ if (isIos() && selfTargetLinkRef.current !== null) {
237
+ selfTargetLinkRef.current.click();
238
+ setLeaving(true);
239
+ onClickLink(null, "swipe");
240
+ } else {
241
+ if (buttonRef.current) {
242
+ buttonRef.current.click();
243
+ onClickLink(null, "swipe");
244
+ }
245
+ }
246
+ }
247
+ }
248
+ };
249
+ $[23] = dragAmount;
250
+ $[24] = inWebView;
251
+ $[25] = onClickLink;
252
+ $[26] = t34;
253
+ } else {
254
+ t34 = $[26];
255
+ }
256
+ const onDragEnd = t34;
257
+ let t35;
258
+ if ($[27] !== onDragEnd) {
259
+ t35 = {
260
+ onDrag,
261
+ onDragEnd
262
+ };
263
+ $[27] = onDragEnd;
264
+ $[28] = t35;
265
+ } else {
266
+ t35 = $[28];
267
+ }
268
+ const bind = useGesture(t35);
269
+ let t36;
270
+ let t37;
271
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
272
+ t36 = () => {
273
+ const onPageHide = () => {
274
+ setLeaving(false);
275
+ };
276
+ window.addEventListener("pagehide", onPageHide);
277
+ return () => {
278
+ window.removeEventListener("pagehide", onPageHide);
279
+ };
174
280
  };
175
- }, [setLeaving]);
176
- return /*#__PURE__*/jsxs("div", {
177
- className: classNames([styles.container, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.disabled, disabled), styles.animationDisabled, animationDisabled), styles.invalidUrl, !validUrl), styles.inWebView, inWebView)]),
178
- ref: elRef,
179
- children: [leaving ? /*#__PURE__*/jsx("div", {
281
+ t37 = [setLeaving];
282
+ $[29] = t36;
283
+ $[30] = t37;
284
+ } else {
285
+ t36 = $[29];
286
+ t37 = $[30];
287
+ }
288
+ useEffect(t36, t37);
289
+ const t38 = !validUrl;
290
+ let t39;
291
+ if ($[31] !== animationDisabled || $[32] !== className || $[33] !== disabled || $[34] !== inWebView || $[35] !== t38) {
292
+ t39 = classNames([styles.container, className, {
293
+ [styles.disabled]: disabled,
294
+ [styles.animationDisabled]: animationDisabled,
295
+ [styles.invalidUrl]: t38,
296
+ [styles.inWebView]: inWebView
297
+ }]);
298
+ $[31] = animationDisabled;
299
+ $[32] = className;
300
+ $[33] = disabled;
301
+ $[34] = inWebView;
302
+ $[35] = t38;
303
+ $[36] = t39;
304
+ } else {
305
+ t39 = $[36];
306
+ }
307
+ let t40;
308
+ if ($[37] !== leaving) {
309
+ t40 = leaving ? /*#__PURE__*/jsx("div", {
180
310
  className: styles.leavingFrame
181
- }) : null, !inWebView && swipeUpEnabled ? /*#__PURE__*/jsx("a", {
311
+ }) : null;
312
+ $[37] = leaving;
313
+ $[38] = t40;
314
+ } else {
315
+ t40 = $[38];
316
+ }
317
+ let t41;
318
+ if ($[39] !== focusable || $[40] !== inWebView || $[41] !== swipeUpEnabled || $[42] !== url) {
319
+ t41 = !inWebView && swipeUpEnabled ? /*#__PURE__*/jsx("a", {
182
320
  className: styles.selfTargetLink,
183
321
  href: url,
184
322
  ref: selfTargetLinkRef,
185
- tabIndex: focusable ? '0' : '-1'
186
- }) : null, swipeUpEnabled ? /*#__PURE__*/jsx("div", {
323
+ tabIndex: focusable ? "0" : "-1"
324
+ }) : null;
325
+ $[39] = focusable;
326
+ $[40] = inWebView;
327
+ $[41] = swipeUpEnabled;
328
+ $[42] = url;
329
+ $[43] = t41;
330
+ } else {
331
+ t41 = $[43];
332
+ }
333
+ let t42;
334
+ if ($[44] !== arrow || $[45] !== arrowClassName || $[46] !== arrowStyle || $[47] !== swipeUpEnabled) {
335
+ t42 = swipeUpEnabled ? /*#__PURE__*/jsx("div", {
187
336
  className: classNames([styles.arrow, arrowClassName]),
188
337
  style: arrowStyle,
189
338
  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
- });
339
+ }) : null;
340
+ $[44] = arrow;
341
+ $[45] = arrowClassName;
342
+ $[46] = arrowStyle;
343
+ $[47] = swipeUpEnabled;
344
+ $[48] = t42;
345
+ } else {
346
+ t42 = $[48];
347
+ }
348
+ let t43;
349
+ if ($[49] !== buttonBorderClassName) {
350
+ t43 = classNames([styles.buttonBorder, buttonBorderClassName]);
351
+ $[49] = buttonBorderClassName;
352
+ $[50] = t43;
353
+ } else {
354
+ t43 = $[50];
355
+ }
356
+ const t44 = !inWebView;
357
+ let t45;
358
+ if ($[51] !== buttonClassName || $[52] !== t44) {
359
+ t45 = classNames([styles.button, buttonClassName, {
360
+ [styles.withoutLinkStyle]: t44
361
+ }]);
362
+ $[51] = buttonClassName;
363
+ $[52] = t44;
364
+ $[53] = t45;
365
+ } else {
366
+ t45 = $[53];
367
+ }
368
+ const t46 = !inWebView ? url : null;
369
+ const t47 = !inWebView ? external : false;
370
+ let t48;
371
+ if ($[54] !== bind || $[55] !== disabled || $[56] !== swipeUpEnabled) {
372
+ t48 = swipeUpEnabled && !disabled ? bind() : null;
373
+ $[54] = bind;
374
+ $[55] = disabled;
375
+ $[56] = swipeUpEnabled;
376
+ $[57] = t48;
377
+ } else {
378
+ t48 = $[57];
379
+ }
380
+ let t49;
381
+ if ($[58] !== labelClassName) {
382
+ t49 = classNames([styles.label, labelClassName]);
383
+ $[58] = labelClassName;
384
+ $[59] = t49;
385
+ } else {
386
+ t49 = $[59];
387
+ }
388
+ let t50;
389
+ if ($[60] !== icon) {
390
+ t50 = icon !== null ? /*#__PURE__*/jsx("div", {
391
+ className: styles.icon,
392
+ children: icon
393
+ }) : null;
394
+ $[60] = icon;
395
+ $[61] = t50;
396
+ } else {
397
+ t50 = $[61];
398
+ }
399
+ const t51 = lineHeight || 1;
400
+ let t52;
401
+ if ($[62] !== t51 || $[63] !== textStyle) {
402
+ t52 = {
403
+ ...textStyle,
404
+ lineHeight: t51
405
+ };
406
+ $[62] = t51;
407
+ $[63] = textStyle;
408
+ $[64] = t52;
409
+ } else {
410
+ t52 = $[64];
411
+ }
412
+ let t53;
413
+ if ($[65] !== label || $[66] !== t52) {
414
+ t53 = /*#__PURE__*/jsx(Text, {
415
+ ...label,
416
+ className: styles.text,
417
+ textStyle: t52,
418
+ inline: true
419
+ });
420
+ $[65] = label;
421
+ $[66] = t52;
422
+ $[67] = t53;
423
+ } else {
424
+ t53 = $[67];
425
+ }
426
+ let t54;
427
+ if ($[68] !== t49 || $[69] !== t50 || $[70] !== t53) {
428
+ t54 = /*#__PURE__*/jsxs("span", {
429
+ className: t49,
430
+ children: [t50, t53]
431
+ });
432
+ $[68] = t49;
433
+ $[69] = t50;
434
+ $[70] = t53;
435
+ $[71] = t54;
436
+ } else {
437
+ t54 = $[71];
438
+ }
439
+ let t55;
440
+ if ($[72] !== boxStyle || $[73] !== focusable || $[74] !== onClickLink || $[75] !== t45 || $[76] !== t46 || $[77] !== t47 || $[78] !== t48 || $[79] !== t54 || $[80] !== toggled) {
441
+ t55 = /*#__PURE__*/jsx(Button, {
442
+ className: t45,
443
+ refButton: buttonRef,
444
+ focusable: focusable,
445
+ buttonStyle: boxStyle,
446
+ inline: true,
447
+ "aria-pressed": toggled,
448
+ href: t46,
449
+ external: t47,
450
+ onClick: onClickLink,
451
+ ...t48,
452
+ children: t54
453
+ });
454
+ $[72] = boxStyle;
455
+ $[73] = focusable;
456
+ $[74] = onClickLink;
457
+ $[75] = t45;
458
+ $[76] = t46;
459
+ $[77] = t47;
460
+ $[78] = t48;
461
+ $[79] = t54;
462
+ $[80] = toggled;
463
+ $[81] = t55;
464
+ } else {
465
+ t55 = $[81];
466
+ }
467
+ let t56;
468
+ if ($[82] !== t43 || $[83] !== t55) {
469
+ t56 = /*#__PURE__*/jsx("div", {
470
+ className: t43,
471
+ children: t55
472
+ });
473
+ $[82] = t43;
474
+ $[83] = t55;
475
+ $[84] = t56;
476
+ } else {
477
+ t56 = $[84];
478
+ }
479
+ let t57;
480
+ if ($[85] !== elRef || $[86] !== t39 || $[87] !== t40 || $[88] !== t41 || $[89] !== t42 || $[90] !== t56) {
481
+ t57 = /*#__PURE__*/jsxs("div", {
482
+ className: t39,
483
+ ref: elRef,
484
+ children: [t40, t41, t42, t56]
485
+ });
486
+ $[85] = elRef;
487
+ $[86] = t39;
488
+ $[87] = t40;
489
+ $[88] = t41;
490
+ $[89] = t42;
491
+ $[90] = t56;
492
+ $[91] = t57;
493
+ } else {
494
+ t57 = $[91];
495
+ }
496
+ return t57;
497
+ }
498
+ function _temp(t0) {
499
+ const {
500
+ event
501
+ } = t0;
502
+ event.preventDefault();
219
503
  }
220
- var CallToAction_default = (function (_ref9) {
221
- var ref = _ref9.ref,
222
- props = _objectWithoutProperties(_ref9, _excluded);
223
- return /*#__PURE__*/jsx(CallToAction, _objectSpread({
224
- elRef: ref
225
- }, props));
504
+ var CallToAction_default = ({
505
+ ref,
506
+ ...props
507
+ }) => /*#__PURE__*/jsx(CallToAction, {
508
+ elRef: ref,
509
+ ...props
226
510
  });
227
511
 
228
512
  export { CallToAction_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-call-to-action",
3
- "version": "0.4.71",
3
+ "version": "0.4.74",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -32,9 +32,11 @@
32
32
  "license": "ISC",
33
33
  "type": "module",
34
34
  "module": "es/index.js",
35
+ "style": "./assets/css/styles.css",
35
36
  "exports": {
36
37
  ".": {
37
38
  "types": "./es/index.d.ts",
39
+ "style": "./assets/css/styles.css",
38
40
  "import": "./es/index.js"
39
41
  },
40
42
  "./assets/css/styles": "./assets/css/styles.css",
@@ -51,22 +53,22 @@
51
53
  "build": "../../scripts/prepare-package.sh --types"
52
54
  },
53
55
  "devDependencies": {
54
- "react": "^18.3.0 || ^19.0.0",
55
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^18.3.0 || ^19.0.0",
59
- "react-dom": "^18.3.0 || ^19.0.0"
60
+ "react": "^19.0.0",
61
+ "react-dom": "^19.0.0"
60
62
  },
61
63
  "dependencies": {
62
64
  "@babel/runtime": "^7.28.6",
63
65
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
64
66
  "@fortawesome/free-solid-svg-icons": "^7.2.0",
65
67
  "@fortawesome/react-fontawesome": "^3.2.0",
66
- "@micromag/core": "^0.4.71",
67
- "@micromag/element-button": "^0.4.71",
68
- "@micromag/element-text": "^0.4.71",
69
- "@micromag/element-webview": "^0.4.71",
68
+ "@micromag/core": "^0.4.74",
69
+ "@micromag/element-button": "^0.4.74",
70
+ "@micromag/element-text": "^0.4.74",
71
+ "@micromag/element-webview": "^0.4.74",
70
72
  "@react-spring/core": "^10.0.3",
71
73
  "@react-spring/web": "^10.0.3",
72
74
  "@use-gesture/react": "^10.3.0",
@@ -79,6 +81,6 @@
79
81
  "access": "public",
80
82
  "registry": "https://registry.npmjs.org/"
81
83
  },
82
- "gitHead": "9101554bc5761e32b4a002a10d26800608c69773",
84
+ "gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
83
85
  "types": "es/index.d.ts"
84
86
  }