@page-speed/forms 0.7.4 → 0.7.5
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/README.md +1 -1
- package/dist/{chunk-SF6NKDID.js → chunk-DSK3VLIV.js} +57 -34
- package/dist/chunk-DSK3VLIV.js.map +1 -0
- package/dist/{chunk-QHAQYOBT.js → chunk-EQKN2OPX.js} +14 -6
- package/dist/chunk-EQKN2OPX.js.map +1 -0
- package/dist/{chunk-PDMFWP5I.cjs → chunk-IGI4JJKE.cjs} +14 -6
- package/dist/chunk-IGI4JJKE.cjs.map +1 -0
- package/dist/{chunk-3VSPIJNK.cjs → chunk-K7ZHLPLX.cjs} +170 -147
- package/dist/chunk-K7ZHLPLX.cjs.map +1 -0
- package/dist/{chunk-HX7733ID.js → chunk-MRGJTFGD.js} +3 -3
- package/dist/{chunk-HX7733ID.js.map → chunk-MRGJTFGD.js.map} +1 -1
- package/dist/{chunk-MBOEVE6D.cjs → chunk-T2SLAP65.cjs} +20 -20
- package/dist/{chunk-MBOEVE6D.cjs.map → chunk-T2SLAP65.cjs.map} +1 -1
- package/dist/core.cjs +9 -9
- package/dist/core.js +2 -2
- package/dist/index.cjs +13 -13
- package/dist/index.js +2 -2
- package/dist/inputs.cjs +14 -14
- package/dist/inputs.d.cts +1 -1
- package/dist/inputs.d.ts +1 -1
- package/dist/inputs.js +2 -2
- package/dist/integration.cjs +25 -25
- package/dist/integration.cjs.map +1 -1
- package/dist/integration.js +4 -4
- package/dist/integration.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3VSPIJNK.cjs.map +0 -1
- package/dist/chunk-PDMFWP5I.cjs.map +0 -1
- package/dist/chunk-QHAQYOBT.js.map +0 -1
- package/dist/chunk-SF6NKDID.js.map +0 -1
package/dist/integration.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkT2SLAP65_cjs = require('./chunk-T2SLAP65.cjs');
|
|
4
|
+
var chunkK7ZHLPLX_cjs = require('./chunk-K7ZHLPLX.cjs');
|
|
5
|
+
var chunkIGI4JJKE_cjs = require('./chunk-IGI4JJKE.cjs');
|
|
6
6
|
var React2 = require('react');
|
|
7
7
|
var icon = require('@page-speed/icon');
|
|
8
8
|
|
|
@@ -395,7 +395,7 @@ function generateValidationSchema(fields) {
|
|
|
395
395
|
acc[field.name] = (value, allValues) => {
|
|
396
396
|
if (field.required) {
|
|
397
397
|
if (!value || typeof value === "string" && !value.trim()) {
|
|
398
|
-
const displayName = field.label ||
|
|
398
|
+
const displayName = field.label || chunkIGI4JJKE_cjs.humanizeFieldName(field.name);
|
|
399
399
|
return `${displayName} is required`;
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -567,7 +567,7 @@ function useContactForm(options) {
|
|
|
567
567
|
window.location.assign(destination);
|
|
568
568
|
}, 150);
|
|
569
569
|
}, [navigate, redirectUrl]);
|
|
570
|
-
const form =
|
|
570
|
+
const form = chunkT2SLAP65_cjs.useForm({
|
|
571
571
|
initialValues: React2.useMemo(
|
|
572
572
|
() => generateInitialValues(formFields),
|
|
573
573
|
[formFields]
|
|
@@ -664,11 +664,11 @@ function DynamicFormField({
|
|
|
664
664
|
}) {
|
|
665
665
|
const fieldId = field.name;
|
|
666
666
|
const usesChoiceCard = React2__namespace.useMemo(() => {
|
|
667
|
-
return
|
|
667
|
+
return chunkIGI4JJKE_cjs.fieldIsChoiceCard(field);
|
|
668
668
|
}, [field.type, field.options]);
|
|
669
669
|
const fieldClassName = React2__namespace.useMemo(() => {
|
|
670
670
|
if (usesChoiceCard) {
|
|
671
|
-
return "p-4 border rounded rounded-lg
|
|
671
|
+
return "p-4 border rounded rounded-lg";
|
|
672
672
|
} else {
|
|
673
673
|
return "";
|
|
674
674
|
}
|
|
@@ -677,16 +677,16 @@ function DynamicFormField({
|
|
|
677
677
|
const usesInlineCheckboxLabel = field.type === "checkbox";
|
|
678
678
|
const shouldRenderFieldLabel = renderLabel && !usesGroupLegend && !usesInlineCheckboxLabel;
|
|
679
679
|
return /* @__PURE__ */ React2__namespace.createElement(
|
|
680
|
-
|
|
680
|
+
chunkT2SLAP65_cjs.Field,
|
|
681
681
|
{
|
|
682
682
|
name: field.name,
|
|
683
683
|
label: shouldRenderFieldLabel ? field.label : void 0,
|
|
684
684
|
description: shouldRenderFieldLabel ? field.description : void 0,
|
|
685
685
|
required: field.required,
|
|
686
|
-
className:
|
|
686
|
+
className: chunkIGI4JJKE_cjs.cn(fieldClassName, className)
|
|
687
687
|
},
|
|
688
688
|
({ field: formField, meta }) => /* @__PURE__ */ React2__namespace.createElement("div", null, (field.type === "text" || field.type === "email" || field.type === "tel" || field.type === "search" || field.type === "password" || field.type === "url") && /* @__PURE__ */ React2__namespace.createElement(
|
|
689
|
-
|
|
689
|
+
chunkIGI4JJKE_cjs.TextInput,
|
|
690
690
|
{
|
|
691
691
|
...formField,
|
|
692
692
|
id: fieldId,
|
|
@@ -698,7 +698,7 @@ function DynamicFormField({
|
|
|
698
698
|
iconStart: getDefaultIconStart(field)
|
|
699
699
|
}
|
|
700
700
|
), field.type === "number" && /* @__PURE__ */ React2__namespace.createElement(
|
|
701
|
-
|
|
701
|
+
chunkIGI4JJKE_cjs.TextInput,
|
|
702
702
|
{
|
|
703
703
|
...formField,
|
|
704
704
|
id: fieldId,
|
|
@@ -709,7 +709,7 @@ function DynamicFormField({
|
|
|
709
709
|
"aria-label": field.label
|
|
710
710
|
}
|
|
711
711
|
), field.type === "textarea" && /* @__PURE__ */ React2__namespace.createElement(
|
|
712
|
-
|
|
712
|
+
chunkK7ZHLPLX_cjs.TextArea,
|
|
713
713
|
{
|
|
714
714
|
...formField,
|
|
715
715
|
id: fieldId,
|
|
@@ -720,7 +720,7 @@ function DynamicFormField({
|
|
|
720
720
|
"aria-label": field.label
|
|
721
721
|
}
|
|
722
722
|
), field.type === "select" && field.options && /* @__PURE__ */ React2__namespace.createElement(
|
|
723
|
-
|
|
723
|
+
chunkK7ZHLPLX_cjs.Select,
|
|
724
724
|
{
|
|
725
725
|
...formField,
|
|
726
726
|
id: fieldId,
|
|
@@ -731,7 +731,7 @@ function DynamicFormField({
|
|
|
731
731
|
"aria-label": field.label
|
|
732
732
|
}
|
|
733
733
|
), field.type === "multi-select" && field.options && /* @__PURE__ */ React2__namespace.createElement(
|
|
734
|
-
|
|
734
|
+
chunkK7ZHLPLX_cjs.MultiSelect,
|
|
735
735
|
{
|
|
736
736
|
...formField,
|
|
737
737
|
id: fieldId,
|
|
@@ -742,7 +742,7 @@ function DynamicFormField({
|
|
|
742
742
|
"aria-label": field.label
|
|
743
743
|
}
|
|
744
744
|
), field.type === "radio" && field.options && /* @__PURE__ */ React2__namespace.createElement(
|
|
745
|
-
|
|
745
|
+
chunkK7ZHLPLX_cjs.Radio,
|
|
746
746
|
{
|
|
747
747
|
...formField,
|
|
748
748
|
id: fieldId,
|
|
@@ -756,7 +756,7 @@ function DynamicFormField({
|
|
|
756
756
|
"aria-label": field.label
|
|
757
757
|
}
|
|
758
758
|
), field.type === "checkbox" && /* @__PURE__ */ React2__namespace.createElement(
|
|
759
|
-
|
|
759
|
+
chunkK7ZHLPLX_cjs.Checkbox,
|
|
760
760
|
{
|
|
761
761
|
...formField,
|
|
762
762
|
id: fieldId,
|
|
@@ -770,7 +770,7 @@ function DynamicFormField({
|
|
|
770
770
|
"aria-label": field.label
|
|
771
771
|
}
|
|
772
772
|
), field.type === "checkbox-group" && field.options && /* @__PURE__ */ React2__namespace.createElement(
|
|
773
|
-
|
|
773
|
+
chunkK7ZHLPLX_cjs.CheckboxGroup,
|
|
774
774
|
{
|
|
775
775
|
...formField,
|
|
776
776
|
id: fieldId,
|
|
@@ -784,7 +784,7 @@ function DynamicFormField({
|
|
|
784
784
|
"aria-label": field.label
|
|
785
785
|
}
|
|
786
786
|
), (field.type === "date-picker" || field.type === "date") && /* @__PURE__ */ React2__namespace.createElement(
|
|
787
|
-
|
|
787
|
+
chunkK7ZHLPLX_cjs.DatePicker,
|
|
788
788
|
{
|
|
789
789
|
...formField,
|
|
790
790
|
id: fieldId,
|
|
@@ -794,7 +794,7 @@ function DynamicFormField({
|
|
|
794
794
|
"aria-label": field.label
|
|
795
795
|
}
|
|
796
796
|
), field.type === "date-range" && /* @__PURE__ */ React2__namespace.createElement(
|
|
797
|
-
|
|
797
|
+
chunkK7ZHLPLX_cjs.DateRangePicker,
|
|
798
798
|
{
|
|
799
799
|
...formField,
|
|
800
800
|
id: fieldId,
|
|
@@ -804,7 +804,7 @@ function DynamicFormField({
|
|
|
804
804
|
"aria-label": field.label
|
|
805
805
|
}
|
|
806
806
|
), field.type === "time" && /* @__PURE__ */ React2__namespace.createElement(
|
|
807
|
-
|
|
807
|
+
chunkK7ZHLPLX_cjs.TimePicker,
|
|
808
808
|
{
|
|
809
809
|
...formField,
|
|
810
810
|
id: fieldId,
|
|
@@ -814,7 +814,7 @@ function DynamicFormField({
|
|
|
814
814
|
"aria-label": field.label
|
|
815
815
|
}
|
|
816
816
|
), field.type === "file" && /* @__PURE__ */ React2__namespace.createElement(
|
|
817
|
-
|
|
817
|
+
chunkK7ZHLPLX_cjs.FileInput,
|
|
818
818
|
{
|
|
819
819
|
...formField,
|
|
820
820
|
id: fieldId,
|
|
@@ -954,7 +954,7 @@ function FormEngine(props) {
|
|
|
954
954
|
};
|
|
955
955
|
}, [isButtonGroup, buttonGroupSetup, api]);
|
|
956
956
|
return /* @__PURE__ */ React2__namespace.createElement("div", { className: styleRules?.formContainer }, /* @__PURE__ */ React2__namespace.createElement(
|
|
957
|
-
|
|
957
|
+
chunkT2SLAP65_cjs.Form,
|
|
958
958
|
{
|
|
959
959
|
form,
|
|
960
960
|
fields: isButtonGroup ? formFields : void 0,
|
|
@@ -974,7 +974,7 @@ function FormEngine(props) {
|
|
|
974
974
|
!isButtonGroup && /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(
|
|
975
975
|
"div",
|
|
976
976
|
{
|
|
977
|
-
className:
|
|
977
|
+
className: chunkIGI4JJKE_cjs.cn(
|
|
978
978
|
"grid grid-cols-12 space-y-8 gap-x-6 md:gap-x-8",
|
|
979
979
|
styleRules?.fieldsContainer
|
|
980
980
|
)
|
|
@@ -983,7 +983,7 @@ function FormEngine(props) {
|
|
|
983
983
|
"div",
|
|
984
984
|
{
|
|
985
985
|
key: field.name,
|
|
986
|
-
className:
|
|
986
|
+
className: chunkIGI4JJKE_cjs.cn(
|
|
987
987
|
getColumnSpanClass(field.columnSpan ?? 12),
|
|
988
988
|
"min-w-0"
|
|
989
989
|
)
|
|
@@ -1001,7 +1001,7 @@ function FormEngine(props) {
|
|
|
1001
1001
|
)
|
|
1002
1002
|
))
|
|
1003
1003
|
), /* @__PURE__ */ React2__namespace.createElement(
|
|
1004
|
-
|
|
1004
|
+
chunkIGI4JJKE_cjs.Button,
|
|
1005
1005
|
{
|
|
1006
1006
|
type: "submit",
|
|
1007
1007
|
variant: submitButtonSetup?.submitVariant ?? DEFAULT_BUTTON_VARIANT,
|