@asdp/ferryui 0.1.22-dev.9812 → 0.1.22-dev.9823
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.js +205 -125
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -125
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8593,6 +8593,7 @@ var ModalTypeOfService = ({
|
|
|
8593
8593
|
}
|
|
8594
8594
|
return [];
|
|
8595
8595
|
});
|
|
8596
|
+
const scrollContainerRef = useRef(null);
|
|
8596
8597
|
const defaultRenderImage = ({
|
|
8597
8598
|
src,
|
|
8598
8599
|
alt,
|
|
@@ -8629,7 +8630,40 @@ var ModalTypeOfService = ({
|
|
|
8629
8630
|
} else if (openItems.length > 0) {
|
|
8630
8631
|
setOpenItems([]);
|
|
8631
8632
|
}
|
|
8632
|
-
}, [open, selectedService?.id]);
|
|
8633
|
+
}, [open, selectedService?.id, serviceTypes?.length]);
|
|
8634
|
+
const getTargetItemId = () => {
|
|
8635
|
+
if (selectedService) {
|
|
8636
|
+
for (const item of serviceTypes) {
|
|
8637
|
+
if (item.children && item.children.length > 0) {
|
|
8638
|
+
const hasSelectedChild = item.children.some(
|
|
8639
|
+
(child) => child.id === selectedService.id
|
|
8640
|
+
);
|
|
8641
|
+
if (hasSelectedChild) {
|
|
8642
|
+
return item.id;
|
|
8643
|
+
}
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
return openItems.length > 0 ? openItems[0] : null;
|
|
8648
|
+
};
|
|
8649
|
+
useEffect(() => {
|
|
8650
|
+
if (!open) return;
|
|
8651
|
+
const timer = setTimeout(() => {
|
|
8652
|
+
const targetId = getTargetItemId();
|
|
8653
|
+
const container = scrollContainerRef.current;
|
|
8654
|
+
if (targetId && container) {
|
|
8655
|
+
const targetEl = document.getElementById(`accordion-header-${targetId}`);
|
|
8656
|
+
if (targetEl) {
|
|
8657
|
+
const containerTop = container.getBoundingClientRect().top;
|
|
8658
|
+
const elTop = targetEl.getBoundingClientRect().top;
|
|
8659
|
+
container.scrollTop += elTop - containerTop;
|
|
8660
|
+
}
|
|
8661
|
+
} else if (container) {
|
|
8662
|
+
container.scrollTop = 0;
|
|
8663
|
+
}
|
|
8664
|
+
}, 150);
|
|
8665
|
+
return () => clearTimeout(timer);
|
|
8666
|
+
}, [open, selectedService?.id, serviceTypes]);
|
|
8633
8667
|
const handleConfirm = () => {
|
|
8634
8668
|
if (selectedServiceId) {
|
|
8635
8669
|
let selectedItem = null;
|
|
@@ -8698,70 +8732,81 @@ var ModalTypeOfService = ({
|
|
|
8698
8732
|
}
|
|
8699
8733
|
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8700
8734
|
/* @__PURE__ */ jsx(
|
|
8701
|
-
|
|
8735
|
+
"div",
|
|
8702
8736
|
{
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8737
|
+
ref: scrollContainerRef,
|
|
8738
|
+
style: {
|
|
8739
|
+
maxHeight: "700px",
|
|
8740
|
+
overflowY: "auto"
|
|
8741
|
+
},
|
|
8707
8742
|
children: /* @__PURE__ */ jsx(
|
|
8708
|
-
|
|
8743
|
+
Accordion,
|
|
8709
8744
|
{
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8745
|
+
collapsible: true,
|
|
8746
|
+
openItems,
|
|
8747
|
+
onToggle: (_, data) => setOpenItems(data.openItems),
|
|
8748
|
+
className: styles.passengerSection,
|
|
8749
|
+
children: /* @__PURE__ */ jsx(
|
|
8750
|
+
RadioGroup,
|
|
8751
|
+
{
|
|
8752
|
+
value: String(selectedServiceId),
|
|
8753
|
+
onChange: (_, data) => setSelectedServiceId(Number(data.value)),
|
|
8754
|
+
children: serviceTypes.map((item, index) => {
|
|
8755
|
+
if (item.children.length > 0) {
|
|
8756
|
+
return /* @__PURE__ */ jsxs(
|
|
8757
|
+
AccordionItem,
|
|
8758
|
+
{
|
|
8759
|
+
value: item?.id,
|
|
8760
|
+
className: styles.accordionItem,
|
|
8761
|
+
children: [
|
|
8762
|
+
/* @__PURE__ */ jsx(
|
|
8763
|
+
AccordionHeader,
|
|
8727
8764
|
{
|
|
8728
|
-
item
|
|
8729
|
-
|
|
8730
|
-
|
|
8765
|
+
id: `accordion-header-${item.id}`,
|
|
8766
|
+
className: styles.accordionHeader,
|
|
8767
|
+
expandIconPosition: "end",
|
|
8768
|
+
children: /* @__PURE__ */ jsx(
|
|
8769
|
+
HoverableAccordionHeaderContent,
|
|
8770
|
+
{
|
|
8771
|
+
item,
|
|
8772
|
+
imageRenderer,
|
|
8773
|
+
styles
|
|
8774
|
+
}
|
|
8775
|
+
)
|
|
8731
8776
|
}
|
|
8732
|
-
)
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8777
|
+
),
|
|
8778
|
+
/* @__PURE__ */ jsx(AccordionPanel, { className: styles.accordionBody, children: item.children.length > 0 && item.children.map((childItem, childIndex) => /* @__PURE__ */ jsx(
|
|
8779
|
+
HoverableRadioItem,
|
|
8780
|
+
{
|
|
8781
|
+
item: childItem,
|
|
8782
|
+
imageRenderer,
|
|
8783
|
+
styles,
|
|
8784
|
+
isChild: true,
|
|
8785
|
+
onClick: () => setSelectedServiceId(childItem.id)
|
|
8786
|
+
},
|
|
8787
|
+
childIndex
|
|
8788
|
+
)) })
|
|
8789
|
+
]
|
|
8790
|
+
},
|
|
8791
|
+
index
|
|
8792
|
+
);
|
|
8793
|
+
} else if (item.children.length === 0) {
|
|
8794
|
+
return /* @__PURE__ */ jsx(
|
|
8795
|
+
HoverableRadioItem,
|
|
8796
|
+
{
|
|
8797
|
+
item,
|
|
8798
|
+
imageRenderer,
|
|
8799
|
+
styles,
|
|
8800
|
+
isChild: false,
|
|
8801
|
+
onClick: () => setSelectedServiceId(item.id)
|
|
8802
|
+
},
|
|
8803
|
+
index
|
|
8804
|
+
);
|
|
8805
|
+
}
|
|
8806
|
+
return null;
|
|
8807
|
+
})
|
|
8762
8808
|
}
|
|
8763
|
-
|
|
8764
|
-
})
|
|
8809
|
+
)
|
|
8765
8810
|
}
|
|
8766
8811
|
)
|
|
8767
8812
|
}
|
|
@@ -10610,6 +10655,14 @@ var useStyles23 = makeStyles({
|
|
|
10610
10655
|
gap: "1rem",
|
|
10611
10656
|
justifyContent: "flex-end",
|
|
10612
10657
|
marginTop: "1rem"
|
|
10658
|
+
},
|
|
10659
|
+
passengerItemDisabled: {
|
|
10660
|
+
opacity: 0.5,
|
|
10661
|
+
cursor: "not-allowed",
|
|
10662
|
+
backgroundColor: tokens.colorNeutralBackgroundDisabled,
|
|
10663
|
+
":hover": {
|
|
10664
|
+
backgroundColor: tokens.colorNeutralBackgroundDisabled
|
|
10665
|
+
}
|
|
10613
10666
|
}
|
|
10614
10667
|
});
|
|
10615
10668
|
var ModalListPassenger = ({
|
|
@@ -10637,11 +10690,6 @@ var ModalListPassenger = ({
|
|
|
10637
10690
|
onSelectPassenger(passenger);
|
|
10638
10691
|
handleClose();
|
|
10639
10692
|
};
|
|
10640
|
-
const filteredPassengers = passengers.filter((passenger) => {
|
|
10641
|
-
if (!searchQuery) return true;
|
|
10642
|
-
const query = searchQuery.toLowerCase();
|
|
10643
|
-
return passenger.fullName && passenger.fullName.toLowerCase().includes(query) || passenger.ageLabel && passenger.ageLabel.toLowerCase().includes(query);
|
|
10644
|
-
});
|
|
10645
10693
|
return /* @__PURE__ */ jsx(
|
|
10646
10694
|
Dialog,
|
|
10647
10695
|
{
|
|
@@ -10666,71 +10714,103 @@ var ModalListPassenger = ({
|
|
|
10666
10714
|
contentBefore: /* @__PURE__ */ jsx(Icon, { icon: "fluent:search-24-regular" }),
|
|
10667
10715
|
placeholder: mergedLabels.searchPlaceholder,
|
|
10668
10716
|
value: searchQuery,
|
|
10669
|
-
onChange: (_, data) =>
|
|
10717
|
+
onChange: (_, data) => {
|
|
10718
|
+
console.log(155, data);
|
|
10719
|
+
onSearchChange(data.value);
|
|
10720
|
+
},
|
|
10670
10721
|
size: "large"
|
|
10671
10722
|
}
|
|
10672
10723
|
),
|
|
10673
|
-
/* @__PURE__ */ jsx("div", { className: styles.passengerList, children:
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
padding: ".4em .9em"
|
|
10703
|
-
},
|
|
10704
|
-
children: "Pemilik Akun"
|
|
10705
|
-
}
|
|
10706
|
-
)
|
|
10707
|
-
] }),
|
|
10708
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
10709
|
-
/* @__PURE__ */ jsxs(Body1, { children: [
|
|
10710
|
-
passenger.ageLabel,
|
|
10711
|
-
" \xB7 ",
|
|
10712
|
-
passenger.identityTypeCode,
|
|
10713
|
-
" ",
|
|
10714
|
-
passenger.identityId
|
|
10715
|
-
] })
|
|
10716
|
-
] }),
|
|
10717
|
-
/* @__PURE__ */ jsx(
|
|
10718
|
-
Button,
|
|
10719
|
-
{
|
|
10720
|
-
appearance: "transparent",
|
|
10721
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:chevron-right-24-regular" }),
|
|
10722
|
-
onClick: (e) => {
|
|
10723
|
-
e.preventDefault();
|
|
10724
|
-
e.stopPropagation();
|
|
10725
|
-
onEditPassenger(passenger);
|
|
10726
|
-
},
|
|
10727
|
-
"aria-label": mergedLabels.editPassengerAriaLabel
|
|
10724
|
+
/* @__PURE__ */ jsx("div", { className: styles.passengerList, children: [...passengers].sort((a, b) => {
|
|
10725
|
+
const isDifferentAgeA = a.ageId !== passengerAgeId;
|
|
10726
|
+
const isExcludedFromSearchA = searchQuery ? !a.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10727
|
+
const isDisabledA = isDifferentAgeA || isExcludedFromSearchA;
|
|
10728
|
+
const isDifferentAgeB = b.ageId !== passengerAgeId;
|
|
10729
|
+
const isExcludedFromSearchB = searchQuery ? !b.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10730
|
+
const isDisabledB = isDifferentAgeB || isExcludedFromSearchB;
|
|
10731
|
+
if (isDisabledA === isDisabledB) return 0;
|
|
10732
|
+
return isDisabledA ? 1 : -1;
|
|
10733
|
+
}).map((passenger, index) => {
|
|
10734
|
+
const isDifferentAge = passenger.ageId !== passengerAgeId;
|
|
10735
|
+
const isExcludedFromSearch = searchQuery ? !passenger.fullName.toLowerCase().includes(searchQuery.toLowerCase()) : false;
|
|
10736
|
+
const isDisabled = isDifferentAge || isExcludedFromSearch;
|
|
10737
|
+
console.log(
|
|
10738
|
+
170,
|
|
10739
|
+
isDisabled,
|
|
10740
|
+
isDifferentAge,
|
|
10741
|
+
isExcludedFromSearch
|
|
10742
|
+
);
|
|
10743
|
+
return /* @__PURE__ */ jsxs(
|
|
10744
|
+
"div",
|
|
10745
|
+
{
|
|
10746
|
+
className: mergeClasses(
|
|
10747
|
+
styles.passengerItem,
|
|
10748
|
+
isDisabled && styles.passengerItemDisabled
|
|
10749
|
+
),
|
|
10750
|
+
onClick: () => {
|
|
10751
|
+
if (!isDisabled) {
|
|
10752
|
+
handleSelectPassenger(passenger);
|
|
10728
10753
|
}
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10754
|
+
},
|
|
10755
|
+
role: "button",
|
|
10756
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
10757
|
+
onKeyDown: (e) => {
|
|
10758
|
+
if (isDisabled) return;
|
|
10759
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10760
|
+
e.preventDefault();
|
|
10761
|
+
handleSelectPassenger(passenger);
|
|
10762
|
+
}
|
|
10763
|
+
},
|
|
10764
|
+
children: [
|
|
10765
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10766
|
+
/* @__PURE__ */ jsxs(Subtitle2, { children: [
|
|
10767
|
+
passenger.fullName,
|
|
10768
|
+
" ",
|
|
10769
|
+
passenger.isAccountOwner && /* @__PURE__ */ jsx(
|
|
10770
|
+
Caption2Strong,
|
|
10771
|
+
{
|
|
10772
|
+
style: {
|
|
10773
|
+
backgroundColor: "#F3F9FD",
|
|
10774
|
+
border: `1px solid #A9D3F2`,
|
|
10775
|
+
borderRadius: "1em",
|
|
10776
|
+
display: "inline-block",
|
|
10777
|
+
color: "#0078D4",
|
|
10778
|
+
padding: ".4em .9em"
|
|
10779
|
+
},
|
|
10780
|
+
children: "Pemilik Akun"
|
|
10781
|
+
}
|
|
10782
|
+
)
|
|
10783
|
+
] }),
|
|
10784
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
10785
|
+
/* @__PURE__ */ jsxs(Body1, { children: [
|
|
10786
|
+
passenger.ageLabel,
|
|
10787
|
+
" \xB7 ",
|
|
10788
|
+
passenger.identityTypeCode,
|
|
10789
|
+
" ",
|
|
10790
|
+
passenger.identityId
|
|
10791
|
+
] })
|
|
10792
|
+
] }),
|
|
10793
|
+
/* @__PURE__ */ jsx(
|
|
10794
|
+
Button,
|
|
10795
|
+
{
|
|
10796
|
+
appearance: "transparent",
|
|
10797
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:chevron-right-24-regular" }),
|
|
10798
|
+
disabled: isDisabled,
|
|
10799
|
+
onClick: (e) => {
|
|
10800
|
+
e.preventDefault();
|
|
10801
|
+
e.stopPropagation();
|
|
10802
|
+
if (!isDisabled) {
|
|
10803
|
+
onEditPassenger(passenger);
|
|
10804
|
+
}
|
|
10805
|
+
},
|
|
10806
|
+
"aria-label": mergedLabels.editPassengerAriaLabel
|
|
10807
|
+
}
|
|
10808
|
+
)
|
|
10809
|
+
]
|
|
10810
|
+
},
|
|
10811
|
+
passenger.id || `passenger-${index}`
|
|
10812
|
+
);
|
|
10813
|
+
}) }),
|
|
10734
10814
|
/* @__PURE__ */ jsxs("div", { className: styles.actions, children: [
|
|
10735
10815
|
/* @__PURE__ */ jsx(
|
|
10736
10816
|
Button,
|