@asdp/ferryui 0.1.22-dev.9813 → 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.mjs CHANGED
@@ -10655,6 +10655,14 @@ var useStyles23 = makeStyles({
10655
10655
  gap: "1rem",
10656
10656
  justifyContent: "flex-end",
10657
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
+ }
10658
10666
  }
10659
10667
  });
10660
10668
  var ModalListPassenger = ({
@@ -10682,11 +10690,6 @@ var ModalListPassenger = ({
10682
10690
  onSelectPassenger(passenger);
10683
10691
  handleClose();
10684
10692
  };
10685
- const filteredPassengers = passengers.filter((passenger) => {
10686
- if (!searchQuery) return true;
10687
- const query = searchQuery.toLowerCase();
10688
- return passenger.fullName && passenger.fullName.toLowerCase().includes(query) || passenger.ageLabel && passenger.ageLabel.toLowerCase().includes(query);
10689
- });
10690
10693
  return /* @__PURE__ */ jsx(
10691
10694
  Dialog,
10692
10695
  {
@@ -10711,71 +10714,103 @@ var ModalListPassenger = ({
10711
10714
  contentBefore: /* @__PURE__ */ jsx(Icon, { icon: "fluent:search-24-regular" }),
10712
10715
  placeholder: mergedLabels.searchPlaceholder,
10713
10716
  value: searchQuery,
10714
- onChange: (_, data) => onSearchChange(data.value),
10717
+ onChange: (_, data) => {
10718
+ console.log(155, data);
10719
+ onSearchChange(data.value);
10720
+ },
10715
10721
  size: "large"
10716
10722
  }
10717
10723
  ),
10718
- /* @__PURE__ */ jsx("div", { className: styles.passengerList, children: filteredPassengers.filter(
10719
- (item) => item.ageId === passengerAgeId
10720
- ).map((passenger, index) => /* @__PURE__ */ jsxs(
10721
- "div",
10722
- {
10723
- className: styles.passengerItem,
10724
- onClick: () => handleSelectPassenger(passenger),
10725
- role: "button",
10726
- tabIndex: 0,
10727
- onKeyDown: (e) => {
10728
- if (e.key === "Enter" || e.key === " ") {
10729
- e.preventDefault();
10730
- handleSelectPassenger(passenger);
10731
- }
10732
- },
10733
- children: [
10734
- /* @__PURE__ */ jsxs("div", { children: [
10735
- /* @__PURE__ */ jsxs(Subtitle2, { children: [
10736
- passenger.fullName,
10737
- " ",
10738
- passenger.isAccountOwner && /* @__PURE__ */ jsx(
10739
- Caption2Strong,
10740
- {
10741
- style: {
10742
- backgroundColor: "#F3F9FD",
10743
- border: `1px solid #A9D3F2`,
10744
- borderRadius: "1em",
10745
- display: "inline-block",
10746
- color: "#0078D4",
10747
- padding: ".4em .9em"
10748
- },
10749
- children: "Pemilik Akun"
10750
- }
10751
- )
10752
- ] }),
10753
- /* @__PURE__ */ jsx("br", {}),
10754
- /* @__PURE__ */ jsxs(Body1, { children: [
10755
- passenger.ageLabel,
10756
- " \xB7 ",
10757
- passenger.identityTypeCode,
10758
- " ",
10759
- passenger.identityId
10760
- ] })
10761
- ] }),
10762
- /* @__PURE__ */ jsx(
10763
- Button,
10764
- {
10765
- appearance: "transparent",
10766
- icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:chevron-right-24-regular" }),
10767
- onClick: (e) => {
10768
- e.preventDefault();
10769
- e.stopPropagation();
10770
- onEditPassenger(passenger);
10771
- },
10772
- "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);
10773
10753
  }
10774
- )
10775
- ]
10776
- },
10777
- passenger.id || `passenger-${index}`
10778
- )) }),
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
+ }) }),
10779
10814
  /* @__PURE__ */ jsxs("div", { className: styles.actions, children: [
10780
10815
  /* @__PURE__ */ jsx(
10781
10816
  Button,