@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 +30 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -43021,12 +43021,9 @@ var ScrollProvider = ({ children }) => {
|
|
|
43021
43021
|
if (element && scrollViewRef.current) {
|
|
43022
43022
|
const { top } = element.getBoundingClientRect();
|
|
43023
43023
|
if (top < 0 || top > window.innerHeight) {
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
|
|
43027
|
-
window.scrollTo({
|
|
43028
|
-
top: newTop,
|
|
43029
|
-
behavior: "smooth"
|
|
43024
|
+
element.scrollIntoView({
|
|
43025
|
+
behavior: "smooth",
|
|
43026
|
+
block: "center"
|
|
43030
43027
|
});
|
|
43031
43028
|
}
|
|
43032
43029
|
}
|
|
@@ -43045,18 +43042,6 @@ function useScroll() {
|
|
|
43045
43042
|
}
|
|
43046
43043
|
return context;
|
|
43047
43044
|
}
|
|
43048
|
-
function getSiteHeaderHeight(formElement) {
|
|
43049
|
-
const classicHeader = document.querySelector("#SITE_HEADER");
|
|
43050
|
-
const potentialHeader = formElement.closest("main")?.previousElementSibling;
|
|
43051
|
-
const studioHeader = potentialHeader?.tagName === "HEADER" ? potentialHeader : void 0;
|
|
43052
|
-
const header = classicHeader || studioHeader;
|
|
43053
|
-
const headerPosition = header && window.getComputedStyle(header).position;
|
|
43054
|
-
return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
|
|
43055
|
-
}
|
|
43056
|
-
function getWixAdHeight() {
|
|
43057
|
-
const ad = document.querySelector("#WIX_ADS");
|
|
43058
|
-
return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
|
|
43059
|
-
}
|
|
43060
43045
|
|
|
43061
43046
|
// ../form-fields/dist/esm/contexts/translation-context.js
|
|
43062
43047
|
var TranslationContext = createContext(void 0);
|
|
@@ -55357,19 +55342,12 @@ var useInvokeCallback = (callback) => {
|
|
|
55357
55342
|
// ../form-fields/dist/esm/ui/events-repeater/events-repeater-headless.js
|
|
55358
55343
|
var NO_ERRORS2 = [];
|
|
55359
55344
|
var NO_VALUES = {};
|
|
55360
|
-
var GuestCount = ({ children,
|
|
55345
|
+
var GuestCount = ({ children, ...internal }) => {
|
|
55361
55346
|
const { guestLimit, guestCount, onGuestCountChange } = internal;
|
|
55362
|
-
const {
|
|
55363
|
-
const { inputId, ariaDescribedBy } = useFieldAttributes();
|
|
55347
|
+
const { label, disabled, readOnly, onBlur, onFocus } = useFieldPropsV2();
|
|
55364
55348
|
const invokeBlur = useInvokeCallback(onBlur);
|
|
55365
|
-
const
|
|
55366
|
-
useFocusFieldEvent(() => {
|
|
55367
|
-
ref.current?.focus();
|
|
55368
|
-
}, id6);
|
|
55369
|
-
const decrementElement = findChildOfType(children, GuestCount.Decrement);
|
|
55370
|
-
const incrementElement = findChildOfType(children, GuestCount.Increment);
|
|
55349
|
+
const controlElement = findChildOfType(children, GuestCount.Control);
|
|
55371
55350
|
return /* @__PURE__ */ React172.createElement(NumberField, {
|
|
55372
|
-
className: groupClassName,
|
|
55373
55351
|
"aria-label": label,
|
|
55374
55352
|
value: guestCount,
|
|
55375
55353
|
onChange: onGuestCountChange,
|
|
@@ -55380,13 +55358,33 @@ var GuestCount = ({ children, className, groupClassName, ...internal }) => {
|
|
|
55380
55358
|
isReadOnly: readOnly,
|
|
55381
55359
|
onBlur: invokeBlur,
|
|
55382
55360
|
onFocus
|
|
55383
|
-
},
|
|
55361
|
+
}, controlElement);
|
|
55362
|
+
};
|
|
55363
|
+
var GuestCountControl = ({ children, className }) => {
|
|
55364
|
+
const { disabled, readOnly } = useFieldPropsV2();
|
|
55365
|
+
const inputElement = findChildOfType(children, GuestCount.Input);
|
|
55366
|
+
const decrementElement = findChildOfType(children, GuestCount.Decrement);
|
|
55367
|
+
const incrementElement = findChildOfType(children, GuestCount.Increment);
|
|
55368
|
+
return /* @__PURE__ */ React172.createElement(Group, {
|
|
55369
|
+
className,
|
|
55370
|
+
isDisabled: disabled,
|
|
55371
|
+
isReadOnly: readOnly
|
|
55372
|
+
}, inputElement, incrementElement, decrementElement);
|
|
55373
|
+
};
|
|
55374
|
+
var GuestCountInput = ({ className }) => {
|
|
55375
|
+
const { id: id6 } = useFieldPropsV2();
|
|
55376
|
+
const { inputId, ariaDescribedBy } = useFieldAttributes();
|
|
55377
|
+
const ref = useRef(null);
|
|
55378
|
+
useFocusFieldEvent(() => {
|
|
55379
|
+
ref.current?.focus();
|
|
55380
|
+
}, id6);
|
|
55381
|
+
return /* @__PURE__ */ React172.createElement(Input, {
|
|
55384
55382
|
ref,
|
|
55385
55383
|
id: inputId,
|
|
55386
55384
|
"aria-describedby": ariaDescribedBy,
|
|
55387
55385
|
className,
|
|
55388
55386
|
inputMode: "numeric"
|
|
55389
|
-
})
|
|
55387
|
+
});
|
|
55390
55388
|
};
|
|
55391
55389
|
var GuestCountDecrement = ({ children, className }) => {
|
|
55392
55390
|
return /* @__PURE__ */ React172.createElement(Button, {
|
|
@@ -55495,6 +55493,8 @@ var Guest = ({ className, ...internal }) => {
|
|
|
55495
55493
|
fieldActions
|
|
55496
55494
|
}));
|
|
55497
55495
|
};
|
|
55496
|
+
GuestCount.Control = GuestCountControl;
|
|
55497
|
+
GuestCount.Input = GuestCountInput;
|
|
55498
55498
|
GuestCount.Decrement = GuestCountDecrement;
|
|
55499
55499
|
GuestCount.Increment = GuestCountIncrement;
|
|
55500
55500
|
GuestToggle.Input = SelectionIndicator;
|