@asdp/ferryui 0.1.22-dev.9803 → 0.1.22-dev.9813

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
@@ -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
- Accordion,
8735
+ "div",
8702
8736
  {
8703
- collapsible: true,
8704
- openItems,
8705
- onToggle: (_, data) => setOpenItems(data.openItems),
8706
- className: styles.passengerSection,
8737
+ ref: scrollContainerRef,
8738
+ style: {
8739
+ maxHeight: "700px",
8740
+ overflowY: "auto"
8741
+ },
8707
8742
  children: /* @__PURE__ */ jsx(
8708
- RadioGroup,
8743
+ Accordion,
8709
8744
  {
8710
- value: String(selectedServiceId),
8711
- onChange: (_, data) => setSelectedServiceId(Number(data.value)),
8712
- children: serviceTypes.map((item, index) => {
8713
- if (item.children.length > 0) {
8714
- return /* @__PURE__ */ jsxs(
8715
- AccordionItem,
8716
- {
8717
- value: item?.id,
8718
- className: styles.accordionItem,
8719
- children: [
8720
- /* @__PURE__ */ jsx(
8721
- AccordionHeader,
8722
- {
8723
- className: styles.accordionHeader,
8724
- expandIconPosition: "end",
8725
- children: /* @__PURE__ */ jsx(
8726
- HoverableAccordionHeaderContent,
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
- imageRenderer,
8730
- styles
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
- /* @__PURE__ */ jsx(AccordionPanel, { className: styles.accordionBody, children: item.children.length > 0 && item.children.map((childItem, childIndex) => /* @__PURE__ */ jsx(
8736
- HoverableRadioItem,
8737
- {
8738
- item: childItem,
8739
- imageRenderer,
8740
- styles,
8741
- isChild: true,
8742
- onClick: () => setSelectedServiceId(childItem.id)
8743
- },
8744
- childIndex
8745
- )) })
8746
- ]
8747
- },
8748
- index
8749
- );
8750
- } else if (item.children.length === 0) {
8751
- return /* @__PURE__ */ jsx(
8752
- HoverableRadioItem,
8753
- {
8754
- item,
8755
- imageRenderer,
8756
- styles,
8757
- isChild: false,
8758
- onClick: () => setSelectedServiceId(item.id)
8759
- },
8760
- index
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
- return null;
8764
- })
8809
+ )
8765
8810
  }
8766
8811
  )
8767
8812
  }
@@ -15361,6 +15406,15 @@ var useStyles38 = makeStyles({
15361
15406
  backgroundColor: tokens.colorNeutralBackground1,
15362
15407
  boxShadow: tokens.shadow4,
15363
15408
  zIndex: 3
15409
+ },
15410
+ totalAmount: {
15411
+ backgroundColor: tokens.colorNeutralBackground3,
15412
+ borderRadius: tokens.borderRadius2XLarge,
15413
+ ...shorthands.padding(
15414
+ tokens.spacingHorizontalM,
15415
+ tokens.spacingHorizontalM
15416
+ ),
15417
+ color: tokens.colorNeutralForeground4
15364
15418
  }
15365
15419
  });
15366
15420
  var CardPaymentInfo = ({
@@ -15418,7 +15472,7 @@ var CardPaymentInfo = ({
15418
15472
  {
15419
15473
  size: "large",
15420
15474
  label: /* @__PURE__ */ jsx(Subtitle2, { style: { color: tokens.colorNeutralForeground1 }, children: mergedLabels.totalPayment }),
15421
- children: /* @__PURE__ */ jsxs(Title2, { children: [
15475
+ children: /* @__PURE__ */ jsxs(Body2, { className: styles.totalAmount, children: [
15422
15476
  mergedLabels.currencySymbol,
15423
15477
  " ",
15424
15478
  totalAmount.toLocaleString(