@wix/editor-react-components 1.2344.0 → 1.2346.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 (43) hide show
  1. package/dist/site/components/AudioPlayer/component.js +3 -4
  2. package/dist/site/components/Breadcrumbs/component.js +1 -1
  3. package/dist/site/components/Button/component.js +1 -1
  4. package/dist/site/components/Checkbox/css.css +4 -4
  5. package/dist/site/components/CheckboxGroup/css.css +4 -4
  6. package/dist/site/components/CollapsibleText/component.js +1 -1
  7. package/dist/site/components/DatePicker/DatePicker.types.d.ts +6 -1
  8. package/dist/site/components/DatePicker/component.js +61 -11
  9. package/dist/site/components/DatePicker/components/DatePickerLabel.d.ts +2 -1
  10. package/dist/site/components/DatePicker/constants.d.ts +8 -0
  11. package/dist/site/components/DatePicker/css.css +13 -0
  12. package/dist/site/components/DatePicker/hooks/useDatePickerValue.d.ts +1 -1
  13. package/dist/site/components/DatePicker/manifest.js +12 -1
  14. package/dist/site/components/Lottie/component.js +1 -1
  15. package/dist/site/components/Menu/component.js +1 -1
  16. package/dist/site/components/Slideshow/component.js +1 -1
  17. package/dist/site/components/TextInput/TextInput.types.d.ts +3 -1
  18. package/dist/site/components/TextInput/component.js +86 -19
  19. package/dist/site/components/TextInput/constants.d.ts +13 -0
  20. package/dist/site/components/TextInput/css.css +47 -4
  21. package/dist/site/components/TextInput/manifest.js +8 -1
  22. package/dist/site/components/TimePicker/TimePicker.types.d.ts +7 -1
  23. package/dist/site/components/TimePicker/component.js +61 -11
  24. package/dist/site/components/TimePicker/constants.d.ts +7 -0
  25. package/dist/site/components/TimePicker/css.css +13 -0
  26. package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +1 -1
  27. package/dist/site/components/TimePicker/manifest.js +8 -1
  28. package/dist/site/components/chunks/Button.js +347 -1057
  29. package/dist/site/components/chunks/{Tooltip.js → DateField.js} +52 -1018
  30. package/dist/site/components/chunks/Group.js +970 -46
  31. package/dist/site/components/chunks/NumberFormatter.js +140 -0
  32. package/dist/site/components/chunks/VisuallyHidden.js +1 -1
  33. package/dist/site/components/chunks/constants2.js +9 -2
  34. package/dist/site/components/chunks/constants3.js +10 -1
  35. package/dist/site/components/chunks/constants33.js +10 -2
  36. package/dist/site/components/chunks/filterDOMProps.js +139 -18
  37. package/dist/site/components/chunks/manifest2.js +73 -0
  38. package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
  39. package/dist/site/components/chunks/useValidatedField.js +1411 -0
  40. package/package.json +5 -5
  41. package/dist/site/components/chunks/Button2.js +0 -365
  42. package/dist/site/components/chunks/I18nProvider.js +0 -125
  43. package/dist/site/components/chunks/Input.js +0 -341
@@ -1,341 +0,0 @@
1
- import { H as $c4867b2f328c2698$export$e5c5a5f917a5871c, n as $fe16bffc7a557bf0$export$7f54fc3180508a52, R as $8f5a2122b0992be3$export$8397ddfc504fdb9a, f as $23f2114a1b82827e$export$e58f029f0fbfdb29, S as $0beb20c9744a2065$export$8467354a121f1b9f, T as $390e54f620492c70$export$b4cc09c592e8fdb8, e as $bbaa08b3cd72f041$export$9d1611c77c2fe928, A as $e969f22b6713ca4a$export$ae780daf29e6d456, z as $0c4a58759813079a$export$4e328f61c538687f } from "./Group.js";
2
- import React__default, { useRef, useEffect, useMemo, useContext, useState, createContext, forwardRef } from "react";
3
- import { b as $64fa3d84918910a7$export$29f1550f4b0d4415, a as $f39a9eba43920ace$export$86427a43e3e48ebb, f as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "./filterDOMProps.js";
4
- function $860f7da480e22816$export$b8473d3665f3a75a(props, state, ref) {
5
- let { validationBehavior, focus } = props;
6
- $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
7
- if (validationBehavior === "native" && (ref == null ? void 0 : ref.current) && !ref.current.disabled) {
8
- let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
9
- ref.current.setCustomValidity(errorMessage);
10
- if (!ref.current.hasAttribute("title")) ref.current.title = "";
11
- if (!state.realtimeValidation.isInvalid) state.updateValidation($860f7da480e22816$var$getNativeValidity(ref.current));
12
- }
13
- });
14
- let isIgnoredReset = useRef(false);
15
- let onReset = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
16
- if (!isIgnoredReset.current) state.resetValidation();
17
- });
18
- let onInvalid = $fe16bffc7a557bf0$export$7f54fc3180508a52((e) => {
19
- var _a, _b;
20
- if (!state.displayValidation.isInvalid) state.commitValidation();
21
- let form = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.form;
22
- if (!e.defaultPrevented && ref && form && $860f7da480e22816$var$getFirstInvalidInput(form) === ref.current) {
23
- if (focus) focus();
24
- else (_b = ref.current) == null ? void 0 : _b.focus();
25
- $8f5a2122b0992be3$export$8397ddfc504fdb9a("keyboard");
26
- }
27
- e.preventDefault();
28
- });
29
- let onChange = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
30
- state.commitValidation();
31
- });
32
- useEffect(() => {
33
- let input = ref == null ? void 0 : ref.current;
34
- if (!input) return;
35
- let form = input.form;
36
- let reset = form == null ? void 0 : form.reset;
37
- if (form)
38
- form.reset = () => {
39
- isIgnoredReset.current = !window.event || window.event.type === "message" && $23f2114a1b82827e$export$e58f029f0fbfdb29(window.event) instanceof MessagePort;
40
- reset == null ? void 0 : reset.call(form);
41
- isIgnoredReset.current = false;
42
- };
43
- input.addEventListener("invalid", onInvalid);
44
- input.addEventListener("change", onChange);
45
- form == null ? void 0 : form.addEventListener("reset", onReset);
46
- return () => {
47
- input.removeEventListener("invalid", onInvalid);
48
- input.removeEventListener("change", onChange);
49
- form == null ? void 0 : form.removeEventListener("reset", onReset);
50
- if (form)
51
- form.reset = reset;
52
- };
53
- }, [
54
- ref,
55
- validationBehavior
56
- ]);
57
- }
58
- function $860f7da480e22816$var$getValidity(input) {
59
- let validity = input.validity;
60
- return {
61
- badInput: validity.badInput,
62
- customError: validity.customError,
63
- patternMismatch: validity.patternMismatch,
64
- rangeOverflow: validity.rangeOverflow,
65
- rangeUnderflow: validity.rangeUnderflow,
66
- stepMismatch: validity.stepMismatch,
67
- tooLong: validity.tooLong,
68
- tooShort: validity.tooShort,
69
- typeMismatch: validity.typeMismatch,
70
- valueMissing: validity.valueMissing,
71
- valid: validity.valid
72
- };
73
- }
74
- function $860f7da480e22816$var$getNativeValidity(input) {
75
- return {
76
- isInvalid: !input.validity.valid,
77
- validationDetails: $860f7da480e22816$var$getValidity(input),
78
- validationErrors: input.validationMessage ? [
79
- input.validationMessage
80
- ] : []
81
- };
82
- }
83
- function $860f7da480e22816$var$getFirstInvalidInput(form) {
84
- var _a;
85
- for (let i = 0; i < form.elements.length; i++) {
86
- let element = form.elements[i];
87
- if (((_a = element.validity) == null ? void 0 : _a.valid) === false) return element;
88
- }
89
- return null;
90
- }
91
- const $fd2148440a13ec26$export$aca958c65c314e6c = {
92
- badInput: false,
93
- customError: false,
94
- patternMismatch: false,
95
- rangeOverflow: false,
96
- rangeUnderflow: false,
97
- stepMismatch: false,
98
- tooLong: false,
99
- tooShort: false,
100
- typeMismatch: false,
101
- valueMissing: false,
102
- valid: true
103
- };
104
- const $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
105
- ...$fd2148440a13ec26$export$aca958c65c314e6c,
106
- customError: true,
107
- valid: false
108
- };
109
- const $fd2148440a13ec26$export$dad6ae84456c676a = {
110
- isInvalid: false,
111
- validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
112
- validationErrors: []
113
- };
114
- const $fd2148440a13ec26$export$571b5131b7e65c11 = createContext({});
115
- const $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
116
- function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
117
- if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
118
- let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
119
- return {
120
- realtimeValidation,
121
- displayValidation,
122
- updateValidation,
123
- resetValidation,
124
- commitValidation
125
- };
126
- }
127
- return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
128
- }
129
- function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
130
- let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
131
- if (validationState) isInvalid || (isInvalid = validationState === "invalid");
132
- let controlledError = isInvalid !== void 0 ? {
133
- isInvalid,
134
- validationErrors: [],
135
- validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
136
- } : null;
137
- let clientError = useMemo(() => {
138
- if (!validate || value == null) return null;
139
- let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
140
- return $fd2148440a13ec26$var$getValidationResult(validateErrors);
141
- }, [
142
- validate,
143
- value
144
- ]);
145
- if (builtinValidation == null ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = void 0;
146
- let serverErrors = useContext($fd2148440a13ec26$export$571b5131b7e65c11);
147
- let serverErrorMessages = useMemo(() => {
148
- if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
149
- return [];
150
- }, [
151
- serverErrors,
152
- name
153
- ]);
154
- let [lastServerErrors, setLastServerErrors] = useState(serverErrors);
155
- let [isServerErrorCleared, setServerErrorCleared] = useState(false);
156
- if (serverErrors !== lastServerErrors) {
157
- setLastServerErrors(serverErrors);
158
- setServerErrorCleared(false);
159
- }
160
- let serverError = useMemo(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
161
- isServerErrorCleared,
162
- serverErrorMessages
163
- ]);
164
- let nextValidation = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
165
- let [currentValidity, setCurrentValidity] = useState($fd2148440a13ec26$export$dad6ae84456c676a);
166
- let lastError = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
167
- let commitValidation = () => {
168
- if (!commitQueued) return;
169
- setCommitQueued(false);
170
- let error = clientError || builtinValidation || nextValidation.current;
171
- if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
172
- lastError.current = error;
173
- setCurrentValidity(error);
174
- }
175
- };
176
- let [commitQueued, setCommitQueued] = useState(false);
177
- useEffect(commitValidation);
178
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
179
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
180
- return {
181
- realtimeValidation,
182
- displayValidation,
183
- updateValidation(value2) {
184
- if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
185
- else nextValidation.current = value2;
186
- },
187
- resetValidation() {
188
- let error = $fd2148440a13ec26$export$dad6ae84456c676a;
189
- if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
190
- lastError.current = error;
191
- setCurrentValidity(error);
192
- }
193
- if (validationBehavior === "native") setCommitQueued(false);
194
- setServerErrorCleared(true);
195
- },
196
- commitValidation() {
197
- if (validationBehavior === "native") setCommitQueued(true);
198
- setServerErrorCleared(true);
199
- }
200
- };
201
- }
202
- function $fd2148440a13ec26$var$asArray(v) {
203
- if (!v) return [];
204
- return Array.isArray(v) ? v : [
205
- v
206
- ];
207
- }
208
- function $fd2148440a13ec26$var$runValidate(validate, value) {
209
- if (typeof validate === "function") {
210
- let e = validate(value);
211
- if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
212
- }
213
- return [];
214
- }
215
- function $fd2148440a13ec26$var$getValidationResult(errors) {
216
- return errors.length ? {
217
- isInvalid: true,
218
- validationErrors: errors,
219
- validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
220
- } : null;
221
- }
222
- function $fd2148440a13ec26$var$isEqualValidation(a, b) {
223
- if (a === b) return true;
224
- return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
225
- }
226
- function $fd2148440a13ec26$export$75ee7c75d68f5b0e(...results) {
227
- let errors = /* @__PURE__ */ new Set();
228
- let isInvalid = false;
229
- let validationDetails = {
230
- ...$fd2148440a13ec26$export$aca958c65c314e6c
231
- };
232
- for (let v of results) {
233
- for (let e of v.validationErrors) errors.add(e);
234
- isInvalid || (isInvalid = v.isInvalid);
235
- for (let key in validationDetails) validationDetails[key] || (validationDetails[key] = v.validationDetails[key]);
236
- }
237
- validationDetails.valid = !isInvalid;
238
- return {
239
- isInvalid,
240
- validationErrors: [
241
- ...errors
242
- ],
243
- validationDetails
244
- };
245
- }
246
- function $191c9b6d48a0a4e2$export$294aa081a6c6f55d(props) {
247
- let { description, errorMessage, isInvalid, validationState } = props;
248
- let { labelProps, fieldProps } = $0beb20c9744a2065$export$8467354a121f1b9f(props);
249
- let descriptionId = $390e54f620492c70$export$b4cc09c592e8fdb8([
250
- Boolean(description),
251
- Boolean(errorMessage),
252
- isInvalid,
253
- validationState
254
- ]);
255
- let errorMessageId = $390e54f620492c70$export$b4cc09c592e8fdb8([
256
- Boolean(description),
257
- Boolean(errorMessage),
258
- isInvalid,
259
- validationState
260
- ]);
261
- fieldProps = $bbaa08b3cd72f041$export$9d1611c77c2fe928(fieldProps, {
262
- "aria-describedby": [
263
- descriptionId,
264
- // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
265
- errorMessageId,
266
- props["aria-describedby"]
267
- ].filter(Boolean).join(" ") || void 0
268
- });
269
- return {
270
- labelProps,
271
- fieldProps,
272
- descriptionProps: {
273
- id: descriptionId
274
- },
275
- errorMessageProps: {
276
- id: errorMessageId
277
- }
278
- };
279
- }
280
- const $514c0188e459b4c0$export$9afb8bc826b033ea = /* @__PURE__ */ createContext({});
281
- const $514c0188e459b4c0$export$5f1af8db9871e1d6 = /* @__PURE__ */ forwardRef(function Text(props, ref) {
282
- [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $514c0188e459b4c0$export$9afb8bc826b033ea);
283
- let { elementType: ElementType = "span", ...domProps } = props;
284
- return /* @__PURE__ */ React__default.createElement(ElementType, {
285
- className: "react-aria-Text",
286
- ...domProps,
287
- ref
288
- });
289
- });
290
- const $ee014567cb39d3f0$export$ff05c3ac10437e03 = /* @__PURE__ */ createContext(null);
291
- const $d3e0e05bdfcf66bd$export$c24727297075ec6a = /* @__PURE__ */ createContext(null);
292
- const $3985021b0ad6602f$export$37fb8590cf2c088c = /* @__PURE__ */ createContext({});
293
- let $3985021b0ad6602f$var$filterHoverProps = (props) => {
294
- let { onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
295
- return otherProps;
296
- };
297
- const $3985021b0ad6602f$export$f5b8910cec6cf069 = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function Input(props, ref) {
298
- [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $3985021b0ad6602f$export$37fb8590cf2c088c);
299
- let { hoverProps, isHovered } = $e969f22b6713ca4a$export$ae780daf29e6d456(props);
300
- let { isFocused, isFocusVisible, focusProps } = $0c4a58759813079a$export$4e328f61c538687f({
301
- isTextInput: true,
302
- autoFocus: props.autoFocus
303
- });
304
- let isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
305
- let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
306
- ...props,
307
- values: {
308
- isHovered,
309
- isFocused,
310
- isFocusVisible,
311
- isDisabled: props.disabled || false,
312
- isInvalid
313
- },
314
- defaultClassName: "react-aria-Input"
315
- });
316
- return /* @__PURE__ */ React__default.createElement("input", {
317
- ...$bbaa08b3cd72f041$export$9d1611c77c2fe928($3985021b0ad6602f$var$filterHoverProps(props), focusProps, hoverProps),
318
- ...renderProps,
319
- ref,
320
- "data-focused": isFocused || void 0,
321
- "data-disabled": props.disabled || void 0,
322
- "data-hovered": isHovered || void 0,
323
- "data-focus-visible": isFocusVisible || void 0,
324
- "data-invalid": isInvalid || void 0
325
- });
326
- });
327
- export {
328
- $514c0188e459b4c0$export$5f1af8db9871e1d6 as $,
329
- $fd2148440a13ec26$export$fc1a364ae1f3ff10 as a,
330
- $191c9b6d48a0a4e2$export$294aa081a6c6f55d as b,
331
- $860f7da480e22816$export$b8473d3665f3a75a as c,
332
- $d3e0e05bdfcf66bd$export$c24727297075ec6a as d,
333
- $3985021b0ad6602f$export$37fb8590cf2c088c as e,
334
- $514c0188e459b4c0$export$9afb8bc826b033ea as f,
335
- $ee014567cb39d3f0$export$ff05c3ac10437e03 as g,
336
- $3985021b0ad6602f$export$f5b8910cec6cf069 as h,
337
- $fd2148440a13ec26$export$75ee7c75d68f5b0e as i,
338
- $fd2148440a13ec26$export$aca958c65c314e6c as j,
339
- $fd2148440a13ec26$export$a763b9476acd3eb as k,
340
- $fd2148440a13ec26$export$dad6ae84456c676a as l
341
- };