@hunter-industries/hunter-components 0.0.105 → 0.0.106

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.
@@ -3616,7 +3616,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3616
3616
  };
3617
3617
  }
3618
3618
  });
3619
- const FormInput = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-7719e3d0"]]);
3619
+ const FormInput = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-565f4883"]]);
3620
3620
  const _hoisted_1$4 = {
3621
3621
  key: 0,
3622
3622
  class: "hunter-form-radio-group__label font-medium"
@@ -3650,7 +3650,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3650
3650
  submitButtonProps,
3651
3651
  cancelButtonProps
3652
3652
  } = toRefs(props);
3653
- const status = ref(props.submitStatus);
3653
+ const status = ref(props.submitStatus ?? "idle");
3654
3654
  const formInputs = ref(
3655
3655
  (props.inputs ?? []).map((i) => ({ ...i }))
3656
3656
  );
@@ -3703,6 +3703,27 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3703
3703
  },
3704
3704
  { deep: true }
3705
3705
  );
3706
+ watch(
3707
+ () => props.inputs,
3708
+ (next) => {
3709
+ formInputs.value = (next ?? []).map((i) => ({ ...i }));
3710
+ formInputs.value.forEach((input) => {
3711
+ if (!input.status) input.status = status.value ?? "idle";
3712
+ if (input.disabled === void 0) input.disabled = false;
3713
+ });
3714
+ initRadioDefaults();
3715
+ },
3716
+ { deep: true }
3717
+ );
3718
+ watch(
3719
+ () => props.submitStatus,
3720
+ (next) => {
3721
+ status.value = next ?? "idle";
3722
+ formInputs.value.forEach((input) => {
3723
+ if (input.status !== "error") input.status = status.value;
3724
+ });
3725
+ }
3726
+ );
3706
3727
  const handleFormSubmit = (e) => {
3707
3728
  e.preventDefault();
3708
3729
  status.value = "pending";
@@ -3727,7 +3748,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3727
3748
  formInputs.value.forEach((input) => {
3728
3749
  if (input.type !== "radio") input.errorMessage = "";
3729
3750
  input.status = status.value;
3730
- return input;
3731
3751
  });
3732
3752
  }
3733
3753
  const staticFields = props.staticFields ?? [];
@@ -3752,7 +3772,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3752
3772
  if (!finalIsValid) {
3753
3773
  formInputs.value.forEach((input) => {
3754
3774
  if (input.status !== "error") input.status = "idle";
3755
- return input;
3756
3775
  });
3757
3776
  setTimeout(() => {
3758
3777
  status.value = "idle";
@@ -3773,13 +3792,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3773
3792
  input.errorMessage = "";
3774
3793
  }
3775
3794
  input.status = status.value;
3776
- return input;
3777
3795
  });
3778
3796
  emit("cancelSubmit");
3779
3797
  };
3780
3798
  const setInputStatus = ({
3781
3799
  id,
3782
- status: status2,
3800
+ status: nextStatus,
3783
3801
  value,
3784
3802
  errorMessage
3785
3803
  }) => {
@@ -3787,9 +3805,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3787
3805
  if (input.id === id) {
3788
3806
  input.value = value;
3789
3807
  input.errorMessage = errorMessage;
3790
- input.status = status2;
3808
+ input.status = nextStatus;
3791
3809
  }
3792
- return input;
3793
3810
  });
3794
3811
  };
3795
3812
  const onDocKeydownEscape = (e) => {
@@ -3804,7 +3821,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3804
3821
  formInputs.value.forEach((input) => {
3805
3822
  if (!input.status) input.status = status.value;
3806
3823
  if (input.disabled === void 0) input.disabled = false;
3807
- return input;
3808
3824
  });
3809
3825
  initRadioDefaults();
3810
3826
  document.addEventListener("keydown", onDocKeydownEscape);
@@ -3899,7 +3915,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3899
3915
  };
3900
3916
  }
3901
3917
  });
3902
- const index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-b5e8ae1e"]]);
3918
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-45b088b9"]]);
3903
3919
  const _hoisted_1$3 = ["href"];
3904
3920
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3905
3921
  __name: "Link",