@asdp/ferryui 0.1.22-dev.9569 → 0.1.22-dev.9577

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.mjs CHANGED
@@ -3629,7 +3629,7 @@ var DEFAULT_LABELS7 = {
3629
3629
  hidePasswordAriaLabel: "Sembunyikan kata sandi",
3630
3630
  datePickerPlaceholder: "Pilih tanggal",
3631
3631
  phoneDefaultPlaceholder: "Nomor telepon",
3632
- requiredFieldError: "Field ini wajib diisi",
3632
+ requiredFieldError: "wajib diisi",
3633
3633
  invalidEmailError: "Email tidak valid",
3634
3634
  emailOrPhoneRequiredError: "Email atau nomor HP wajib diisi",
3635
3635
  invalidEmailFormatError: "Format email tidak valid",
@@ -3652,7 +3652,7 @@ var DEFAULT_LABELS7 = {
3652
3652
  hidePasswordAriaLabel: "Hide password",
3653
3653
  datePickerPlaceholder: "Select date",
3654
3654
  phoneDefaultPlaceholder: "Phone number",
3655
- requiredFieldError: "This field is required",
3655
+ requiredFieldError: "is required",
3656
3656
  invalidEmailError: "Invalid email",
3657
3657
  emailOrPhoneRequiredError: "Email or phone number is required",
3658
3658
  invalidEmailFormatError: "Invalid email format",
@@ -5230,8 +5230,9 @@ var InputDynamic = ({
5230
5230
  };
5231
5231
  const getValidationRules = () => {
5232
5232
  const rules = {};
5233
+ const requiredMessage = typeof validationRules?.required === "string" ? validationRules.required : `${label || (language === "id" ? "Field ini" : "This field")} ${mergedLabels.requiredFieldError}`;
5233
5234
  if (required) {
5234
- rules.required = validationRules?.required || mergedLabels.requiredFieldError;
5235
+ rules.required = requiredMessage;
5235
5236
  }
5236
5237
  if (validationRules?.minLength) {
5237
5238
  rules.minLength = validationRules.minLength;
@@ -5260,7 +5261,7 @@ var InputDynamic = ({
5260
5261
  if (type === "emailOrPhone") {
5261
5262
  rules.validate = (value) => {
5262
5263
  if (required && !value) {
5263
- return mergedLabels.emailOrPhoneRequiredError;
5264
+ return label ? requiredMessage : mergedLabels.emailOrPhoneRequiredError;
5264
5265
  }
5265
5266
  const stringValue = typeof value === "string" ? value : "";
5266
5267
  if (!stringValue) return true;
@@ -5283,7 +5284,7 @@ var InputDynamic = ({
5283
5284
  if (type === "identity") {
5284
5285
  rules.validate = (value) => {
5285
5286
  if (required && !value) {
5286
- return mergedLabels.requiredFieldError;
5287
+ return requiredMessage;
5287
5288
  }
5288
5289
  const stringValue = typeof value === "string" ? value : value?.phoneNumber || "";
5289
5290
  if (!stringValue) return true;
@@ -5304,7 +5305,7 @@ var InputDynamic = ({
5304
5305
  if (type === "phone") {
5305
5306
  rules.validate = (value) => {
5306
5307
  if (required && !value) {
5307
- return mergedLabels.requiredFieldError;
5308
+ return requiredMessage;
5308
5309
  }
5309
5310
  if (value) {
5310
5311
  const stringValue = typeof value === "string" ? value : String(value);
@@ -10969,9 +10970,15 @@ var ModalPassengerForm = ({
10969
10970
  const [capturedImage, setCapturedImage] = useState(null);
10970
10971
  const [stream, setStream] = useState(null);
10971
10972
  const videoRef = useRef(null);
10972
- const { control, handleSubmit, reset, watch, setValue } = useForm({
10973
+ const { control, handleSubmit, reset, watch, setValue, trigger } = useForm({
10974
+ mode: "all",
10973
10975
  defaultValues
10974
10976
  });
10977
+ useEffect(() => {
10978
+ if (open) {
10979
+ trigger();
10980
+ }
10981
+ }, [open, trigger]);
10975
10982
  const watchIdentityTypeId = watch("identityTypeId");
10976
10983
  const watchPassportCountryId = watch("countryId");
10977
10984
  const watchBirthdate = watch("birthdate");
@@ -11971,6 +11978,7 @@ var CardVehicleDetail = ({
11971
11978
  disabled,
11972
11979
  name: vehicleNumberName,
11973
11980
  placeholder: mergedLabels.vehicleNumberPlaceholder,
11981
+ required: true,
11974
11982
  type: "text"
11975
11983
  }
11976
11984
  )
@@ -12279,14 +12287,14 @@ var CardVehicleOwnerForm = ({
12279
12287
  Radio,
12280
12288
  {
12281
12289
  value: MANIFEST_ENTITY.COMPANY,
12282
- label: MANIFEST_ENTITY.COMPANY
12290
+ label: mergedLabels.entityTypeCompany
12283
12291
  }
12284
12292
  ),
12285
12293
  /* @__PURE__ */ jsx(
12286
12294
  Radio,
12287
12295
  {
12288
12296
  value: MANIFEST_ENTITY.INDIVIDUAL,
12289
- label: MANIFEST_ENTITY.INDIVIDUAL
12297
+ label: mergedLabels.entityTypeIndividual
12290
12298
  }
12291
12299
  )
12292
12300
  ]