@wix/editor-react-components 1.2764.0 → 1.2765.0

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 (100) hide show
  1. package/dist/site/components/AccordionComponent/manifest.js +1 -1
  2. package/dist/site/components/AudioPlayer/component.js +4 -3
  3. package/dist/site/components/AudioPlayer/manifest.js +1 -1
  4. package/dist/site/components/BoxContainer/component.js +2 -2
  5. package/dist/site/components/Breadcrumbs/component.js +3 -3
  6. package/dist/site/components/Breadcrumbs/manifest.js +1 -1
  7. package/dist/site/components/Button/component.js +1 -1
  8. package/dist/site/components/Button/manifest.js +1 -1
  9. package/dist/site/components/Checkbox/component.js +2 -2
  10. package/dist/site/components/CheckboxGroup/component.js +2 -2
  11. package/dist/site/components/CollapsibleText/component.js +2 -2
  12. package/dist/site/components/CollapsibleText/manifest.js +1 -1
  13. package/dist/site/components/DatePicker/component.js +6 -4
  14. package/dist/site/components/Dropdown/component.js +1 -1
  15. package/dist/site/components/Dropdown/manifest.js +1 -1
  16. package/dist/site/components/GoogleMap/manifest.js +1 -1
  17. package/dist/site/components/HTMLComponent/manifest.js +1 -1
  18. package/dist/site/components/HeadingTextBlock/component.js +2 -2
  19. package/dist/site/components/HipaaIcon/component.js +1 -1
  20. package/dist/site/components/Image3/component.js +1 -1
  21. package/dist/site/components/ImageReveal/component.js +2 -2
  22. package/dist/site/components/LegacyAppWidget/component.js +1 -1
  23. package/dist/site/components/LegacyContainer/component.js +1 -1
  24. package/dist/site/components/LegacyMultiStateBox/component.js +2 -2
  25. package/dist/site/components/Line/component.js +1 -1
  26. package/dist/site/components/LinkBar/manifest.js +1 -1
  27. package/dist/site/components/Lottie/component.js +1 -1
  28. package/dist/site/components/Lottie/manifest.js +1 -1
  29. package/dist/site/components/MarkdownBlock/component.js +1 -1
  30. package/dist/site/components/Menu/component.js +3 -3
  31. package/dist/site/components/Menu/manifest.js +1 -1
  32. package/dist/site/components/MultiStateBox/manifest.js +1 -1
  33. package/dist/site/components/RadioButtons/component.js +2 -2
  34. package/dist/site/components/ShareButtons/component.js +1 -1
  35. package/dist/site/components/ShareButtons/manifest.js +1 -1
  36. package/dist/site/components/Slideshow/component.js +1 -1
  37. package/dist/site/components/Slideshow/manifest.js +1 -1
  38. package/dist/site/components/Tabs/manifest.js +1 -1
  39. package/dist/site/components/TestComp/manifest.js +1 -1
  40. package/dist/site/components/TextBox/component.js +1 -1
  41. package/dist/site/components/TextEffects3d/component.js +1 -1
  42. package/dist/site/components/TextEffectsBauhaus/component.js +1 -1
  43. package/dist/site/components/TextEffectsGlass/component.js +1 -1
  44. package/dist/site/components/TextEffectsGlitch/component.js +1 -1
  45. package/dist/site/components/TextEffectsLetterPress/component.js +1 -1
  46. package/dist/site/components/TextEffectsMatrix/component.js +1 -1
  47. package/dist/site/components/TextEffectsNeonSign/component.js +1 -1
  48. package/dist/site/components/TextEffectsNoisy/component.js +1 -1
  49. package/dist/site/components/TextEffectsOutlineOut/component.js +1 -1
  50. package/dist/site/components/TextEffectsRetro/component.js +1 -1
  51. package/dist/site/components/TextEffectsShook/component.js +1 -1
  52. package/dist/site/components/TextEffectsSticker/component.js +1 -1
  53. package/dist/site/components/TextEffectsStriped/component.js +1 -1
  54. package/dist/site/components/TextInput/TextInput.d.ts +3 -7
  55. package/dist/site/components/TextInput/TextInput.types.d.ts +38 -105
  56. package/dist/site/components/TextInput/component.js +104 -780
  57. package/dist/site/components/TextInput/component.preview.d.ts +1 -4
  58. package/dist/site/components/TextInput/constants.d.ts +17 -65
  59. package/dist/site/components/TextInput/css.css +25 -223
  60. package/dist/site/components/TextInput/manifest.js +181 -367
  61. package/dist/site/components/TimePicker/component.js +6 -5
  62. package/dist/site/components/chunks/AnimatedIcon.js +1 -1
  63. package/dist/site/components/chunks/Button.js +1055 -466
  64. package/dist/site/components/chunks/Button2.js +486 -0
  65. package/dist/site/components/chunks/Group.js +46 -970
  66. package/dist/site/components/chunks/I18nProvider.js +125 -0
  67. package/dist/site/components/chunks/Input.js +369 -0
  68. package/dist/site/components/chunks/Link.js +1 -1
  69. package/dist/site/components/chunks/ResponsiveBox.js +1 -1
  70. package/dist/site/components/chunks/ResponsiveContainer.js +1 -1
  71. package/dist/site/components/chunks/TextEffectsShared.js +1 -1
  72. package/dist/site/components/chunks/Tooltip.js +6745 -351
  73. package/dist/site/components/chunks/VisuallyHidden.js +1 -1
  74. package/dist/site/components/chunks/a11y.js +4 -5
  75. package/dist/site/components/chunks/constants3.js +23 -63
  76. package/dist/site/components/chunks/filterDOMProps.js +18 -139
  77. package/dist/site/components/chunks/index10.js +3 -2020
  78. package/dist/site/components/chunks/index11.js +31184 -232
  79. package/dist/site/components/chunks/index12.js +3 -31191
  80. package/dist/site/components/chunks/index13.js +44 -3
  81. package/dist/site/components/chunks/index3.js +1 -1
  82. package/dist/site/components/chunks/index4.js +1 -1
  83. package/dist/site/components/chunks/index5.js +1 -1
  84. package/dist/site/components/chunks/index7.js +67 -3
  85. package/dist/site/components/chunks/index8.js +2020 -3
  86. package/dist/site/components/chunks/index9.js +232 -60
  87. package/dist/site/components/chunks/manifestSdkMixins.js +4 -4
  88. package/dist/site/components/chunks/parseHtml.js +1 -1
  89. package/dist/site/components/chunks/parseSvg.js +1 -1
  90. package/dist/site/components/chunks/staticService.js +1 -1
  91. package/dist/site/components/chunks/useConsentPolicyProps.js +1 -1
  92. package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
  93. package/package.json +2 -2
  94. package/dist/site/components/TextInput/TextInput.viewer.constants.d.ts +0 -24
  95. package/dist/site/components/TextInput/sdk.d.ts +0 -4
  96. package/dist/site/components/TextInput/sdk.js +0 -91
  97. package/dist/site/components/TextInput/utils.d.ts +0 -9
  98. package/dist/site/components/chunks/DateField.js +0 -6762
  99. package/dist/site/components/chunks/NumberFormatter.js +0 -140
  100. package/dist/site/components/chunks/index14.js +0 -46
@@ -0,0 +1,486 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useRef, useCallback, useState, useEffect, useMemo } from "react";
3
+ import { c as clsx } from "./clsx.js";
4
+ import { d as directionStyles } from "./direction.module.js";
5
+ import { p as presetWrapperStyles } from "./presetWrapper.module.js";
6
+ import { a as getDataAttributes, g as getQaDataAttributes } from "./dataUtils.js";
7
+ import { f as formatClassNames } from "./classNames.js";
8
+ import { I as IconAnimationTriggers } from "./Button.types.js";
9
+ import AnimatedIconWithReducedMotion from "../AnimatedIcon/component.js";
10
+ import { T as TRANSITION_DURATION, D as DesignStates, S as SEMANTIC_CLASS_NAMES, a as TestIds, C as COMPONENT_TYPE } from "./constants21.js";
11
+ import { d as activateByEnterButton, a as activateBySpaceOrEnterButton, r as removeAriaPrefix, g as getAccessibilityAttributesSpread } from "./a11y.js";
12
+ import { i as isValidLink } from "./Link.js";
13
+ import { d as defineStaticService } from "./staticService.js";
14
+ import { d as defineService } from "./index10.js";
15
+ import { E as EnvironmentDefinition } from "./index2.js";
16
+ import { useService } from "@wix/services-manager-react";
17
+ const root = "root__IB9QF";
18
+ const active = "active__lpoVO";
19
+ const label = "label__EtLji";
20
+ const hasTransitions = "hasTransitions__sv08Z";
21
+ const link = "link__0rDnC";
22
+ const icon = "icon__ZzsS5";
23
+ const button = "button__i8gkO";
24
+ const styles = {
25
+ root,
26
+ active,
27
+ label,
28
+ hasTransitions,
29
+ link,
30
+ icon,
31
+ button
32
+ };
33
+ const AnimatedButtonIcon = forwardRef(
34
+ ({ svg, duration, className }, ref) => /* @__PURE__ */ jsx(
35
+ AnimatedIconWithReducedMotion,
36
+ {
37
+ id: "animated-icon",
38
+ duration,
39
+ svg,
40
+ className: clsx("animated-icon", styles.icon, className),
41
+ ref
42
+ }
43
+ )
44
+ );
45
+ function useIconAnimation(isDisabled) {
46
+ const iconAnimatedRef = useRef(null);
47
+ const onAnimationForward = useCallback(() => {
48
+ var _a;
49
+ !isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationForward());
50
+ }, [isDisabled]);
51
+ const onAnimationBackward = useCallback(() => {
52
+ var _a;
53
+ !isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationBackward());
54
+ }, [isDisabled]);
55
+ return { iconAnimatedRef, onAnimationForward, onAnimationBackward };
56
+ }
57
+ function useButtonInteractionState(iconAnimationTriggers, onAnimationForward, onAnimationBackward, propsOnMouseEnter, propsOnMouseLeave) {
58
+ const [active2, setActive] = useState(false);
59
+ const animationTimeoutRef = useRef(
60
+ null
61
+ );
62
+ const isForwardRef = useRef(false);
63
+ const hasHoverTrigger = iconAnimationTriggers.includes(
64
+ IconAnimationTriggers.HOVER
65
+ );
66
+ const hasClickTrigger = iconAnimationTriggers.includes(
67
+ IconAnimationTriggers.CLICK
68
+ );
69
+ useEffect(() => {
70
+ isForwardRef.current = false;
71
+ }, [hasClickTrigger, hasHoverTrigger]);
72
+ useEffect(() => {
73
+ return () => {
74
+ if (animationTimeoutRef.current) {
75
+ clearTimeout(animationTimeoutRef.current);
76
+ }
77
+ };
78
+ }, []);
79
+ const onMouseEnter = useCallback(
80
+ (event) => {
81
+ if (animationTimeoutRef.current) {
82
+ clearTimeout(animationTimeoutRef.current);
83
+ animationTimeoutRef.current = null;
84
+ }
85
+ setActive(true);
86
+ if (hasHoverTrigger) {
87
+ onAnimationForward();
88
+ }
89
+ propsOnMouseEnter == null ? void 0 : propsOnMouseEnter(event);
90
+ },
91
+ [hasHoverTrigger, onAnimationForward, propsOnMouseEnter]
92
+ );
93
+ const onMouseLeave = useCallback(
94
+ (event) => {
95
+ animationTimeoutRef.current = setTimeout(() => {
96
+ setActive(false);
97
+ }, TRANSITION_DURATION);
98
+ if (hasHoverTrigger) {
99
+ onAnimationBackward();
100
+ }
101
+ propsOnMouseLeave == null ? void 0 : propsOnMouseLeave(event);
102
+ },
103
+ [hasHoverTrigger, onAnimationBackward, propsOnMouseLeave]
104
+ );
105
+ const onIconAnimationClick = useCallback(() => {
106
+ if (!hasClickTrigger) {
107
+ return;
108
+ }
109
+ if (isForwardRef.current) {
110
+ onAnimationBackward();
111
+ } else {
112
+ onAnimationForward();
113
+ }
114
+ isForwardRef.current = !isForwardRef.current;
115
+ }, [hasClickTrigger, onAnimationBackward, onAnimationForward]);
116
+ return {
117
+ active: active2,
118
+ onMouseEnter,
119
+ onMouseLeave,
120
+ onIconAnimationClick: hasClickTrigger ? onIconAnimationClick : void 0
121
+ };
122
+ }
123
+ const useAnalyticsReportClicks = ({
124
+ reportBiOnClick,
125
+ onClick: propsOnClick
126
+ }) => {
127
+ return useCallback(
128
+ (event) => {
129
+ reportBiOnClick == null ? void 0 : reportBiOnClick(event);
130
+ propsOnClick == null ? void 0 : propsOnClick(event);
131
+ },
132
+ [reportBiOnClick, propsOnClick]
133
+ );
134
+ };
135
+ function useButtonEventHandlers({
136
+ isDisabled,
137
+ link: link2,
138
+ propsOnClick,
139
+ preventLinkNavigation,
140
+ reportBiOnClick,
141
+ onMouseEnter,
142
+ onMouseLeave,
143
+ onIconAnimationClick,
144
+ onDblClick,
145
+ onFocus,
146
+ onBlur
147
+ }) {
148
+ const isLink = isValidLink(link2);
149
+ const shouldPreventLinkNavigation = preventLinkNavigation && isLink;
150
+ const shouldHaveOnClick = !isDisabled && propsOnClick || shouldPreventLinkNavigation;
151
+ const onClick = useAnalyticsReportClicks({
152
+ reportBiOnClick,
153
+ onClick: shouldHaveOnClick || onIconAnimationClick ? (event) => {
154
+ onIconAnimationClick == null ? void 0 : onIconAnimationClick(event);
155
+ if (shouldHaveOnClick) {
156
+ shouldPreventLinkNavigation && event.preventDefault();
157
+ !isDisabled && (propsOnClick == null ? void 0 : propsOnClick());
158
+ }
159
+ } : void 0
160
+ });
161
+ const eventHandlers = useMemo(
162
+ () => ({
163
+ onClick,
164
+ onMouseEnter,
165
+ onMouseLeave,
166
+ onKeyDown: isLink ? activateByEnterButton : activateBySpaceOrEnterButton,
167
+ onDoubleClick: !isDisabled && onDblClick ? onDblClick : void 0,
168
+ onFocus: !isDisabled && onFocus ? onFocus : void 0,
169
+ onBlur: !isDisabled && onBlur ? onBlur : void 0
170
+ }),
171
+ [
172
+ onClick,
173
+ onMouseEnter,
174
+ onMouseLeave,
175
+ isLink,
176
+ isDisabled,
177
+ onDblClick,
178
+ onFocus,
179
+ onBlur
180
+ ]
181
+ );
182
+ return { isLink, eventHandlers };
183
+ }
184
+ function useButtonA11y({
185
+ propsA11y,
186
+ ariaAttributes,
187
+ lang
188
+ }) {
189
+ const normalizedA11y = useMemo(() => {
190
+ const {
191
+ lang: manifestLang,
192
+ tabIndex: manifestTabindex,
193
+ ...manifestAriaAttributes
194
+ } = propsA11y ?? {};
195
+ return {
196
+ lang: manifestLang,
197
+ tabIndex: manifestTabindex,
198
+ ariaAttributes: removeAriaPrefix(manifestAriaAttributes)
199
+ };
200
+ }, [propsA11y]);
201
+ const a11yAttr = useMemo(
202
+ () => {
203
+ var _a;
204
+ return getAccessibilityAttributesSpread({
205
+ ariaAttributes: {
206
+ ...ariaAttributes,
207
+ ...normalizedA11y.ariaAttributes,
208
+ label: (ariaAttributes == null ? void 0 : ariaAttributes.label) ?? normalizedA11y.ariaAttributes.label
209
+ },
210
+ tabIndex: normalizedA11y.tabIndex,
211
+ lang: ((lang == null ? void 0 : lang.trim()) ?? ((_a = normalizedA11y.lang) == null ? void 0 : _a.trim())) || void 0
212
+ });
213
+ },
214
+ [normalizedA11y, ariaAttributes, lang]
215
+ );
216
+ return a11yAttr;
217
+ }
218
+ const BusinessLoggerDefinition = defineStaticService("@wix/site-service-business-logger");
219
+ const ConfigurationDefinition = defineService("@wix/site-service-configuration");
220
+ const CLICK_ANALYTICS_SRC = 76;
221
+ const CLICK_ANALYTICS_EVID = 1113;
222
+ const CLICK_ANALYTICS_ENDPOINT = "pa";
223
+ const ClickAnalyticsGroups = {
224
+ Button: "Button"
225
+ };
226
+ const buildClickAnalyticsEvent = ({
227
+ link: link2,
228
+ details,
229
+ elementId,
230
+ elementType,
231
+ elementGroup,
232
+ elementTitle,
233
+ language
234
+ }) => ({
235
+ src: CLICK_ANALYTICS_SRC,
236
+ evid: CLICK_ANALYTICS_EVID,
237
+ bl: navigator.language,
238
+ url: window.location.href,
239
+ element_id: elementId,
240
+ elementType,
241
+ elementGroup,
242
+ elementTitle,
243
+ language,
244
+ value: link2 == null ? void 0 : link2.href,
245
+ details: details ? JSON.stringify(details) : void 0
246
+ });
247
+ const useClickAnalyticsReporter = (params) => {
248
+ var _a;
249
+ const businessLogger = useService(
250
+ BusinessLoggerDefinition
251
+ );
252
+ const environment = useService(EnvironmentDefinition);
253
+ const configuration = useService(
254
+ ConfigurationDefinition
255
+ );
256
+ const isPreview = (_a = environment == null ? void 0 : environment.getPreviewMode) == null ? void 0 : _a.call(environment);
257
+ const reportBi = businessLogger == null ? void 0 : businessLogger.reportBi;
258
+ const language = params.language ?? (environment == null ? void 0 : environment.language);
259
+ const trackClicksAnalytics = configuration == null ? void 0 : configuration.trackClicksAnalytics;
260
+ const isEnabled = !isPreview && trackClicksAnalytics && typeof reportBi === "function";
261
+ const paramsRef = useRef(params);
262
+ paramsRef.current = params;
263
+ return useMemo(() => {
264
+ if (!isEnabled) {
265
+ return void 0;
266
+ }
267
+ return (event) => {
268
+ const { elementId, ...restParams } = paramsRef.current;
269
+ try {
270
+ void Promise.resolve(
271
+ reportBi(
272
+ buildClickAnalyticsEvent({
273
+ ...restParams,
274
+ language,
275
+ elementId: elementId || event.currentTarget.id
276
+ }),
277
+ { endpoint: CLICK_ANALYTICS_ENDPOINT }
278
+ )
279
+ ).catch(() => {
280
+ });
281
+ } catch {
282
+ }
283
+ };
284
+ }, [isEnabled, reportBi, language]);
285
+ };
286
+ const Button = (props) => {
287
+ var _a;
288
+ const {
289
+ id,
290
+ link: link2,
291
+ type = "button",
292
+ label: label2 = "",
293
+ labelContent,
294
+ disabled: isDisabled = false,
295
+ onClick: propsOnClick,
296
+ className,
297
+ corvid,
298
+ a11y: propsA11y,
299
+ direction,
300
+ elementProps,
301
+ compPreviewState,
302
+ isQaMode,
303
+ fullNameCompType,
304
+ lang,
305
+ ariaAttributes,
306
+ onDblClick,
307
+ onFocus,
308
+ onBlur,
309
+ reportBiOnClick,
310
+ preventLinkNavigation,
311
+ onMouseEnter,
312
+ onMouseLeave,
313
+ onMouseIn,
314
+ onMouseOut,
315
+ wix,
316
+ hasTransitions: hasTransitions2 = true
317
+ } = props;
318
+ const propsOnMouseEnter = useCallback(
319
+ (event) => {
320
+ onMouseIn == null ? void 0 : onMouseIn(event);
321
+ onMouseEnter == null ? void 0 : onMouseEnter(event);
322
+ },
323
+ [onMouseIn, onMouseEnter]
324
+ );
325
+ const propsOnMouseLeave = useCallback(
326
+ (event) => {
327
+ onMouseOut == null ? void 0 : onMouseOut(event);
328
+ onMouseLeave == null ? void 0 : onMouseLeave(event);
329
+ },
330
+ [onMouseOut, onMouseLeave]
331
+ );
332
+ const presetsWrapperProps = (wix == null ? void 0 : wix.presetsWrapperProps) || {};
333
+ const animatedIconProps = elementProps == null ? void 0 : elementProps.animatedIcon;
334
+ const corvidIconAnimationTriggers = (corvid == null ? void 0 : corvid.iconAnimationTriggers) ?? [];
335
+ const defaultTrigger = (animatedIconProps == null ? void 0 : animatedIconProps.trigger) === IconAnimationTriggers.CLICK ? IconAnimationTriggers.CLICK : IconAnimationTriggers.HOVER;
336
+ const iconAnimationTriggers = corvidIconAnimationTriggers.length > 0 ? corvidIconAnimationTriggers : [defaultTrigger];
337
+ const { iconAnimatedRef, onAnimationForward, onAnimationBackward } = useIconAnimation(isDisabled);
338
+ const {
339
+ active: active2,
340
+ onMouseEnter: handleMouseEnter,
341
+ onMouseLeave: handleMouseLeave,
342
+ onIconAnimationClick
343
+ } = useButtonInteractionState(
344
+ iconAnimationTriggers,
345
+ onAnimationForward,
346
+ onAnimationBackward,
347
+ propsOnMouseEnter,
348
+ propsOnMouseLeave
349
+ );
350
+ const buttonOrLinkRef = useRef(null);
351
+ const semanticClassNames = SEMANTIC_CLASS_NAMES;
352
+ const rootClassName = clsx(
353
+ styles.root,
354
+ className,
355
+ styles.button,
356
+ "button",
357
+ !direction && directionStyles.fallbackDirection,
358
+ formatClassNames(semanticClassNames.root),
359
+ {
360
+ disabled: isDisabled,
361
+ [DesignStates.root.disabled.className]: isDisabled,
362
+ [styles.active]: active2,
363
+ [styles.hasTransitions]: hasTransitions2
364
+ }
365
+ );
366
+ const labelClassName = clsx(
367
+ "label",
368
+ styles.label,
369
+ formatClassNames(semanticClassNames.buttonLabel),
370
+ (_a = elementProps == null ? void 0 : elementProps.label) == null ? void 0 : _a.className,
371
+ isDisabled && DesignStates.label.disabled.className
372
+ );
373
+ const linkClassName = styles.link;
374
+ const reportClickAnalytics = useClickAnalyticsReporter({
375
+ link: link2,
376
+ elementId: id,
377
+ elementType: COMPONENT_TYPE,
378
+ elementGroup: ClickAnalyticsGroups.Button,
379
+ elementTitle: label2,
380
+ details: { isDisabled }
381
+ });
382
+ const { isLink, eventHandlers } = useButtonEventHandlers({
383
+ isDisabled,
384
+ link: link2,
385
+ propsOnClick,
386
+ preventLinkNavigation,
387
+ reportBiOnClick: reportBiOnClick ?? reportClickAnalytics,
388
+ onMouseEnter: handleMouseEnter,
389
+ onMouseLeave: handleMouseLeave,
390
+ onIconAnimationClick,
391
+ onDblClick,
392
+ onFocus,
393
+ onBlur
394
+ });
395
+ const a11yAttr = useButtonA11y({ propsA11y, ariaAttributes, lang });
396
+ const renderedLabel = labelContent ?? label2;
397
+ const wrapperAttributes = {
398
+ id,
399
+ ...getDataAttributes(props),
400
+ ...getQaDataAttributes(isQaMode, fullNameCompType),
401
+ "data-semantic-classname": semanticClassNames.root,
402
+ ...direction && { dir: direction }
403
+ };
404
+ const renderButtonContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
405
+ renderedLabel && /* @__PURE__ */ jsx("span", { className: labelClassName, "data-testid": TestIds.buttonLabel, children: renderedLabel }),
406
+ /* @__PURE__ */ jsx(
407
+ AnimatedButtonIcon,
408
+ {
409
+ ref: iconAnimatedRef,
410
+ svg: animatedIconProps == null ? void 0 : animatedIconProps.svg,
411
+ duration: animatedIconProps == null ? void 0 : animatedIconProps.duration,
412
+ className: animatedIconProps == null ? void 0 : animatedIconProps.className
413
+ }
414
+ )
415
+ ] });
416
+ const renderButton = () => /* @__PURE__ */ jsx(
417
+ "button",
418
+ {
419
+ type,
420
+ disabled: isDisabled,
421
+ className: rootClassName,
422
+ "data-testid": TestIds.buttonContent,
423
+ ...wrapperAttributes,
424
+ ...a11yAttr,
425
+ ...eventHandlers,
426
+ ref: buttonOrLinkRef,
427
+ "data-preview": compPreviewState,
428
+ children: renderButtonContent()
429
+ }
430
+ );
431
+ const renderLinkedButton = () => {
432
+ const linkHref = isDisabled ? void 0 : link2.href;
433
+ const linkRel = link2.rel;
434
+ const linkTarget = link2.target;
435
+ const linkPopupId = link2.linkPopupId;
436
+ const anchorDataId = link2.anchorDataId;
437
+ const anchorCompId = link2.anchorCompId;
438
+ return /* @__PURE__ */ jsx(
439
+ "a",
440
+ {
441
+ href: linkHref,
442
+ rel: linkRel,
443
+ target: linkTarget,
444
+ "data-popupid": linkPopupId,
445
+ "data-anchor": anchorDataId,
446
+ "data-anchor-comp-id": anchorCompId,
447
+ className: clsx(linkClassName, rootClassName),
448
+ "data-testid": TestIds.buttonContent,
449
+ ...wrapperAttributes,
450
+ ...a11yAttr,
451
+ ...eventHandlers,
452
+ role: a11yAttr.role,
453
+ tabIndex: a11yAttr.tabIndex,
454
+ ref: buttonOrLinkRef,
455
+ "data-preview": compPreviewState,
456
+ children: renderButtonContent()
457
+ }
458
+ );
459
+ };
460
+ const renderDisabledLinkAsButton = () => /* @__PURE__ */ jsx(
461
+ "button",
462
+ {
463
+ type,
464
+ disabled: isDisabled,
465
+ className: clsx(rootClassName),
466
+ "data-testid": TestIds.buttonContent,
467
+ ...wrapperAttributes,
468
+ ...a11yAttr,
469
+ ...eventHandlers,
470
+ role: "link",
471
+ ref: buttonOrLinkRef,
472
+ "data-preview": compPreviewState,
473
+ children: renderButtonContent()
474
+ }
475
+ );
476
+ const renderContent = () => {
477
+ if (isDisabled && isLink) {
478
+ return renderDisabledLinkAsButton();
479
+ }
480
+ return isLink ? renderLinkedButton() : renderButton();
481
+ };
482
+ return /* @__PURE__ */ jsx("div", { className: presetWrapperStyles.presetWrapper, ...presetsWrapperProps, children: renderContent() });
483
+ };
484
+ export {
485
+ Button as B
486
+ };