@asdp/ferryui 0.1.22-dev.8661 → 0.1.22-dev.8694

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
@@ -3,7 +3,6 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import React5, { forwardRef, useState, useCallback, useRef, useEffect, useMemo, Fragment as Fragment$1 } from 'react';
4
4
  import { Row, Col, Visible } from 'react-grid-system';
5
5
  import { Icon } from '@iconify/react';
6
- import { Icon as Icon$1 } from '@iconify/react/dist/iconify.js';
7
6
  import { Controller, useForm, useWatch } from 'react-hook-form';
8
7
  import PhoneInputComponent from 'react-phone-input-2';
9
8
  import Select from 'react-select';
@@ -2028,7 +2027,7 @@ var useStyles7 = makeStyles({
2028
2027
  display: "none"
2029
2028
  },
2030
2029
  "& .fui-Radio__label": {
2031
- padding: "10px 24px",
2030
+ padding: "5px 10px",
2032
2031
  border: `1px solid ${tokens.colorNeutralStroke1}`,
2033
2032
  borderRadius: tokens.borderRadiusCircular,
2034
2033
  cursor: "pointer",
@@ -3548,7 +3547,7 @@ var CardTicketSearch = ({
3548
3547
  control,
3549
3548
  type: "text",
3550
3549
  contentBefore: /* @__PURE__ */ jsx(
3551
- Icon$1,
3550
+ Icon,
3552
3551
  {
3553
3552
  icon: "fluent:vehicle-ship-16-filled",
3554
3553
  color: tokens.colorBrandBackground
@@ -3617,7 +3616,7 @@ var CardTicketSearch = ({
3617
3616
  control,
3618
3617
  type: "text",
3619
3618
  contentBefore: /* @__PURE__ */ jsx(
3620
- Icon$1,
3619
+ Icon,
3621
3620
  {
3622
3621
  icon: "fluent:location-24-filled",
3623
3622
  color: tokens.colorBrandBackground
@@ -3656,7 +3655,7 @@ var CardTicketSearch = ({
3656
3655
  control,
3657
3656
  type: "text",
3658
3657
  contentBefore: /* @__PURE__ */ jsx(
3659
- Icon$1,
3658
+ Icon,
3660
3659
  {
3661
3660
  icon: "fluent:calendar-24-filled",
3662
3661
  color: tokens.colorBrandBackground
@@ -3716,7 +3715,7 @@ var CardTicketSearch = ({
3716
3715
  control,
3717
3716
  type: "text",
3718
3717
  contentBefore: /* @__PURE__ */ jsx(
3719
- Icon$1,
3718
+ Icon,
3720
3719
  {
3721
3720
  icon: "fluent:calendar-24-filled",
3722
3721
  color: tokens.colorBrandBackground
@@ -3789,7 +3788,7 @@ var CardTicketSearch = ({
3789
3788
  control,
3790
3789
  type: "text",
3791
3790
  contentBefore: /* @__PURE__ */ jsx(
3792
- Icon$1,
3791
+ Icon,
3793
3792
  {
3794
3793
  icon: "fluent:ribbon-star-24-filled",
3795
3794
  color: tokens.colorBrandBackground
@@ -3823,7 +3822,7 @@ var CardTicketSearch = ({
3823
3822
  control,
3824
3823
  type: "text",
3825
3824
  contentBefore: /* @__PURE__ */ jsx(
3826
- Icon$1,
3825
+ Icon,
3827
3826
  {
3828
3827
  icon: "fluent:apps-list-24-filled",
3829
3828
  color: tokens.colorBrandBackground
@@ -3858,7 +3857,7 @@ var CardTicketSearch = ({
3858
3857
  control,
3859
3858
  type: "text",
3860
3859
  contentBefore: /* @__PURE__ */ jsx(
3861
- Icon$1,
3860
+ Icon,
3862
3861
  {
3863
3862
  icon: "fluent:people-24-filled",
3864
3863
  color: tokens.colorBrandBackground
@@ -3880,7 +3879,7 @@ var CardTicketSearch = ({
3880
3879
  appearance: "primary",
3881
3880
  size: "large",
3882
3881
  type: "submit",
3883
- icon: /* @__PURE__ */ jsx(Icon$1, { icon: "fluent:vehicle-ship-20-filled" }),
3882
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:vehicle-ship-20-filled" }),
3884
3883
  disabled: submitDisabled,
3885
3884
  children: labels.searchButton
3886
3885
  }
@@ -7820,6 +7819,8 @@ var DEFAULT_LABELS22 = {
7820
7819
  ticketClassLabel: "Kelas penumpang",
7821
7820
  saveButton: "Simpan",
7822
7821
  cancelButton: "Batal",
7822
+ idTypeOtherLabel: "Tanggal lahir",
7823
+ idTypeOtherPlaceholder: "DD/MM/YYYY",
7823
7824
  errors: {
7824
7825
  requiredTitle: "Title harus dipilih",
7825
7826
  requiredName: "Nama lengkap harus diisi",
@@ -7853,6 +7854,8 @@ var DEFAULT_LABELS22 = {
7853
7854
  ticketClassLabel: "Passenger Class",
7854
7855
  saveButton: "Save",
7855
7856
  cancelButton: "Cancel",
7857
+ idTypeOtherLabel: "Date of Birth",
7858
+ idTypeOtherPlaceholder: "DD/MM/YYYY",
7856
7859
  errors: {
7857
7860
  requiredTitle: "Title is required",
7858
7861
  requiredName: "Full name is required",
@@ -7868,6 +7871,24 @@ var DEFAULT_LABELS22 = {
7868
7871
  }
7869
7872
  }
7870
7873
  };
7874
+ var TYPE_OPTIONS = [
7875
+ {
7876
+ label: "KTP",
7877
+ value: "ktp"
7878
+ },
7879
+ {
7880
+ label: "SIM",
7881
+ value: "sim"
7882
+ },
7883
+ {
7884
+ label: "Paspor",
7885
+ value: "paspor"
7886
+ },
7887
+ {
7888
+ label: "Lainnya",
7889
+ value: "lainnya"
7890
+ }
7891
+ ];
7871
7892
  var useStyles22 = makeStyles({
7872
7893
  dialogSurface: {
7873
7894
  maxWidth: "600px",
@@ -7896,7 +7917,6 @@ var ModalPassengerForm = ({
7896
7917
  defaultValues,
7897
7918
  isAdultForm = true,
7898
7919
  titleOptions,
7899
- idTypeOptions,
7900
7920
  cityOptions,
7901
7921
  ticketClassOptions
7902
7922
  }) => {
@@ -7907,12 +7927,18 @@ var ModalPassengerForm = ({
7907
7927
  ...labels?.errors
7908
7928
  };
7909
7929
  const displayTitle = title || mergedLabels.title;
7910
- const { control, handleSubmit, reset } = useForm({
7930
+ const { control, handleSubmit, reset, watch, setValue } = useForm({
7911
7931
  defaultValues
7912
7932
  });
7933
+ const idType = watch("idType");
7913
7934
  useEffect(() => {
7914
7935
  reset(defaultValues);
7915
7936
  }, [defaultValues, reset]);
7937
+ useEffect(() => {
7938
+ if (idType) {
7939
+ setValue("idNumber", "");
7940
+ }
7941
+ }, [idType, setValue]);
7916
7942
  const handleFormSubmit = (data) => {
7917
7943
  onSubmit(data);
7918
7944
  reset();
@@ -7968,6 +7994,45 @@ var ModalPassengerForm = ({
7968
7994
  }
7969
7995
  }
7970
7996
  ),
7997
+ /* @__PURE__ */ jsx(
7998
+ InputDynamic_default,
7999
+ {
8000
+ name: "age",
8001
+ control,
8002
+ type: "number",
8003
+ label: mergedLabels.ageLabel,
8004
+ placeholder: mergedLabels.agePlaceholder,
8005
+ size: "large",
8006
+ required: true,
8007
+ validationRules: {
8008
+ required: mergedErrors.requiredAge,
8009
+ min: {
8010
+ value: 1,
8011
+ message: mergedErrors.minAge
8012
+ },
8013
+ max: {
8014
+ value: 150,
8015
+ message: mergedErrors.maxAge
8016
+ }
8017
+ }
8018
+ }
8019
+ ),
8020
+ /* @__PURE__ */ jsx(
8021
+ InputDynamic_default,
8022
+ {
8023
+ name: "cityId",
8024
+ control,
8025
+ type: "select",
8026
+ label: mergedLabels.cityLabel,
8027
+ options: cityOptions,
8028
+ placeholder: mergedLabels.cityPlaceholder,
8029
+ size: "large",
8030
+ required: true,
8031
+ validationRules: {
8032
+ required: mergedErrors.requiredCity
8033
+ }
8034
+ }
8035
+ ),
7971
8036
  isAdultForm ? /* @__PURE__ */ jsxs(Fragment, { children: [
7972
8037
  /* @__PURE__ */ jsx(
7973
8038
  InputDynamic_default,
@@ -7977,7 +8042,7 @@ var ModalPassengerForm = ({
7977
8042
  type: "select",
7978
8043
  label: mergedLabels.idTypeLabel,
7979
8044
  placeholder: mergedLabels.idTypePlaceholder,
7980
- options: idTypeOptions,
8045
+ options: TYPE_OPTIONS,
7981
8046
  size: "large",
7982
8047
  required: true,
7983
8048
  validationRules: {
@@ -7985,48 +8050,40 @@ var ModalPassengerForm = ({
7985
8050
  }
7986
8051
  }
7987
8052
  ),
7988
- /* @__PURE__ */ jsx(
8053
+ idType ? idType === "lainnya" ? /* @__PURE__ */ jsx(
7989
8054
  InputDynamic_default,
7990
8055
  {
7991
8056
  name: "idNumber",
7992
8057
  control,
7993
- type: "text",
7994
- label: mergedLabels.idNumberLabel,
7995
- placeholder: mergedLabels.idNumberPlaceholder,
8058
+ type: "date",
8059
+ label: mergedLabels.idTypeOtherLabel,
8060
+ placeholder: mergedLabels.idTypeOtherPlaceholder,
7996
8061
  size: "large",
7997
8062
  required: true,
8063
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
7998
8064
  validationRules: {
7999
- required: mergedErrors.requiredIdNumber,
8000
- minLength: {
8001
- value: 6,
8002
- message: mergedErrors.minLengthIdNumber
8003
- }
8065
+ required: mergedErrors.requiredDate
8004
8066
  }
8005
8067
  }
8006
- ),
8007
- /* @__PURE__ */ jsx(
8068
+ ) : /* @__PURE__ */ jsx(
8008
8069
  InputDynamic_default,
8009
8070
  {
8010
- name: "age",
8071
+ name: "idNumber",
8011
8072
  control,
8012
- type: "number",
8013
- label: mergedLabels.ageLabel,
8014
- placeholder: mergedLabels.agePlaceholder,
8073
+ type: idType === "ktp" ? "number" : "text",
8074
+ label: mergedLabels.idNumberLabel,
8075
+ placeholder: mergedLabels.idNumberPlaceholder,
8015
8076
  size: "large",
8016
8077
  required: true,
8017
8078
  validationRules: {
8018
- required: mergedErrors.requiredAge,
8019
- min: {
8020
- value: 1,
8021
- message: mergedErrors.minAge
8022
- },
8023
- max: {
8024
- value: 150,
8025
- message: mergedErrors.maxAge
8079
+ required: mergedErrors.requiredIdNumber,
8080
+ minLength: {
8081
+ value: 6,
8082
+ message: mergedErrors.minLengthIdNumber
8026
8083
  }
8027
8084
  }
8028
8085
  }
8029
- )
8086
+ ) : null
8030
8087
  ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
8031
8088
  InputDynamic_default,
8032
8089
  {
@@ -8042,22 +8099,6 @@ var ModalPassengerForm = ({
8042
8099
  }
8043
8100
  }
8044
8101
  ) }),
8045
- /* @__PURE__ */ jsx(
8046
- InputDynamic_default,
8047
- {
8048
- name: "cityId",
8049
- control,
8050
- type: "select",
8051
- label: mergedLabels.cityLabel,
8052
- options: cityOptions,
8053
- placeholder: mergedLabels.cityPlaceholder,
8054
- size: "large",
8055
- required: true,
8056
- validationRules: {
8057
- required: mergedErrors.requiredCity
8058
- }
8059
- }
8060
- ),
8061
8102
  /* @__PURE__ */ jsx("br", {}),
8062
8103
  /* @__PURE__ */ jsx(Divider, {}),
8063
8104
  /* @__PURE__ */ jsx("br", {}),