@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.d.mts CHANGED
@@ -2196,6 +2196,8 @@ interface ModalPassengerFormLabels {
2196
2196
  ticketClassLabel: string;
2197
2197
  saveButton: string;
2198
2198
  cancelButton: string;
2199
+ idTypeOtherLabel: string;
2200
+ idTypeOtherPlaceholder: string;
2199
2201
  errors: {
2200
2202
  requiredTitle: string;
2201
2203
  requiredName: string;
@@ -2287,10 +2289,6 @@ interface ModalPassengerFormProps {
2287
2289
  * Options for title select field
2288
2290
  */
2289
2291
  titleOptions: SelectOption[];
2290
- /**
2291
- * Options for ID type select field
2292
- */
2293
- idTypeOptions: SelectOption[];
2294
2292
  /**
2295
2293
  * Options for city select field
2296
2294
  */
package/dist/index.d.ts CHANGED
@@ -2196,6 +2196,8 @@ interface ModalPassengerFormLabels {
2196
2196
  ticketClassLabel: string;
2197
2197
  saveButton: string;
2198
2198
  cancelButton: string;
2199
+ idTypeOtherLabel: string;
2200
+ idTypeOtherPlaceholder: string;
2199
2201
  errors: {
2200
2202
  requiredTitle: string;
2201
2203
  requiredName: string;
@@ -2287,10 +2289,6 @@ interface ModalPassengerFormProps {
2287
2289
  * Options for title select field
2288
2290
  */
2289
2291
  titleOptions: SelectOption[];
2290
- /**
2291
- * Options for ID type select field
2292
- */
2293
- idTypeOptions: SelectOption[];
2294
2292
  /**
2295
2293
  * Options for city select field
2296
2294
  */
package/dist/index.js CHANGED
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var React5 = require('react');
6
6
  var reactGridSystem = require('react-grid-system');
7
7
  var react = require('@iconify/react');
8
- var iconify_js = require('@iconify/react/dist/iconify.js');
9
8
  var reactHookForm = require('react-hook-form');
10
9
  var PhoneInputComponent = require('react-phone-input-2');
11
10
  var Select = require('react-select');
@@ -2037,7 +2036,7 @@ var useStyles7 = reactComponents.makeStyles({
2037
2036
  display: "none"
2038
2037
  },
2039
2038
  "& .fui-Radio__label": {
2040
- padding: "10px 24px",
2039
+ padding: "5px 10px",
2041
2040
  border: `1px solid ${reactComponents.tokens.colorNeutralStroke1}`,
2042
2041
  borderRadius: reactComponents.tokens.borderRadiusCircular,
2043
2042
  cursor: "pointer",
@@ -3557,7 +3556,7 @@ var CardTicketSearch = ({
3557
3556
  control,
3558
3557
  type: "text",
3559
3558
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3560
- iconify_js.Icon,
3559
+ react.Icon,
3561
3560
  {
3562
3561
  icon: "fluent:vehicle-ship-16-filled",
3563
3562
  color: reactComponents.tokens.colorBrandBackground
@@ -3626,7 +3625,7 @@ var CardTicketSearch = ({
3626
3625
  control,
3627
3626
  type: "text",
3628
3627
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3629
- iconify_js.Icon,
3628
+ react.Icon,
3630
3629
  {
3631
3630
  icon: "fluent:location-24-filled",
3632
3631
  color: reactComponents.tokens.colorBrandBackground
@@ -3665,7 +3664,7 @@ var CardTicketSearch = ({
3665
3664
  control,
3666
3665
  type: "text",
3667
3666
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3668
- iconify_js.Icon,
3667
+ react.Icon,
3669
3668
  {
3670
3669
  icon: "fluent:calendar-24-filled",
3671
3670
  color: reactComponents.tokens.colorBrandBackground
@@ -3725,7 +3724,7 @@ var CardTicketSearch = ({
3725
3724
  control,
3726
3725
  type: "text",
3727
3726
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3728
- iconify_js.Icon,
3727
+ react.Icon,
3729
3728
  {
3730
3729
  icon: "fluent:calendar-24-filled",
3731
3730
  color: reactComponents.tokens.colorBrandBackground
@@ -3798,7 +3797,7 @@ var CardTicketSearch = ({
3798
3797
  control,
3799
3798
  type: "text",
3800
3799
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3801
- iconify_js.Icon,
3800
+ react.Icon,
3802
3801
  {
3803
3802
  icon: "fluent:ribbon-star-24-filled",
3804
3803
  color: reactComponents.tokens.colorBrandBackground
@@ -3832,7 +3831,7 @@ var CardTicketSearch = ({
3832
3831
  control,
3833
3832
  type: "text",
3834
3833
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3835
- iconify_js.Icon,
3834
+ react.Icon,
3836
3835
  {
3837
3836
  icon: "fluent:apps-list-24-filled",
3838
3837
  color: reactComponents.tokens.colorBrandBackground
@@ -3867,7 +3866,7 @@ var CardTicketSearch = ({
3867
3866
  control,
3868
3867
  type: "text",
3869
3868
  contentBefore: /* @__PURE__ */ jsxRuntime.jsx(
3870
- iconify_js.Icon,
3869
+ react.Icon,
3871
3870
  {
3872
3871
  icon: "fluent:people-24-filled",
3873
3872
  color: reactComponents.tokens.colorBrandBackground
@@ -3889,7 +3888,7 @@ var CardTicketSearch = ({
3889
3888
  appearance: "primary",
3890
3889
  size: "large",
3891
3890
  type: "submit",
3892
- icon: /* @__PURE__ */ jsxRuntime.jsx(iconify_js.Icon, { icon: "fluent:vehicle-ship-20-filled" }),
3891
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:vehicle-ship-20-filled" }),
3893
3892
  disabled: submitDisabled,
3894
3893
  children: labels.searchButton
3895
3894
  }
@@ -7829,6 +7828,8 @@ var DEFAULT_LABELS22 = {
7829
7828
  ticketClassLabel: "Kelas penumpang",
7830
7829
  saveButton: "Simpan",
7831
7830
  cancelButton: "Batal",
7831
+ idTypeOtherLabel: "Tanggal lahir",
7832
+ idTypeOtherPlaceholder: "DD/MM/YYYY",
7832
7833
  errors: {
7833
7834
  requiredTitle: "Title harus dipilih",
7834
7835
  requiredName: "Nama lengkap harus diisi",
@@ -7862,6 +7863,8 @@ var DEFAULT_LABELS22 = {
7862
7863
  ticketClassLabel: "Passenger Class",
7863
7864
  saveButton: "Save",
7864
7865
  cancelButton: "Cancel",
7866
+ idTypeOtherLabel: "Date of Birth",
7867
+ idTypeOtherPlaceholder: "DD/MM/YYYY",
7865
7868
  errors: {
7866
7869
  requiredTitle: "Title is required",
7867
7870
  requiredName: "Full name is required",
@@ -7877,6 +7880,24 @@ var DEFAULT_LABELS22 = {
7877
7880
  }
7878
7881
  }
7879
7882
  };
7883
+ var TYPE_OPTIONS = [
7884
+ {
7885
+ label: "KTP",
7886
+ value: "ktp"
7887
+ },
7888
+ {
7889
+ label: "SIM",
7890
+ value: "sim"
7891
+ },
7892
+ {
7893
+ label: "Paspor",
7894
+ value: "paspor"
7895
+ },
7896
+ {
7897
+ label: "Lainnya",
7898
+ value: "lainnya"
7899
+ }
7900
+ ];
7880
7901
  var useStyles22 = reactComponents.makeStyles({
7881
7902
  dialogSurface: {
7882
7903
  maxWidth: "600px",
@@ -7905,7 +7926,6 @@ var ModalPassengerForm = ({
7905
7926
  defaultValues,
7906
7927
  isAdultForm = true,
7907
7928
  titleOptions,
7908
- idTypeOptions,
7909
7929
  cityOptions,
7910
7930
  ticketClassOptions
7911
7931
  }) => {
@@ -7916,12 +7936,18 @@ var ModalPassengerForm = ({
7916
7936
  ...labels?.errors
7917
7937
  };
7918
7938
  const displayTitle = title || mergedLabels.title;
7919
- const { control, handleSubmit, reset } = reactHookForm.useForm({
7939
+ const { control, handleSubmit, reset, watch, setValue } = reactHookForm.useForm({
7920
7940
  defaultValues
7921
7941
  });
7942
+ const idType = watch("idType");
7922
7943
  React5.useEffect(() => {
7923
7944
  reset(defaultValues);
7924
7945
  }, [defaultValues, reset]);
7946
+ React5.useEffect(() => {
7947
+ if (idType) {
7948
+ setValue("idNumber", "");
7949
+ }
7950
+ }, [idType, setValue]);
7925
7951
  const handleFormSubmit = (data) => {
7926
7952
  onSubmit(data);
7927
7953
  reset();
@@ -7977,6 +8003,45 @@ var ModalPassengerForm = ({
7977
8003
  }
7978
8004
  }
7979
8005
  ),
8006
+ /* @__PURE__ */ jsxRuntime.jsx(
8007
+ InputDynamic_default,
8008
+ {
8009
+ name: "age",
8010
+ control,
8011
+ type: "number",
8012
+ label: mergedLabels.ageLabel,
8013
+ placeholder: mergedLabels.agePlaceholder,
8014
+ size: "large",
8015
+ required: true,
8016
+ validationRules: {
8017
+ required: mergedErrors.requiredAge,
8018
+ min: {
8019
+ value: 1,
8020
+ message: mergedErrors.minAge
8021
+ },
8022
+ max: {
8023
+ value: 150,
8024
+ message: mergedErrors.maxAge
8025
+ }
8026
+ }
8027
+ }
8028
+ ),
8029
+ /* @__PURE__ */ jsxRuntime.jsx(
8030
+ InputDynamic_default,
8031
+ {
8032
+ name: "cityId",
8033
+ control,
8034
+ type: "select",
8035
+ label: mergedLabels.cityLabel,
8036
+ options: cityOptions,
8037
+ placeholder: mergedLabels.cityPlaceholder,
8038
+ size: "large",
8039
+ required: true,
8040
+ validationRules: {
8041
+ required: mergedErrors.requiredCity
8042
+ }
8043
+ }
8044
+ ),
7980
8045
  isAdultForm ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7981
8046
  /* @__PURE__ */ jsxRuntime.jsx(
7982
8047
  InputDynamic_default,
@@ -7986,7 +8051,7 @@ var ModalPassengerForm = ({
7986
8051
  type: "select",
7987
8052
  label: mergedLabels.idTypeLabel,
7988
8053
  placeholder: mergedLabels.idTypePlaceholder,
7989
- options: idTypeOptions,
8054
+ options: TYPE_OPTIONS,
7990
8055
  size: "large",
7991
8056
  required: true,
7992
8057
  validationRules: {
@@ -7994,48 +8059,40 @@ var ModalPassengerForm = ({
7994
8059
  }
7995
8060
  }
7996
8061
  ),
7997
- /* @__PURE__ */ jsxRuntime.jsx(
8062
+ idType ? idType === "lainnya" ? /* @__PURE__ */ jsxRuntime.jsx(
7998
8063
  InputDynamic_default,
7999
8064
  {
8000
8065
  name: "idNumber",
8001
8066
  control,
8002
- type: "text",
8003
- label: mergedLabels.idNumberLabel,
8004
- placeholder: mergedLabels.idNumberPlaceholder,
8067
+ type: "date",
8068
+ label: mergedLabels.idTypeOtherLabel,
8069
+ placeholder: mergedLabels.idTypeOtherPlaceholder,
8005
8070
  size: "large",
8006
8071
  required: true,
8072
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
8007
8073
  validationRules: {
8008
- required: mergedErrors.requiredIdNumber,
8009
- minLength: {
8010
- value: 6,
8011
- message: mergedErrors.minLengthIdNumber
8012
- }
8074
+ required: mergedErrors.requiredDate
8013
8075
  }
8014
8076
  }
8015
- ),
8016
- /* @__PURE__ */ jsxRuntime.jsx(
8077
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8017
8078
  InputDynamic_default,
8018
8079
  {
8019
- name: "age",
8080
+ name: "idNumber",
8020
8081
  control,
8021
- type: "number",
8022
- label: mergedLabels.ageLabel,
8023
- placeholder: mergedLabels.agePlaceholder,
8082
+ type: idType === "ktp" ? "number" : "text",
8083
+ label: mergedLabels.idNumberLabel,
8084
+ placeholder: mergedLabels.idNumberPlaceholder,
8024
8085
  size: "large",
8025
8086
  required: true,
8026
8087
  validationRules: {
8027
- required: mergedErrors.requiredAge,
8028
- min: {
8029
- value: 1,
8030
- message: mergedErrors.minAge
8031
- },
8032
- max: {
8033
- value: 150,
8034
- message: mergedErrors.maxAge
8088
+ required: mergedErrors.requiredIdNumber,
8089
+ minLength: {
8090
+ value: 6,
8091
+ message: mergedErrors.minLengthIdNumber
8035
8092
  }
8036
8093
  }
8037
8094
  }
8038
- )
8095
+ ) : null
8039
8096
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
8040
8097
  InputDynamic_default,
8041
8098
  {
@@ -8051,22 +8108,6 @@ var ModalPassengerForm = ({
8051
8108
  }
8052
8109
  }
8053
8110
  ) }),
8054
- /* @__PURE__ */ jsxRuntime.jsx(
8055
- InputDynamic_default,
8056
- {
8057
- name: "cityId",
8058
- control,
8059
- type: "select",
8060
- label: mergedLabels.cityLabel,
8061
- options: cityOptions,
8062
- placeholder: mergedLabels.cityPlaceholder,
8063
- size: "large",
8064
- required: true,
8065
- validationRules: {
8066
- required: mergedErrors.requiredCity
8067
- }
8068
- }
8069
- ),
8070
8111
  /* @__PURE__ */ jsxRuntime.jsx("br", {}),
8071
8112
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
8072
8113
  /* @__PURE__ */ jsxRuntime.jsx("br", {}),