@page-speed/forms 0.7.4 → 0.7.6

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.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkMBOEVE6D_cjs = require('./chunk-MBOEVE6D.cjs');
4
- var chunk3VSPIJNK_cjs = require('./chunk-3VSPIJNK.cjs');
5
- var chunkPDMFWP5I_cjs = require('./chunk-PDMFWP5I.cjs');
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 || chunkPDMFWP5I_cjs.humanizeFieldName(field.name);
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 = chunkMBOEVE6D_cjs.useForm({
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 chunkPDMFWP5I_cjs.fieldIsChoiceCard(field);
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 bg-muted/20";
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
- chunkMBOEVE6D_cjs.Field,
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: chunkPDMFWP5I_cjs.cn(fieldClassName, 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
- chunkPDMFWP5I_cjs.TextInput,
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
- chunkPDMFWP5I_cjs.TextInput,
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
- chunk3VSPIJNK_cjs.TextArea,
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
- chunk3VSPIJNK_cjs.Select,
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
- chunk3VSPIJNK_cjs.MultiSelect,
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
- chunk3VSPIJNK_cjs.Radio,
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
- chunk3VSPIJNK_cjs.Checkbox,
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
- chunk3VSPIJNK_cjs.CheckboxGroup,
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
- chunk3VSPIJNK_cjs.DatePicker,
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
- chunk3VSPIJNK_cjs.DateRangePicker,
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
- chunk3VSPIJNK_cjs.TimePicker,
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
- chunk3VSPIJNK_cjs.FileInput,
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
- chunkMBOEVE6D_cjs.Form,
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: chunkPDMFWP5I_cjs.cn(
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: chunkPDMFWP5I_cjs.cn(
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
- chunkPDMFWP5I_cjs.Button,
1004
+ chunkIGI4JJKE_cjs.Button,
1005
1005
  {
1006
1006
  type: "submit",
1007
1007
  variant: submitButtonSetup?.submitVariant ?? DEFAULT_BUTTON_VARIANT,