@asdp/ferryui 0.1.22-dev.9233 → 0.1.22-dev.9319

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
@@ -494,7 +494,7 @@ var useStyles2 = reactComponents.makeStyles({
494
494
  display: "flex",
495
495
  gap: `${spacing2[360]}px`,
496
496
  alignItems: "center",
497
- justifyContent: "center",
497
+ justifyContent: "start",
498
498
  [`@media (max-width: ${extendedTokens.breakpointMd})`]: {
499
499
  gap: reactComponents.tokens.spacingVerticalXS
500
500
  }
@@ -502,7 +502,7 @@ var useStyles2 = reactComponents.makeStyles({
502
502
  carouselContainerNoNav: {
503
503
  display: "flex",
504
504
  alignItems: "center",
505
- justifyContent: "center"
505
+ justifyContent: "start"
506
506
  },
507
507
  customCarouselNav: {
508
508
  display: "flex",
@@ -590,6 +590,29 @@ var useStyles2 = reactComponents.makeStyles({
590
590
  height: "10px"
591
591
  }
592
592
  }
593
+ },
594
+ singleIndicatorWrapper: {
595
+ display: "flex",
596
+ justifyContent: "center",
597
+ alignItems: "center",
598
+ marginTop: reactComponents.tokens.spacingVerticalXXL,
599
+ ...reactComponents.shorthands.padding(reactComponents.tokens.spacingVerticalS, reactComponents.tokens.spacingVerticalM),
600
+ borderRadius: reactComponents.tokens.borderRadiusCircular
601
+ },
602
+ singleIndicatorDot: {
603
+ backgroundImage: "linear-gradient(to right,#00B3BD, #8DC63F)",
604
+ display: "inline-block",
605
+ width: "55px",
606
+ height: "16px",
607
+ borderRadius: reactComponents.tokens.borderRadiusCircular,
608
+ "@media (max-width: 768px)": {
609
+ width: "35px",
610
+ height: "13px"
611
+ },
612
+ "@media (max-width: 425px)": {
613
+ width: "25px",
614
+ height: "10px"
615
+ }
593
616
  }
594
617
  });
595
618
  var CarouselWithCustomNav = ({
@@ -615,6 +638,8 @@ var CarouselWithCustomNav = ({
615
638
  }) => {
616
639
  const styles = useStyles2();
617
640
  const [internalIndex, setInternalIndex] = React.useState(0);
641
+ const totalSlides = React__default.default.Children.count(children);
642
+ const isSingleSlide = totalSlides === 1;
618
643
  const labels = React__default.default.useMemo(
619
644
  () => ({
620
645
  ...DEFAULT_LABELS2[language],
@@ -623,20 +648,19 @@ var CarouselWithCustomNav = ({
623
648
  }),
624
649
  [language, customLabels, deprecatedAriaLabel]
625
650
  );
626
- const activeIndex = controlledIndex !== void 0 ? controlledIndex : internalIndex;
651
+ const activeIndex = isSingleSlide ? 0 : controlledIndex !== void 0 ? controlledIndex : internalIndex;
627
652
  const handleIndexChange = React.useCallback(
628
653
  (index) => {
654
+ if (isSingleSlide) return;
629
655
  if (controlledIndex === void 0) {
630
656
  setInternalIndex(index);
631
657
  }
632
658
  onActiveIndexChange?.(index);
633
659
  },
634
- [controlledIndex, onActiveIndexChange]
660
+ [controlledIndex, onActiveIndexChange, isSingleSlide]
635
661
  );
636
662
  React__default.default.useEffect(() => {
637
- if (!autoPlay) return;
638
- const totalSlides = React__default.default.Children.count(children);
639
- if (totalSlides <= 1) return;
663
+ if (!autoPlay || isSingleSlide) return;
640
664
  const intervalId = setInterval(() => {
641
665
  let nextIndex = activeIndex + 1;
642
666
  if (nextIndex >= totalSlides) {
@@ -653,15 +677,16 @@ var CarouselWithCustomNav = ({
653
677
  }, [
654
678
  autoPlay,
655
679
  autoPlayInterval,
656
- children,
680
+ totalSlides,
657
681
  circular,
658
682
  activeIndex,
659
683
  controlledIndex,
660
- onActiveIndexChange
684
+ onActiveIndexChange,
685
+ isSingleSlide
661
686
  ]);
662
687
  const defaultAnnouncement = React.useCallback(
663
- (index, totalSlides) => {
664
- return labels.announcementTemplate.replace("{index}", (index + 1).toString()).replace("{total}", totalSlides.toString());
688
+ (index, totalSlides2) => {
689
+ return labels.announcementTemplate.replace("{index}", (index + 1).toString()).replace("{total}", totalSlides2.toString());
665
690
  },
666
691
  [labels.announcementTemplate]
667
692
  );
@@ -669,7 +694,7 @@ var CarouselWithCustomNav = ({
669
694
  return /* @__PURE__ */ jsxRuntime.jsxs(
670
695
  reactComponents.Carousel,
671
696
  {
672
- circular,
697
+ circular: isSingleSlide ? true : circular,
673
698
  draggable,
674
699
  align,
675
700
  className: reactComponents.mergeClasses(styles.carousel, className),
@@ -678,53 +703,73 @@ var CarouselWithCustomNav = ({
678
703
  activeIndex,
679
704
  onActiveIndexChange: (_, data) => handleIndexChange(data.index),
680
705
  children: [
681
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: showNavButtons ? styles.carouselContainer : styles.carouselContainerNoNav, children: [
682
- showNavButtons && /* @__PURE__ */ jsxRuntime.jsx(
683
- reactComponents.CarouselButton,
684
- {
685
- navType: "prev",
686
- "aria-label": labels.prevButtonAriaLabel,
687
- className: styles.customeCarouselButton
688
- }
689
- ),
690
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.CarouselViewport, { style: { overflow: "hidden", paddingBottom: "10px" }, children: [
691
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
692
- reactComponents.Button,
693
- {
694
- icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DismissRegular, {}),
695
- shape: "circular",
696
- onClick: onCloseClick,
697
- "aria-label": labels.closeButtonAriaLabel,
698
- className: reactComponents.mergeClasses(
699
- styles.closeButton,
700
- showNavButtons ? styles.closeButtonWithNav : styles.closeButtonWithoutNav
706
+ /* @__PURE__ */ jsxRuntime.jsxs(
707
+ "div",
708
+ {
709
+ className: showNavButtons ? styles.carouselContainer : styles.carouselContainerNoNav,
710
+ children: [
711
+ showNavButtons && !isSingleSlide && /* @__PURE__ */ jsxRuntime.jsx(
712
+ reactComponents.CarouselButton,
713
+ {
714
+ navType: "prev",
715
+ "aria-label": labels.prevButtonAriaLabel,
716
+ className: styles.customeCarouselButton
717
+ }
718
+ ),
719
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.CarouselViewport, { style: { overflow: "hidden", paddingBottom: "10px" }, children: [
720
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
721
+ reactComponents.Button,
722
+ {
723
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DismissRegular, {}),
724
+ shape: "circular",
725
+ onClick: onCloseClick,
726
+ "aria-label": labels.closeButtonAriaLabel,
727
+ className: reactComponents.mergeClasses(
728
+ styles.closeButton,
729
+ showNavButtons ? styles.closeButtonWithNav : styles.closeButtonWithoutNav
730
+ )
731
+ }
732
+ ),
733
+ /* @__PURE__ */ jsxRuntime.jsx(
734
+ reactComponents.CarouselSlider,
735
+ {
736
+ cardFocus,
737
+ "aria-label": labels.carouselAriaLabel,
738
+ children: isSingleSlide ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
739
+ children,
740
+ children
741
+ ] }) : children
742
+ }
701
743
  )
702
- }
703
- ),
704
- /* @__PURE__ */ jsxRuntime.jsx(
705
- reactComponents.CarouselSlider,
706
- {
707
- cardFocus,
708
- "aria-label": labels.carouselAriaLabel,
709
- children
710
- }
711
- )
712
- ] }),
713
- showNavButtons && /* @__PURE__ */ jsxRuntime.jsx(
714
- reactComponents.CarouselButton,
715
- {
716
- navType: "next",
717
- "aria-label": labels.nextButtonAriaLabel,
718
- className: styles.customeCarouselButton
719
- }
720
- )
721
- ] }),
722
- /* @__PURE__ */ jsxRuntime.jsx(
744
+ ] }),
745
+ showNavButtons && !isSingleSlide && /* @__PURE__ */ jsxRuntime.jsx(
746
+ reactComponents.CarouselButton,
747
+ {
748
+ navType: "next",
749
+ "aria-label": labels.nextButtonAriaLabel,
750
+ className: styles.customeCarouselButton
751
+ }
752
+ )
753
+ ]
754
+ }
755
+ ),
756
+ isSingleSlide ? /* @__PURE__ */ jsxRuntime.jsx(
757
+ "div",
758
+ {
759
+ className: styles.singleIndicatorWrapper,
760
+ style: {
761
+ backgroundColor: darkNavBackground ? reactComponents.tokens.colorSubtleBackgroundInverted : reactComponents.tokens.colorSubtleBackground,
762
+ justifyContent: align === "start" ? "flex-start" : align === "end" ? "flex-end" : "center"
763
+ },
764
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.singleIndicatorDot })
765
+ }
766
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
723
767
  reactComponents.CarouselNav,
724
768
  {
725
769
  style: {
726
770
  backgroundColor: darkNavBackground ? reactComponents.tokens.colorSubtleBackgroundInverted : reactComponents.tokens.colorSubtleBackground,
727
- marginTop: reactComponents.tokens.spacingVerticalXXL
771
+ marginTop: reactComponents.tokens.spacingVerticalXXL,
772
+ justifyContent: align === "start" ? "flex-start" : align === "end" ? "flex-end" : "center"
728
773
  },
729
774
  appearance: "brand",
730
775
  className: styles.carouselNavButton,
@@ -2477,7 +2522,9 @@ var DatePickerInput = React.forwardRef(
2477
2522
  contentBefore,
2478
2523
  onClick,
2479
2524
  style,
2525
+ min,
2480
2526
  max,
2527
+ disablePastDates = false,
2481
2528
  ...restProps
2482
2529
  }, ref) => {
2483
2530
  const [isOpen, setIsOpen] = React.useState(false);
@@ -2506,6 +2553,12 @@ var DatePickerInput = React.forwardRef(
2506
2553
  }
2507
2554
  onClick?.(e);
2508
2555
  };
2556
+ const getStartOfToday = () => {
2557
+ const today = /* @__PURE__ */ new Date();
2558
+ today.setHours(0, 0, 0, 0);
2559
+ return today;
2560
+ };
2561
+ const minDate = min ? new Date(min) : disablePastDates ? getStartOfToday() : void 0;
2509
2562
  return /* @__PURE__ */ jsxRuntime.jsxs(
2510
2563
  reactComponents.Popover,
2511
2564
  {
@@ -2556,6 +2609,7 @@ var DatePickerInput = React.forwardRef(
2556
2609
  showGoToToday: true,
2557
2610
  highlightSelectedMonth: true,
2558
2611
  showMonthPickerAsOverlay: false,
2612
+ minDate,
2559
2613
  maxDate: max ? new Date(max) : void 0
2560
2614
  }
2561
2615
  ) })
@@ -3138,7 +3192,8 @@ var InputDynamic = ({
3138
3192
  onChange,
3139
3193
  language = "id",
3140
3194
  labels,
3141
- menuPlacement
3195
+ menuPlacement,
3196
+ disablePastDates = false
3142
3197
  }) => {
3143
3198
  const styles = useStyles8();
3144
3199
  const mergedLabels = { ...DEFAULT_LABELS7[language], ...labels };
@@ -3443,6 +3498,7 @@ var InputDynamic = ({
3443
3498
  children: /* @__PURE__ */ jsxRuntime.jsx(
3444
3499
  PhoneInput,
3445
3500
  {
3501
+ countryCodeEditable: false,
3446
3502
  inputStyle: phoneInputSizeStyle,
3447
3503
  country: defaultCountry.toLowerCase(),
3448
3504
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
@@ -3550,6 +3606,7 @@ var InputDynamic = ({
3550
3606
  children: /* @__PURE__ */ jsxRuntime.jsx(
3551
3607
  PhoneInput,
3552
3608
  {
3609
+ countryCodeEditable: false,
3553
3610
  country: defaultCountry.toLowerCase(),
3554
3611
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
3555
3612
  onChange: (value, data) => {
@@ -3749,6 +3806,7 @@ var InputDynamic = ({
3749
3806
  children: /* @__PURE__ */ jsxRuntime.jsx(
3750
3807
  PhoneInput,
3751
3808
  {
3809
+ countryCodeEditable: false,
3752
3810
  ...phoneInputProps,
3753
3811
  country: defaultCountry.toLowerCase(),
3754
3812
  disabled,
@@ -3804,7 +3862,9 @@ var InputDynamic = ({
3804
3862
  size,
3805
3863
  onClick,
3806
3864
  style: inputStyle,
3807
- max: max ? String(max) : void 0
3865
+ max: max ? String(max) : void 0,
3866
+ min: min ? String(min) : void 0,
3867
+ disablePastDates
3808
3868
  }
3809
3869
  );
3810
3870
  }
@@ -5339,7 +5399,8 @@ var DEFAULT_LABELS10 = {
5339
5399
  loadingData: "Memuat data...",
5340
5400
  harborNotFound: "Pelabuhan tidak ditemukan",
5341
5401
  closeAriaLabel: "Tutup",
5342
- popularHarborHeader: "Pelabuhan Populer"
5402
+ popularHarborHeader: "Pelabuhan Populer",
5403
+ favoriteHeader: "Favorit"
5343
5404
  },
5344
5405
  en: {
5345
5406
  title: "Select Harbor",
@@ -5350,7 +5411,8 @@ var DEFAULT_LABELS10 = {
5350
5411
  loadingData: "Loading data...",
5351
5412
  harborNotFound: "Harbor not found",
5352
5413
  closeAriaLabel: "Close",
5353
- popularHarborHeader: "Popular Harbor"
5414
+ popularHarborHeader: "Popular Harbor",
5415
+ favoriteHeader: "Favorite"
5354
5416
  }
5355
5417
  };
5356
5418
  var useStyles11 = reactComponents.makeStyles({
@@ -5419,10 +5481,20 @@ var useStyles11 = reactComponents.makeStyles({
5419
5481
  display: "flex",
5420
5482
  gap: "1rem",
5421
5483
  marginBottom: "1rem",
5422
- flexWrap: "wrap"
5484
+ flexWrap: "wrap",
5485
+ marginTop: "1rem"
5423
5486
  },
5424
5487
  circularButton: {
5425
- borderRadius: reactComponents.tokens.borderRadiusCircular
5488
+ borderRadius: reactComponents.tokens.borderRadius3XLarge,
5489
+ border: `1px solid ${reactComponents.tokens.colorBrandBackground}`,
5490
+ backgroundColor: brandColors2["140"],
5491
+ gap: "5px"
5492
+ },
5493
+ buttonContent: {
5494
+ display: "flex",
5495
+ flexDirection: "column",
5496
+ alignItems: "center",
5497
+ justifyContent: "center"
5426
5498
  },
5427
5499
  headerRow: {
5428
5500
  display: "flex",
@@ -5436,11 +5508,13 @@ var useStyles11 = reactComponents.makeStyles({
5436
5508
  historyItem: {
5437
5509
  display: "flex",
5438
5510
  justifyContent: "space-between",
5511
+ alignItems: "center",
5439
5512
  marginTop: "1rem",
5440
5513
  marginBottom: "1rem"
5441
5514
  },
5442
5515
  iconMargin: {
5443
- marginRight: "0.5rem"
5516
+ marginRight: "1rem"
5517
+ // fontSize: tokens.fontSizeBase400
5444
5518
  },
5445
5519
  cursorPointer: {
5446
5520
  cursor: "pointer"
@@ -5457,14 +5531,51 @@ var useStyles11 = reactComponents.makeStyles({
5457
5531
  },
5458
5532
  harborItem: {
5459
5533
  display: "flex",
5460
- justifyContent: "space-between"
5534
+ justifyContent: "space-between",
5535
+ alignItems: "center"
5461
5536
  },
5462
5537
  emptyState: {
5463
5538
  textAlign: "center",
5464
5539
  padding: "32px",
5465
5540
  color: reactComponents.tokens.colorNeutralForeground3
5541
+ },
5542
+ listContent: {
5543
+ cursor: "pointer",
5544
+ display: "flex",
5545
+ justifyContent: "center",
5546
+ alignItems: "center"
5466
5547
  }
5467
5548
  });
5549
+ var HarborListItem = ({
5550
+ harbor,
5551
+ onSelect,
5552
+ trailingIcon,
5553
+ showDivider,
5554
+ containerClassName
5555
+ }) => {
5556
+ const styles = useStyles11();
5557
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5558
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerClassName, children: [
5559
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.listContent, onClick: () => onSelect(harbor), children: [
5560
+ /* @__PURE__ */ jsxRuntime.jsx(
5561
+ react.Icon,
5562
+ {
5563
+ icon: "fluent:vehicle-ship-24-regular",
5564
+ fontSize: 20,
5565
+ className: styles.iconMargin
5566
+ }
5567
+ ),
5568
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "left" }, children: [
5569
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: harbor.portName }),
5570
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
5571
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { children: harbor.branchName })
5572
+ ] })
5573
+ ] }),
5574
+ trailingIcon
5575
+ ] }),
5576
+ showDivider && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {})
5577
+ ] });
5578
+ };
5468
5579
  var ModalSearchHarbor = ({
5469
5580
  language = "id",
5470
5581
  labels,
@@ -5483,6 +5594,7 @@ var ModalSearchHarbor = ({
5483
5594
  onAddLastSearched,
5484
5595
  onRemoveLastSearched,
5485
5596
  onClearLastSearched,
5597
+ onClearFavorite,
5486
5598
  popularHarbors,
5487
5599
  showButtonFavorite = true
5488
5600
  }) => {
@@ -5541,119 +5653,169 @@ var ModalSearchHarbor = ({
5541
5653
  size: "large"
5542
5654
  }
5543
5655
  ) }),
5544
- favoriteHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsx(
5545
- reactComponents.Button,
5546
- {
5547
- onClick: () => handleSelect(harbor),
5548
- size: "medium",
5549
- appearance: "outline",
5550
- iconPosition: "before",
5551
- className: styles.circularButton,
5552
- icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:ribbon-20-filled" }),
5553
- children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: harbor.portName + ", " + harbor.branchName })
5554
- },
5555
- harbor.portId
5556
- )) }),
5557
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
5558
5656
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.resultList, children: [
5559
- lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5657
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5560
5658
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.headerRow, children: [
5561
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.lastSearchedHeader }),
5659
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.favoriteHeader }),
5562
5660
  /* @__PURE__ */ jsxRuntime.jsx(
5563
5661
  reactComponents.Caption1,
5564
5662
  {
5565
- className: `${styles.dangerText} ${styles.cursorPointer}`,
5566
- onClick: onClearLastSearched,
5663
+ className: reactComponents.mergeClasses(
5664
+ styles.dangerText,
5665
+ styles.cursorPointer
5666
+ ),
5667
+ onClick: onClearFavorite,
5567
5668
  children: mergedLabels.clearAllButton
5568
5669
  }
5569
5670
  )
5570
5671
  ] }),
5571
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.historyItem, children: [
5572
- /* @__PURE__ */ jsxRuntime.jsxs(
5573
- "div",
5574
- {
5575
- style: { cursor: "pointer" },
5576
- onClick: () => handleSelect(harbor),
5577
- children: [
5578
- /* @__PURE__ */ jsxRuntime.jsx(
5579
- react.Icon,
5580
- {
5581
- icon: "fluent:vehicle-ship-24-regular",
5582
- className: styles.iconMargin
5583
- }
5584
- ),
5585
- harbor.portName + ", " + harbor.branchName
5586
- ]
5587
- }
5588
- ),
5589
- /* @__PURE__ */ jsxRuntime.jsx(
5590
- react.Icon,
5591
- {
5592
- onClick: () => onRemoveLastSearched(harbor),
5593
- icon: "fluent:dismiss-24-regular",
5594
- color: reactComponents.tokens.colorStatusDangerForeground1,
5595
- className: styles.cursorPointer
5596
- }
5597
- )
5598
- ] }, harbor.portId)) }),
5599
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {})
5600
- ] }),
5601
- popularHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5602
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.headerRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.popularHarborHeader }) }),
5603
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: popularHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.historyItem, children: /* @__PURE__ */ jsxRuntime.jsxs(
5604
- "div",
5672
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsxs(
5673
+ reactComponents.Button,
5605
5674
  {
5606
- style: { cursor: "pointer" },
5607
5675
  onClick: () => handleSelect(harbor),
5676
+ size: "medium",
5677
+ appearance: "subtle",
5678
+ iconPosition: "before",
5679
+ className: styles.circularButton,
5680
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
5681
+ react.Icon,
5682
+ {
5683
+ icon: "fluent:vehicle-ship-20-regular",
5684
+ fontSize: 20,
5685
+ color: reactComponents.tokens.colorBrandBackground
5686
+ }
5687
+ ),
5608
5688
  children: [
5689
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.buttonContent, children: [
5690
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: harbor.portName }),
5691
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { children: harbor.branchName })
5692
+ ] }),
5609
5693
  /* @__PURE__ */ jsxRuntime.jsx(
5610
5694
  react.Icon,
5611
5695
  {
5612
- icon: "fluent:vehicle-ship-24-regular",
5613
- className: styles.iconMargin
5696
+ icon: "fluent:star-24-filled",
5697
+ fontSize: 20,
5698
+ color: reactComponents.tokens.colorBrandBackground,
5699
+ style: { marginLeft: 5 }
5614
5700
  }
5615
- ),
5616
- harbor.portName + ", " + harbor.branchName
5701
+ )
5617
5702
  ]
5618
- }
5619
- ) }, harbor.portId)) }),
5620
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {})
5703
+ },
5704
+ harbor.portId
5705
+ )) })
5706
+ ] }),
5707
+ lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5708
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.headerRow, children: [
5709
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.lastSearchedHeader }),
5710
+ /* @__PURE__ */ jsxRuntime.jsx(
5711
+ reactComponents.Caption1,
5712
+ {
5713
+ className: reactComponents.mergeClasses(
5714
+ styles.dangerText,
5715
+ styles.cursorPointer
5716
+ ),
5717
+ onClick: onClearLastSearched,
5718
+ children: mergedLabels.clearAllButton
5719
+ }
5720
+ )
5721
+ ] }),
5722
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsx(
5723
+ HarborListItem,
5724
+ {
5725
+ harbor,
5726
+ onSelect: handleSelect,
5727
+ containerClassName: styles.historyItem,
5728
+ trailingIcon: /* @__PURE__ */ jsxRuntime.jsx(
5729
+ react.Icon,
5730
+ {
5731
+ onClick: () => onRemoveLastSearched(harbor),
5732
+ icon: "fluent:dismiss-24-regular",
5733
+ fontSize: 20,
5734
+ className: styles.cursorPointer
5735
+ }
5736
+ ),
5737
+ showDivider: true
5738
+ },
5739
+ harbor.portId
5740
+ )) })
5741
+ ] }),
5742
+ popularHarbors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5743
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.headerRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: mergedLabels.popularHarborHeader }) }),
5744
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: popularHarbors.map((harbor) => /* @__PURE__ */ jsxRuntime.jsx(
5745
+ HarborListItem,
5746
+ {
5747
+ harbor,
5748
+ onSelect: handleSelect,
5749
+ containerClassName: styles.historyItem,
5750
+ showDivider: true
5751
+ },
5752
+ harbor.portId
5753
+ )) })
5621
5754
  ] }),
5622
5755
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { className: styles.sectionTitle, children: mergedLabels.allHarborsHeader }),
5623
5756
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.harborList, children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: [1, 2, 3, 4, 5].map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.harborItem, children: [
5624
- /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Skeleton, { style: { display: "flex", alignItems: "center", gap: "0.5rem", width: "70%" }, children: [
5625
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }),
5626
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "100%", height: "20px", borderRadius: "4px" } })
5627
- ] }),
5628
- showButtonFavorite && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }) })
5629
- ] }, item)) }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.harborItem, children: [
5630
5757
  /* @__PURE__ */ jsxRuntime.jsxs(
5631
- "div",
5758
+ reactComponents.Skeleton,
5632
5759
  {
5633
- className: styles.cursorPointer,
5634
- onClick: () => handleSelect(harbor),
5760
+ style: {
5761
+ display: "flex",
5762
+ alignItems: "center",
5763
+ gap: "0.5rem",
5764
+ width: "70%"
5765
+ },
5635
5766
  children: [
5636
5767
  /* @__PURE__ */ jsxRuntime.jsx(
5637
- react.Icon,
5768
+ reactComponents.SkeletonItem,
5638
5769
  {
5639
- icon: "fluent:vehicle-ship-24-regular",
5640
- className: styles.iconMargin
5770
+ style: {
5771
+ width: "24px",
5772
+ height: "24px",
5773
+ borderRadius: "4px"
5774
+ }
5641
5775
  }
5642
5776
  ),
5643
- harbor.portName + ", " + harbor.branchName
5777
+ /* @__PURE__ */ jsxRuntime.jsx(
5778
+ reactComponents.SkeletonItem,
5779
+ {
5780
+ style: {
5781
+ width: "100%",
5782
+ height: "20px",
5783
+ borderRadius: "4px"
5784
+ }
5785
+ }
5786
+ )
5644
5787
  ]
5645
5788
  }
5646
5789
  ),
5647
- showButtonFavorite && /* @__PURE__ */ jsxRuntime.jsx(
5648
- react.Icon,
5790
+ showButtonFavorite && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(
5791
+ reactComponents.SkeletonItem,
5649
5792
  {
5650
- icon: harbor.isFavorite ? "fluent:star-24-filled" : "fluent:star-24-regular",
5651
- color: reactComponents.tokens.colorBrandBackground,
5652
- className: styles.cursorPointer,
5653
- onClick: () => onToggleFavorite(harbor)
5793
+ style: {
5794
+ width: "24px",
5795
+ height: "24px",
5796
+ borderRadius: "4px"
5797
+ }
5654
5798
  }
5655
- )
5656
- ] }, index)) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.emptyState, children: mergedLabels.harborNotFound }) })
5799
+ ) })
5800
+ ] }, item)) }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsxRuntime.jsx(
5801
+ HarborListItem,
5802
+ {
5803
+ harbor,
5804
+ onSelect: handleSelect,
5805
+ containerClassName: styles.harborItem,
5806
+ trailingIcon: showButtonFavorite && /* @__PURE__ */ jsxRuntime.jsx(
5807
+ react.Icon,
5808
+ {
5809
+ icon: harbor.isFavorite ? "fluent:star-24-filled" : "fluent:star-24-regular",
5810
+ color: reactComponents.tokens.colorBrandBackground,
5811
+ className: styles.cursorPointer,
5812
+ onClick: () => onToggleFavorite(harbor)
5813
+ }
5814
+ ),
5815
+ showDivider: index !== harbors.length - 1
5816
+ },
5817
+ harbor.portId || index
5818
+ )) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.emptyState, children: mergedLabels.harborNotFound }) })
5657
5819
  ] })
5658
5820
  ] })
5659
5821
  ] }) })
@@ -8753,12 +8915,34 @@ var ModalListPassenger = ({
8753
8915
  }
8754
8916
  },
8755
8917
  children: [
8756
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Subtitle2, { children: [
8757
- passenger.fullName,
8758
- " (",
8759
- passenger.ageLabel,
8760
- " )"
8761
- ] }) }),
8918
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8919
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Subtitle2, { children: [
8920
+ passenger.fullName,
8921
+ " ",
8922
+ passenger.isAccountOwner && /* @__PURE__ */ jsxRuntime.jsx(
8923
+ reactComponents.Caption2Strong,
8924
+ {
8925
+ style: {
8926
+ backgroundColor: "#F3F9FD",
8927
+ border: `1px solid #A9D3F2`,
8928
+ borderRadius: "1em",
8929
+ display: "inline-block",
8930
+ color: "#0078D4",
8931
+ padding: ".4em .9em"
8932
+ },
8933
+ children: "Pemilik Akun"
8934
+ }
8935
+ )
8936
+ ] }),
8937
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
8938
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Body1, { children: [
8939
+ passenger.ageLabel,
8940
+ " \xB7 ",
8941
+ passenger.identityTypeCode,
8942
+ " ",
8943
+ passenger.identityId
8944
+ ] })
8945
+ ] }),
8762
8946
  /* @__PURE__ */ jsxRuntime.jsx(
8763
8947
  reactComponents.Button,
8764
8948
  {
@@ -8816,8 +9000,10 @@ var DEFAULT_LABELS22 = {
8816
9000
  idTypePlaceholder: "Pilih",
8817
9001
  idNumberLabel: "Nomor Identitas",
8818
9002
  idNumberPlaceholder: "Masukkan Nomor Identitas",
8819
- ageLabel: "Usia",
8820
- agePlaceholder: "Masukkan Usia",
9003
+ age: "Usia",
9004
+ agePlaceholder: "0 Tahun 0 Bulan",
9005
+ yearLabel: "tahun",
9006
+ monthLabel: "bulan",
8821
9007
  dateLabel: "Tanggal Lahir",
8822
9008
  datePlaceholder: "Masukkan Tanggal Lahir",
8823
9009
  cityLabel: "Kota Kabupaten",
@@ -8862,6 +9048,7 @@ var DEFAULT_LABELS22 = {
8862
9048
  minAge: "Usia minimal 1 tahun",
8863
9049
  maxAge: "Usia maksimal 150 tahun",
8864
9050
  requiredDate: "Tanggal lahir harus diisi",
9051
+ birthDateFuture: "Tanggal lahir tidak boleh di masa depan",
8865
9052
  requiredCity: "Kota/Kabupaten harus diisi",
8866
9053
  requiredCountry: "Negara harus diisi",
8867
9054
  requiredPhoneNumber: "Nomor telepon harus diisi",
@@ -8879,8 +9066,10 @@ var DEFAULT_LABELS22 = {
8879
9066
  idTypePlaceholder: "Select",
8880
9067
  idNumberLabel: "Identity Number",
8881
9068
  idNumberPlaceholder: "Enter Identity Number",
8882
- ageLabel: "Age",
8883
- agePlaceholder: "Enter Age",
9069
+ age: "Age",
9070
+ agePlaceholder: "0 Year 0 Month",
9071
+ yearLabel: "year(s)",
9072
+ monthLabel: "month(s)",
8884
9073
  dateLabel: "Date of Birth",
8885
9074
  datePlaceholder: "Enter Date of Birth",
8886
9075
  cityLabel: "City/Regency",
@@ -8925,6 +9114,7 @@ var DEFAULT_LABELS22 = {
8925
9114
  minAge: "Age must be at least 1 year",
8926
9115
  maxAge: "Age must be at most 150 years",
8927
9116
  requiredDate: "Date of birth is required",
9117
+ birthDateFuture: "Date of birth cannot be in the future",
8928
9118
  requiredCity: "City/Regency is required",
8929
9119
  requiredCountry: "Country is required",
8930
9120
  requiredPhoneNumber: "Phone number is required",
@@ -8933,24 +9123,23 @@ var DEFAULT_LABELS22 = {
8933
9123
  }
8934
9124
  }
8935
9125
  };
8936
- var TYPE_OPTIONS = [
8937
- {
8938
- label: "KTP",
8939
- value: "ktp"
8940
- },
8941
- {
8942
- label: "SIM",
8943
- value: "sim"
8944
- },
8945
- {
8946
- label: "Paspor",
8947
- value: "paspor"
8948
- },
8949
- {
8950
- label: "Lainnya",
8951
- value: "lainnya"
9126
+
9127
+ // src/utils/date.ts
9128
+ var calculateAge = (birthDate) => {
9129
+ const today = /* @__PURE__ */ new Date();
9130
+ const birth = new Date(birthDate);
9131
+ if (isNaN(birth.getTime())) return { years: 0, months: 0 };
9132
+ let years = today.getFullYear() - birth.getFullYear();
9133
+ let months = today.getMonth() - birth.getMonth();
9134
+ if (today.getDate() < birth.getDate()) {
9135
+ months--;
8952
9136
  }
8953
- ];
9137
+ if (months < 0) {
9138
+ years--;
9139
+ months += 12;
9140
+ }
9141
+ return { years: Math.max(0, years), months: Math.max(0, months) };
9142
+ };
8954
9143
  var useStyles23 = reactComponents.makeStyles({
8955
9144
  dialogSurface: {
8956
9145
  maxWidth: "600px",
@@ -9116,16 +9305,18 @@ var useStyles23 = reactComponents.makeStyles({
9116
9305
  }
9117
9306
  });
9118
9307
  var ModalPassengerForm = ({
9308
+ defaultValues,
9119
9309
  language = "id",
9120
9310
  labels,
9121
9311
  open,
9312
+ onChange,
9122
9313
  onClose,
9123
- title,
9124
9314
  onSubmit,
9125
- defaultValues,
9126
- isAdultForm = true,
9315
+ title,
9127
9316
  titleOptions,
9317
+ countryOptions,
9128
9318
  cityOptions,
9319
+ idTypeOptions,
9129
9320
  ticketClassOptions,
9130
9321
  onScanComplete
9131
9322
  }) => {
@@ -9136,7 +9327,6 @@ var ModalPassengerForm = ({
9136
9327
  ...labels?.errors
9137
9328
  };
9138
9329
  const displayTitle = title || mergedLabels.title;
9139
- const idTypes = ["KTP", "SIM", "Paspor"];
9140
9330
  const [isModalSelectIdTypeOpen, setIsModalSelectIdTypeOpen] = React.useState(false);
9141
9331
  const [isModalScanOpen, setIsModalScanOpen] = React.useState(false);
9142
9332
  const [scannedIdType, setScannedIdType] = React.useState(null);
@@ -9148,16 +9338,42 @@ var ModalPassengerForm = ({
9148
9338
  const { control, handleSubmit, reset, watch, setValue } = reactHookForm.useForm({
9149
9339
  defaultValues
9150
9340
  });
9151
- const idType = watch("idType");
9152
- const watchPassportCountry = watch("country");
9341
+ watch();
9342
+ const watchIdentityTypeId = watch("identityTypeId");
9343
+ const watchPassportCountryId = watch("countryId");
9344
+ const watchBirthdate = watch("birthdate");
9345
+ React.useEffect(() => {
9346
+ const subscription = watch((value, { name, type }) => {
9347
+ console.log("Changed field:", name);
9348
+ console.log("Change type:", type);
9349
+ onChange(value);
9350
+ });
9351
+ return () => subscription.unsubscribe();
9352
+ }, [watch, onChange]);
9153
9353
  React.useEffect(() => {
9154
9354
  reset(defaultValues);
9155
9355
  }, [defaultValues, reset]);
9156
9356
  React.useEffect(() => {
9157
- if (idType) {
9158
- setValue("idNumber", "");
9357
+ if (watchIdentityTypeId) {
9358
+ setValue("identityId", "");
9159
9359
  }
9160
- }, [idType, watchPassportCountry, setValue]);
9360
+ }, [watchIdentityTypeId, watchPassportCountryId, setValue]);
9361
+ React.useEffect(() => {
9362
+ if (watchBirthdate) {
9363
+ const { years, months } = calculateAge(watchBirthdate);
9364
+ setValue(
9365
+ "age",
9366
+ `${years} ${mergedLabels.yearLabel} ${months} ${mergedLabels.monthLabel}`
9367
+ );
9368
+ } else {
9369
+ setValue("age", "");
9370
+ }
9371
+ }, [
9372
+ watchBirthdate,
9373
+ setValue,
9374
+ mergedLabels.yearLabel,
9375
+ mergedLabels.monthLabel
9376
+ ]);
9161
9377
  const stopCamera = React.useCallback(() => {
9162
9378
  if (stream) {
9163
9379
  stream.getTracks().forEach((track) => track.stop());
@@ -9193,7 +9409,7 @@ var ModalPassengerForm = ({
9193
9409
  ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
9194
9410
  setCapturedImage(canvas.toDataURL("image/jpeg"));
9195
9411
  stopCamera();
9196
- if (scannedIdType === "KTP") {
9412
+ if (scannedIdType === IDENTITY_TYPE.KTP) {
9197
9413
  setScanStatus("reading");
9198
9414
  } else {
9199
9415
  setScanStatus("error");
@@ -9266,14 +9482,14 @@ var ModalPassengerForm = ({
9266
9482
  }
9267
9483
  stopCamera();
9268
9484
  if (name) {
9269
- setValue("name", name, {
9485
+ setValue("fullName", name, {
9270
9486
  shouldValidate: true,
9271
9487
  shouldDirty: true
9272
9488
  });
9273
9489
  }
9274
9490
  if (idNumber && scannedIdType) {
9275
- setValue("idType", scannedIdType.toLowerCase());
9276
- setValue("idNumber", idNumber);
9491
+ setValue("identityTypeId", scannedIdType.toString());
9492
+ setValue("identityId", idNumber);
9277
9493
  }
9278
9494
  onScanComplete?.({ name, idNumber, city });
9279
9495
  setScanStatus("success");
@@ -9355,22 +9571,22 @@ var ModalPassengerForm = ({
9355
9571
  children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Subtitle1, { children: mergedLabels.selectIdTypeTitle })
9356
9572
  }
9357
9573
  ),
9358
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogContent, { className: styles.content, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.idTypeList, children: idTypes.map((type) => /* @__PURE__ */ jsxRuntime.jsx(
9574
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogContent, { className: styles.content, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.idTypeList, children: idTypeOptions.map((type) => /* @__PURE__ */ jsxRuntime.jsx(
9359
9575
  "div",
9360
9576
  {
9361
9577
  className: styles.idTypeItem,
9362
- onClick: () => handleSelectIdType(type),
9578
+ onClick: () => handleSelectIdType(Number(type.value)),
9363
9579
  onKeyDown: (e) => {
9364
9580
  if (e.key === "Enter" || e.key === " ") {
9365
9581
  e.preventDefault();
9366
- handleSelectIdType(type);
9582
+ handleSelectIdType(Number(type.value));
9367
9583
  }
9368
9584
  },
9369
9585
  role: "button",
9370
9586
  tabIndex: 0,
9371
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.idTypeText, children: type })
9587
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.idTypeText, children: type.label })
9372
9588
  },
9373
- type
9589
+ type.value
9374
9590
  )) }) })
9375
9591
  ] }) })
9376
9592
  }
@@ -9637,7 +9853,7 @@ var ModalPassengerForm = ({
9637
9853
  /* @__PURE__ */ jsxRuntime.jsx(
9638
9854
  InputDynamic_default,
9639
9855
  {
9640
- name: "title",
9856
+ name: "titleId",
9641
9857
  control,
9642
9858
  type: "select",
9643
9859
  label: mergedLabels.titleLabel,
@@ -9653,7 +9869,7 @@ var ModalPassengerForm = ({
9653
9869
  /* @__PURE__ */ jsxRuntime.jsx(
9654
9870
  InputDynamic_default,
9655
9871
  {
9656
- name: "name",
9872
+ name: "fullName",
9657
9873
  control,
9658
9874
  type: "text",
9659
9875
  label: mergedLabels.nameLabel,
@@ -9672,22 +9888,23 @@ var ModalPassengerForm = ({
9672
9888
  /* @__PURE__ */ jsxRuntime.jsx(
9673
9889
  InputDynamic_default,
9674
9890
  {
9675
- name: "age",
9891
+ name: "birthdate",
9676
9892
  control,
9677
- type: "number",
9678
- label: mergedLabels.ageLabel,
9679
- placeholder: mergedLabels.agePlaceholder,
9893
+ type: "date",
9894
+ label: mergedLabels.dateLabel,
9895
+ placeholder: mergedLabels.datePlaceholder,
9680
9896
  size: "large",
9681
9897
  required: true,
9682
9898
  validationRules: {
9683
- required: mergedErrors.requiredAge,
9684
- min: {
9685
- value: 1,
9686
- message: mergedErrors.minAge
9687
- },
9688
- max: {
9689
- value: 150,
9690
- message: mergedErrors.maxAge
9899
+ required: mergedErrors.requiredDate,
9900
+ validate: (value) => {
9901
+ const selectedDate = new Date(value);
9902
+ const today = /* @__PURE__ */ new Date();
9903
+ today.setHours(0, 0, 0, 0);
9904
+ if (selectedDate > today) {
9905
+ return mergedErrors.birthDateFuture;
9906
+ }
9907
+ return true;
9691
9908
  }
9692
9909
  }
9693
9910
  }
@@ -9695,110 +9912,107 @@ var ModalPassengerForm = ({
9695
9912
  /* @__PURE__ */ jsxRuntime.jsx(
9696
9913
  InputDynamic_default,
9697
9914
  {
9698
- name: "cityId",
9915
+ name: "age",
9916
+ control,
9917
+ type: "text",
9918
+ disabled: true,
9919
+ label: mergedLabels.age,
9920
+ placeholder: mergedLabels.agePlaceholder,
9921
+ size: "large"
9922
+ }
9923
+ ),
9924
+ /* @__PURE__ */ jsxRuntime.jsx(
9925
+ InputDynamic_default,
9926
+ {
9927
+ name: "identityTypeId",
9699
9928
  control,
9700
9929
  type: "select",
9701
- label: mergedLabels.cityLabel,
9702
- options: cityOptions,
9703
- placeholder: mergedLabels.cityPlaceholder,
9930
+ label: mergedLabels.idTypeLabel,
9931
+ placeholder: mergedLabels.idTypePlaceholder,
9932
+ options: idTypeOptions,
9704
9933
  size: "large",
9705
9934
  required: true,
9706
9935
  validationRules: {
9707
- required: mergedErrors.requiredCity
9936
+ required: mergedErrors.requiredIdType
9708
9937
  }
9709
9938
  }
9710
9939
  ),
9711
- isAdultForm ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9712
- /* @__PURE__ */ jsxRuntime.jsx(
9940
+ watchIdentityTypeId ? watchIdentityTypeId === "lainnya" ? /* @__PURE__ */ jsxRuntime.jsx(
9941
+ InputDynamic_default,
9942
+ {
9943
+ name: "identityId",
9944
+ control,
9945
+ type: "date",
9946
+ label: mergedLabels.idTypeOtherLabel,
9947
+ placeholder: mergedLabels.idTypeOtherPlaceholder,
9948
+ size: "large",
9949
+ required: true,
9950
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
9951
+ validationRules: {
9952
+ required: mergedErrors.requiredDate
9953
+ }
9954
+ }
9955
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9956
+ watchIdentityTypeId === IDENTITY_TYPE.PSP.toString() && /* @__PURE__ */ jsxRuntime.jsx(
9713
9957
  InputDynamic_default,
9714
9958
  {
9715
- name: "idType",
9959
+ menuPlacement: "top",
9960
+ name: "countryId",
9716
9961
  control,
9962
+ options: countryOptions,
9717
9963
  type: "select",
9718
- label: mergedLabels.idTypeLabel,
9719
- placeholder: mergedLabels.idTypePlaceholder,
9720
- options: TYPE_OPTIONS,
9964
+ label: mergedLabels.countryLabel,
9965
+ placeholder: mergedLabels.countryPlaceholder,
9721
9966
  size: "large",
9722
9967
  required: true,
9723
9968
  validationRules: {
9724
- required: mergedErrors.requiredIdType
9969
+ required: mergedErrors.requiredCountry
9725
9970
  }
9726
9971
  }
9727
9972
  ),
9728
- idType ? idType === "lainnya" ? /* @__PURE__ */ jsxRuntime.jsx(
9973
+ /* @__PURE__ */ jsxRuntime.jsx(
9729
9974
  InputDynamic_default,
9730
9975
  {
9731
- name: "idNumber",
9976
+ name: "identityId",
9732
9977
  control,
9733
- type: "date",
9734
- label: mergedLabels.idTypeOtherLabel,
9735
- placeholder: mergedLabels.idTypeOtherPlaceholder,
9978
+ type: watchIdentityTypeId === IDENTITY_TYPE.KTP.toString() ? "number" : "text",
9979
+ label: mergedLabels.idNumberLabel,
9980
+ placeholder: mergedLabels.idNumberPlaceholder,
9736
9981
  size: "large",
9737
9982
  required: true,
9738
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
9739
9983
  validationRules: {
9740
- required: mergedErrors.requiredDate
9741
- }
9742
- }
9743
- ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9744
- idType === "paspor" && /* @__PURE__ */ jsxRuntime.jsx(
9745
- InputDynamic_default,
9746
- {
9747
- menuPlacement: "top",
9748
- name: "country",
9749
- control,
9750
- type: "country",
9751
- label: mergedLabels.countryLabel,
9752
- placeholder: mergedLabels.countryPlaceholder,
9753
- size: "large",
9754
- required: true,
9755
- validationRules: {
9756
- required: mergedErrors.requiredCountry
9984
+ required: mergedErrors.requiredIdNumber,
9985
+ minLength: {
9986
+ value: 6,
9987
+ message: mergedErrors.minLengthIdNumber
9757
9988
  }
9758
9989
  }
9759
- ),
9760
- /* @__PURE__ */ jsxRuntime.jsx(
9761
- InputDynamic_default,
9762
- {
9763
- name: "idNumber",
9764
- control,
9765
- type: idType === "ktp" ? "number" : "text",
9766
- label: mergedLabels.idNumberLabel,
9767
- placeholder: mergedLabels.idNumberPlaceholder,
9768
- size: "large",
9769
- required: true,
9770
- validationRules: {
9771
- required: mergedErrors.requiredIdNumber,
9772
- minLength: {
9773
- value: 6,
9774
- message: mergedErrors.minLengthIdNumber
9775
- }
9776
- }
9777
- }
9778
- )
9779
- ] }) : null
9780
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
9990
+ }
9991
+ )
9992
+ ] }) : null,
9993
+ /* @__PURE__ */ jsxRuntime.jsx(
9781
9994
  InputDynamic_default,
9782
9995
  {
9783
- name: "date",
9996
+ name: "regencyId",
9784
9997
  control,
9785
- type: "date",
9786
- label: mergedLabels.dateLabel,
9787
- placeholder: mergedLabels.datePlaceholder,
9998
+ type: "select",
9999
+ label: mergedLabels.cityLabel,
10000
+ options: cityOptions,
10001
+ placeholder: mergedLabels.cityPlaceholder,
9788
10002
  size: "large",
9789
10003
  required: true,
9790
10004
  validationRules: {
9791
- required: mergedErrors.requiredDate
10005
+ required: mergedErrors.requiredCity
9792
10006
  }
9793
10007
  }
9794
- ) }),
10008
+ ),
9795
10009
  /* @__PURE__ */ jsxRuntime.jsx("br", {}),
9796
10010
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9797
10011
  /* @__PURE__ */ jsxRuntime.jsx("br", {}),
9798
10012
  /* @__PURE__ */ jsxRuntime.jsx(
9799
10013
  InputDynamic_default,
9800
10014
  {
9801
- name: "ticketClass",
10015
+ name: "passengerClassId",
9802
10016
  control,
9803
10017
  type: "radiobutton",
9804
10018
  label: mergedLabels.ticketClassLabel,
@@ -11134,11 +11348,16 @@ var DEFAULT_LABELS26 = {
11134
11348
  estimationPrefix: "Estimasi",
11135
11349
  totalPriceLabel: "Total Harga",
11136
11350
  nextButton: "Lanjutkan",
11351
+ cancelButton: "Batalkan Pesanan",
11137
11352
  previousButton: "Sebelumnya",
11138
11353
  viewBookingButton: "Lihat Pemesanan",
11139
11354
  changePaymentButton: "Ubah Metode Pembayaran",
11140
11355
  timezoneLabel: "WIB",
11141
- currencySymbol: "IDR"
11356
+ currencySymbol: "IDR",
11357
+ cancelDialogTitle: "Buang perubahan?",
11358
+ cancelDialogBody: "Perubahan belum disimpan dan akan hilang jika Anda melanjutkan.",
11359
+ cancelDialogConfirm: "Buang Perubahan",
11360
+ cancelDialogDismiss: "Batal"
11142
11361
  },
11143
11362
  en: {
11144
11363
  bookingDetails: "Booking Details",
@@ -11146,11 +11365,16 @@ var DEFAULT_LABELS26 = {
11146
11365
  estimationPrefix: "Estimation",
11147
11366
  totalPriceLabel: "Total Price",
11148
11367
  nextButton: "Continue",
11368
+ cancelButton: "Cancel Booking",
11149
11369
  previousButton: "Previous",
11150
11370
  viewBookingButton: "View Booking",
11151
11371
  changePaymentButton: "Change Payment Method",
11152
11372
  timezoneLabel: "WIB",
11153
- currencySymbol: "IDR"
11373
+ currencySymbol: "IDR",
11374
+ cancelDialogTitle: "Discard changes?",
11375
+ cancelDialogBody: "Changes have not been saved and will be lost if you continue.",
11376
+ cancelDialogConfirm: "Discard Changes",
11377
+ cancelDialogDismiss: "Cancel"
11154
11378
  }
11155
11379
  };
11156
11380
  var useStyles27 = reactComponents.makeStyles({
@@ -11262,6 +11486,35 @@ var useStyles27 = reactComponents.makeStyles({
11262
11486
  border: "1px solid " + reactComponents.tokens.colorBrandStroke1,
11263
11487
  color: reactComponents.tokens.colorBrandBackground,
11264
11488
  width: "100%"
11489
+ },
11490
+ cancelButton: {
11491
+ border: "1px solid #D13438",
11492
+ color: "#D13438",
11493
+ width: "100%"
11494
+ },
11495
+ dialogDismissButton: {
11496
+ border: "1px solid " + reactComponents.tokens.colorBrandStroke1,
11497
+ color: reactComponents.tokens.colorBrandBackground,
11498
+ borderRadius: reactComponents.tokens.borderRadiusCircular,
11499
+ marginTop: "1em",
11500
+ marginBottom: ".5em",
11501
+ width: "100%"
11502
+ },
11503
+ dialogConfirmButton: {
11504
+ backgroundColor: "#D13438",
11505
+ color: reactComponents.tokens.colorNeutralForegroundOnBrand,
11506
+ width: "100%",
11507
+ borderRadius: reactComponents.tokens.borderRadiusCircular,
11508
+ border: "none",
11509
+ "&:hover": {
11510
+ backgroundColor: "#b02020"
11511
+ }
11512
+ },
11513
+ dialogActions: {
11514
+ display: "flex",
11515
+ flexDirection: "column",
11516
+ gap: reactComponents.tokens.spacingVerticalS,
11517
+ width: "100%"
11265
11518
  }
11266
11519
  });
11267
11520
  var CardBookingTicket = ({
@@ -11274,6 +11527,7 @@ var CardBookingTicket = ({
11274
11527
  departureDay,
11275
11528
  departureTime,
11276
11529
  departureLocation,
11530
+ disableNextButton,
11277
11531
  arrivalDay,
11278
11532
  arrivalTime,
11279
11533
  arrivalLocation,
@@ -11282,12 +11536,14 @@ var CardBookingTicket = ({
11282
11536
  reservationStep,
11283
11537
  paymentStep,
11284
11538
  onPriceDetailClick,
11539
+ onCancel,
11285
11540
  onNext,
11286
11541
  onPrevious,
11287
11542
  className
11288
11543
  }) => {
11289
11544
  const styles = useStyles27();
11290
11545
  const mergedLabels = { ...DEFAULT_LABELS26[language], ...labels };
11546
+ const [cancelDialogOpen, setCancelDialogOpen] = React.useState(false);
11291
11547
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles.container} ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.bookingDetail, children: [
11292
11548
  /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Card, { className: styles.bookingDetailTop, children: [
11293
11549
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Subtitle1, { children: mergedLabels.bookingDetails }),
@@ -11371,6 +11627,7 @@ var CardBookingTicket = ({
11371
11627
  reactComponents.Button,
11372
11628
  {
11373
11629
  appearance: "primary",
11630
+ disabled: disableNextButton,
11374
11631
  onClick: onNext,
11375
11632
  shape: "circular",
11376
11633
  size: "large",
@@ -11394,31 +11651,93 @@ var CardBookingTicket = ({
11394
11651
  iconPosition: "before",
11395
11652
  children: mergedLabels.previousButton
11396
11653
  }
11397
- )
11398
- ] }),
11399
- paymentStep === "pay" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.gapButton, children: [
11400
- /* @__PURE__ */ jsxRuntime.jsx(
11401
- reactComponents.Button,
11402
- {
11403
- appearance: "primary",
11404
- shape: "circular",
11405
- size: "large",
11406
- style: { width: "100%" },
11407
- onClick: onNext,
11408
- children: mergedLabels.viewBookingButton
11409
- }
11410
11654
  ),
11411
- /* @__PURE__ */ jsxRuntime.jsx(
11412
- reactComponents.Button,
11413
- {
11414
- appearance: "secondary",
11415
- shape: "circular",
11416
- size: "large",
11417
- className: styles.secondaryButton,
11418
- onClick: onPrevious,
11419
- children: mergedLabels.changePaymentButton
11420
- }
11421
- )
11655
+ paymentStep === "pay" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11656
+ /* @__PURE__ */ jsxRuntime.jsx(
11657
+ reactComponents.Button,
11658
+ {
11659
+ appearance: "primary",
11660
+ disabled: disableNextButton,
11661
+ onClick: onNext,
11662
+ shape: "circular",
11663
+ size: "large",
11664
+ style: { width: "100%" },
11665
+ children: mergedLabels.viewBookingButton
11666
+ }
11667
+ ),
11668
+ /* @__PURE__ */ jsxRuntime.jsx(
11669
+ reactComponents.Button,
11670
+ {
11671
+ appearance: "secondary",
11672
+ shape: "circular",
11673
+ size: "large",
11674
+ className: styles.secondaryButton,
11675
+ onClick: onPrevious,
11676
+ children: mergedLabels.changePaymentButton
11677
+ }
11678
+ )
11679
+ ] }),
11680
+ reservationStep === "manifest" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11681
+ /* @__PURE__ */ jsxRuntime.jsx(
11682
+ reactComponents.Button,
11683
+ {
11684
+ appearance: "outline",
11685
+ onClick: () => setCancelDialogOpen(true),
11686
+ shape: "circular",
11687
+ size: "large",
11688
+ className: styles.cancelButton,
11689
+ iconPosition: "before",
11690
+ children: mergedLabels.cancelButton
11691
+ }
11692
+ ),
11693
+ /* @__PURE__ */ jsxRuntime.jsx(
11694
+ reactComponents.Dialog,
11695
+ {
11696
+ open: cancelDialogOpen,
11697
+ onOpenChange: (_, data) => setCancelDialogOpen(data.open),
11698
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogSurface, { style: { maxWidth: "479px", width: "479px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.DialogBody, { children: [
11699
+ /* @__PURE__ */ jsxRuntime.jsx(
11700
+ reactComponents.DialogTitle,
11701
+ {
11702
+ action: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogTrigger, { action: "close", children: /* @__PURE__ */ jsxRuntime.jsx(
11703
+ reactComponents.Button,
11704
+ {
11705
+ appearance: "subtle",
11706
+ "aria-label": "close",
11707
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:dismiss-24-regular" })
11708
+ }
11709
+ ) }),
11710
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Subtitle1, { children: mergedLabels.cancelDialogTitle })
11711
+ }
11712
+ ),
11713
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.DialogContent, { children: [
11714
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.cancelDialogBody }),
11715
+ /* @__PURE__ */ jsxRuntime.jsx(
11716
+ reactComponents.Button,
11717
+ {
11718
+ className: styles.dialogDismissButton,
11719
+ size: "large",
11720
+ onClick: () => setCancelDialogOpen(false),
11721
+ children: mergedLabels.cancelDialogDismiss
11722
+ }
11723
+ ),
11724
+ /* @__PURE__ */ jsxRuntime.jsx(
11725
+ reactComponents.Button,
11726
+ {
11727
+ className: styles.dialogConfirmButton,
11728
+ size: "large",
11729
+ onClick: () => {
11730
+ setCancelDialogOpen(false);
11731
+ onCancel();
11732
+ },
11733
+ children: mergedLabels.cancelDialogConfirm
11734
+ }
11735
+ )
11736
+ ] })
11737
+ ] }) })
11738
+ }
11739
+ )
11740
+ ] })
11422
11741
  ] })
11423
11742
  ] })
11424
11743
  ] }) });
@@ -13524,14 +13843,16 @@ var DEFAULT_LABELS38 = {
13524
13843
  maxSizeWarning: "Maksimal {maxSize}MB per file dalam format PDF, JPG, JPEG, PNG.",
13525
13844
  sizeLabel: "Ukuran",
13526
13845
  preview: "Pratinjau",
13527
- requiredError: "wajib diisi"
13846
+ requiredError: "wajib diisi",
13847
+ downloadTemplateDocument: "Download Template Dokumen"
13528
13848
  },
13529
13849
  en: {
13530
13850
  placeholder: "Tap to select a file",
13531
13851
  maxSizeWarning: "Maximum {maxSize}MB per file in PDF, JPG, JPEG, PNG format.",
13532
13852
  sizeLabel: "Size",
13533
13853
  preview: "Preview",
13534
- requiredError: "is required"
13854
+ requiredError: "is required",
13855
+ downloadTemplateDocument: "Download Template Document"
13535
13856
  }
13536
13857
  };
13537
13858
  var useStyles40 = reactComponents.makeStyles({
@@ -13671,7 +13992,8 @@ var FileUpload = React__default.default.forwardRef(
13671
13992
  disabled = false,
13672
13993
  language = "id",
13673
13994
  labels: customLabels,
13674
- pdfIcon
13995
+ pdfIcon,
13996
+ downloadTemplateDocument = false
13675
13997
  }, ref) => {
13676
13998
  const mergedLabels = { ...DEFAULT_LABELS38[language], ...customLabels };
13677
13999
  const styles = uploadStyles();
@@ -13756,6 +14078,20 @@ var FileUpload = React__default.default.forwardRef(
13756
14078
  }
13757
14079
  }
13758
14080
  };
14081
+ const handleDownloadFile = (e, file) => {
14082
+ e.stopPropagation();
14083
+ if (!(file instanceof File)) {
14084
+ return;
14085
+ }
14086
+ const fileUrl = URL.createObjectURL(file);
14087
+ const link = document.createElement("a");
14088
+ link.href = fileUrl;
14089
+ link.download = file.name;
14090
+ document.body.appendChild(link);
14091
+ link.click();
14092
+ document.body.removeChild(link);
14093
+ URL.revokeObjectURL(fileUrl);
14094
+ };
13759
14095
  const getContainerStyle = (hasFile, hasError) => {
13760
14096
  if (disabled && hasFile) return styles.containerDisabled;
13761
14097
  if (hasError) return styles.containerError;
@@ -13865,202 +14201,216 @@ var FileUpload = React__default.default.forwardRef(
13865
14201
  }
13866
14202
  );
13867
14203
  }
13868
- return /* @__PURE__ */ jsxRuntime.jsxs(
13869
- reactComponents.Field,
13870
- {
13871
- ref,
13872
- required,
13873
- label: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: label }),
13874
- className: styles.fieldContainer,
13875
- children: [
13876
- /* @__PURE__ */ jsxRuntime.jsxs(
13877
- reactGridSystem.Container,
13878
- {
13879
- className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
13880
- onClick: handleClick,
13881
- onDrop: (e) => handleDrop(e, onChange),
13882
- onDragOver: handleDragOver,
13883
- onDragLeave: handleDragLeave,
13884
- fluid: true,
13885
- children: [
13886
- /* @__PURE__ */ jsxRuntime.jsxs(
13887
- reactGridSystem.Row,
13888
- {
13889
- nogutter: true,
13890
- style: { gap: reactComponents.tokens.spacingVerticalL },
13891
- justify: "center",
13892
- align: "center",
13893
- children: [
13894
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsxRuntime.jsx(
13895
- react.Icon,
13896
- {
13897
- icon: "fluent:warning-32-regular",
13898
- style: {
13899
- color: reactComponents.tokens.colorStatusWarningBackground3,
13900
- maxWidth: "32px",
13901
- width: "32px",
13902
- maxHeight: "32px",
13903
- height: "32px"
14204
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14205
+ /* @__PURE__ */ jsxRuntime.jsxs(
14206
+ reactComponents.Field,
14207
+ {
14208
+ ref,
14209
+ required,
14210
+ label: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: label }),
14211
+ className: styles.fieldContainer,
14212
+ children: [
14213
+ /* @__PURE__ */ jsxRuntime.jsxs(
14214
+ reactGridSystem.Container,
14215
+ {
14216
+ className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
14217
+ onClick: handleClick,
14218
+ onDrop: (e) => handleDrop(e, onChange),
14219
+ onDragOver: handleDragOver,
14220
+ onDragLeave: handleDragLeave,
14221
+ fluid: true,
14222
+ children: [
14223
+ /* @__PURE__ */ jsxRuntime.jsxs(
14224
+ reactGridSystem.Row,
14225
+ {
14226
+ nogutter: true,
14227
+ style: { gap: reactComponents.tokens.spacingVerticalL },
14228
+ justify: "center",
14229
+ align: "center",
14230
+ children: [
14231
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsxRuntime.jsx(
14232
+ react.Icon,
14233
+ {
14234
+ icon: "fluent:warning-32-regular",
14235
+ style: {
14236
+ color: reactComponents.tokens.colorStatusWarningBackground3,
14237
+ maxWidth: "32px",
14238
+ width: "32px",
14239
+ maxHeight: "32px",
14240
+ height: "32px"
14241
+ }
13904
14242
  }
13905
- }
13906
- ) : /* @__PURE__ */ jsxRuntime.jsx(
13907
- react.Icon,
13908
- {
13909
- icon: "fluent:arrow-upload-32-filled",
13910
- style: {
13911
- color: brandColors2[80],
13912
- maxWidth: "32px",
13913
- width: "32px",
13914
- maxHeight: "32px",
13915
- height: "32px"
14243
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
14244
+ react.Icon,
14245
+ {
14246
+ icon: "fluent:arrow-upload-32-filled",
14247
+ style: {
14248
+ color: brandColors2[80],
14249
+ maxWidth: "32px",
14250
+ width: "32px",
14251
+ maxHeight: "32px",
14252
+ height: "32px"
14253
+ }
13916
14254
  }
13917
- }
13918
- ) }) }),
13919
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: /* @__PURE__ */ jsxRuntime.jsxs(
13920
- reactGridSystem.Row,
13921
- {
13922
- direction: "column",
13923
- nogutter: true,
13924
- style: { rowGap: reactComponents.tokens.spacingVerticalXS },
13925
- children: [
13926
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
13927
- displayFile instanceof File ? /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, style: { gap: reactComponents.tokens.spacingHorizontalS }, children: [
13928
- /* @__PURE__ */ jsxRuntime.jsx(
13929
- reactGridSystem.Col,
13930
- {
13931
- xs: "content",
13932
- style: {
13933
- display: "flex",
13934
- justifyContent: "center",
13935
- alignItems: "center",
13936
- width: "max-content"
13937
- },
13938
- children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsxRuntime.jsx(
13939
- "img",
13940
- {
13941
- src: previewUrl,
13942
- alt: "preview",
13943
- className: styles.filePreviewImage
13944
- }
13945
- ) : pdfIcon ? /* @__PURE__ */ jsxRuntime.jsx(
13946
- "img",
13947
- {
13948
- src: pdfIcon,
13949
- alt: "PDF Icon",
13950
- width: 32,
13951
- height: 32,
13952
- style: { flexShrink: 0 }
13953
- }
13954
- ) : /* @__PURE__ */ jsxRuntime.jsx(
13955
- react.Icon,
13956
- {
13957
- icon: "fluent:document-pdf-32-regular",
13958
- width: 32,
13959
- height: 32,
13960
- style: { flexShrink: 0, color: brandColors2[80] }
13961
- }
13962
- )
13963
- }
13964
- ),
13965
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: /* @__PURE__ */ jsxRuntime.jsxs(
13966
- "div",
13967
- {
13968
- style: { display: "flex", flexDirection: "column" },
13969
- children: [
13970
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1Strong, { children: getDisplayFileName(displayFile) }),
13971
- /* @__PURE__ */ jsxRuntime.jsxs(
13972
- reactComponents.Caption2,
14255
+ ) }) }),
14256
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: /* @__PURE__ */ jsxRuntime.jsxs(
14257
+ reactGridSystem.Row,
14258
+ {
14259
+ direction: "column",
14260
+ nogutter: true,
14261
+ style: { rowGap: reactComponents.tokens.spacingVerticalXS },
14262
+ children: [
14263
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
14264
+ displayFile instanceof File ? /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(reactGridSystem.Row, { nogutter: true, style: { gap: reactComponents.tokens.spacingHorizontalS }, children: [
14265
+ /* @__PURE__ */ jsxRuntime.jsx(
14266
+ reactGridSystem.Col,
14267
+ {
14268
+ xs: "content",
14269
+ style: {
14270
+ display: "flex",
14271
+ justifyContent: "center",
14272
+ alignItems: "center",
14273
+ width: "max-content"
14274
+ },
14275
+ children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsxRuntime.jsx(
14276
+ "img",
13973
14277
  {
13974
- style: { color: reactComponents.tokens.colorNeutralForeground3 },
13975
- children: [
13976
- mergedLabels.sizeLabel,
13977
- ": ",
13978
- formatFileSize(displayFile.size),
13979
- (error || sizeError) && /* @__PURE__ */ jsxRuntime.jsxs(
13980
- "span",
13981
- {
13982
- style: {
13983
- color: reactComponents.tokens.colorStatusWarningForeground1,
13984
- marginLeft: reactComponents.tokens.spacingHorizontalXS
13985
- },
13986
- children: [
13987
- "(",
13988
- sizeError || error?.message,
13989
- ")"
13990
- ]
13991
- }
13992
- )
13993
- ]
14278
+ src: previewUrl,
14279
+ alt: "preview",
14280
+ className: styles.filePreviewImage
13994
14281
  }
13995
- )
13996
- ]
13997
- }
13998
- ) }),
13999
- /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsxs(
14000
- "div",
14001
- {
14002
- style: {
14003
- display: "flex",
14004
- gap: reactComponents.tokens.spacingVerticalS,
14005
- justifyContent: "center",
14006
- alignItems: "center",
14007
- width: "max-content",
14008
- height: "100%"
14009
- },
14010
- children: [
14011
- /* @__PURE__ */ jsxRuntime.jsx(
14012
- reactComponents.Button,
14282
+ ) : pdfIcon ? /* @__PURE__ */ jsxRuntime.jsx(
14283
+ "img",
14013
14284
  {
14014
- appearance: "transparent",
14015
- size: "small",
14016
- style: { color: brandColors2[80] },
14017
- onClick: (e) => handlePreview(e, displayFile),
14018
- children: mergedLabels.preview
14285
+ src: pdfIcon,
14286
+ alt: "PDF Icon",
14287
+ width: 32,
14288
+ height: 32,
14289
+ style: { flexShrink: 0 }
14019
14290
  }
14020
- ),
14021
- /* @__PURE__ */ jsxRuntime.jsx(
14022
- reactComponents.Button,
14291
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
14292
+ react.Icon,
14023
14293
  {
14024
- appearance: "transparent",
14025
- size: "small",
14026
- onClick: (e) => handleRemoveFile(e, onChange),
14027
- icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:dismiss-16-regular" })
14294
+ icon: "fluent:document-pdf-32-regular",
14295
+ width: 32,
14296
+ height: 32,
14297
+ style: { flexShrink: 0, color: brandColors2[80] }
14028
14298
  }
14029
14299
  )
14030
- ]
14300
+ }
14301
+ ),
14302
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { children: /* @__PURE__ */ jsxRuntime.jsxs(
14303
+ "div",
14304
+ {
14305
+ style: { display: "flex", flexDirection: "column" },
14306
+ children: [
14307
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1Strong, { children: getDisplayFileName(displayFile) }),
14308
+ /* @__PURE__ */ jsxRuntime.jsxs(
14309
+ reactComponents.Caption2,
14310
+ {
14311
+ style: { color: reactComponents.tokens.colorNeutralForeground3 },
14312
+ children: [
14313
+ mergedLabels.sizeLabel,
14314
+ ": ",
14315
+ formatFileSize(displayFile.size),
14316
+ (error || sizeError) && /* @__PURE__ */ jsxRuntime.jsxs(
14317
+ "span",
14318
+ {
14319
+ style: {
14320
+ color: reactComponents.tokens.colorStatusWarningForeground1,
14321
+ marginLeft: reactComponents.tokens.spacingHorizontalXS
14322
+ },
14323
+ children: [
14324
+ "(",
14325
+ sizeError || error?.message,
14326
+ ")"
14327
+ ]
14328
+ }
14329
+ )
14330
+ ]
14331
+ }
14332
+ )
14333
+ ]
14334
+ }
14335
+ ) }),
14336
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: "content", children: /* @__PURE__ */ jsxRuntime.jsxs(
14337
+ "div",
14338
+ {
14339
+ style: {
14340
+ display: "flex",
14341
+ gap: reactComponents.tokens.spacingVerticalS,
14342
+ justifyContent: "center",
14343
+ alignItems: "center",
14344
+ width: "max-content",
14345
+ height: "100%"
14346
+ },
14347
+ children: [
14348
+ /* @__PURE__ */ jsxRuntime.jsx(
14349
+ reactComponents.Button,
14350
+ {
14351
+ appearance: "transparent",
14352
+ size: "small",
14353
+ style: { color: brandColors2[80] },
14354
+ onClick: (e) => handlePreview(e, displayFile),
14355
+ children: mergedLabels.preview
14356
+ }
14357
+ ),
14358
+ /* @__PURE__ */ jsxRuntime.jsx(
14359
+ reactComponents.Button,
14360
+ {
14361
+ appearance: "transparent",
14362
+ size: "small",
14363
+ onClick: (e) => handleRemoveFile(e, onChange),
14364
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:dismiss-16-regular" })
14365
+ }
14366
+ )
14367
+ ]
14368
+ }
14369
+ ) })
14370
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
14371
+ reactComponents.Caption1,
14372
+ {
14373
+ style: { color: reactComponents.tokens.colorNeutralForeground3 },
14374
+ children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
14031
14375
  }
14032
14376
  ) })
14033
- ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
14034
- reactComponents.Caption1,
14035
- {
14036
- style: { color: reactComponents.tokens.colorNeutralForeground3 },
14037
- children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
14038
- }
14039
- ) })
14040
- ]
14041
- }
14042
- ) })
14043
- ]
14044
- }
14045
- ),
14046
- /* @__PURE__ */ jsxRuntime.jsx(
14047
- "input",
14048
- {
14049
- ref: fileInputRef,
14050
- type: "file",
14051
- accept,
14052
- onChange: (e) => handleFileSelect(e.target.files, onChange),
14053
- className: styles.hiddenInput,
14054
- disabled
14055
- }
14056
- )
14057
- ]
14058
- }
14059
- ),
14060
- /* @__PURE__ */ jsxRuntime.jsx(ModalPreviewImage, { imageUrl: previewUrl, open: isPreviewOpen, onOpenChange: setIsPreviewOpen })
14061
- ]
14062
- }
14063
- );
14377
+ ]
14378
+ }
14379
+ ) })
14380
+ ]
14381
+ }
14382
+ ),
14383
+ /* @__PURE__ */ jsxRuntime.jsx(
14384
+ "input",
14385
+ {
14386
+ ref: fileInputRef,
14387
+ type: "file",
14388
+ accept,
14389
+ onChange: (e) => handleFileSelect(e.target.files, onChange),
14390
+ className: styles.hiddenInput,
14391
+ disabled
14392
+ }
14393
+ )
14394
+ ]
14395
+ }
14396
+ ),
14397
+ /* @__PURE__ */ jsxRuntime.jsx(ModalPreviewImage, { imageUrl: previewUrl, open: isPreviewOpen, onOpenChange: setIsPreviewOpen })
14398
+ ]
14399
+ }
14400
+ ),
14401
+ downloadTemplateDocument && /* @__PURE__ */ jsxRuntime.jsx(
14402
+ reactComponents.Button,
14403
+ {
14404
+ appearance: "transparent",
14405
+ size: "small",
14406
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ArrowDownloadRegular, {}),
14407
+ style: { display: "flex", justifyContent: "end", color: brandColors2[80], width: "100%" },
14408
+ onClick: (e) => handleDownloadFile(e, displayFile),
14409
+ disabled: !(displayFile instanceof File),
14410
+ children: mergedLabels.downloadTemplateDocument
14411
+ }
14412
+ )
14413
+ ] });
14064
14414
  }
14065
14415
  }
14066
14416
  );
@@ -14069,6 +14419,19 @@ var FileUpload = React__default.default.forwardRef(
14069
14419
  FileUpload.displayName = "FileUpload";
14070
14420
  var FileUpload_default = FileUpload;
14071
14421
 
14422
+ // src/utils/color.ts
14423
+ function hexToRgba(hex, alpha = 1) {
14424
+ hex = hex.replace("#", "");
14425
+ if (hex.length === 3) {
14426
+ hex = hex.split("").map((c) => c + c).join("");
14427
+ }
14428
+ const bigint = parseInt(hex, 16);
14429
+ const r = bigint >> 16 & 255;
14430
+ const g = bigint >> 8 & 255;
14431
+ const b = bigint & 255;
14432
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
14433
+ }
14434
+
14072
14435
  // src/components/CardProfileMenu/CardProfileMenu.constants.ts
14073
14436
  var DEFAULT_LABELS39 = {
14074
14437
  id: {},
@@ -14230,8 +14593,10 @@ exports.ModalTypeOfService = ModalTypeOfService;
14230
14593
  exports.PASSENGER_TYPE = PASSENGER_TYPE;
14231
14594
  exports.SortMenu = SortMenu;
14232
14595
  exports.Stepper = Stepper;
14596
+ exports.calculateAge = calculateAge;
14233
14597
  exports.getBadgeConfig = getBadgeConfig;
14234
14598
  exports.getModalPreset = getModalPreset;
14235
14599
  exports.getSortLabel = getSortLabel;
14600
+ exports.hexToRgba = hexToRgba;
14236
14601
  //# sourceMappingURL=index.js.map
14237
14602
  //# sourceMappingURL=index.js.map