@wix/form-public 0.514.0 → 0.516.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 +55 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -32
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -43131,6 +43131,7 @@ var ForcedState = /* @__PURE__ */ (function(ForcedState2) {
|
|
|
43131
43131
|
ForcedState2["INPUT_FIELDS_FOCUS"] = "INPUT_FIELDS_FOCUS";
|
|
43132
43132
|
ForcedState2["INPUT_FIELDS_ERROR"] = "INPUT_FIELDS_ERROR";
|
|
43133
43133
|
ForcedState2["SUCCESS_MESSAGE"] = "SUCCESS_MESSAGE";
|
|
43134
|
+
ForcedState2["HIDDEN_FIELDS"] = "HIDDEN_FIELDS";
|
|
43134
43135
|
return ForcedState2;
|
|
43135
43136
|
})({});
|
|
43136
43137
|
var ForcedStateContext = React172.createContext([]);
|
|
@@ -49918,6 +49919,7 @@ var useFormValues = (form, values, onChange, userData, addressTemplates, enableA
|
|
|
49918
49919
|
};
|
|
49919
49920
|
var useFormView2 = (form, stepId, breakpoint) => {
|
|
49920
49921
|
const { isMobile: isMobile2 } = useConfig();
|
|
49922
|
+
const includeHiddenFields = useForcedState().includes(ForcedState.HIDDEN_FIELDS);
|
|
49921
49923
|
const experiments = useExperiments();
|
|
49922
49924
|
const useFieldsV2App = experiments.isExperimentEnabled(EXPERIMENTS.USE_FIELDS_V2);
|
|
49923
49925
|
const useFieldsV2Standalone = experiments.isExperimentEnabled(EXPERIMENTS.USE_FIELDS_V2_STANDALONE);
|
|
@@ -49932,7 +49934,8 @@ var useFormView2 = (form, stepId, breakpoint) => {
|
|
|
49932
49934
|
stepId: step.id,
|
|
49933
49935
|
isMobile: isMobile2,
|
|
49934
49936
|
breakpoint,
|
|
49935
|
-
useFieldsV2
|
|
49937
|
+
useFieldsV2,
|
|
49938
|
+
includeHiddenFields
|
|
49936
49939
|
});
|
|
49937
49940
|
});
|
|
49938
49941
|
}, [
|
|
@@ -49940,7 +49943,8 @@ var useFormView2 = (form, stepId, breakpoint) => {
|
|
|
49940
49943
|
stepId,
|
|
49941
49944
|
isMobile2,
|
|
49942
49945
|
breakpoint,
|
|
49943
|
-
useFieldsV2
|
|
49946
|
+
useFieldsV2,
|
|
49947
|
+
includeHiddenFields
|
|
49944
49948
|
]);
|
|
49945
49949
|
};
|
|
49946
49950
|
var useReportFieldEdit = (form) => {
|
|
@@ -59290,11 +59294,11 @@ var PhoneInput = ({ children }) => {
|
|
|
59290
59294
|
}));
|
|
59291
59295
|
};
|
|
59292
59296
|
var CountryButton = ({ children, className }) => {
|
|
59293
|
-
const {
|
|
59297
|
+
const { labelId } = useFieldAttributes();
|
|
59294
59298
|
const { hasError, disabled, readOnly } = useFieldPropsV2();
|
|
59295
59299
|
const { t } = useTranslation2();
|
|
59296
59300
|
const { selectedCountryCode, countries } = usePhoneInputContext();
|
|
59297
|
-
const buttonId =
|
|
59301
|
+
const buttonId = React172.useId();
|
|
59298
59302
|
const selectedCountry = selectedCountryCode ? countries.find((c) => c.shortCountryCode === selectedCountryCode) : void 0;
|
|
59299
59303
|
const dialingCode = selectedCountry ? getCallingCode2(selectedCountry.longCountryCode) || "" : "";
|
|
59300
59304
|
const countryCodeLabel = t("field.phone.country-code.aria-label");
|
|
@@ -59332,9 +59336,12 @@ var CountryButtonEmptyState = ({ children, className }) => {
|
|
|
59332
59336
|
CountryButton.Flag = CountryButtonFlag;
|
|
59333
59337
|
CountryButton.EmptyState = CountryButtonEmptyState;
|
|
59334
59338
|
var CountryOptions = ({ children, className, "aria-label": ariaLabel, placement, offset, ...internal }) => {
|
|
59335
|
-
const { triggerRef, optionsRef, isForcedOpen } = internal;
|
|
59339
|
+
const { triggerRef, optionsRef, isForcedOpen, isOpen } = internal;
|
|
59336
59340
|
const { popoverContainer } = usePhoneInputContext();
|
|
59337
59341
|
const searchElement = findChildOfType(children, CountryOptions.Search);
|
|
59342
|
+
if (!isOpen) {
|
|
59343
|
+
return null;
|
|
59344
|
+
}
|
|
59338
59345
|
const content = /* @__PURE__ */ React172__default.default.createElement(CountryOptionsContent, {
|
|
59339
59346
|
isForcedOpen
|
|
59340
59347
|
}, children);
|
|
@@ -59492,24 +59499,54 @@ var PhoneNumber2 = ({ className }) => {
|
|
|
59492
59499
|
className
|
|
59493
59500
|
});
|
|
59494
59501
|
};
|
|
59502
|
+
var CountryPopover = ({ children, ...internal }) => {
|
|
59503
|
+
const pickerProps = internal;
|
|
59504
|
+
const { isForcedOpen } = pickerProps;
|
|
59505
|
+
const { disabled, readOnly, required, hasError } = useFieldPropsV2();
|
|
59506
|
+
const [isOpen, setIsOpen] = React172.useState(false);
|
|
59507
|
+
const { t } = useTranslation2();
|
|
59508
|
+
const { selectedCountryCode, handleCountryCodeChange } = usePhoneInputContext();
|
|
59509
|
+
const isPopoverOpen = isForcedOpen || isOpen && !disabled && !readOnly;
|
|
59510
|
+
return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Select, {
|
|
59511
|
+
"aria-label": t("field.phone.country-code.aria-label"),
|
|
59512
|
+
value: selectedCountryCode ?? null,
|
|
59513
|
+
onChange: (key) => handleCountryCodeChange(key),
|
|
59514
|
+
isDisabled: disabled || readOnly,
|
|
59515
|
+
isInvalid: hasError,
|
|
59516
|
+
isRequired: required,
|
|
59517
|
+
placeholder: "",
|
|
59518
|
+
isOpen: isPopoverOpen,
|
|
59519
|
+
allowsEmptyCollection: true,
|
|
59520
|
+
onOpenChange: isForcedOpen ? void 0 : setIsOpen
|
|
59521
|
+
}, findChildOfType(children, PhoneInput.CountryButton), applyInternalProps(findChildOfType(children, PhoneInput.CountryOptions.Popover), {
|
|
59522
|
+
...pickerProps,
|
|
59523
|
+
isOpen: isPopoverOpen
|
|
59524
|
+
}));
|
|
59525
|
+
};
|
|
59526
|
+
var CountryDrawer = ({ children, ...internal }) => {
|
|
59527
|
+
const pickerProps = internal;
|
|
59528
|
+
return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.DialogTrigger, null, findChildOfType(children, PhoneInput.CountryButton), applyInternalProps(findChildOfType(children, PhoneInput.CountryOptions.Modal), pickerProps));
|
|
59529
|
+
};
|
|
59495
59530
|
var Control7 = ({ children, className }) => {
|
|
59496
59531
|
const controlRef = React172.useRef(null);
|
|
59497
59532
|
const optionsRef = React172.useRef(null);
|
|
59498
59533
|
const isFocused = React172.useRef(false);
|
|
59499
|
-
const { id: id6, disabled,
|
|
59500
|
-
const [isOpen, setIsOpen] = React172.useState(false);
|
|
59534
|
+
const { id: id6, disabled, hasError, showFlag, onFocus, onBlur } = useFieldPropsV2();
|
|
59501
59535
|
const invokeBlur = useInvokeCallback(onBlur);
|
|
59502
|
-
const {
|
|
59503
|
-
const
|
|
59504
|
-
const
|
|
59505
|
-
const modalElement = findChildOfType(children, PhoneInput.CountryOptions.Modal);
|
|
59506
|
-
const countryOptionsElement = modalElement ?? findChildOfType(children, PhoneInput.CountryOptions.Popover);
|
|
59536
|
+
const { countries } = usePhoneInputContext();
|
|
59537
|
+
const drawerElement = findChildOfType(children, PhoneInput.CountryDrawer);
|
|
59538
|
+
const popoverElement = findChildOfType(children, PhoneInput.CountryPopover);
|
|
59507
59539
|
const phoneNumberElement = findChildOfType(children, PhoneInput.PhoneNumber);
|
|
59508
59540
|
const hasCountryOptions2 = countries.length > 1;
|
|
59509
|
-
const isForcedOpen = useIsForcedOpenDropdown(id6) &&
|
|
59541
|
+
const isForcedOpen = useIsForcedOpenDropdown(id6) && !!popoverElement && hasCountryOptions2;
|
|
59510
59542
|
const controlClassName = typeof className === "function" ? className({
|
|
59511
59543
|
hasCountryOptions: hasCountryOptions2
|
|
59512
59544
|
}) : className;
|
|
59545
|
+
const pickerProps = {
|
|
59546
|
+
triggerRef: controlRef,
|
|
59547
|
+
optionsRef,
|
|
59548
|
+
isForcedOpen
|
|
59549
|
+
};
|
|
59513
59550
|
const focusHandlers = {
|
|
59514
59551
|
onFocus: () => {
|
|
59515
59552
|
if (!isFocused.current) {
|
|
@@ -59536,32 +59573,19 @@ var Control7 = ({ children, className }) => {
|
|
|
59536
59573
|
longCountryCode: countries[0].longCountryCode
|
|
59537
59574
|
}), phoneNumberElement);
|
|
59538
59575
|
}
|
|
59539
|
-
const selector = /* @__PURE__ */ React172__default.default.createElement(React172__default.default.Fragment, null, countryButtonElement, applyInternalProps(countryOptionsElement, {
|
|
59540
|
-
triggerRef: controlRef,
|
|
59541
|
-
optionsRef,
|
|
59542
|
-
isForcedOpen
|
|
59543
|
-
}));
|
|
59544
59576
|
return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Group, {
|
|
59545
59577
|
ref: controlRef,
|
|
59546
59578
|
className: controlClassName,
|
|
59547
59579
|
isDisabled: disabled,
|
|
59548
59580
|
isInvalid: hasError,
|
|
59549
59581
|
...focusHandlers
|
|
59550
|
-
},
|
|
59551
|
-
"aria-label": t("field.phone.country-code.aria-label"),
|
|
59552
|
-
value: selectedCountryCode ?? null,
|
|
59553
|
-
onChange: (key) => handleCountryCodeChange(key),
|
|
59554
|
-
isDisabled: disabled || readOnly,
|
|
59555
|
-
isInvalid: hasError,
|
|
59556
|
-
isRequired: required,
|
|
59557
|
-
placeholder: "",
|
|
59558
|
-
isOpen: isForcedOpen || isOpen && !disabled && !readOnly,
|
|
59559
|
-
onOpenChange: isForcedOpen ? void 0 : setIsOpen
|
|
59560
|
-
}, selector), phoneNumberElement);
|
|
59582
|
+
}, !isForcedOpen && applyInternalProps(drawerElement, pickerProps), applyInternalProps(popoverElement, pickerProps), phoneNumberElement);
|
|
59561
59583
|
};
|
|
59562
59584
|
PhoneInput.Label = Label;
|
|
59563
59585
|
PhoneInput.Control = Control7;
|
|
59564
59586
|
PhoneInput.CountryButton = CountryButton;
|
|
59587
|
+
PhoneInput.CountryDrawer = CountryDrawer;
|
|
59588
|
+
PhoneInput.CountryPopover = CountryPopover;
|
|
59565
59589
|
PhoneInput.CountryOptions = CountryOptions;
|
|
59566
59590
|
PhoneInput.PhoneNumber = PhoneNumber2;
|
|
59567
59591
|
PhoneInput.Description = Description;
|
|
@@ -60722,7 +60746,7 @@ var SignaturePad = class _SignaturePad extends SignatureEventTarget {
|
|
|
60722
60746
|
return svg.outerHTML;
|
|
60723
60747
|
}
|
|
60724
60748
|
};
|
|
60725
|
-
var
|
|
60749
|
+
var useId2 = typeof React172__default.default.useId === "function" ? React172__default.default.useId : () => React172.useRef(generateUUID()).current;
|
|
60726
60750
|
|
|
60727
60751
|
// ../form-fields/dist/esm/ui/signature-field/signature-types.js
|
|
60728
60752
|
var SignatureFormat = /* @__PURE__ */ (function(SignatureFormat2) {
|
|
@@ -61632,7 +61656,7 @@ var Upload = ({ children, className, imageAlt, ...internal }) => {
|
|
|
61632
61656
|
var UploadButton = ({ children, className, ...internal }) => {
|
|
61633
61657
|
const { fileInputRef, disabled, readOnly, onBlur, onFocus } = internal;
|
|
61634
61658
|
const { inputId, ariaDescribedBy, labelId } = useFieldAttributes();
|
|
61635
|
-
const textId =
|
|
61659
|
+
const textId = useId2();
|
|
61636
61660
|
const handlePress = React172.useCallback(() => {
|
|
61637
61661
|
fileInputRef.current?.click();
|
|
61638
61662
|
}, [
|