@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.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,103 @@ 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) => onSearchChange(data.value),
10726
+ onChange: (_, data) => {
10727
+ console.log(155, data);
10728
+ onSearchChange(data.value);
10729
+ },
10724
10730
  size: "large"
10725
10731
  }
10726
10732
  ),
10727
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.passengerList, children: filteredPassengers.filter(
10728
- (item) => item.ageId === passengerAgeId
10729
- ).map((passenger, index) => /* @__PURE__ */ jsxRuntime.jsxs(
10730
- "div",
10731
- {
10732
- className: styles.passengerItem,
10733
- onClick: () => handleSelectPassenger(passenger),
10734
- role: "button",
10735
- tabIndex: 0,
10736
- onKeyDown: (e) => {
10737
- if (e.key === "Enter" || e.key === " ") {
10738
- e.preventDefault();
10739
- handleSelectPassenger(passenger);
10740
- }
10741
- },
10742
- children: [
10743
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10744
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Subtitle2, { children: [
10745
- passenger.fullName,
10746
- " ",
10747
- passenger.isAccountOwner && /* @__PURE__ */ jsxRuntime.jsx(
10748
- reactComponents.Caption2Strong,
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
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);
10782
10762
  }
10783
- )
10784
- ]
10785
- },
10786
- passenger.id || `passenger-${index}`
10787
- )) }),
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
+ }) }),
10788
10823
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.actions, children: [
10789
10824
  /* @__PURE__ */ jsxRuntime.jsx(
10790
10825
  reactComponents.Button,