@wix/form-public 0.508.0 → 0.510.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 +21 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -43
- 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);
|
|
@@ -51735,15 +51720,6 @@ function r(r3, e, n) {
|
|
|
51735
51720
|
}, d;
|
|
51736
51721
|
}
|
|
51737
51722
|
|
|
51738
|
-
// ../form-fields/dist/esm/ui/options-layout/options-layout-constants.js
|
|
51739
|
-
var NUMBER_OF_COLUMNS = /* @__PURE__ */ (function(NUMBER_OF_COLUMNS2) {
|
|
51740
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["FREE_FLOW"] = 0] = "FREE_FLOW";
|
|
51741
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["ONE"] = 1] = "ONE";
|
|
51742
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["TWO"] = 2] = "TWO";
|
|
51743
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["THREE"] = 3] = "THREE";
|
|
51744
|
-
return NUMBER_OF_COLUMNS2;
|
|
51745
|
-
})({});
|
|
51746
|
-
|
|
51747
51723
|
// ../form-fields/dist/esm/ui/checkbox-group-field/checkbox-group-field-utils.js
|
|
51748
51724
|
var OTHER_ID = "Other";
|
|
51749
51725
|
var getValueIncludesOther = (value, optionsNames) => value.some((_value) => !optionsNames.includes(_value));
|
|
@@ -51761,7 +51737,7 @@ var getOtherValue = (value, addOtherLabel) => {
|
|
|
51761
51737
|
var getOptionsValues = (options) => options.map((option2) => option2.value ?? option2.label);
|
|
51762
51738
|
|
|
51763
51739
|
// ../form-fields/dist/esm/ui/checkbox-group-field/checkbox-group-field-headless.js
|
|
51764
|
-
var CheckboxGroup = ({ children }) => {
|
|
51740
|
+
var CheckboxGroup = ({ children, className }) => {
|
|
51765
51741
|
const props2 = useFieldPropsV2();
|
|
51766
51742
|
const { id: id6, value, onChange, disabled, required, onBlur, onFocus, hasError, FieldLayout } = props2;
|
|
51767
51743
|
const { inputId, labelId, ariaDescribedBy } = useFieldAttributes();
|
|
@@ -51788,6 +51764,7 @@ var CheckboxGroup = ({ children }) => {
|
|
|
51788
51764
|
onBlur,
|
|
51789
51765
|
onFocus
|
|
51790
51766
|
}, /* @__PURE__ */ React172.createElement(CheckboxGroup$1, {
|
|
51767
|
+
className,
|
|
51791
51768
|
"aria-labelledby": labelId,
|
|
51792
51769
|
value: _value,
|
|
51793
51770
|
onChange: handleChange,
|
|
@@ -51802,13 +51779,11 @@ var Options = ({ children, className }) => {
|
|
|
51802
51779
|
const props2 = useFieldPropsV2();
|
|
51803
51780
|
const { id: id6, options, addOther, addOtherLabel, numberOfColumns } = props2;
|
|
51804
51781
|
const { t } = useTranslation2();
|
|
51805
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
51806
51782
|
const optionElement = findChildOfType(children, Options.Option);
|
|
51807
51783
|
const otherLabel = getOtherLabel(addOtherLabel, t);
|
|
51808
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
51809
51784
|
return /* @__PURE__ */ React172.createElement("div", {
|
|
51810
51785
|
className,
|
|
51811
|
-
"data-columns":
|
|
51786
|
+
"data-columns": numberOfColumns
|
|
51812
51787
|
}, options?.map((option2, index2) => {
|
|
51813
51788
|
const checkboxValue = option2.value ?? option2.label;
|
|
51814
51789
|
return applyInternalProps(optionElement, {
|
|
@@ -55104,12 +55079,10 @@ var Control3 = ({ children, className, ...internal }) => {
|
|
|
55104
55079
|
var Options2 = ({ children, className, ...internal }) => {
|
|
55105
55080
|
const { productsById } = internal;
|
|
55106
55081
|
const { options, numberOfColumns } = useFieldPropsV2();
|
|
55107
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
55108
55082
|
const optionElement = findChildOfType(children, Options2.Option);
|
|
55109
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
55110
55083
|
return /* @__PURE__ */ React172.createElement("div", {
|
|
55111
55084
|
className,
|
|
55112
|
-
"data-columns":
|
|
55085
|
+
"data-columns": numberOfColumns
|
|
55113
55086
|
}, options.map((option2) => {
|
|
55114
55087
|
const product = productsById[option2.value];
|
|
55115
55088
|
const price = product?.fixedPriceOptions?.price;
|
|
@@ -55527,7 +55500,7 @@ var getOtherValue2 = (value, addOtherLabel) => {
|
|
|
55527
55500
|
};
|
|
55528
55501
|
|
|
55529
55502
|
// ../form-fields/dist/esm/ui/radio-group-field/radio-group-field-headless.js
|
|
55530
|
-
var RadioGroup = ({ children }) => {
|
|
55503
|
+
var RadioGroup = ({ children, className }) => {
|
|
55531
55504
|
const { id: id6, value, onChange, disabled, readOnly, required, onBlur, onFocus, hasError, FieldLayout, options } = useFieldPropsV2();
|
|
55532
55505
|
const { inputId, labelId, ariaDescribedBy } = useFieldAttributes();
|
|
55533
55506
|
const labelElement = findChildOfType(children, RadioGroup.Label);
|
|
@@ -55542,6 +55515,7 @@ var RadioGroup = ({ children }) => {
|
|
|
55542
55515
|
}),
|
|
55543
55516
|
renderInput: () => /* @__PURE__ */ React172.createElement(RadioGroup$1, {
|
|
55544
55517
|
id: inputId,
|
|
55518
|
+
className,
|
|
55545
55519
|
"aria-labelledby": labelId,
|
|
55546
55520
|
"aria-describedby": ariaDescribedBy,
|
|
55547
55521
|
value: groupValue,
|
|
@@ -55559,17 +55533,15 @@ var RadioGroup = ({ children }) => {
|
|
|
55559
55533
|
var Options4 = ({ children, className }) => {
|
|
55560
55534
|
const { options, addOther, addOtherLabel, id: id6, numberOfColumns, hasError } = useFieldPropsV2();
|
|
55561
55535
|
const { t } = useTranslation2();
|
|
55562
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
55563
55536
|
const optionElement = findChildOfType(children, RadioGroup.Option);
|
|
55564
55537
|
const firstRadioRef = useRef(null);
|
|
55565
55538
|
const otherLabel = addOtherLabel || t("add-other.default-other-option-label") || OTHER_ID2;
|
|
55566
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
55567
55539
|
useFocusFieldEvent(() => {
|
|
55568
55540
|
firstRadioRef.current?.focus();
|
|
55569
55541
|
}, id6);
|
|
55570
55542
|
return /* @__PURE__ */ React172.createElement("div", {
|
|
55571
55543
|
className,
|
|
55572
|
-
"data-columns":
|
|
55544
|
+
"data-columns": numberOfColumns,
|
|
55573
55545
|
"data-invalid": hasError
|
|
55574
55546
|
}, options.map((option2, index2) => applyInternalProps(optionElement, {
|
|
55575
55547
|
key: option2.value ?? option2.label,
|
|
@@ -56213,12 +56185,11 @@ FixedPayment.Amount = Amount;
|
|
|
56213
56185
|
FixedPayment.Description = Description;
|
|
56214
56186
|
FixedPayment.Error = Error2;
|
|
56215
56187
|
var Options5 = ({ children, className }) => {
|
|
56216
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
56217
56188
|
const { id: id6, options, numberOfColumns } = useFieldPropsV2();
|
|
56218
56189
|
const optionElement = findChildOfType(children, Options5.Option);
|
|
56219
56190
|
return /* @__PURE__ */ React172.createElement("div", {
|
|
56220
56191
|
className,
|
|
56221
|
-
"data-columns":
|
|
56192
|
+
"data-columns": numberOfColumns
|
|
56222
56193
|
}, options?.map((option2, index2) => applyInternalProps(optionElement, {
|
|
56223
56194
|
key: option2.id || option2.label,
|
|
56224
56195
|
option: option2,
|
|
@@ -61753,6 +61724,15 @@ ButtonsContainer.NextButton = NextButton;
|
|
|
61753
61724
|
ButtonsContainer.SubmitButton = SubmitButtonComponent;
|
|
61754
61725
|
SubmitButton.SubmitButton = ButtonsContainer;
|
|
61755
61726
|
|
|
61727
|
+
// ../form-fields/dist/esm/ui/options-layout/options-layout-constants.js
|
|
61728
|
+
var NUMBER_OF_COLUMNS = /* @__PURE__ */ (function(NUMBER_OF_COLUMNS2) {
|
|
61729
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["FREE_FLOW"] = 0] = "FREE_FLOW";
|
|
61730
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["ONE"] = 1] = "ONE";
|
|
61731
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["TWO"] = 2] = "TWO";
|
|
61732
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["THREE"] = 3] = "THREE";
|
|
61733
|
+
return NUMBER_OF_COLUMNS2;
|
|
61734
|
+
})({});
|
|
61735
|
+
|
|
61756
61736
|
// ../form-fields/dist/esm/ui/tags-field/tags-field-utils.js
|
|
61757
61737
|
var OTHER_ID3 = "Other";
|
|
61758
61738
|
var getOtherValue3 = (value, addOtherLabel) => {
|
|
@@ -61870,9 +61850,7 @@ var Option12 = ({ children, className, ...internal }) => {
|
|
|
61870
61850
|
};
|
|
61871
61851
|
var Options12 = ({ children, className }) => {
|
|
61872
61852
|
const { options, addOther, addOtherLabel, numberOfColumns = NUMBER_OF_COLUMNS.FREE_FLOW } = useFieldPropsV2();
|
|
61873
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
61874
61853
|
const { t } = useTranslation2();
|
|
61875
|
-
const columns = isMobile2 && numberOfColumns !== NUMBER_OF_COLUMNS.FREE_FLOW ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
61876
61854
|
const otherLabel = addOtherLabel || t("add-other.default-other-option-label") || OTHER_ID3;
|
|
61877
61855
|
const optionElement = findChildOfType(children, Option12);
|
|
61878
61856
|
const allOptions = useMemo(() => {
|
|
@@ -61898,7 +61876,7 @@ var Options12 = ({ children, className }) => {
|
|
|
61898
61876
|
}
|
|
61899
61877
|
return /* @__PURE__ */ React172.createElement("div", {
|
|
61900
61878
|
className,
|
|
61901
|
-
"data-columns":
|
|
61879
|
+
"data-columns": numberOfColumns
|
|
61902
61880
|
}, allOptions.map((option2, index2) => {
|
|
61903
61881
|
const optionValue = option2.value ?? option2.label;
|
|
61904
61882
|
return applyInternalProps(optionElement, {
|