@wix/form-public 0.507.0 → 0.509.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/index.cjs CHANGED
@@ -43031,12 +43031,9 @@ var ScrollProvider = ({ children }) => {
43031
43031
  if (element && scrollViewRef.current) {
43032
43032
  const { top } = element.getBoundingClientRect();
43033
43033
  if (top < 0 || top > window.innerHeight) {
43034
- const headerHeight = getSiteHeaderHeight(scrollViewRef.current);
43035
- const wixAdHeight = getWixAdHeight();
43036
- const newTop = top + window.scrollY - 20 - headerHeight - wixAdHeight;
43037
- window.scrollTo({
43038
- top: newTop,
43039
- behavior: "smooth"
43034
+ element.scrollIntoView({
43035
+ behavior: "smooth",
43036
+ block: "center"
43040
43037
  });
43041
43038
  }
43042
43039
  }
@@ -43055,18 +43052,6 @@ function useScroll() {
43055
43052
  }
43056
43053
  return context;
43057
43054
  }
43058
- function getSiteHeaderHeight(formElement) {
43059
- const classicHeader = document.querySelector("#SITE_HEADER");
43060
- const potentialHeader = formElement.closest("main")?.previousElementSibling;
43061
- const studioHeader = potentialHeader?.tagName === "HEADER" ? potentialHeader : void 0;
43062
- const header = classicHeader || studioHeader;
43063
- const headerPosition = header && window.getComputedStyle(header).position;
43064
- return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
43065
- }
43066
- function getWixAdHeight() {
43067
- const ad = document.querySelector("#WIX_ADS");
43068
- return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
43069
- }
43070
43055
 
43071
43056
  // ../form-fields/dist/esm/contexts/translation-context.js
43072
43057
  var TranslationContext = React172.createContext(void 0);
@@ -55367,19 +55352,12 @@ var useInvokeCallback = (callback) => {
55367
55352
  // ../form-fields/dist/esm/ui/events-repeater/events-repeater-headless.js
55368
55353
  var NO_ERRORS2 = [];
55369
55354
  var NO_VALUES = {};
55370
- var GuestCount = ({ children, className, groupClassName, ...internal }) => {
55355
+ var GuestCount = ({ children, ...internal }) => {
55371
55356
  const { guestLimit, guestCount, onGuestCountChange } = internal;
55372
- const { id: id6, label, disabled, readOnly, onBlur, onFocus } = useFieldPropsV2();
55373
- const { inputId, ariaDescribedBy } = useFieldAttributes();
55357
+ const { label, disabled, readOnly, onBlur, onFocus } = useFieldPropsV2();
55374
55358
  const invokeBlur = useInvokeCallback(onBlur);
55375
- const ref = React172.useRef(null);
55376
- useFocusFieldEvent(() => {
55377
- ref.current?.focus();
55378
- }, id6);
55379
- const decrementElement = findChildOfType(children, GuestCount.Decrement);
55380
- const incrementElement = findChildOfType(children, GuestCount.Increment);
55359
+ const controlElement = findChildOfType(children, GuestCount.Control);
55381
55360
  return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.NumberField, {
55382
- className: groupClassName,
55383
55361
  "aria-label": label,
55384
55362
  value: guestCount,
55385
55363
  onChange: onGuestCountChange,
@@ -55390,13 +55368,33 @@ var GuestCount = ({ children, className, groupClassName, ...internal }) => {
55390
55368
  isReadOnly: readOnly,
55391
55369
  onBlur: invokeBlur,
55392
55370
  onFocus
55393
- }, /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Input, {
55371
+ }, controlElement);
55372
+ };
55373
+ var GuestCountControl = ({ children, className }) => {
55374
+ const { disabled, readOnly } = useFieldPropsV2();
55375
+ const inputElement = findChildOfType(children, GuestCount.Input);
55376
+ const decrementElement = findChildOfType(children, GuestCount.Decrement);
55377
+ const incrementElement = findChildOfType(children, GuestCount.Increment);
55378
+ return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Group, {
55379
+ className,
55380
+ isDisabled: disabled,
55381
+ isReadOnly: readOnly
55382
+ }, inputElement, incrementElement, decrementElement);
55383
+ };
55384
+ var GuestCountInput = ({ className }) => {
55385
+ const { id: id6 } = useFieldPropsV2();
55386
+ const { inputId, ariaDescribedBy } = useFieldAttributes();
55387
+ const ref = React172.useRef(null);
55388
+ useFocusFieldEvent(() => {
55389
+ ref.current?.focus();
55390
+ }, id6);
55391
+ return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Input, {
55394
55392
  ref,
55395
55393
  id: inputId,
55396
55394
  "aria-describedby": ariaDescribedBy,
55397
55395
  className,
55398
55396
  inputMode: "numeric"
55399
- }), incrementElement, decrementElement);
55397
+ });
55400
55398
  };
55401
55399
  var GuestCountDecrement = ({ children, className }) => {
55402
55400
  return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Button, {
@@ -55505,6 +55503,8 @@ var Guest = ({ className, ...internal }) => {
55505
55503
  fieldActions
55506
55504
  }));
55507
55505
  };
55506
+ GuestCount.Control = GuestCountControl;
55507
+ GuestCount.Input = GuestCountInput;
55508
55508
  GuestCount.Decrement = GuestCountDecrement;
55509
55509
  GuestCount.Increment = GuestCountIncrement;
55510
55510
  GuestToggle.Input = SelectionIndicator;