@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.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
|
-
|
|
43035
|
-
|
|
43036
|
-
|
|
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);
|
|
@@ -51745,15 +51730,6 @@ function r(r3, e, n) {
|
|
|
51745
51730
|
}, d;
|
|
51746
51731
|
}
|
|
51747
51732
|
|
|
51748
|
-
// ../form-fields/dist/esm/ui/options-layout/options-layout-constants.js
|
|
51749
|
-
var NUMBER_OF_COLUMNS = /* @__PURE__ */ (function(NUMBER_OF_COLUMNS2) {
|
|
51750
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["FREE_FLOW"] = 0] = "FREE_FLOW";
|
|
51751
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["ONE"] = 1] = "ONE";
|
|
51752
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["TWO"] = 2] = "TWO";
|
|
51753
|
-
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["THREE"] = 3] = "THREE";
|
|
51754
|
-
return NUMBER_OF_COLUMNS2;
|
|
51755
|
-
})({});
|
|
51756
|
-
|
|
51757
51733
|
// ../form-fields/dist/esm/ui/checkbox-group-field/checkbox-group-field-utils.js
|
|
51758
51734
|
var OTHER_ID = "Other";
|
|
51759
51735
|
var getValueIncludesOther = (value, optionsNames) => value.some((_value) => !optionsNames.includes(_value));
|
|
@@ -51771,7 +51747,7 @@ var getOtherValue = (value, addOtherLabel) => {
|
|
|
51771
51747
|
var getOptionsValues = (options) => options.map((option2) => option2.value ?? option2.label);
|
|
51772
51748
|
|
|
51773
51749
|
// ../form-fields/dist/esm/ui/checkbox-group-field/checkbox-group-field-headless.js
|
|
51774
|
-
var CheckboxGroup = ({ children }) => {
|
|
51750
|
+
var CheckboxGroup = ({ children, className }) => {
|
|
51775
51751
|
const props2 = useFieldPropsV2();
|
|
51776
51752
|
const { id: id6, value, onChange, disabled, required, onBlur, onFocus, hasError, FieldLayout } = props2;
|
|
51777
51753
|
const { inputId, labelId, ariaDescribedBy } = useFieldAttributes();
|
|
@@ -51798,6 +51774,7 @@ var CheckboxGroup = ({ children }) => {
|
|
|
51798
51774
|
onBlur,
|
|
51799
51775
|
onFocus
|
|
51800
51776
|
}, /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.CheckboxGroup, {
|
|
51777
|
+
className,
|
|
51801
51778
|
"aria-labelledby": labelId,
|
|
51802
51779
|
value: _value,
|
|
51803
51780
|
onChange: handleChange,
|
|
@@ -51812,13 +51789,11 @@ var Options = ({ children, className }) => {
|
|
|
51812
51789
|
const props2 = useFieldPropsV2();
|
|
51813
51790
|
const { id: id6, options, addOther, addOtherLabel, numberOfColumns } = props2;
|
|
51814
51791
|
const { t } = useTranslation2();
|
|
51815
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
51816
51792
|
const optionElement = findChildOfType(children, Options.Option);
|
|
51817
51793
|
const otherLabel = getOtherLabel(addOtherLabel, t);
|
|
51818
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
51819
51794
|
return /* @__PURE__ */ React172__default.default.createElement("div", {
|
|
51820
51795
|
className,
|
|
51821
|
-
"data-columns":
|
|
51796
|
+
"data-columns": numberOfColumns
|
|
51822
51797
|
}, options?.map((option2, index2) => {
|
|
51823
51798
|
const checkboxValue = option2.value ?? option2.label;
|
|
51824
51799
|
return applyInternalProps(optionElement, {
|
|
@@ -55114,12 +55089,10 @@ var Control3 = ({ children, className, ...internal }) => {
|
|
|
55114
55089
|
var Options2 = ({ children, className, ...internal }) => {
|
|
55115
55090
|
const { productsById } = internal;
|
|
55116
55091
|
const { options, numberOfColumns } = useFieldPropsV2();
|
|
55117
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
55118
55092
|
const optionElement = findChildOfType(children, Options2.Option);
|
|
55119
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
55120
55093
|
return /* @__PURE__ */ React172__default.default.createElement("div", {
|
|
55121
55094
|
className,
|
|
55122
|
-
"data-columns":
|
|
55095
|
+
"data-columns": numberOfColumns
|
|
55123
55096
|
}, options.map((option2) => {
|
|
55124
55097
|
const product = productsById[option2.value];
|
|
55125
55098
|
const price = product?.fixedPriceOptions?.price;
|
|
@@ -55537,7 +55510,7 @@ var getOtherValue2 = (value, addOtherLabel) => {
|
|
|
55537
55510
|
};
|
|
55538
55511
|
|
|
55539
55512
|
// ../form-fields/dist/esm/ui/radio-group-field/radio-group-field-headless.js
|
|
55540
|
-
var RadioGroup = ({ children }) => {
|
|
55513
|
+
var RadioGroup = ({ children, className }) => {
|
|
55541
55514
|
const { id: id6, value, onChange, disabled, readOnly, required, onBlur, onFocus, hasError, FieldLayout, options } = useFieldPropsV2();
|
|
55542
55515
|
const { inputId, labelId, ariaDescribedBy } = useFieldAttributes();
|
|
55543
55516
|
const labelElement = findChildOfType(children, RadioGroup.Label);
|
|
@@ -55552,6 +55525,7 @@ var RadioGroup = ({ children }) => {
|
|
|
55552
55525
|
}),
|
|
55553
55526
|
renderInput: () => /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.RadioGroup, {
|
|
55554
55527
|
id: inputId,
|
|
55528
|
+
className,
|
|
55555
55529
|
"aria-labelledby": labelId,
|
|
55556
55530
|
"aria-describedby": ariaDescribedBy,
|
|
55557
55531
|
value: groupValue,
|
|
@@ -55569,17 +55543,15 @@ var RadioGroup = ({ children }) => {
|
|
|
55569
55543
|
var Options4 = ({ children, className }) => {
|
|
55570
55544
|
const { options, addOther, addOtherLabel, id: id6, numberOfColumns, hasError } = useFieldPropsV2();
|
|
55571
55545
|
const { t } = useTranslation2();
|
|
55572
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
55573
55546
|
const optionElement = findChildOfType(children, RadioGroup.Option);
|
|
55574
55547
|
const firstRadioRef = React172.useRef(null);
|
|
55575
55548
|
const otherLabel = addOtherLabel || t("add-other.default-other-option-label") || OTHER_ID2;
|
|
55576
|
-
const columns = isMobile2 ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
55577
55549
|
useFocusFieldEvent(() => {
|
|
55578
55550
|
firstRadioRef.current?.focus();
|
|
55579
55551
|
}, id6);
|
|
55580
55552
|
return /* @__PURE__ */ React172__default.default.createElement("div", {
|
|
55581
55553
|
className,
|
|
55582
|
-
"data-columns":
|
|
55554
|
+
"data-columns": numberOfColumns,
|
|
55583
55555
|
"data-invalid": hasError
|
|
55584
55556
|
}, options.map((option2, index2) => applyInternalProps(optionElement, {
|
|
55585
55557
|
key: option2.value ?? option2.label,
|
|
@@ -56223,12 +56195,11 @@ FixedPayment.Amount = Amount;
|
|
|
56223
56195
|
FixedPayment.Description = Description;
|
|
56224
56196
|
FixedPayment.Error = Error2;
|
|
56225
56197
|
var Options5 = ({ children, className }) => {
|
|
56226
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
56227
56198
|
const { id: id6, options, numberOfColumns } = useFieldPropsV2();
|
|
56228
56199
|
const optionElement = findChildOfType(children, Options5.Option);
|
|
56229
56200
|
return /* @__PURE__ */ React172__default.default.createElement("div", {
|
|
56230
56201
|
className,
|
|
56231
|
-
"data-columns":
|
|
56202
|
+
"data-columns": numberOfColumns
|
|
56232
56203
|
}, options?.map((option2, index2) => applyInternalProps(optionElement, {
|
|
56233
56204
|
key: option2.id || option2.label,
|
|
56234
56205
|
option: option2,
|
|
@@ -61763,6 +61734,15 @@ ButtonsContainer.NextButton = NextButton;
|
|
|
61763
61734
|
ButtonsContainer.SubmitButton = SubmitButtonComponent;
|
|
61764
61735
|
SubmitButton.SubmitButton = ButtonsContainer;
|
|
61765
61736
|
|
|
61737
|
+
// ../form-fields/dist/esm/ui/options-layout/options-layout-constants.js
|
|
61738
|
+
var NUMBER_OF_COLUMNS = /* @__PURE__ */ (function(NUMBER_OF_COLUMNS2) {
|
|
61739
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["FREE_FLOW"] = 0] = "FREE_FLOW";
|
|
61740
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["ONE"] = 1] = "ONE";
|
|
61741
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["TWO"] = 2] = "TWO";
|
|
61742
|
+
NUMBER_OF_COLUMNS2[NUMBER_OF_COLUMNS2["THREE"] = 3] = "THREE";
|
|
61743
|
+
return NUMBER_OF_COLUMNS2;
|
|
61744
|
+
})({});
|
|
61745
|
+
|
|
61766
61746
|
// ../form-fields/dist/esm/ui/tags-field/tags-field-utils.js
|
|
61767
61747
|
var OTHER_ID3 = "Other";
|
|
61768
61748
|
var getOtherValue3 = (value, addOtherLabel) => {
|
|
@@ -61880,9 +61860,7 @@ var Option12 = ({ children, className, ...internal }) => {
|
|
|
61880
61860
|
};
|
|
61881
61861
|
var Options12 = ({ children, className }) => {
|
|
61882
61862
|
const { options, addOther, addOtherLabel, numberOfColumns = NUMBER_OF_COLUMNS.FREE_FLOW } = useFieldPropsV2();
|
|
61883
|
-
const { isMobile: isMobile2 } = useConfig();
|
|
61884
61863
|
const { t } = useTranslation2();
|
|
61885
|
-
const columns = isMobile2 && numberOfColumns !== NUMBER_OF_COLUMNS.FREE_FLOW ? NUMBER_OF_COLUMNS.ONE : numberOfColumns;
|
|
61886
61864
|
const otherLabel = addOtherLabel || t("add-other.default-other-option-label") || OTHER_ID3;
|
|
61887
61865
|
const optionElement = findChildOfType(children, Option12);
|
|
61888
61866
|
const allOptions = React172.useMemo(() => {
|
|
@@ -61908,7 +61886,7 @@ var Options12 = ({ children, className }) => {
|
|
|
61908
61886
|
}
|
|
61909
61887
|
return /* @__PURE__ */ React172__default.default.createElement("div", {
|
|
61910
61888
|
className,
|
|
61911
|
-
"data-columns":
|
|
61889
|
+
"data-columns": numberOfColumns
|
|
61912
61890
|
}, allOptions.map((option2, index2) => {
|
|
61913
61891
|
const optionValue = option2.value ?? option2.label;
|
|
61914
61892
|
return applyInternalProps(optionElement, {
|