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