@wix/editor-react-components 1.2288.0 → 1.2289.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 (45) hide show
  1. package/dist/site/components/AccordionComponent/component.js +1 -1
  2. package/dist/site/components/AccordionComponent/manifest.js +1 -1
  3. package/dist/site/components/AudioPlayer/component.js +5 -1105
  4. package/dist/site/components/AudioPlayer/manifest.js +1 -1
  5. package/dist/site/components/Breadcrumbs/component.js +3 -117
  6. package/dist/site/components/Breadcrumbs/manifest.js +1 -1
  7. package/dist/site/components/CollapsibleText/component.js +1 -1
  8. package/dist/site/components/CollapsibleText/manifest.js +1 -1
  9. package/dist/site/components/DatePicker/DatePicker.d.ts +3 -0
  10. package/dist/site/components/DatePicker/DatePicker.types.d.ts +91 -0
  11. package/dist/site/components/DatePicker/component.d.ts +2 -0
  12. package/dist/site/components/DatePicker/component.js +12181 -0
  13. package/dist/site/components/DatePicker/component.preview.d.ts +2 -0
  14. package/dist/site/components/DatePicker/components/DatePickerCalendar.d.ts +5 -0
  15. package/dist/site/components/DatePicker/components/DatePickerField.d.ts +6 -0
  16. package/dist/site/components/DatePicker/components/DatePickerLabel.d.ts +6 -0
  17. package/dist/site/components/DatePicker/components/DatePickerTooltip.d.ts +5 -0
  18. package/dist/site/components/DatePicker/constants.d.ts +177 -0
  19. package/dist/site/components/DatePicker/css.css +349 -0
  20. package/dist/site/components/DatePicker/datePickerUtils.d.ts +26 -0
  21. package/dist/site/components/DatePicker/hooks/useDateConstraints.d.ts +12 -0
  22. package/dist/site/components/DatePicker/hooks/useDatePickerValue.d.ts +15 -0
  23. package/dist/site/components/DatePicker/hooks/useUnavailableDates.d.ts +3 -0
  24. package/dist/site/components/DatePicker/index.d.ts +2 -0
  25. package/dist/site/components/DatePicker/index.js +6 -0
  26. package/dist/site/components/DatePicker/manifest.d.ts +5 -0
  27. package/dist/site/components/DatePicker/manifest.js +370 -0
  28. package/dist/site/components/Dropdown/component.js +1 -3
  29. package/dist/site/components/TextBox/component.js +1 -4
  30. package/dist/site/components/TextInput/component.js +4 -297
  31. package/dist/site/components/chunks/Button2.js +1118 -0
  32. package/dist/site/components/chunks/DismissSmall.js +7 -0
  33. package/dist/site/components/chunks/Group.js +108 -36
  34. package/dist/site/components/chunks/I18nProvider.js +32 -2
  35. package/dist/site/components/chunks/InfoCircleSmall.js +7 -0
  36. package/dist/site/components/chunks/Input.js +341 -0
  37. package/dist/site/components/chunks/constants32.js +152 -49
  38. package/dist/site/components/chunks/constants33.js +53 -71
  39. package/dist/site/components/chunks/constants34.js +73 -77
  40. package/dist/site/components/chunks/constants35.js +76 -57
  41. package/dist/site/components/chunks/constants36.js +72 -0
  42. package/dist/site/components/chunks/filterDOMProps.js +14 -8
  43. package/dist/site/components/chunks/useLocalizedStringFormatter.js +122 -0
  44. package/dist/site/components/extensions.js +53 -48
  45. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { Component, createElement, createContext, Suspense, useContext, useRef, useEffect, useMemo, useState, useCallback } from "react";
3
+ import React__default, { Component, createElement, createContext, Suspense, useContext, useState, useRef, useCallback } from "react";
4
4
  import { c as clsx } from "../chunks/clsx.js";
5
5
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
6
6
  import { b as getAccessibilityAttributes, H as HAS_CUSTOM_FOCUS_CLASSNAME } from "../chunks/a11y.js";
@@ -8,8 +8,9 @@ import { a as getDataAttributes } from "../chunks/dataUtils.js";
8
8
  import { s as selectors } from "../chunks/constants2.js";
9
9
  import { useService } from "@wix/services-manager-react";
10
10
  import { T as TranslationsDefinition } from "../chunks/index5.js";
11
- import { $ as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, a as $f39a9eba43920ace$export$86427a43e3e48ebb, b as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $64fa3d84918910a7$export$fabf2dc03a41866e, e as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, f as $64fa3d84918910a7$export$ef03459518577ad4, g as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, h as $64fa3d84918910a7$export$2881499e37b75b9a } from "../chunks/filterDOMProps.js";
12
- import { $ as $c4867b2f328c2698$export$e5c5a5f917a5871c, a as $fe16bffc7a557bf0$export$7f54fc3180508a52, b as $8f5a2122b0992be3$export$8397ddfc504fdb9a, c as $23f2114a1b82827e$export$e58f029f0fbfdb29, d as $0beb20c9744a2065$export$8467354a121f1b9f, e as $390e54f620492c70$export$b4cc09c592e8fdb8, f as $bbaa08b3cd72f041$export$9d1611c77c2fe928, g as $3e6197669829fe11$export$40bfa8c7b0832715, h as $d1116acdf220c2da$export$4c014de7c8940b4c, i as $3274bf1495747a7b$export$5add1d006293d136, j as $e969f22b6713ca4a$export$ae780daf29e6d456, k as $0c4a58759813079a$export$4e328f61c538687f, l as $01b77f81d0f07f68$export$75b6ee27786ba447, m as $a049562f99e7db0e$export$f9c6924e160136d1, n as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
11
+ import { $ as $fd2148440a13ec26$export$fc1a364ae1f3ff10, a as $191c9b6d48a0a4e2$export$294aa081a6c6f55d, b as $860f7da480e22816$export$b8473d3665f3a75a, c as $d3e0e05bdfcf66bd$export$c24727297075ec6a, d as $3985021b0ad6602f$export$37fb8590cf2c088c, e as $514c0188e459b4c0$export$9afb8bc826b033ea, f as $ee014567cb39d3f0$export$ff05c3ac10437e03, g as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../chunks/Input.js";
12
+ import { $ as $3e6197669829fe11$export$40bfa8c7b0832715, a as $d1116acdf220c2da$export$4c014de7c8940b4c, b as $3274bf1495747a7b$export$5add1d006293d136, c as $bbaa08b3cd72f041$export$9d1611c77c2fe928, d as $23f2114a1b82827e$export$e58f029f0fbfdb29, e as $01b77f81d0f07f68$export$75b6ee27786ba447, f as $a049562f99e7db0e$export$f9c6924e160136d1, g as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
13
+ import { $ as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, a as $f39a9eba43920ace$export$86427a43e3e48ebb, b as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$fabf2dc03a41866e, d as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, e as $64fa3d84918910a7$export$ef03459518577ad4, f as $64fa3d84918910a7$export$4d86445c2cf5e3, g as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, h as $64fa3d84918910a7$export$2881499e37b75b9a } from "../chunks/filterDOMProps.js";
13
14
  import { S as SdkStateDefinition } from "../chunks/index6.js";
14
15
  const ABORT_SIGNAL_TIMEOUT = 5e3;
15
16
  function createTimeoutSignal(timeout) {
@@ -395,262 +396,6 @@ const getPhoneFormatLengthValidationError = (phoneFormat, phoneFormatLengthValid
395
396
  `${phoneFormat ? phoneFormat.replace(/-/g, "").length : 0}`
396
397
  );
397
398
  const $8e6cc465cc68f603$export$698f465ec27e93df = /* @__PURE__ */ createContext(null);
398
- function $860f7da480e22816$export$b8473d3665f3a75a(props, state, ref) {
399
- let { validationBehavior, focus } = props;
400
- $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
401
- if (validationBehavior === "native" && (ref == null ? void 0 : ref.current) && !ref.current.disabled) {
402
- let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
403
- ref.current.setCustomValidity(errorMessage);
404
- if (!ref.current.hasAttribute("title")) ref.current.title = "";
405
- if (!state.realtimeValidation.isInvalid) state.updateValidation($860f7da480e22816$var$getNativeValidity(ref.current));
406
- }
407
- });
408
- let isIgnoredReset = useRef(false);
409
- let onReset = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
410
- if (!isIgnoredReset.current) state.resetValidation();
411
- });
412
- let onInvalid = $fe16bffc7a557bf0$export$7f54fc3180508a52((e) => {
413
- var _a, _b;
414
- if (!state.displayValidation.isInvalid) state.commitValidation();
415
- let form = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.form;
416
- if (!e.defaultPrevented && ref && form && $860f7da480e22816$var$getFirstInvalidInput(form) === ref.current) {
417
- if (focus) focus();
418
- else (_b = ref.current) == null ? void 0 : _b.focus();
419
- $8f5a2122b0992be3$export$8397ddfc504fdb9a("keyboard");
420
- }
421
- e.preventDefault();
422
- });
423
- let onChange = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
424
- state.commitValidation();
425
- });
426
- useEffect(() => {
427
- let input2 = ref == null ? void 0 : ref.current;
428
- if (!input2) return;
429
- let form = input2.form;
430
- let reset = form == null ? void 0 : form.reset;
431
- if (form)
432
- form.reset = () => {
433
- isIgnoredReset.current = !window.event || window.event.type === "message" && $23f2114a1b82827e$export$e58f029f0fbfdb29(window.event) instanceof MessagePort;
434
- reset == null ? void 0 : reset.call(form);
435
- isIgnoredReset.current = false;
436
- };
437
- input2.addEventListener("invalid", onInvalid);
438
- input2.addEventListener("change", onChange);
439
- form == null ? void 0 : form.addEventListener("reset", onReset);
440
- return () => {
441
- input2.removeEventListener("invalid", onInvalid);
442
- input2.removeEventListener("change", onChange);
443
- form == null ? void 0 : form.removeEventListener("reset", onReset);
444
- if (form)
445
- form.reset = reset;
446
- };
447
- }, [
448
- ref,
449
- validationBehavior
450
- ]);
451
- }
452
- function $860f7da480e22816$var$getValidity(input2) {
453
- let validity = input2.validity;
454
- return {
455
- badInput: validity.badInput,
456
- customError: validity.customError,
457
- patternMismatch: validity.patternMismatch,
458
- rangeOverflow: validity.rangeOverflow,
459
- rangeUnderflow: validity.rangeUnderflow,
460
- stepMismatch: validity.stepMismatch,
461
- tooLong: validity.tooLong,
462
- tooShort: validity.tooShort,
463
- typeMismatch: validity.typeMismatch,
464
- valueMissing: validity.valueMissing,
465
- valid: validity.valid
466
- };
467
- }
468
- function $860f7da480e22816$var$getNativeValidity(input2) {
469
- return {
470
- isInvalid: !input2.validity.valid,
471
- validationDetails: $860f7da480e22816$var$getValidity(input2),
472
- validationErrors: input2.validationMessage ? [
473
- input2.validationMessage
474
- ] : []
475
- };
476
- }
477
- function $860f7da480e22816$var$getFirstInvalidInput(form) {
478
- var _a;
479
- for (let i = 0; i < form.elements.length; i++) {
480
- let element = form.elements[i];
481
- if (((_a = element.validity) == null ? void 0 : _a.valid) === false) return element;
482
- }
483
- return null;
484
- }
485
- const $fd2148440a13ec26$export$aca958c65c314e6c = {
486
- badInput: false,
487
- customError: false,
488
- patternMismatch: false,
489
- rangeOverflow: false,
490
- rangeUnderflow: false,
491
- stepMismatch: false,
492
- tooLong: false,
493
- tooShort: false,
494
- typeMismatch: false,
495
- valueMissing: false,
496
- valid: true
497
- };
498
- const $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
499
- ...$fd2148440a13ec26$export$aca958c65c314e6c,
500
- customError: true,
501
- valid: false
502
- };
503
- const $fd2148440a13ec26$export$dad6ae84456c676a = {
504
- isInvalid: false,
505
- validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
506
- validationErrors: []
507
- };
508
- const $fd2148440a13ec26$export$571b5131b7e65c11 = createContext({});
509
- const $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
510
- function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
511
- if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
512
- let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
513
- return {
514
- realtimeValidation,
515
- displayValidation,
516
- updateValidation,
517
- resetValidation,
518
- commitValidation
519
- };
520
- }
521
- return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
522
- }
523
- function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
524
- let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
525
- if (validationState) isInvalid || (isInvalid = validationState === "invalid");
526
- let controlledError = isInvalid !== void 0 ? {
527
- isInvalid,
528
- validationErrors: [],
529
- validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
530
- } : null;
531
- let clientError = useMemo(() => {
532
- if (!validate || value == null) return null;
533
- let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
534
- return $fd2148440a13ec26$var$getValidationResult(validateErrors);
535
- }, [
536
- validate,
537
- value
538
- ]);
539
- if (builtinValidation == null ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = void 0;
540
- let serverErrors = useContext($fd2148440a13ec26$export$571b5131b7e65c11);
541
- let serverErrorMessages = useMemo(() => {
542
- if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
543
- return [];
544
- }, [
545
- serverErrors,
546
- name
547
- ]);
548
- let [lastServerErrors, setLastServerErrors] = useState(serverErrors);
549
- let [isServerErrorCleared, setServerErrorCleared] = useState(false);
550
- if (serverErrors !== lastServerErrors) {
551
- setLastServerErrors(serverErrors);
552
- setServerErrorCleared(false);
553
- }
554
- let serverError = useMemo(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
555
- isServerErrorCleared,
556
- serverErrorMessages
557
- ]);
558
- let nextValidation = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
559
- let [currentValidity, setCurrentValidity] = useState($fd2148440a13ec26$export$dad6ae84456c676a);
560
- let lastError = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
561
- let commitValidation = () => {
562
- if (!commitQueued) return;
563
- setCommitQueued(false);
564
- let error = clientError || builtinValidation || nextValidation.current;
565
- if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
566
- lastError.current = error;
567
- setCurrentValidity(error);
568
- }
569
- };
570
- let [commitQueued, setCommitQueued] = useState(false);
571
- useEffect(commitValidation);
572
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
573
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
574
- return {
575
- realtimeValidation,
576
- displayValidation,
577
- updateValidation(value2) {
578
- if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
579
- else nextValidation.current = value2;
580
- },
581
- resetValidation() {
582
- let error = $fd2148440a13ec26$export$dad6ae84456c676a;
583
- if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
584
- lastError.current = error;
585
- setCurrentValidity(error);
586
- }
587
- if (validationBehavior === "native") setCommitQueued(false);
588
- setServerErrorCleared(true);
589
- },
590
- commitValidation() {
591
- if (validationBehavior === "native") setCommitQueued(true);
592
- setServerErrorCleared(true);
593
- }
594
- };
595
- }
596
- function $fd2148440a13ec26$var$asArray(v) {
597
- if (!v) return [];
598
- return Array.isArray(v) ? v : [
599
- v
600
- ];
601
- }
602
- function $fd2148440a13ec26$var$runValidate(validate, value) {
603
- if (typeof validate === "function") {
604
- let e = validate(value);
605
- if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
606
- }
607
- return [];
608
- }
609
- function $fd2148440a13ec26$var$getValidationResult(errors) {
610
- return errors.length ? {
611
- isInvalid: true,
612
- validationErrors: errors,
613
- validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
614
- } : null;
615
- }
616
- function $fd2148440a13ec26$var$isEqualValidation(a, b) {
617
- if (a === b) return true;
618
- 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);
619
- }
620
- function $191c9b6d48a0a4e2$export$294aa081a6c6f55d(props) {
621
- let { description, errorMessage, isInvalid, validationState } = props;
622
- let { labelProps, fieldProps } = $0beb20c9744a2065$export$8467354a121f1b9f(props);
623
- let descriptionId = $390e54f620492c70$export$b4cc09c592e8fdb8([
624
- Boolean(description),
625
- Boolean(errorMessage),
626
- isInvalid,
627
- validationState
628
- ]);
629
- let errorMessageId = $390e54f620492c70$export$b4cc09c592e8fdb8([
630
- Boolean(description),
631
- Boolean(errorMessage),
632
- isInvalid,
633
- validationState
634
- ]);
635
- fieldProps = $bbaa08b3cd72f041$export$9d1611c77c2fe928(fieldProps, {
636
- "aria-describedby": [
637
- descriptionId,
638
- // 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
639
- errorMessageId,
640
- props["aria-describedby"]
641
- ].filter(Boolean).join(" ") || void 0
642
- });
643
- return {
644
- labelProps,
645
- fieldProps,
646
- descriptionProps: {
647
- id: descriptionId
648
- },
649
- errorMessageProps: {
650
- id: errorMessageId
651
- }
652
- };
653
- }
654
399
  function $054f71d2330da2e3$export$712718f7aec83d5(props, ref) {
655
400
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type = "text", validationBehavior = "aria" } = props;
656
401
  let [value, setValue] = $3e6197669829fe11$export$40bfa8c7b0832715(props.value, props.defaultValue || "", props.onChange);
@@ -724,44 +469,6 @@ function $054f71d2330da2e3$export$712718f7aec83d5(props, ref) {
724
469
  validationDetails
725
470
  };
726
471
  }
727
- const $514c0188e459b4c0$export$9afb8bc826b033ea = /* @__PURE__ */ createContext({});
728
- const $ee014567cb39d3f0$export$ff05c3ac10437e03 = /* @__PURE__ */ createContext(null);
729
- const $d3e0e05bdfcf66bd$export$c24727297075ec6a = /* @__PURE__ */ createContext(null);
730
- const $3985021b0ad6602f$export$37fb8590cf2c088c = /* @__PURE__ */ createContext({});
731
- let $3985021b0ad6602f$var$filterHoverProps = (props) => {
732
- let { onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
733
- return otherProps;
734
- };
735
- const $3985021b0ad6602f$export$f5b8910cec6cf069 = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function Input(props, ref) {
736
- [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $3985021b0ad6602f$export$37fb8590cf2c088c);
737
- let { hoverProps, isHovered } = $e969f22b6713ca4a$export$ae780daf29e6d456(props);
738
- let { isFocused, isFocusVisible, focusProps } = $0c4a58759813079a$export$4e328f61c538687f({
739
- isTextInput: true,
740
- autoFocus: props.autoFocus
741
- });
742
- let isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
743
- let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
744
- ...props,
745
- values: {
746
- isHovered,
747
- isFocused,
748
- isFocusVisible,
749
- isDisabled: props.disabled || false,
750
- isInvalid
751
- },
752
- defaultClassName: "react-aria-Input"
753
- });
754
- return /* @__PURE__ */ React__default.createElement("input", {
755
- ...$bbaa08b3cd72f041$export$9d1611c77c2fe928($3985021b0ad6602f$var$filterHoverProps(props), focusProps, hoverProps),
756
- ...renderProps,
757
- ref,
758
- "data-focused": isFocused || void 0,
759
- "data-disabled": props.disabled || void 0,
760
- "data-hovered": isHovered || void 0,
761
- "data-focus-visible": isFocusVisible || void 0,
762
- "data-invalid": isInvalid || void 0
763
- });
764
- });
765
472
  const $216918bed6669f72$export$2dc6166a7e65358c = /* @__PURE__ */ createContext({});
766
473
  const $bcdf0525bf22703d$export$2129e27b3ef0d483 = /* @__PURE__ */ createContext(null);
767
474
  const $bcdf0525bf22703d$export$2c73285ae9390cec = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function TextField(props, ref) {