@asdp/ferryui 0.1.22-dev.9813 → 0.1.22-dev.9825
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +99 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2851,6 +2851,10 @@ interface ModalPassengerFormProps {
|
|
|
2851
2851
|
* Receives the scanned data for external processing
|
|
2852
2852
|
*/
|
|
2853
2853
|
onScanComplete?: (data: ScannedData) => void;
|
|
2854
|
+
/**
|
|
2855
|
+
* Whether the form is currently submitting
|
|
2856
|
+
*/
|
|
2857
|
+
isLoading?: boolean;
|
|
2854
2858
|
}
|
|
2855
2859
|
|
|
2856
2860
|
declare const ModalPassengerForm: React$1.FC<ModalPassengerFormProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2851,6 +2851,10 @@ interface ModalPassengerFormProps {
|
|
|
2851
2851
|
* Receives the scanned data for external processing
|
|
2852
2852
|
*/
|
|
2853
2853
|
onScanComplete?: (data: ScannedData) => void;
|
|
2854
|
+
/**
|
|
2855
|
+
* Whether the form is currently submitting
|
|
2856
|
+
*/
|
|
2857
|
+
isLoading?: boolean;
|
|
2854
2858
|
}
|
|
2855
2859
|
|
|
2856
2860
|
declare const ModalPassengerForm: React$1.FC<ModalPassengerFormProps>;
|
package/dist/index.js
CHANGED
|
@@ -10664,6 +10664,14 @@ var useStyles23 = reactComponents.makeStyles({
|
|
|
10664
10664
|
gap: "1rem",
|
|
10665
10665
|
justifyContent: "flex-end",
|
|
10666
10666
|
marginTop: "1rem"
|
|
10667
|
+
},
|
|
10668
|
+
passengerItemDisabled: {
|
|
10669
|
+
opacity: 0.5,
|
|
10670
|
+
cursor: "not-allowed",
|
|
10671
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackgroundDisabled,
|
|
10672
|
+
":hover": {
|
|
10673
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackgroundDisabled
|
|
10674
|
+
}
|
|
10667
10675
|
}
|
|
10668
10676
|
});
|
|
10669
10677
|
var ModalListPassenger = ({
|
|
@@ -10691,11 +10699,6 @@ var ModalListPassenger = ({
|
|
|
10691
10699
|
onSelectPassenger(passenger);
|
|
10692
10700
|
handleClose();
|
|
10693
10701
|
};
|
|
10694
|
-
const filteredPassengers = passengers.filter((passenger) => {
|
|
10695
|
-
if (!searchQuery) return true;
|
|
10696
|
-
const query = searchQuery.toLowerCase();
|
|
10697
|
-
return passenger.fullName && passenger.fullName.toLowerCase().includes(query) || passenger.ageLabel && passenger.ageLabel.toLowerCase().includes(query);
|
|
10698
|
-
});
|
|
10699
10702
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10700
10703
|
reactComponents.Dialog,
|
|
10701
10704
|
{
|
|
@@ -10720,71 +10723,96 @@ var ModalListPassenger = ({
|
|
|
10720
10723
|
contentBefore: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:search-24-regular" }),
|
|
10721
10724
|
placeholder: mergedLabels.searchPlaceholder,
|
|
10722
10725
|
value: searchQuery,
|
|
10723
|
-
onChange: (_, data) =>
|
|
10726
|
+
onChange: (_, data) => {
|
|
10727
|
+
onSearchChange(data.value);
|
|
10728
|
+
},
|
|
10724
10729
|
size: "large"
|
|
10725
10730
|
}
|
|
10726
10731
|
),
|
|
10727
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.passengerList, children:
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
style: {
|
|
10751
|
-
backgroundColor: "#F3F9FD",
|
|
10752
|
-
border: `1px solid #A9D3F2`,
|
|
10753
|
-
borderRadius: "1em",
|
|
10754
|
-
display: "inline-block",
|
|
10755
|
-
color: "#0078D4",
|
|
10756
|
-
padding: ".4em .9em"
|
|
10757
|
-
},
|
|
10758
|
-
children: "Pemilik Akun"
|
|
10759
|
-
}
|
|
10760
|
-
)
|
|
10761
|
-
] }),
|
|
10762
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
10763
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { children: [
|
|
10764
|
-
passenger.ageLabel,
|
|
10765
|
-
" \xB7 ",
|
|
10766
|
-
passenger.identityTypeCode,
|
|
10767
|
-
" ",
|
|
10768
|
-
passenger.identityId
|
|
10769
|
-
] })
|
|
10770
|
-
] }),
|
|
10771
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10772
|
-
reactComponents.Button,
|
|
10773
|
-
{
|
|
10774
|
-
appearance: "transparent",
|
|
10775
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:chevron-right-24-regular" }),
|
|
10776
|
-
onClick: (e) => {
|
|
10777
|
-
e.preventDefault();
|
|
10778
|
-
e.stopPropagation();
|
|
10779
|
-
onEditPassenger(passenger);
|
|
10780
|
-
},
|
|
10781
|
-
"aria-label": mergedLabels.editPassengerAriaLabel
|
|
10732
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.passengerList, children: [...passengers].sort((a, b) => {
|
|
10733
|
+
const isDifferentAgeA = a.ageId !== passengerAgeId;
|
|
10734
|
+
const isExcludedFromSearchA = searchQuery ? !a.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10735
|
+
const isDisabledA = isDifferentAgeA || isExcludedFromSearchA;
|
|
10736
|
+
const isDifferentAgeB = b.ageId !== passengerAgeId;
|
|
10737
|
+
const isExcludedFromSearchB = searchQuery ? !b.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10738
|
+
const isDisabledB = isDifferentAgeB || isExcludedFromSearchB;
|
|
10739
|
+
if (isDisabledA === isDisabledB) return 0;
|
|
10740
|
+
return isDisabledA ? 1 : -1;
|
|
10741
|
+
}).map((passenger, index) => {
|
|
10742
|
+
const isDifferentAge = passenger.ageId !== passengerAgeId;
|
|
10743
|
+
const isExcludedFromSearch = searchQuery ? !passenger.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10744
|
+
const isDisabled = isDifferentAge || isExcludedFromSearch;
|
|
10745
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10746
|
+
"div",
|
|
10747
|
+
{
|
|
10748
|
+
className: reactComponents.mergeClasses(
|
|
10749
|
+
styles.passengerItem,
|
|
10750
|
+
isDisabled && styles.passengerItemDisabled
|
|
10751
|
+
),
|
|
10752
|
+
onClick: () => {
|
|
10753
|
+
if (!isDisabled) {
|
|
10754
|
+
handleSelectPassenger(passenger);
|
|
10782
10755
|
}
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10756
|
+
},
|
|
10757
|
+
role: "button",
|
|
10758
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
10759
|
+
onKeyDown: (e) => {
|
|
10760
|
+
if (isDisabled) return;
|
|
10761
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10762
|
+
e.preventDefault();
|
|
10763
|
+
handleSelectPassenger(passenger);
|
|
10764
|
+
}
|
|
10765
|
+
},
|
|
10766
|
+
children: [
|
|
10767
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
10768
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Subtitle2, { children: [
|
|
10769
|
+
passenger.fullName,
|
|
10770
|
+
" ",
|
|
10771
|
+
passenger.isAccountOwner && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10772
|
+
reactComponents.Caption2Strong,
|
|
10773
|
+
{
|
|
10774
|
+
style: {
|
|
10775
|
+
backgroundColor: "#F3F9FD",
|
|
10776
|
+
border: `1px solid #A9D3F2`,
|
|
10777
|
+
borderRadius: "1em",
|
|
10778
|
+
display: "inline-block",
|
|
10779
|
+
color: "#0078D4",
|
|
10780
|
+
padding: ".4em .9em"
|
|
10781
|
+
},
|
|
10782
|
+
children: "Pemilik Akun"
|
|
10783
|
+
}
|
|
10784
|
+
)
|
|
10785
|
+
] }),
|
|
10786
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
10787
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { children: [
|
|
10788
|
+
passenger.ageLabel,
|
|
10789
|
+
" \xB7 ",
|
|
10790
|
+
passenger.identityTypeCode,
|
|
10791
|
+
" ",
|
|
10792
|
+
passenger.identityId
|
|
10793
|
+
] })
|
|
10794
|
+
] }),
|
|
10795
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10796
|
+
reactComponents.Button,
|
|
10797
|
+
{
|
|
10798
|
+
appearance: "transparent",
|
|
10799
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:chevron-right-24-regular" }),
|
|
10800
|
+
disabled: isDisabled,
|
|
10801
|
+
onClick: (e) => {
|
|
10802
|
+
e.preventDefault();
|
|
10803
|
+
e.stopPropagation();
|
|
10804
|
+
if (!isDisabled) {
|
|
10805
|
+
onEditPassenger(passenger);
|
|
10806
|
+
}
|
|
10807
|
+
},
|
|
10808
|
+
"aria-label": mergedLabels.editPassengerAriaLabel
|
|
10809
|
+
}
|
|
10810
|
+
)
|
|
10811
|
+
]
|
|
10812
|
+
},
|
|
10813
|
+
passenger.id || `passenger-${index}`
|
|
10814
|
+
);
|
|
10815
|
+
}) }),
|
|
10788
10816
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.actions, children: [
|
|
10789
10817
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10790
10818
|
reactComponents.Button,
|
|
@@ -11147,7 +11175,8 @@ var ModalPassengerForm = ({
|
|
|
11147
11175
|
cityOptions,
|
|
11148
11176
|
idTypes,
|
|
11149
11177
|
ticketClassOptions,
|
|
11150
|
-
onScanComplete
|
|
11178
|
+
onScanComplete,
|
|
11179
|
+
isLoading
|
|
11151
11180
|
}) => {
|
|
11152
11181
|
const styles = useStyles24();
|
|
11153
11182
|
const mergedLabels = { ...DEFAULT_LABELS23[language], ...labels };
|
|
@@ -11164,7 +11193,7 @@ var ModalPassengerForm = ({
|
|
|
11164
11193
|
const [capturedImage, setCapturedImage] = React.useState(null);
|
|
11165
11194
|
const [stream, setStream] = React.useState(null);
|
|
11166
11195
|
const videoRef = React.useRef(null);
|
|
11167
|
-
const { control, handleSubmit, reset, watch, setValue, trigger } = reactHookForm.useForm({
|
|
11196
|
+
const { control, handleSubmit, reset, watch, setValue, trigger, formState: { isValid } } = reactHookForm.useForm({
|
|
11168
11197
|
mode: "all",
|
|
11169
11198
|
defaultValues
|
|
11170
11199
|
});
|
|
@@ -11893,6 +11922,8 @@ var ModalPassengerForm = ({
|
|
|
11893
11922
|
size: "large",
|
|
11894
11923
|
shape: "circular",
|
|
11895
11924
|
type: "submit",
|
|
11925
|
+
disabled: !isValid || isLoading,
|
|
11926
|
+
icon: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Spinner, { size: "tiny" }) : void 0,
|
|
11896
11927
|
children: mergedLabels.saveButton
|
|
11897
11928
|
}
|
|
11898
11929
|
),
|