@wix/editor-react-components 1.2345.0 → 1.2347.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.
- package/dist/site/components/AnimatedIcon/types.d.ts +1 -1
- package/dist/site/components/AudioPlayer/component.js +3 -4
- package/dist/site/components/Breadcrumbs/component.js +1 -1
- package/dist/site/components/Button/component.js +1 -1
- package/dist/site/components/Checkbox/css.css +4 -4
- package/dist/site/components/CheckboxGroup/css.css +4 -4
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/DatePicker/DatePicker.types.d.ts +6 -1
- package/dist/site/components/DatePicker/component.js +61 -11
- package/dist/site/components/DatePicker/components/DatePickerLabel.d.ts +2 -1
- package/dist/site/components/DatePicker/constants.d.ts +8 -0
- package/dist/site/components/DatePicker/css.css +13 -0
- package/dist/site/components/DatePicker/hooks/useDatePickerValue.d.ts +1 -1
- package/dist/site/components/DatePicker/manifest.js +12 -1
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Menu/Menu.types.d.ts +1 -33
- package/dist/site/components/Menu/component.js +8 -160
- package/dist/site/components/Menu/constants.d.ts +0 -18
- package/dist/site/components/Menu/css.css +21 -34
- package/dist/site/components/Menu/manifest.js +4 -68
- package/dist/site/components/Menu/manifestConfigs/itemConfig.d.ts +1 -4
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalHugNavbarConfig.d.ts +0 -2
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalScrollNavbarConfig.d.ts +0 -2
- package/dist/site/components/Menu/manifestConfigs/overrides/verticalNavbarConfig.d.ts +1 -3
- package/dist/site/components/Slideshow/component.js +1 -1
- package/dist/site/components/TextInput/TextInput.types.d.ts +3 -1
- package/dist/site/components/TextInput/component.js +86 -19
- package/dist/site/components/TextInput/constants.d.ts +13 -0
- package/dist/site/components/TextInput/css.css +47 -4
- package/dist/site/components/TextInput/manifest.js +8 -1
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +7 -1
- package/dist/site/components/TimePicker/component.js +61 -11
- package/dist/site/components/TimePicker/constants.d.ts +7 -0
- package/dist/site/components/TimePicker/css.css +13 -0
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +1 -1
- package/dist/site/components/TimePicker/manifest.js +8 -1
- package/dist/site/components/chunks/Button.js +347 -1057
- package/dist/site/components/chunks/{Tooltip.js → DateField.js} +52 -1018
- package/dist/site/components/chunks/Group.js +970 -46
- package/dist/site/components/chunks/NumberFormatter.js +140 -0
- package/dist/site/components/chunks/VisuallyHidden.js +1 -1
- package/dist/site/components/chunks/constants2.js +9 -2
- package/dist/site/components/chunks/constants26.js +4 -23
- package/dist/site/components/chunks/constants3.js +10 -1
- package/dist/site/components/chunks/constants33.js +10 -2
- package/dist/site/components/chunks/filterDOMProps.js +139 -18
- package/dist/site/components/chunks/manifest2.js +73 -0
- package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
- package/dist/site/components/chunks/useValidatedField.js +1411 -0
- package/package.json +2 -2
- package/dist/site/components/Menu/components/MenuContent/MenuItem/useIconAnimation.d.ts +0 -17
- package/dist/site/components/Menu/manifestConfigs/animatedIconConfig.d.ts +0 -2
- package/dist/site/components/chunks/Button2.js +0 -365
- package/dist/site/components/chunks/I18nProvider.js +0 -125
- package/dist/site/components/chunks/Input.js +0 -341
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2347.0",
|
|
4
4
|
"description": "React components for the Wix Editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -199,5 +199,5 @@
|
|
|
199
199
|
"registry": "https://registry.npmjs.org/",
|
|
200
200
|
"access": "public"
|
|
201
201
|
},
|
|
202
|
-
"falconPackageHash": "
|
|
202
|
+
"falconPackageHash": "da47f7a892d684020ed2bc122b653607fc518a2d33af8b46aa75fa9a"
|
|
203
203
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { default as React, RefObject } from 'react';
|
|
2
|
-
import { AnimatedSvgRef } from '../../../../AnimatedIcon/types';
|
|
3
|
-
import { BuilderAnimationIconComponent } from '../../../Menu.types';
|
|
4
|
-
type UseIconAnimationOptions = {
|
|
5
|
-
BuilderAnimationIcon: BuilderAnimationIconComponent | undefined;
|
|
6
|
-
isCurrentPage: boolean;
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
onMouseEnter?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
9
|
-
onMouseLeave?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
10
|
-
};
|
|
11
|
-
type UseIconAnimationResult = {
|
|
12
|
-
iconAnimatedRef: RefObject<AnimatedSvgRef>;
|
|
13
|
-
handleMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
14
|
-
handleMouseLeave: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
15
|
-
};
|
|
16
|
-
export declare function useIconAnimation({ BuilderAnimationIcon, isCurrentPage, isOpen, onMouseEnter, onMouseLeave, }: UseIconAnimationOptions): UseIconAnimationResult;
|
|
17
|
-
export {};
|
|
@@ -1,365 +0,0 @@
|
|
|
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, S as SEMANTIC_CLASS_NAMES, a as TestIds } from "./constants20.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
|
-
const root = "root__IB9QF";
|
|
14
|
-
const active = "active__lpoVO";
|
|
15
|
-
const label = "label__EtLji";
|
|
16
|
-
const link = "link__0rDnC";
|
|
17
|
-
const icon = "icon__ZzsS5";
|
|
18
|
-
const button = "button__i8gkO";
|
|
19
|
-
const styles = {
|
|
20
|
-
root,
|
|
21
|
-
active,
|
|
22
|
-
label,
|
|
23
|
-
link,
|
|
24
|
-
icon,
|
|
25
|
-
button
|
|
26
|
-
};
|
|
27
|
-
const AnimatedButtonIcon = forwardRef(
|
|
28
|
-
({ svg, duration }, ref) => /* @__PURE__ */ jsx(
|
|
29
|
-
AnimatedIconWithReducedMotion,
|
|
30
|
-
{
|
|
31
|
-
id: "animated-icon",
|
|
32
|
-
duration,
|
|
33
|
-
svg,
|
|
34
|
-
className: clsx("animated-icon", styles.icon),
|
|
35
|
-
ref
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
function useIconAnimation(isDisabled) {
|
|
40
|
-
const iconAnimatedRef = useRef(null);
|
|
41
|
-
const onAnimationForward = useCallback(() => {
|
|
42
|
-
var _a;
|
|
43
|
-
!isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationForward());
|
|
44
|
-
}, [isDisabled]);
|
|
45
|
-
const onAnimationBackward = useCallback(() => {
|
|
46
|
-
var _a;
|
|
47
|
-
!isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationBackward());
|
|
48
|
-
}, [isDisabled]);
|
|
49
|
-
return { iconAnimatedRef, onAnimationForward, onAnimationBackward };
|
|
50
|
-
}
|
|
51
|
-
function useButtonInteractionState(iconAnimationTriggers, onAnimationForward, onAnimationBackward, propsOnMouseEnter, propsOnMouseLeave) {
|
|
52
|
-
const [active2, setActive] = useState(false);
|
|
53
|
-
const animationTimeoutRef = useRef(
|
|
54
|
-
null
|
|
55
|
-
);
|
|
56
|
-
const isForwardRef = useRef(false);
|
|
57
|
-
const hasHoverTrigger = iconAnimationTriggers.includes(
|
|
58
|
-
IconAnimationTriggers.HOVER
|
|
59
|
-
);
|
|
60
|
-
const hasClickTrigger = iconAnimationTriggers.includes(
|
|
61
|
-
IconAnimationTriggers.CLICK
|
|
62
|
-
);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
isForwardRef.current = false;
|
|
65
|
-
}, [hasClickTrigger, hasHoverTrigger]);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
return () => {
|
|
68
|
-
if (animationTimeoutRef.current) {
|
|
69
|
-
clearTimeout(animationTimeoutRef.current);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}, []);
|
|
73
|
-
const onMouseEnter = useCallback(
|
|
74
|
-
(event) => {
|
|
75
|
-
if (animationTimeoutRef.current) {
|
|
76
|
-
clearTimeout(animationTimeoutRef.current);
|
|
77
|
-
animationTimeoutRef.current = null;
|
|
78
|
-
}
|
|
79
|
-
setActive(true);
|
|
80
|
-
if (hasHoverTrigger) {
|
|
81
|
-
onAnimationForward();
|
|
82
|
-
}
|
|
83
|
-
propsOnMouseEnter == null ? void 0 : propsOnMouseEnter(event);
|
|
84
|
-
},
|
|
85
|
-
[hasHoverTrigger, onAnimationForward, propsOnMouseEnter]
|
|
86
|
-
);
|
|
87
|
-
const onMouseLeave = useCallback(
|
|
88
|
-
(event) => {
|
|
89
|
-
animationTimeoutRef.current = setTimeout(() => {
|
|
90
|
-
setActive(false);
|
|
91
|
-
}, TRANSITION_DURATION);
|
|
92
|
-
if (hasHoverTrigger) {
|
|
93
|
-
onAnimationBackward();
|
|
94
|
-
}
|
|
95
|
-
propsOnMouseLeave == null ? void 0 : propsOnMouseLeave(event);
|
|
96
|
-
},
|
|
97
|
-
[hasHoverTrigger, onAnimationBackward, propsOnMouseLeave]
|
|
98
|
-
);
|
|
99
|
-
const onIconAnimationClick = useCallback(() => {
|
|
100
|
-
if (!hasClickTrigger) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (isForwardRef.current) {
|
|
104
|
-
onAnimationBackward();
|
|
105
|
-
} else {
|
|
106
|
-
onAnimationForward();
|
|
107
|
-
}
|
|
108
|
-
isForwardRef.current = !isForwardRef.current;
|
|
109
|
-
}, [hasClickTrigger, onAnimationBackward, onAnimationForward]);
|
|
110
|
-
return {
|
|
111
|
-
active: active2,
|
|
112
|
-
onMouseEnter,
|
|
113
|
-
onMouseLeave,
|
|
114
|
-
onIconAnimationClick: hasClickTrigger ? onIconAnimationClick : void 0
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
const useAnalyticsReportClicks = ({
|
|
118
|
-
reportBiOnClick,
|
|
119
|
-
onClick: propsOnClick
|
|
120
|
-
}) => {
|
|
121
|
-
return useCallback(
|
|
122
|
-
(event) => {
|
|
123
|
-
reportBiOnClick == null ? void 0 : reportBiOnClick(event);
|
|
124
|
-
propsOnClick == null ? void 0 : propsOnClick(event);
|
|
125
|
-
},
|
|
126
|
-
[reportBiOnClick, propsOnClick]
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
function useButtonEventHandlers({
|
|
130
|
-
isDisabled,
|
|
131
|
-
link: link2,
|
|
132
|
-
propsOnClick,
|
|
133
|
-
preventLinkNavigation,
|
|
134
|
-
reportBiOnClick,
|
|
135
|
-
onMouseEnter,
|
|
136
|
-
onMouseLeave,
|
|
137
|
-
onIconAnimationClick,
|
|
138
|
-
onDblClick,
|
|
139
|
-
onFocus,
|
|
140
|
-
onBlur
|
|
141
|
-
}) {
|
|
142
|
-
const isLink = isValidLink(link2);
|
|
143
|
-
const shouldPreventLinkNavigation = preventLinkNavigation && isLink;
|
|
144
|
-
const shouldHaveOnClick = !isDisabled && propsOnClick || shouldPreventLinkNavigation;
|
|
145
|
-
const onClick = useAnalyticsReportClicks({
|
|
146
|
-
reportBiOnClick,
|
|
147
|
-
onClick: shouldHaveOnClick || onIconAnimationClick ? (event) => {
|
|
148
|
-
onIconAnimationClick == null ? void 0 : onIconAnimationClick(event);
|
|
149
|
-
if (shouldHaveOnClick) {
|
|
150
|
-
shouldPreventLinkNavigation && event.preventDefault();
|
|
151
|
-
!isDisabled && (propsOnClick == null ? void 0 : propsOnClick());
|
|
152
|
-
}
|
|
153
|
-
} : void 0
|
|
154
|
-
});
|
|
155
|
-
const eventHandlers = useMemo(
|
|
156
|
-
() => ({
|
|
157
|
-
onClick,
|
|
158
|
-
onMouseEnter,
|
|
159
|
-
onMouseLeave,
|
|
160
|
-
onKeyDown: isLink ? activateByEnterButton : activateBySpaceOrEnterButton,
|
|
161
|
-
onDoubleClick: !isDisabled && onDblClick ? onDblClick : void 0,
|
|
162
|
-
onFocus: !isDisabled && onFocus ? onFocus : void 0,
|
|
163
|
-
onBlur: !isDisabled && onBlur ? onBlur : void 0
|
|
164
|
-
}),
|
|
165
|
-
[
|
|
166
|
-
onClick,
|
|
167
|
-
onMouseEnter,
|
|
168
|
-
onMouseLeave,
|
|
169
|
-
isLink,
|
|
170
|
-
isDisabled,
|
|
171
|
-
onDblClick,
|
|
172
|
-
onFocus,
|
|
173
|
-
onBlur
|
|
174
|
-
]
|
|
175
|
-
);
|
|
176
|
-
return { isLink, eventHandlers };
|
|
177
|
-
}
|
|
178
|
-
function useButtonA11y({
|
|
179
|
-
propsA11y,
|
|
180
|
-
ariaAttributes,
|
|
181
|
-
label: label2
|
|
182
|
-
}) {
|
|
183
|
-
const normalizedA11y = useMemo(
|
|
184
|
-
() => removeAriaPrefix(propsA11y ?? {}),
|
|
185
|
-
[propsA11y]
|
|
186
|
-
);
|
|
187
|
-
const a11yAttr = useMemo(
|
|
188
|
-
() => getAccessibilityAttributesSpread({
|
|
189
|
-
ariaAttributes: {
|
|
190
|
-
...ariaAttributes,
|
|
191
|
-
...normalizedA11y,
|
|
192
|
-
label: (ariaAttributes == null ? void 0 : ariaAttributes.label) ?? (normalizedA11y.label || label2)
|
|
193
|
-
},
|
|
194
|
-
tabindex: normalizedA11y == null ? void 0 : normalizedA11y.tabindex
|
|
195
|
-
}),
|
|
196
|
-
[normalizedA11y, label2, ariaAttributes]
|
|
197
|
-
);
|
|
198
|
-
return a11yAttr;
|
|
199
|
-
}
|
|
200
|
-
const Button = (props) => {
|
|
201
|
-
const {
|
|
202
|
-
id,
|
|
203
|
-
link: link2,
|
|
204
|
-
type = "button",
|
|
205
|
-
label: label2 = "",
|
|
206
|
-
labelContent,
|
|
207
|
-
disabled: isDisabled = false,
|
|
208
|
-
onClick: propsOnClick,
|
|
209
|
-
className,
|
|
210
|
-
corvid,
|
|
211
|
-
a11y: propsA11y,
|
|
212
|
-
direction,
|
|
213
|
-
elementProps,
|
|
214
|
-
compPreviewState,
|
|
215
|
-
isQaMode,
|
|
216
|
-
fullNameCompType,
|
|
217
|
-
lang,
|
|
218
|
-
ariaAttributes,
|
|
219
|
-
onDblClick,
|
|
220
|
-
onFocus,
|
|
221
|
-
onBlur,
|
|
222
|
-
reportBiOnClick,
|
|
223
|
-
preventLinkNavigation,
|
|
224
|
-
onMouseEnter: propsOnMouseEnter,
|
|
225
|
-
onMouseLeave: propsOnMouseLeave,
|
|
226
|
-
wix
|
|
227
|
-
} = props;
|
|
228
|
-
const presetsWrapperProps = (wix == null ? void 0 : wix.presetsWrapperProps) || {};
|
|
229
|
-
const animatedIconProps = elementProps == null ? void 0 : elementProps.animatedIcon;
|
|
230
|
-
const corvidIconAnimationTriggers = (corvid == null ? void 0 : corvid.iconAnimationTriggers) ?? [];
|
|
231
|
-
const defaultTrigger = (animatedIconProps == null ? void 0 : animatedIconProps.trigger) === IconAnimationTriggers.CLICK ? IconAnimationTriggers.CLICK : IconAnimationTriggers.HOVER;
|
|
232
|
-
const iconAnimationTriggers = corvidIconAnimationTriggers.length > 0 ? corvidIconAnimationTriggers : [defaultTrigger];
|
|
233
|
-
const { iconAnimatedRef, onAnimationForward, onAnimationBackward } = useIconAnimation(isDisabled);
|
|
234
|
-
const { active: active2, onMouseEnter, onMouseLeave, onIconAnimationClick } = useButtonInteractionState(
|
|
235
|
-
iconAnimationTriggers,
|
|
236
|
-
onAnimationForward,
|
|
237
|
-
onAnimationBackward,
|
|
238
|
-
propsOnMouseEnter,
|
|
239
|
-
propsOnMouseLeave
|
|
240
|
-
);
|
|
241
|
-
const buttonOrLinkRef = useRef(null);
|
|
242
|
-
const semanticClassNames = SEMANTIC_CLASS_NAMES;
|
|
243
|
-
const rootClassName = clsx(
|
|
244
|
-
styles.root,
|
|
245
|
-
className,
|
|
246
|
-
styles.button,
|
|
247
|
-
"button",
|
|
248
|
-
!direction && directionStyles.fallbackDirection,
|
|
249
|
-
formatClassNames(semanticClassNames.root),
|
|
250
|
-
{
|
|
251
|
-
disabled: isDisabled,
|
|
252
|
-
[styles.active]: active2
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
const labelClassName = clsx(
|
|
256
|
-
"label",
|
|
257
|
-
styles.label,
|
|
258
|
-
formatClassNames(semanticClassNames.buttonLabel)
|
|
259
|
-
);
|
|
260
|
-
const linkClassName = styles.link;
|
|
261
|
-
const { isLink, eventHandlers } = useButtonEventHandlers({
|
|
262
|
-
isDisabled,
|
|
263
|
-
link: link2,
|
|
264
|
-
propsOnClick,
|
|
265
|
-
preventLinkNavigation,
|
|
266
|
-
reportBiOnClick,
|
|
267
|
-
onMouseEnter,
|
|
268
|
-
onMouseLeave,
|
|
269
|
-
onIconAnimationClick,
|
|
270
|
-
onDblClick,
|
|
271
|
-
onFocus,
|
|
272
|
-
onBlur
|
|
273
|
-
});
|
|
274
|
-
const a11yAttr = useButtonA11y({ propsA11y, ariaAttributes, label: label2 });
|
|
275
|
-
const renderedLabel = labelContent ?? label2;
|
|
276
|
-
const wrapperAttributes = {
|
|
277
|
-
id,
|
|
278
|
-
...getDataAttributes(props),
|
|
279
|
-
...getQaDataAttributes(isQaMode, fullNameCompType),
|
|
280
|
-
"data-semantic-classname": semanticClassNames.root,
|
|
281
|
-
lang,
|
|
282
|
-
...direction && { dir: direction }
|
|
283
|
-
};
|
|
284
|
-
const renderButtonContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
|
-
renderedLabel && /* @__PURE__ */ jsx("span", { className: labelClassName, "data-testid": TestIds.buttonLabel, children: renderedLabel }),
|
|
286
|
-
/* @__PURE__ */ jsx(
|
|
287
|
-
AnimatedButtonIcon,
|
|
288
|
-
{
|
|
289
|
-
ref: iconAnimatedRef,
|
|
290
|
-
svg: animatedIconProps == null ? void 0 : animatedIconProps.svg,
|
|
291
|
-
duration: animatedIconProps == null ? void 0 : animatedIconProps.duration
|
|
292
|
-
}
|
|
293
|
-
)
|
|
294
|
-
] });
|
|
295
|
-
const renderButton = () => /* @__PURE__ */ jsx(
|
|
296
|
-
"button",
|
|
297
|
-
{
|
|
298
|
-
type,
|
|
299
|
-
disabled: isDisabled,
|
|
300
|
-
className: rootClassName,
|
|
301
|
-
"data-testid": TestIds.buttonContent,
|
|
302
|
-
...wrapperAttributes,
|
|
303
|
-
...a11yAttr,
|
|
304
|
-
...eventHandlers,
|
|
305
|
-
ref: buttonOrLinkRef,
|
|
306
|
-
"data-preview": compPreviewState,
|
|
307
|
-
children: renderButtonContent()
|
|
308
|
-
}
|
|
309
|
-
);
|
|
310
|
-
const renderLinkedButton = () => {
|
|
311
|
-
const linkHref = isDisabled ? void 0 : link2.href;
|
|
312
|
-
const linkRel = link2.rel;
|
|
313
|
-
const linkTarget = link2.target;
|
|
314
|
-
const linkPopupId = link2.linkPopupId;
|
|
315
|
-
const anchorDataId = link2.anchorDataId;
|
|
316
|
-
const anchorCompId = link2.anchorCompId;
|
|
317
|
-
return /* @__PURE__ */ jsx(
|
|
318
|
-
"a",
|
|
319
|
-
{
|
|
320
|
-
href: linkHref,
|
|
321
|
-
rel: linkRel,
|
|
322
|
-
target: linkTarget,
|
|
323
|
-
"data-popupid": linkPopupId,
|
|
324
|
-
"data-anchor": anchorDataId,
|
|
325
|
-
"data-anchor-comp-id": anchorCompId,
|
|
326
|
-
className: clsx(linkClassName, rootClassName),
|
|
327
|
-
"data-testid": TestIds.buttonContent,
|
|
328
|
-
...wrapperAttributes,
|
|
329
|
-
...a11yAttr,
|
|
330
|
-
...eventHandlers,
|
|
331
|
-
role: a11yAttr.role,
|
|
332
|
-
tabIndex: a11yAttr.tabIndex,
|
|
333
|
-
ref: buttonOrLinkRef,
|
|
334
|
-
"data-preview": compPreviewState,
|
|
335
|
-
children: renderButtonContent()
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
};
|
|
339
|
-
const renderDisabledLinkAsButton = () => /* @__PURE__ */ jsx(
|
|
340
|
-
"button",
|
|
341
|
-
{
|
|
342
|
-
type,
|
|
343
|
-
disabled: isDisabled,
|
|
344
|
-
className: clsx(rootClassName),
|
|
345
|
-
"data-testid": TestIds.buttonContent,
|
|
346
|
-
...wrapperAttributes,
|
|
347
|
-
...a11yAttr,
|
|
348
|
-
...eventHandlers,
|
|
349
|
-
role: "link",
|
|
350
|
-
ref: buttonOrLinkRef,
|
|
351
|
-
"data-preview": compPreviewState,
|
|
352
|
-
children: renderButtonContent()
|
|
353
|
-
}
|
|
354
|
-
);
|
|
355
|
-
const renderContent = () => {
|
|
356
|
-
if (isDisabled && isLink) {
|
|
357
|
-
return renderDisabledLinkAsButton();
|
|
358
|
-
}
|
|
359
|
-
return isLink ? renderLinkedButton() : renderButton();
|
|
360
|
-
};
|
|
361
|
-
return /* @__PURE__ */ jsx("div", { className: presetWrapperStyles.presetWrapper, ...presetsWrapperProps, children: renderContent() });
|
|
362
|
-
};
|
|
363
|
-
export {
|
|
364
|
-
Button as B
|
|
365
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { j as $c7eafbbe1ea5834e$export$535bd6ca7f90a273 } from "./filterDOMProps.js";
|
|
2
|
-
import React__default, { useState, useEffect, useContext } from "react";
|
|
3
|
-
const $d805ff57cab8bee2$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
|
|
4
|
-
"Arab",
|
|
5
|
-
"Syrc",
|
|
6
|
-
"Samr",
|
|
7
|
-
"Mand",
|
|
8
|
-
"Thaa",
|
|
9
|
-
"Mend",
|
|
10
|
-
"Nkoo",
|
|
11
|
-
"Adlm",
|
|
12
|
-
"Rohg",
|
|
13
|
-
"Hebr"
|
|
14
|
-
]);
|
|
15
|
-
const $d805ff57cab8bee2$var$RTL_LANGS = /* @__PURE__ */ new Set([
|
|
16
|
-
"ae",
|
|
17
|
-
"ar",
|
|
18
|
-
"arc",
|
|
19
|
-
"bcc",
|
|
20
|
-
"bqi",
|
|
21
|
-
"ckb",
|
|
22
|
-
"dv",
|
|
23
|
-
"fa",
|
|
24
|
-
"glk",
|
|
25
|
-
"he",
|
|
26
|
-
"ku",
|
|
27
|
-
"mzn",
|
|
28
|
-
"nqo",
|
|
29
|
-
"pnb",
|
|
30
|
-
"ps",
|
|
31
|
-
"sd",
|
|
32
|
-
"ug",
|
|
33
|
-
"ur",
|
|
34
|
-
"yi"
|
|
35
|
-
]);
|
|
36
|
-
function $d805ff57cab8bee2$export$702d680b21cbd764(localeString) {
|
|
37
|
-
if (Intl.Locale) {
|
|
38
|
-
let locale = new Intl.Locale(localeString).maximize();
|
|
39
|
-
let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
|
|
40
|
-
if (textInfo) return textInfo.direction === "rtl";
|
|
41
|
-
if (locale.script) return $d805ff57cab8bee2$var$RTL_SCRIPTS.has(locale.script);
|
|
42
|
-
}
|
|
43
|
-
let lang = localeString.split("-")[0];
|
|
44
|
-
return $d805ff57cab8bee2$var$RTL_LANGS.has(lang);
|
|
45
|
-
}
|
|
46
|
-
const $520a025cdb0d710d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
|
|
47
|
-
function $520a025cdb0d710d$export$f09106e7c6677ec5() {
|
|
48
|
-
let locale = typeof window !== "undefined" && window[$520a025cdb0d710d$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
49
|
-
try {
|
|
50
|
-
Intl.DateTimeFormat.supportedLocalesOf([
|
|
51
|
-
locale
|
|
52
|
-
]);
|
|
53
|
-
} catch {
|
|
54
|
-
locale = "en-US";
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
locale,
|
|
58
|
-
direction: $d805ff57cab8bee2$export$702d680b21cbd764(locale) ? "rtl" : "ltr"
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
let $520a025cdb0d710d$var$currentLocale = $520a025cdb0d710d$export$f09106e7c6677ec5();
|
|
62
|
-
let $520a025cdb0d710d$var$listeners = /* @__PURE__ */ new Set();
|
|
63
|
-
function $520a025cdb0d710d$var$updateLocale() {
|
|
64
|
-
$520a025cdb0d710d$var$currentLocale = $520a025cdb0d710d$export$f09106e7c6677ec5();
|
|
65
|
-
for (let listener of $520a025cdb0d710d$var$listeners) listener($520a025cdb0d710d$var$currentLocale);
|
|
66
|
-
}
|
|
67
|
-
function $520a025cdb0d710d$export$188ec29ebc2bdc3a() {
|
|
68
|
-
let isSSR = $c7eafbbe1ea5834e$export$535bd6ca7f90a273();
|
|
69
|
-
let [defaultLocale, setDefaultLocale] = useState($520a025cdb0d710d$var$currentLocale);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if ($520a025cdb0d710d$var$listeners.size === 0) window.addEventListener("languagechange", $520a025cdb0d710d$var$updateLocale);
|
|
72
|
-
$520a025cdb0d710d$var$listeners.add(setDefaultLocale);
|
|
73
|
-
return () => {
|
|
74
|
-
$520a025cdb0d710d$var$listeners.delete(setDefaultLocale);
|
|
75
|
-
if ($520a025cdb0d710d$var$listeners.size === 0) window.removeEventListener("languagechange", $520a025cdb0d710d$var$updateLocale);
|
|
76
|
-
};
|
|
77
|
-
}, []);
|
|
78
|
-
if (isSSR) {
|
|
79
|
-
let locale = typeof window !== "undefined" && window[$520a025cdb0d710d$var$localeSymbol];
|
|
80
|
-
return {
|
|
81
|
-
locale: locale || "en-US",
|
|
82
|
-
direction: "ltr"
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return defaultLocale;
|
|
86
|
-
}
|
|
87
|
-
const $2eb8e6d23f3d0cb0$var$I18nContext = /* @__PURE__ */ React__default.createContext(null);
|
|
88
|
-
function $2eb8e6d23f3d0cb0$var$I18nProviderWithLocale(props) {
|
|
89
|
-
let { locale, children } = props;
|
|
90
|
-
let value = React__default.useMemo(() => ({
|
|
91
|
-
locale,
|
|
92
|
-
direction: $d805ff57cab8bee2$export$702d680b21cbd764(locale) ? "rtl" : "ltr"
|
|
93
|
-
}), [
|
|
94
|
-
locale
|
|
95
|
-
]);
|
|
96
|
-
return /* @__PURE__ */ React__default.createElement($2eb8e6d23f3d0cb0$var$I18nContext.Provider, {
|
|
97
|
-
value
|
|
98
|
-
}, children);
|
|
99
|
-
}
|
|
100
|
-
function $2eb8e6d23f3d0cb0$var$I18nProviderWithDefaultLocale(props) {
|
|
101
|
-
let { children } = props;
|
|
102
|
-
let defaultLocale = $520a025cdb0d710d$export$188ec29ebc2bdc3a();
|
|
103
|
-
return /* @__PURE__ */ React__default.createElement($2eb8e6d23f3d0cb0$var$I18nContext.Provider, {
|
|
104
|
-
value: defaultLocale
|
|
105
|
-
}, children);
|
|
106
|
-
}
|
|
107
|
-
function $2eb8e6d23f3d0cb0$export$a54013f0d02a8f82(props) {
|
|
108
|
-
let { locale, children } = props;
|
|
109
|
-
if (locale) return /* @__PURE__ */ React__default.createElement($2eb8e6d23f3d0cb0$var$I18nProviderWithLocale, {
|
|
110
|
-
locale,
|
|
111
|
-
children
|
|
112
|
-
});
|
|
113
|
-
return /* @__PURE__ */ React__default.createElement($2eb8e6d23f3d0cb0$var$I18nProviderWithDefaultLocale, {
|
|
114
|
-
children
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7() {
|
|
118
|
-
let defaultLocale = $520a025cdb0d710d$export$188ec29ebc2bdc3a();
|
|
119
|
-
let context = useContext($2eb8e6d23f3d0cb0$var$I18nContext);
|
|
120
|
-
return context || defaultLocale;
|
|
121
|
-
}
|
|
122
|
-
export {
|
|
123
|
-
$2eb8e6d23f3d0cb0$export$a54013f0d02a8f82 as $,
|
|
124
|
-
$2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7 as a
|
|
125
|
-
};
|