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

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
@@ -1,7 +1,7 @@
1
1
  import { makeStyles, tokens, createLightTheme, createDarkTheme, shorthands, Popover, PopoverTrigger, Input, PopoverSurface, Field, Caption1Strong, Caption2, Button, Body1, Body1Strong, Caption1, Dialog, DialogSurface, DialogBody, DialogTitle, DialogTrigger, DialogContent, Carousel, CarouselButton, CarouselViewport, mergeClasses, CarouselSlider, CarouselNav, CarouselNavButton, CarouselCard, Skeleton, SkeletonItem, Subtitle2, Card, Tooltip, Badge, Title2, Divider, Title3, Label, Text, Checkbox, MessageBar, MessageBarBody, Accordion, AccordionItem, AccordionHeader, AccordionPanel, RadioGroup, Radio, Menu, MenuTrigger, MenuPopover, MenuList, DialogActions, Caption2Strong, Subtitle1, Body1Stronger, Caption1Stronger, Display, Image, Title1, TabList, Tab, Body2, typographyStyles, Switch, Textarea, Link } from '@fluentui/react-components';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import React, { forwardRef, useState, useRef, useEffect, useCallback, useMemo, Fragment as Fragment$1 } from 'react';
4
- import { Dismiss24Regular, DismissRegular, SubtractRegular, AddRegular, DeleteRegular, InfoRegular, SearchRegular } from '@fluentui/react-icons';
4
+ import { ArrowDownloadRegular, Dismiss24Regular, DismissRegular, SubtractRegular, AddRegular, DeleteRegular, InfoRegular, SearchRegular } from '@fluentui/react-icons';
5
5
  import { Container, Row, Col, Visible } from 'react-grid-system';
6
6
  import { Icon } from '@iconify/react';
7
7
  import { Controller, useForm, useWatch } from 'react-hook-form';
@@ -485,7 +485,7 @@ var useStyles2 = makeStyles({
485
485
  display: "flex",
486
486
  gap: `${spacing2[360]}px`,
487
487
  alignItems: "center",
488
- justifyContent: "center",
488
+ justifyContent: "start",
489
489
  [`@media (max-width: ${extendedTokens.breakpointMd})`]: {
490
490
  gap: tokens.spacingVerticalXS
491
491
  }
@@ -493,7 +493,7 @@ var useStyles2 = makeStyles({
493
493
  carouselContainerNoNav: {
494
494
  display: "flex",
495
495
  alignItems: "center",
496
- justifyContent: "center"
496
+ justifyContent: "start"
497
497
  },
498
498
  customCarouselNav: {
499
499
  display: "flex",
@@ -581,6 +581,29 @@ var useStyles2 = makeStyles({
581
581
  height: "10px"
582
582
  }
583
583
  }
584
+ },
585
+ singleIndicatorWrapper: {
586
+ display: "flex",
587
+ justifyContent: "center",
588
+ alignItems: "center",
589
+ marginTop: tokens.spacingVerticalXXL,
590
+ ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingVerticalM),
591
+ borderRadius: tokens.borderRadiusCircular
592
+ },
593
+ singleIndicatorDot: {
594
+ backgroundImage: "linear-gradient(to right,#00B3BD, #8DC63F)",
595
+ display: "inline-block",
596
+ width: "55px",
597
+ height: "16px",
598
+ borderRadius: tokens.borderRadiusCircular,
599
+ "@media (max-width: 768px)": {
600
+ width: "35px",
601
+ height: "13px"
602
+ },
603
+ "@media (max-width: 425px)": {
604
+ width: "25px",
605
+ height: "10px"
606
+ }
584
607
  }
585
608
  });
586
609
  var CarouselWithCustomNav = ({
@@ -606,6 +629,8 @@ var CarouselWithCustomNav = ({
606
629
  }) => {
607
630
  const styles = useStyles2();
608
631
  const [internalIndex, setInternalIndex] = useState(0);
632
+ const totalSlides = React.Children.count(children);
633
+ const isSingleSlide = totalSlides === 1;
609
634
  const labels = React.useMemo(
610
635
  () => ({
611
636
  ...DEFAULT_LABELS2[language],
@@ -622,15 +647,14 @@ var CarouselWithCustomNav = ({
622
647
  }
623
648
  onActiveIndexChange?.(index);
624
649
  },
625
- [controlledIndex, onActiveIndexChange]
650
+ [controlledIndex, onActiveIndexChange, isSingleSlide]
626
651
  );
627
652
  React.useEffect(() => {
628
653
  if (!autoPlay) return;
629
- const totalSlides = React.Children.count(children);
630
- if (totalSlides <= 1) return;
654
+ const effectiveTotalSlides = isSingleSlide ? 2 : totalSlides;
631
655
  const intervalId = setInterval(() => {
632
656
  let nextIndex = activeIndex + 1;
633
- if (nextIndex >= totalSlides) {
657
+ if (nextIndex >= effectiveTotalSlides) {
634
658
  nextIndex = circular ? 0 : activeIndex;
635
659
  }
636
660
  if (nextIndex !== activeIndex) {
@@ -644,15 +668,16 @@ var CarouselWithCustomNav = ({
644
668
  }, [
645
669
  autoPlay,
646
670
  autoPlayInterval,
647
- children,
671
+ totalSlides,
648
672
  circular,
649
673
  activeIndex,
650
674
  controlledIndex,
651
- onActiveIndexChange
675
+ onActiveIndexChange,
676
+ isSingleSlide
652
677
  ]);
653
678
  const defaultAnnouncement = useCallback(
654
- (index, totalSlides) => {
655
- return labels.announcementTemplate.replace("{index}", (index + 1).toString()).replace("{total}", totalSlides.toString());
679
+ (index, totalSlides2) => {
680
+ return labels.announcementTemplate.replace("{index}", (index + 1).toString()).replace("{total}", totalSlides2.toString());
656
681
  },
657
682
  [labels.announcementTemplate]
658
683
  );
@@ -660,7 +685,7 @@ var CarouselWithCustomNav = ({
660
685
  return /* @__PURE__ */ jsxs(
661
686
  Carousel,
662
687
  {
663
- circular,
688
+ circular: isSingleSlide ? true : circular,
664
689
  draggable,
665
690
  align,
666
691
  className: mergeClasses(styles.carousel, className),
@@ -669,53 +694,73 @@ var CarouselWithCustomNav = ({
669
694
  activeIndex,
670
695
  onActiveIndexChange: (_, data) => handleIndexChange(data.index),
671
696
  children: [
672
- /* @__PURE__ */ jsxs("div", { className: showNavButtons ? styles.carouselContainer : styles.carouselContainerNoNav, children: [
673
- showNavButtons && /* @__PURE__ */ jsx(
674
- CarouselButton,
675
- {
676
- navType: "prev",
677
- "aria-label": labels.prevButtonAriaLabel,
678
- className: styles.customeCarouselButton
679
- }
680
- ),
681
- /* @__PURE__ */ jsxs(CarouselViewport, { style: { overflow: "hidden", paddingBottom: "10px" }, children: [
682
- showCloseButton && /* @__PURE__ */ jsx(
683
- Button,
684
- {
685
- icon: /* @__PURE__ */ jsx(DismissRegular, {}),
686
- shape: "circular",
687
- onClick: onCloseClick,
688
- "aria-label": labels.closeButtonAriaLabel,
689
- className: mergeClasses(
690
- styles.closeButton,
691
- showNavButtons ? styles.closeButtonWithNav : styles.closeButtonWithoutNav
697
+ /* @__PURE__ */ jsxs(
698
+ "div",
699
+ {
700
+ className: showNavButtons ? styles.carouselContainer : styles.carouselContainerNoNav,
701
+ children: [
702
+ showNavButtons && !isSingleSlide && /* @__PURE__ */ jsx(
703
+ CarouselButton,
704
+ {
705
+ navType: "prev",
706
+ "aria-label": labels.prevButtonAriaLabel,
707
+ className: styles.customeCarouselButton
708
+ }
709
+ ),
710
+ /* @__PURE__ */ jsxs(CarouselViewport, { style: { overflow: "hidden", paddingBottom: "10px" }, children: [
711
+ showCloseButton && /* @__PURE__ */ jsx(
712
+ Button,
713
+ {
714
+ icon: /* @__PURE__ */ jsx(DismissRegular, {}),
715
+ shape: "circular",
716
+ onClick: onCloseClick,
717
+ "aria-label": labels.closeButtonAriaLabel,
718
+ className: mergeClasses(
719
+ styles.closeButton,
720
+ showNavButtons ? styles.closeButtonWithNav : styles.closeButtonWithoutNav
721
+ )
722
+ }
723
+ ),
724
+ /* @__PURE__ */ jsx(
725
+ CarouselSlider,
726
+ {
727
+ cardFocus,
728
+ "aria-label": labels.carouselAriaLabel,
729
+ children: isSingleSlide ? /* @__PURE__ */ jsxs(Fragment, { children: [
730
+ children,
731
+ children
732
+ ] }) : children
733
+ }
692
734
  )
693
- }
694
- ),
695
- /* @__PURE__ */ jsx(
696
- CarouselSlider,
697
- {
698
- cardFocus,
699
- "aria-label": labels.carouselAriaLabel,
700
- children
701
- }
702
- )
703
- ] }),
704
- showNavButtons && /* @__PURE__ */ jsx(
705
- CarouselButton,
706
- {
707
- navType: "next",
708
- "aria-label": labels.nextButtonAriaLabel,
709
- className: styles.customeCarouselButton
710
- }
711
- )
712
- ] }),
713
- /* @__PURE__ */ jsx(
735
+ ] }),
736
+ showNavButtons && !isSingleSlide && /* @__PURE__ */ jsx(
737
+ CarouselButton,
738
+ {
739
+ navType: "next",
740
+ "aria-label": labels.nextButtonAriaLabel,
741
+ className: styles.customeCarouselButton
742
+ }
743
+ )
744
+ ]
745
+ }
746
+ ),
747
+ isSingleSlide ? /* @__PURE__ */ jsx(
748
+ "div",
749
+ {
750
+ className: styles.singleIndicatorWrapper,
751
+ style: {
752
+ backgroundColor: darkNavBackground ? tokens.colorSubtleBackgroundInverted : tokens.colorSubtleBackground,
753
+ justifyContent: align === "start" ? "flex-start" : align === "end" ? "flex-end" : "center"
754
+ },
755
+ children: /* @__PURE__ */ jsx("span", { className: styles.singleIndicatorDot })
756
+ }
757
+ ) : /* @__PURE__ */ jsx(
714
758
  CarouselNav,
715
759
  {
716
760
  style: {
717
761
  backgroundColor: darkNavBackground ? tokens.colorSubtleBackgroundInverted : tokens.colorSubtleBackground,
718
- marginTop: tokens.spacingVerticalXXL
762
+ marginTop: tokens.spacingVerticalXXL,
763
+ justifyContent: align === "start" ? "flex-start" : align === "end" ? "flex-end" : "center"
719
764
  },
720
765
  appearance: "brand",
721
766
  className: styles.carouselNavButton,
@@ -2468,7 +2513,9 @@ var DatePickerInput = forwardRef(
2468
2513
  contentBefore,
2469
2514
  onClick,
2470
2515
  style,
2516
+ min,
2471
2517
  max,
2518
+ disablePastDates = false,
2472
2519
  ...restProps
2473
2520
  }, ref) => {
2474
2521
  const [isOpen, setIsOpen] = useState(false);
@@ -2497,6 +2544,12 @@ var DatePickerInput = forwardRef(
2497
2544
  }
2498
2545
  onClick?.(e);
2499
2546
  };
2547
+ const getStartOfToday = () => {
2548
+ const today = /* @__PURE__ */ new Date();
2549
+ today.setHours(0, 0, 0, 0);
2550
+ return today;
2551
+ };
2552
+ const minDate = min ? new Date(min) : disablePastDates ? getStartOfToday() : void 0;
2500
2553
  return /* @__PURE__ */ jsxs(
2501
2554
  Popover,
2502
2555
  {
@@ -2547,6 +2600,7 @@ var DatePickerInput = forwardRef(
2547
2600
  showGoToToday: true,
2548
2601
  highlightSelectedMonth: true,
2549
2602
  showMonthPickerAsOverlay: false,
2603
+ minDate,
2550
2604
  maxDate: max ? new Date(max) : void 0
2551
2605
  }
2552
2606
  ) })
@@ -3129,7 +3183,8 @@ var InputDynamic = ({
3129
3183
  onChange,
3130
3184
  language = "id",
3131
3185
  labels,
3132
- menuPlacement
3186
+ menuPlacement,
3187
+ disablePastDates = false
3133
3188
  }) => {
3134
3189
  const styles = useStyles8();
3135
3190
  const mergedLabels = { ...DEFAULT_LABELS7[language], ...labels };
@@ -3434,6 +3489,7 @@ var InputDynamic = ({
3434
3489
  children: /* @__PURE__ */ jsx(
3435
3490
  PhoneInput,
3436
3491
  {
3492
+ countryCodeEditable: false,
3437
3493
  inputStyle: phoneInputSizeStyle,
3438
3494
  country: defaultCountry.toLowerCase(),
3439
3495
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
@@ -3541,6 +3597,7 @@ var InputDynamic = ({
3541
3597
  children: /* @__PURE__ */ jsx(
3542
3598
  PhoneInput,
3543
3599
  {
3600
+ countryCodeEditable: false,
3544
3601
  country: defaultCountry.toLowerCase(),
3545
3602
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
3546
3603
  onChange: (value, data) => {
@@ -3740,6 +3797,7 @@ var InputDynamic = ({
3740
3797
  children: /* @__PURE__ */ jsx(
3741
3798
  PhoneInput,
3742
3799
  {
3800
+ countryCodeEditable: false,
3743
3801
  ...phoneInputProps,
3744
3802
  country: defaultCountry.toLowerCase(),
3745
3803
  disabled,
@@ -3795,7 +3853,9 @@ var InputDynamic = ({
3795
3853
  size,
3796
3854
  onClick,
3797
3855
  style: inputStyle,
3798
- max: max ? String(max) : void 0
3856
+ max: max ? String(max) : void 0,
3857
+ min: min ? String(min) : void 0,
3858
+ disablePastDates
3799
3859
  }
3800
3860
  );
3801
3861
  }
@@ -5330,7 +5390,8 @@ var DEFAULT_LABELS10 = {
5330
5390
  loadingData: "Memuat data...",
5331
5391
  harborNotFound: "Pelabuhan tidak ditemukan",
5332
5392
  closeAriaLabel: "Tutup",
5333
- popularHarborHeader: "Pelabuhan Populer"
5393
+ popularHarborHeader: "Pelabuhan Populer",
5394
+ favoriteHeader: "Favorit"
5334
5395
  },
5335
5396
  en: {
5336
5397
  title: "Select Harbor",
@@ -5341,7 +5402,8 @@ var DEFAULT_LABELS10 = {
5341
5402
  loadingData: "Loading data...",
5342
5403
  harborNotFound: "Harbor not found",
5343
5404
  closeAriaLabel: "Close",
5344
- popularHarborHeader: "Popular Harbor"
5405
+ popularHarborHeader: "Popular Harbor",
5406
+ favoriteHeader: "Favorite"
5345
5407
  }
5346
5408
  };
5347
5409
  var useStyles11 = makeStyles({
@@ -5410,10 +5472,20 @@ var useStyles11 = makeStyles({
5410
5472
  display: "flex",
5411
5473
  gap: "1rem",
5412
5474
  marginBottom: "1rem",
5413
- flexWrap: "wrap"
5475
+ flexWrap: "wrap",
5476
+ marginTop: "1rem"
5414
5477
  },
5415
5478
  circularButton: {
5416
- borderRadius: tokens.borderRadiusCircular
5479
+ borderRadius: tokens.borderRadius3XLarge,
5480
+ border: `1px solid ${tokens.colorBrandBackground}`,
5481
+ backgroundColor: brandColors2["140"],
5482
+ gap: "5px"
5483
+ },
5484
+ buttonContent: {
5485
+ display: "flex",
5486
+ flexDirection: "column",
5487
+ alignItems: "center",
5488
+ justifyContent: "center"
5417
5489
  },
5418
5490
  headerRow: {
5419
5491
  display: "flex",
@@ -5427,11 +5499,13 @@ var useStyles11 = makeStyles({
5427
5499
  historyItem: {
5428
5500
  display: "flex",
5429
5501
  justifyContent: "space-between",
5502
+ alignItems: "center",
5430
5503
  marginTop: "1rem",
5431
5504
  marginBottom: "1rem"
5432
5505
  },
5433
5506
  iconMargin: {
5434
- marginRight: "0.5rem"
5507
+ marginRight: "1rem"
5508
+ // fontSize: tokens.fontSizeBase400
5435
5509
  },
5436
5510
  cursorPointer: {
5437
5511
  cursor: "pointer"
@@ -5448,14 +5522,51 @@ var useStyles11 = makeStyles({
5448
5522
  },
5449
5523
  harborItem: {
5450
5524
  display: "flex",
5451
- justifyContent: "space-between"
5525
+ justifyContent: "space-between",
5526
+ alignItems: "center"
5452
5527
  },
5453
5528
  emptyState: {
5454
5529
  textAlign: "center",
5455
5530
  padding: "32px",
5456
5531
  color: tokens.colorNeutralForeground3
5532
+ },
5533
+ listContent: {
5534
+ cursor: "pointer",
5535
+ display: "flex",
5536
+ justifyContent: "center",
5537
+ alignItems: "center"
5457
5538
  }
5458
5539
  });
5540
+ var HarborListItem = ({
5541
+ harbor,
5542
+ onSelect,
5543
+ trailingIcon,
5544
+ showDivider,
5545
+ containerClassName
5546
+ }) => {
5547
+ const styles = useStyles11();
5548
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5549
+ /* @__PURE__ */ jsxs("div", { className: containerClassName, children: [
5550
+ /* @__PURE__ */ jsxs("div", { className: styles.listContent, onClick: () => onSelect(harbor), children: [
5551
+ /* @__PURE__ */ jsx(
5552
+ Icon,
5553
+ {
5554
+ icon: "fluent:vehicle-ship-24-regular",
5555
+ fontSize: 20,
5556
+ className: styles.iconMargin
5557
+ }
5558
+ ),
5559
+ /* @__PURE__ */ jsxs("div", { style: { textAlign: "left" }, children: [
5560
+ /* @__PURE__ */ jsx(Body1, { children: harbor.portName }),
5561
+ /* @__PURE__ */ jsx("br", {}),
5562
+ /* @__PURE__ */ jsx(Caption1, { children: harbor.branchName })
5563
+ ] })
5564
+ ] }),
5565
+ trailingIcon
5566
+ ] }),
5567
+ showDivider && /* @__PURE__ */ jsx(Divider, {})
5568
+ ] });
5569
+ };
5459
5570
  var ModalSearchHarbor = ({
5460
5571
  language = "id",
5461
5572
  labels,
@@ -5474,6 +5585,7 @@ var ModalSearchHarbor = ({
5474
5585
  onAddLastSearched,
5475
5586
  onRemoveLastSearched,
5476
5587
  onClearLastSearched,
5588
+ onClearFavorite,
5477
5589
  popularHarbors,
5478
5590
  showButtonFavorite = true
5479
5591
  }) => {
@@ -5532,119 +5644,169 @@ var ModalSearchHarbor = ({
5532
5644
  size: "large"
5533
5645
  }
5534
5646
  ) }),
5535
- favoriteHarbors.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsx(
5536
- Button,
5537
- {
5538
- onClick: () => handleSelect(harbor),
5539
- size: "medium",
5540
- appearance: "outline",
5541
- iconPosition: "before",
5542
- className: styles.circularButton,
5543
- icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:ribbon-20-filled" }),
5544
- children: /* @__PURE__ */ jsx(Body1, { children: harbor.portName + ", " + harbor.branchName })
5545
- },
5546
- harbor.portId
5547
- )) }),
5548
- /* @__PURE__ */ jsx(Divider, {}),
5549
5647
  /* @__PURE__ */ jsxs("div", { className: styles.resultList, children: [
5550
- lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5648
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5551
5649
  /* @__PURE__ */ jsxs("div", { className: styles.headerRow, children: [
5552
- /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.lastSearchedHeader }),
5650
+ /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.favoriteHeader }),
5553
5651
  /* @__PURE__ */ jsx(
5554
5652
  Caption1,
5555
5653
  {
5556
- className: `${styles.dangerText} ${styles.cursorPointer}`,
5557
- onClick: onClearLastSearched,
5654
+ className: mergeClasses(
5655
+ styles.dangerText,
5656
+ styles.cursorPointer
5657
+ ),
5658
+ onClick: onClearFavorite,
5558
5659
  children: mergedLabels.clearAllButton
5559
5660
  }
5560
5661
  )
5561
5662
  ] }),
5562
- /* @__PURE__ */ jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsxs("div", { className: styles.historyItem, children: [
5563
- /* @__PURE__ */ jsxs(
5564
- "div",
5565
- {
5566
- style: { cursor: "pointer" },
5567
- onClick: () => handleSelect(harbor),
5568
- children: [
5569
- /* @__PURE__ */ jsx(
5570
- Icon,
5571
- {
5572
- icon: "fluent:vehicle-ship-24-regular",
5573
- className: styles.iconMargin
5574
- }
5575
- ),
5576
- harbor.portName + ", " + harbor.branchName
5577
- ]
5578
- }
5579
- ),
5580
- /* @__PURE__ */ jsx(
5581
- Icon,
5582
- {
5583
- onClick: () => onRemoveLastSearched(harbor),
5584
- icon: "fluent:dismiss-24-regular",
5585
- color: tokens.colorStatusDangerForeground1,
5586
- className: styles.cursorPointer
5587
- }
5588
- )
5589
- ] }, harbor.portId)) }),
5590
- /* @__PURE__ */ jsx(Divider, {})
5591
- ] }),
5592
- popularHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5593
- /* @__PURE__ */ jsx("div", { className: styles.headerRow, children: /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.popularHarborHeader }) }),
5594
- /* @__PURE__ */ jsx("div", { children: popularHarbors.map((harbor) => /* @__PURE__ */ jsx("div", { className: styles.historyItem, children: /* @__PURE__ */ jsxs(
5595
- "div",
5663
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsxs(
5664
+ Button,
5596
5665
  {
5597
- style: { cursor: "pointer" },
5598
5666
  onClick: () => handleSelect(harbor),
5667
+ size: "medium",
5668
+ appearance: "subtle",
5669
+ iconPosition: "before",
5670
+ className: styles.circularButton,
5671
+ icon: /* @__PURE__ */ jsx(
5672
+ Icon,
5673
+ {
5674
+ icon: "fluent:vehicle-ship-20-regular",
5675
+ fontSize: 20,
5676
+ color: tokens.colorBrandBackground
5677
+ }
5678
+ ),
5599
5679
  children: [
5680
+ /* @__PURE__ */ jsxs("div", { className: styles.buttonContent, children: [
5681
+ /* @__PURE__ */ jsx(Body1, { children: harbor.portName }),
5682
+ /* @__PURE__ */ jsx(Caption1, { children: harbor.branchName })
5683
+ ] }),
5600
5684
  /* @__PURE__ */ jsx(
5601
5685
  Icon,
5602
5686
  {
5603
- icon: "fluent:vehicle-ship-24-regular",
5604
- className: styles.iconMargin
5687
+ icon: "fluent:star-24-filled",
5688
+ fontSize: 20,
5689
+ color: tokens.colorBrandBackground,
5690
+ style: { marginLeft: 5 }
5605
5691
  }
5606
- ),
5607
- harbor.portName + ", " + harbor.branchName
5692
+ )
5608
5693
  ]
5609
- }
5610
- ) }, harbor.portId)) }),
5611
- /* @__PURE__ */ jsx(Divider, {})
5694
+ },
5695
+ harbor.portId
5696
+ )) })
5697
+ ] }),
5698
+ lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5699
+ /* @__PURE__ */ jsxs("div", { className: styles.headerRow, children: [
5700
+ /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.lastSearchedHeader }),
5701
+ /* @__PURE__ */ jsx(
5702
+ Caption1,
5703
+ {
5704
+ className: mergeClasses(
5705
+ styles.dangerText,
5706
+ styles.cursorPointer
5707
+ ),
5708
+ onClick: onClearLastSearched,
5709
+ children: mergedLabels.clearAllButton
5710
+ }
5711
+ )
5712
+ ] }),
5713
+ /* @__PURE__ */ jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsx(
5714
+ HarborListItem,
5715
+ {
5716
+ harbor,
5717
+ onSelect: handleSelect,
5718
+ containerClassName: styles.historyItem,
5719
+ trailingIcon: /* @__PURE__ */ jsx(
5720
+ Icon,
5721
+ {
5722
+ onClick: () => onRemoveLastSearched(harbor),
5723
+ icon: "fluent:dismiss-24-regular",
5724
+ fontSize: 20,
5725
+ className: styles.cursorPointer
5726
+ }
5727
+ ),
5728
+ showDivider: true
5729
+ },
5730
+ harbor.portId
5731
+ )) })
5732
+ ] }),
5733
+ popularHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5734
+ /* @__PURE__ */ jsx("div", { className: styles.headerRow, children: /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.popularHarborHeader }) }),
5735
+ /* @__PURE__ */ jsx("div", { children: popularHarbors.map((harbor) => /* @__PURE__ */ jsx(
5736
+ HarborListItem,
5737
+ {
5738
+ harbor,
5739
+ onSelect: handleSelect,
5740
+ containerClassName: styles.historyItem,
5741
+ showDivider: true
5742
+ },
5743
+ harbor.portId
5744
+ )) })
5612
5745
  ] }),
5613
5746
  /* @__PURE__ */ jsx(Body1Strong, { className: styles.sectionTitle, children: mergedLabels.allHarborsHeader }),
5614
5747
  /* @__PURE__ */ jsx("div", { className: styles.harborList, children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: [1, 2, 3, 4, 5].map((item) => /* @__PURE__ */ jsxs("div", { className: styles.harborItem, children: [
5615
- /* @__PURE__ */ jsxs(Skeleton, { style: { display: "flex", alignItems: "center", gap: "0.5rem", width: "70%" }, children: [
5616
- /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }),
5617
- /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "100%", height: "20px", borderRadius: "4px" } })
5618
- ] }),
5619
- showButtonFavorite && /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }) })
5620
- ] }, item)) }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsxs("div", { className: styles.harborItem, children: [
5621
5748
  /* @__PURE__ */ jsxs(
5622
- "div",
5749
+ Skeleton,
5623
5750
  {
5624
- className: styles.cursorPointer,
5625
- onClick: () => handleSelect(harbor),
5751
+ style: {
5752
+ display: "flex",
5753
+ alignItems: "center",
5754
+ gap: "0.5rem",
5755
+ width: "70%"
5756
+ },
5626
5757
  children: [
5627
5758
  /* @__PURE__ */ jsx(
5628
- Icon,
5759
+ SkeletonItem,
5629
5760
  {
5630
- icon: "fluent:vehicle-ship-24-regular",
5631
- className: styles.iconMargin
5761
+ style: {
5762
+ width: "24px",
5763
+ height: "24px",
5764
+ borderRadius: "4px"
5765
+ }
5632
5766
  }
5633
5767
  ),
5634
- harbor.portName + ", " + harbor.branchName
5768
+ /* @__PURE__ */ jsx(
5769
+ SkeletonItem,
5770
+ {
5771
+ style: {
5772
+ width: "100%",
5773
+ height: "20px",
5774
+ borderRadius: "4px"
5775
+ }
5776
+ }
5777
+ )
5635
5778
  ]
5636
5779
  }
5637
5780
  ),
5638
- showButtonFavorite && /* @__PURE__ */ jsx(
5639
- Icon,
5781
+ showButtonFavorite && /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(
5782
+ SkeletonItem,
5640
5783
  {
5641
- icon: harbor.isFavorite ? "fluent:star-24-filled" : "fluent:star-24-regular",
5642
- color: tokens.colorBrandBackground,
5643
- className: styles.cursorPointer,
5644
- onClick: () => onToggleFavorite(harbor)
5784
+ style: {
5785
+ width: "24px",
5786
+ height: "24px",
5787
+ borderRadius: "4px"
5788
+ }
5645
5789
  }
5646
- )
5647
- ] }, index)) : /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: mergedLabels.harborNotFound }) })
5790
+ ) })
5791
+ ] }, item)) }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsx(
5792
+ HarborListItem,
5793
+ {
5794
+ harbor,
5795
+ onSelect: handleSelect,
5796
+ containerClassName: styles.harborItem,
5797
+ trailingIcon: showButtonFavorite && /* @__PURE__ */ jsx(
5798
+ Icon,
5799
+ {
5800
+ icon: harbor.isFavorite ? "fluent:star-24-filled" : "fluent:star-24-regular",
5801
+ color: tokens.colorBrandBackground,
5802
+ className: styles.cursorPointer,
5803
+ onClick: () => onToggleFavorite(harbor)
5804
+ }
5805
+ ),
5806
+ showDivider: index !== harbors.length - 1
5807
+ },
5808
+ harbor.portId || index
5809
+ )) : /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: mergedLabels.harborNotFound }) })
5648
5810
  ] })
5649
5811
  ] })
5650
5812
  ] }) })
@@ -8744,12 +8906,34 @@ var ModalListPassenger = ({
8744
8906
  }
8745
8907
  },
8746
8908
  children: [
8747
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Subtitle2, { children: [
8748
- passenger.fullName,
8749
- " (",
8750
- passenger.ageLabel,
8751
- " )"
8752
- ] }) }),
8909
+ /* @__PURE__ */ jsxs("div", { children: [
8910
+ /* @__PURE__ */ jsxs(Subtitle2, { children: [
8911
+ passenger.fullName,
8912
+ " ",
8913
+ passenger.isAccountOwner && /* @__PURE__ */ jsx(
8914
+ Caption2Strong,
8915
+ {
8916
+ style: {
8917
+ backgroundColor: "#F3F9FD",
8918
+ border: `1px solid #A9D3F2`,
8919
+ borderRadius: "1em",
8920
+ display: "inline-block",
8921
+ color: "#0078D4",
8922
+ padding: ".4em .9em"
8923
+ },
8924
+ children: "Pemilik Akun"
8925
+ }
8926
+ )
8927
+ ] }),
8928
+ /* @__PURE__ */ jsx("br", {}),
8929
+ /* @__PURE__ */ jsxs(Body1, { children: [
8930
+ passenger.ageLabel,
8931
+ " \xB7 ",
8932
+ passenger.identityTypeCode,
8933
+ " ",
8934
+ passenger.identityId
8935
+ ] })
8936
+ ] }),
8753
8937
  /* @__PURE__ */ jsx(
8754
8938
  Button,
8755
8939
  {
@@ -8807,8 +8991,10 @@ var DEFAULT_LABELS22 = {
8807
8991
  idTypePlaceholder: "Pilih",
8808
8992
  idNumberLabel: "Nomor Identitas",
8809
8993
  idNumberPlaceholder: "Masukkan Nomor Identitas",
8810
- ageLabel: "Usia",
8811
- agePlaceholder: "Masukkan Usia",
8994
+ age: "Usia",
8995
+ agePlaceholder: "0 Tahun 0 Bulan",
8996
+ yearLabel: "tahun",
8997
+ monthLabel: "bulan",
8812
8998
  dateLabel: "Tanggal Lahir",
8813
8999
  datePlaceholder: "Masukkan Tanggal Lahir",
8814
9000
  cityLabel: "Kota Kabupaten",
@@ -8853,6 +9039,7 @@ var DEFAULT_LABELS22 = {
8853
9039
  minAge: "Usia minimal 1 tahun",
8854
9040
  maxAge: "Usia maksimal 150 tahun",
8855
9041
  requiredDate: "Tanggal lahir harus diisi",
9042
+ birthDateFuture: "Tanggal lahir tidak boleh di masa depan",
8856
9043
  requiredCity: "Kota/Kabupaten harus diisi",
8857
9044
  requiredCountry: "Negara harus diisi",
8858
9045
  requiredPhoneNumber: "Nomor telepon harus diisi",
@@ -8870,8 +9057,10 @@ var DEFAULT_LABELS22 = {
8870
9057
  idTypePlaceholder: "Select",
8871
9058
  idNumberLabel: "Identity Number",
8872
9059
  idNumberPlaceholder: "Enter Identity Number",
8873
- ageLabel: "Age",
8874
- agePlaceholder: "Enter Age",
9060
+ age: "Age",
9061
+ agePlaceholder: "0 Year 0 Month",
9062
+ yearLabel: "year(s)",
9063
+ monthLabel: "month(s)",
8875
9064
  dateLabel: "Date of Birth",
8876
9065
  datePlaceholder: "Enter Date of Birth",
8877
9066
  cityLabel: "City/Regency",
@@ -8916,6 +9105,7 @@ var DEFAULT_LABELS22 = {
8916
9105
  minAge: "Age must be at least 1 year",
8917
9106
  maxAge: "Age must be at most 150 years",
8918
9107
  requiredDate: "Date of birth is required",
9108
+ birthDateFuture: "Date of birth cannot be in the future",
8919
9109
  requiredCity: "City/Regency is required",
8920
9110
  requiredCountry: "Country is required",
8921
9111
  requiredPhoneNumber: "Phone number is required",
@@ -8924,24 +9114,23 @@ var DEFAULT_LABELS22 = {
8924
9114
  }
8925
9115
  }
8926
9116
  };
8927
- var TYPE_OPTIONS = [
8928
- {
8929
- label: "KTP",
8930
- value: "ktp"
8931
- },
8932
- {
8933
- label: "SIM",
8934
- value: "sim"
8935
- },
8936
- {
8937
- label: "Paspor",
8938
- value: "paspor"
8939
- },
8940
- {
8941
- label: "Lainnya",
8942
- value: "lainnya"
9117
+
9118
+ // src/utils/date.ts
9119
+ var calculateAge = (birthDate) => {
9120
+ const today = /* @__PURE__ */ new Date();
9121
+ const birth = new Date(birthDate);
9122
+ if (isNaN(birth.getTime())) return { years: 0, months: 0 };
9123
+ let years = today.getFullYear() - birth.getFullYear();
9124
+ let months = today.getMonth() - birth.getMonth();
9125
+ if (today.getDate() < birth.getDate()) {
9126
+ months--;
8943
9127
  }
8944
- ];
9128
+ if (months < 0) {
9129
+ years--;
9130
+ months += 12;
9131
+ }
9132
+ return { years: Math.max(0, years), months: Math.max(0, months) };
9133
+ };
8945
9134
  var useStyles23 = makeStyles({
8946
9135
  dialogSurface: {
8947
9136
  maxWidth: "600px",
@@ -9107,16 +9296,18 @@ var useStyles23 = makeStyles({
9107
9296
  }
9108
9297
  });
9109
9298
  var ModalPassengerForm = ({
9299
+ defaultValues,
9110
9300
  language = "id",
9111
9301
  labels,
9112
9302
  open,
9303
+ onChange,
9113
9304
  onClose,
9114
- title,
9115
9305
  onSubmit,
9116
- defaultValues,
9117
- isAdultForm = true,
9306
+ title,
9118
9307
  titleOptions,
9308
+ countryOptions,
9119
9309
  cityOptions,
9310
+ idTypeOptions,
9120
9311
  ticketClassOptions,
9121
9312
  onScanComplete
9122
9313
  }) => {
@@ -9127,7 +9318,6 @@ var ModalPassengerForm = ({
9127
9318
  ...labels?.errors
9128
9319
  };
9129
9320
  const displayTitle = title || mergedLabels.title;
9130
- const idTypes = ["KTP", "SIM", "Paspor"];
9131
9321
  const [isModalSelectIdTypeOpen, setIsModalSelectIdTypeOpen] = useState(false);
9132
9322
  const [isModalScanOpen, setIsModalScanOpen] = useState(false);
9133
9323
  const [scannedIdType, setScannedIdType] = useState(null);
@@ -9139,16 +9329,42 @@ var ModalPassengerForm = ({
9139
9329
  const { control, handleSubmit, reset, watch, setValue } = useForm({
9140
9330
  defaultValues
9141
9331
  });
9142
- const idType = watch("idType");
9143
- const watchPassportCountry = watch("country");
9332
+ watch();
9333
+ const watchIdentityTypeId = watch("identityTypeId");
9334
+ const watchPassportCountryId = watch("countryId");
9335
+ const watchBirthdate = watch("birthdate");
9336
+ useEffect(() => {
9337
+ const subscription = watch((value, { name, type }) => {
9338
+ console.log("Changed field:", name);
9339
+ console.log("Change type:", type);
9340
+ onChange(value);
9341
+ });
9342
+ return () => subscription.unsubscribe();
9343
+ }, [watch, onChange]);
9144
9344
  useEffect(() => {
9145
9345
  reset(defaultValues);
9146
9346
  }, [defaultValues, reset]);
9147
9347
  useEffect(() => {
9148
- if (idType) {
9149
- setValue("idNumber", "");
9348
+ if (watchIdentityTypeId) {
9349
+ setValue("identityId", "");
9150
9350
  }
9151
- }, [idType, watchPassportCountry, setValue]);
9351
+ }, [watchIdentityTypeId, watchPassportCountryId, setValue]);
9352
+ useEffect(() => {
9353
+ if (watchBirthdate) {
9354
+ const { years, months } = calculateAge(watchBirthdate);
9355
+ setValue(
9356
+ "age",
9357
+ `${years} ${mergedLabels.yearLabel} ${months} ${mergedLabels.monthLabel}`
9358
+ );
9359
+ } else {
9360
+ setValue("age", "");
9361
+ }
9362
+ }, [
9363
+ watchBirthdate,
9364
+ setValue,
9365
+ mergedLabels.yearLabel,
9366
+ mergedLabels.monthLabel
9367
+ ]);
9152
9368
  const stopCamera = useCallback(() => {
9153
9369
  if (stream) {
9154
9370
  stream.getTracks().forEach((track) => track.stop());
@@ -9184,7 +9400,7 @@ var ModalPassengerForm = ({
9184
9400
  ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
9185
9401
  setCapturedImage(canvas.toDataURL("image/jpeg"));
9186
9402
  stopCamera();
9187
- if (scannedIdType === "KTP") {
9403
+ if (scannedIdType === IDENTITY_TYPE.KTP) {
9188
9404
  setScanStatus("reading");
9189
9405
  } else {
9190
9406
  setScanStatus("error");
@@ -9257,14 +9473,14 @@ var ModalPassengerForm = ({
9257
9473
  }
9258
9474
  stopCamera();
9259
9475
  if (name) {
9260
- setValue("name", name, {
9476
+ setValue("fullName", name, {
9261
9477
  shouldValidate: true,
9262
9478
  shouldDirty: true
9263
9479
  });
9264
9480
  }
9265
9481
  if (idNumber && scannedIdType) {
9266
- setValue("idType", scannedIdType.toLowerCase());
9267
- setValue("idNumber", idNumber);
9482
+ setValue("identityTypeId", scannedIdType.toString());
9483
+ setValue("identityId", idNumber);
9268
9484
  }
9269
9485
  onScanComplete?.({ name, idNumber, city });
9270
9486
  setScanStatus("success");
@@ -9346,22 +9562,22 @@ var ModalPassengerForm = ({
9346
9562
  children: /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.selectIdTypeTitle })
9347
9563
  }
9348
9564
  ),
9349
- /* @__PURE__ */ jsx(DialogContent, { className: styles.content, children: /* @__PURE__ */ jsx("div", { className: styles.idTypeList, children: idTypes.map((type) => /* @__PURE__ */ jsx(
9565
+ /* @__PURE__ */ jsx(DialogContent, { className: styles.content, children: /* @__PURE__ */ jsx("div", { className: styles.idTypeList, children: idTypeOptions.map((type) => /* @__PURE__ */ jsx(
9350
9566
  "div",
9351
9567
  {
9352
9568
  className: styles.idTypeItem,
9353
- onClick: () => handleSelectIdType(type),
9569
+ onClick: () => handleSelectIdType(Number(type.value)),
9354
9570
  onKeyDown: (e) => {
9355
9571
  if (e.key === "Enter" || e.key === " ") {
9356
9572
  e.preventDefault();
9357
- handleSelectIdType(type);
9573
+ handleSelectIdType(Number(type.value));
9358
9574
  }
9359
9575
  },
9360
9576
  role: "button",
9361
9577
  tabIndex: 0,
9362
- children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type })
9578
+ children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type.label })
9363
9579
  },
9364
- type
9580
+ type.value
9365
9581
  )) }) })
9366
9582
  ] }) })
9367
9583
  }
@@ -9628,7 +9844,7 @@ var ModalPassengerForm = ({
9628
9844
  /* @__PURE__ */ jsx(
9629
9845
  InputDynamic_default,
9630
9846
  {
9631
- name: "title",
9847
+ name: "titleId",
9632
9848
  control,
9633
9849
  type: "select",
9634
9850
  label: mergedLabels.titleLabel,
@@ -9644,7 +9860,7 @@ var ModalPassengerForm = ({
9644
9860
  /* @__PURE__ */ jsx(
9645
9861
  InputDynamic_default,
9646
9862
  {
9647
- name: "name",
9863
+ name: "fullName",
9648
9864
  control,
9649
9865
  type: "text",
9650
9866
  label: mergedLabels.nameLabel,
@@ -9663,22 +9879,23 @@ var ModalPassengerForm = ({
9663
9879
  /* @__PURE__ */ jsx(
9664
9880
  InputDynamic_default,
9665
9881
  {
9666
- name: "age",
9882
+ name: "birthdate",
9667
9883
  control,
9668
- type: "number",
9669
- label: mergedLabels.ageLabel,
9670
- placeholder: mergedLabels.agePlaceholder,
9884
+ type: "date",
9885
+ label: mergedLabels.dateLabel,
9886
+ placeholder: mergedLabels.datePlaceholder,
9671
9887
  size: "large",
9672
9888
  required: true,
9673
9889
  validationRules: {
9674
- required: mergedErrors.requiredAge,
9675
- min: {
9676
- value: 1,
9677
- message: mergedErrors.minAge
9678
- },
9679
- max: {
9680
- value: 150,
9681
- message: mergedErrors.maxAge
9890
+ required: mergedErrors.requiredDate,
9891
+ validate: (value) => {
9892
+ const selectedDate = new Date(value);
9893
+ const today = /* @__PURE__ */ new Date();
9894
+ today.setHours(0, 0, 0, 0);
9895
+ if (selectedDate > today) {
9896
+ return mergedErrors.birthDateFuture;
9897
+ }
9898
+ return true;
9682
9899
  }
9683
9900
  }
9684
9901
  }
@@ -9686,110 +9903,107 @@ var ModalPassengerForm = ({
9686
9903
  /* @__PURE__ */ jsx(
9687
9904
  InputDynamic_default,
9688
9905
  {
9689
- name: "cityId",
9906
+ name: "age",
9907
+ control,
9908
+ type: "text",
9909
+ disabled: true,
9910
+ label: mergedLabels.age,
9911
+ placeholder: mergedLabels.agePlaceholder,
9912
+ size: "large"
9913
+ }
9914
+ ),
9915
+ /* @__PURE__ */ jsx(
9916
+ InputDynamic_default,
9917
+ {
9918
+ name: "identityTypeId",
9690
9919
  control,
9691
9920
  type: "select",
9692
- label: mergedLabels.cityLabel,
9693
- options: cityOptions,
9694
- placeholder: mergedLabels.cityPlaceholder,
9921
+ label: mergedLabels.idTypeLabel,
9922
+ placeholder: mergedLabels.idTypePlaceholder,
9923
+ options: idTypeOptions,
9695
9924
  size: "large",
9696
9925
  required: true,
9697
9926
  validationRules: {
9698
- required: mergedErrors.requiredCity
9927
+ required: mergedErrors.requiredIdType
9699
9928
  }
9700
9929
  }
9701
9930
  ),
9702
- isAdultForm ? /* @__PURE__ */ jsxs(Fragment, { children: [
9703
- /* @__PURE__ */ jsx(
9931
+ watchIdentityTypeId ? watchIdentityTypeId === "lainnya" ? /* @__PURE__ */ jsx(
9932
+ InputDynamic_default,
9933
+ {
9934
+ name: "identityId",
9935
+ control,
9936
+ type: "date",
9937
+ label: mergedLabels.idTypeOtherLabel,
9938
+ placeholder: mergedLabels.idTypeOtherPlaceholder,
9939
+ size: "large",
9940
+ required: true,
9941
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
9942
+ validationRules: {
9943
+ required: mergedErrors.requiredDate
9944
+ }
9945
+ }
9946
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
9947
+ watchIdentityTypeId === IDENTITY_TYPE.PSP.toString() && /* @__PURE__ */ jsx(
9704
9948
  InputDynamic_default,
9705
9949
  {
9706
- name: "idType",
9950
+ menuPlacement: "top",
9951
+ name: "countryId",
9707
9952
  control,
9953
+ options: countryOptions,
9708
9954
  type: "select",
9709
- label: mergedLabels.idTypeLabel,
9710
- placeholder: mergedLabels.idTypePlaceholder,
9711
- options: TYPE_OPTIONS,
9955
+ label: mergedLabels.countryLabel,
9956
+ placeholder: mergedLabels.countryPlaceholder,
9712
9957
  size: "large",
9713
9958
  required: true,
9714
9959
  validationRules: {
9715
- required: mergedErrors.requiredIdType
9960
+ required: mergedErrors.requiredCountry
9716
9961
  }
9717
9962
  }
9718
9963
  ),
9719
- idType ? idType === "lainnya" ? /* @__PURE__ */ jsx(
9964
+ /* @__PURE__ */ jsx(
9720
9965
  InputDynamic_default,
9721
9966
  {
9722
- name: "idNumber",
9967
+ name: "identityId",
9723
9968
  control,
9724
- type: "date",
9725
- label: mergedLabels.idTypeOtherLabel,
9726
- placeholder: mergedLabels.idTypeOtherPlaceholder,
9969
+ type: watchIdentityTypeId === IDENTITY_TYPE.KTP.toString() ? "number" : "text",
9970
+ label: mergedLabels.idNumberLabel,
9971
+ placeholder: mergedLabels.idNumberPlaceholder,
9727
9972
  size: "large",
9728
9973
  required: true,
9729
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
9730
9974
  validationRules: {
9731
- required: mergedErrors.requiredDate
9732
- }
9733
- }
9734
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
9735
- idType === "paspor" && /* @__PURE__ */ jsx(
9736
- InputDynamic_default,
9737
- {
9738
- menuPlacement: "top",
9739
- name: "country",
9740
- control,
9741
- type: "country",
9742
- label: mergedLabels.countryLabel,
9743
- placeholder: mergedLabels.countryPlaceholder,
9744
- size: "large",
9745
- required: true,
9746
- validationRules: {
9747
- required: mergedErrors.requiredCountry
9975
+ required: mergedErrors.requiredIdNumber,
9976
+ minLength: {
9977
+ value: 6,
9978
+ message: mergedErrors.minLengthIdNumber
9748
9979
  }
9749
9980
  }
9750
- ),
9751
- /* @__PURE__ */ jsx(
9752
- InputDynamic_default,
9753
- {
9754
- name: "idNumber",
9755
- control,
9756
- type: idType === "ktp" ? "number" : "text",
9757
- label: mergedLabels.idNumberLabel,
9758
- placeholder: mergedLabels.idNumberPlaceholder,
9759
- size: "large",
9760
- required: true,
9761
- validationRules: {
9762
- required: mergedErrors.requiredIdNumber,
9763
- minLength: {
9764
- value: 6,
9765
- message: mergedErrors.minLengthIdNumber
9766
- }
9767
- }
9768
- }
9769
- )
9770
- ] }) : null
9771
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
9981
+ }
9982
+ )
9983
+ ] }) : null,
9984
+ /* @__PURE__ */ jsx(
9772
9985
  InputDynamic_default,
9773
9986
  {
9774
- name: "date",
9987
+ name: "regencyId",
9775
9988
  control,
9776
- type: "date",
9777
- label: mergedLabels.dateLabel,
9778
- placeholder: mergedLabels.datePlaceholder,
9989
+ type: "select",
9990
+ label: mergedLabels.cityLabel,
9991
+ options: cityOptions,
9992
+ placeholder: mergedLabels.cityPlaceholder,
9779
9993
  size: "large",
9780
9994
  required: true,
9781
9995
  validationRules: {
9782
- required: mergedErrors.requiredDate
9996
+ required: mergedErrors.requiredCity
9783
9997
  }
9784
9998
  }
9785
- ) }),
9999
+ ),
9786
10000
  /* @__PURE__ */ jsx("br", {}),
9787
10001
  /* @__PURE__ */ jsx(Divider, {}),
9788
10002
  /* @__PURE__ */ jsx("br", {}),
9789
10003
  /* @__PURE__ */ jsx(
9790
10004
  InputDynamic_default,
9791
10005
  {
9792
- name: "ticketClass",
10006
+ name: "passengerClassId",
9793
10007
  control,
9794
10008
  type: "radiobutton",
9795
10009
  label: mergedLabels.ticketClassLabel,
@@ -11125,11 +11339,16 @@ var DEFAULT_LABELS26 = {
11125
11339
  estimationPrefix: "Estimasi",
11126
11340
  totalPriceLabel: "Total Harga",
11127
11341
  nextButton: "Lanjutkan",
11342
+ cancelButton: "Batalkan Pesanan",
11128
11343
  previousButton: "Sebelumnya",
11129
11344
  viewBookingButton: "Lihat Pemesanan",
11130
11345
  changePaymentButton: "Ubah Metode Pembayaran",
11131
11346
  timezoneLabel: "WIB",
11132
- currencySymbol: "IDR"
11347
+ currencySymbol: "IDR",
11348
+ cancelDialogTitle: "Buang perubahan?",
11349
+ cancelDialogBody: "Perubahan belum disimpan dan akan hilang jika Anda melanjutkan.",
11350
+ cancelDialogConfirm: "Buang Perubahan",
11351
+ cancelDialogDismiss: "Batal"
11133
11352
  },
11134
11353
  en: {
11135
11354
  bookingDetails: "Booking Details",
@@ -11137,11 +11356,16 @@ var DEFAULT_LABELS26 = {
11137
11356
  estimationPrefix: "Estimation",
11138
11357
  totalPriceLabel: "Total Price",
11139
11358
  nextButton: "Continue",
11359
+ cancelButton: "Cancel Booking",
11140
11360
  previousButton: "Previous",
11141
11361
  viewBookingButton: "View Booking",
11142
11362
  changePaymentButton: "Change Payment Method",
11143
11363
  timezoneLabel: "WIB",
11144
- currencySymbol: "IDR"
11364
+ currencySymbol: "IDR",
11365
+ cancelDialogTitle: "Discard changes?",
11366
+ cancelDialogBody: "Changes have not been saved and will be lost if you continue.",
11367
+ cancelDialogConfirm: "Discard Changes",
11368
+ cancelDialogDismiss: "Cancel"
11145
11369
  }
11146
11370
  };
11147
11371
  var useStyles27 = makeStyles({
@@ -11253,6 +11477,35 @@ var useStyles27 = makeStyles({
11253
11477
  border: "1px solid " + tokens.colorBrandStroke1,
11254
11478
  color: tokens.colorBrandBackground,
11255
11479
  width: "100%"
11480
+ },
11481
+ cancelButton: {
11482
+ border: "1px solid #D13438",
11483
+ color: "#D13438",
11484
+ width: "100%"
11485
+ },
11486
+ dialogDismissButton: {
11487
+ border: "1px solid " + tokens.colorBrandStroke1,
11488
+ color: tokens.colorBrandBackground,
11489
+ borderRadius: tokens.borderRadiusCircular,
11490
+ marginTop: "1em",
11491
+ marginBottom: ".5em",
11492
+ width: "100%"
11493
+ },
11494
+ dialogConfirmButton: {
11495
+ backgroundColor: "#D13438",
11496
+ color: tokens.colorNeutralForegroundOnBrand,
11497
+ width: "100%",
11498
+ borderRadius: tokens.borderRadiusCircular,
11499
+ border: "none",
11500
+ "&:hover": {
11501
+ backgroundColor: "#b02020"
11502
+ }
11503
+ },
11504
+ dialogActions: {
11505
+ display: "flex",
11506
+ flexDirection: "column",
11507
+ gap: tokens.spacingVerticalS,
11508
+ width: "100%"
11256
11509
  }
11257
11510
  });
11258
11511
  var CardBookingTicket = ({
@@ -11265,6 +11518,7 @@ var CardBookingTicket = ({
11265
11518
  departureDay,
11266
11519
  departureTime,
11267
11520
  departureLocation,
11521
+ disableNextButton,
11268
11522
  arrivalDay,
11269
11523
  arrivalTime,
11270
11524
  arrivalLocation,
@@ -11273,12 +11527,14 @@ var CardBookingTicket = ({
11273
11527
  reservationStep,
11274
11528
  paymentStep,
11275
11529
  onPriceDetailClick,
11530
+ onCancel,
11276
11531
  onNext,
11277
11532
  onPrevious,
11278
11533
  className
11279
11534
  }) => {
11280
11535
  const styles = useStyles27();
11281
11536
  const mergedLabels = { ...DEFAULT_LABELS26[language], ...labels };
11537
+ const [cancelDialogOpen, setCancelDialogOpen] = useState(false);
11282
11538
  return /* @__PURE__ */ jsx("div", { className: `${styles.container} ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: styles.bookingDetail, children: [
11283
11539
  /* @__PURE__ */ jsxs(Card, { className: styles.bookingDetailTop, children: [
11284
11540
  /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.bookingDetails }),
@@ -11362,6 +11618,7 @@ var CardBookingTicket = ({
11362
11618
  Button,
11363
11619
  {
11364
11620
  appearance: "primary",
11621
+ disabled: disableNextButton,
11365
11622
  onClick: onNext,
11366
11623
  shape: "circular",
11367
11624
  size: "large",
@@ -11385,31 +11642,93 @@ var CardBookingTicket = ({
11385
11642
  iconPosition: "before",
11386
11643
  children: mergedLabels.previousButton
11387
11644
  }
11388
- )
11389
- ] }),
11390
- paymentStep === "pay" && /* @__PURE__ */ jsxs("div", { className: styles.gapButton, children: [
11391
- /* @__PURE__ */ jsx(
11392
- Button,
11393
- {
11394
- appearance: "primary",
11395
- shape: "circular",
11396
- size: "large",
11397
- style: { width: "100%" },
11398
- onClick: onNext,
11399
- children: mergedLabels.viewBookingButton
11400
- }
11401
11645
  ),
11402
- /* @__PURE__ */ jsx(
11403
- Button,
11404
- {
11405
- appearance: "secondary",
11406
- shape: "circular",
11407
- size: "large",
11408
- className: styles.secondaryButton,
11409
- onClick: onPrevious,
11410
- children: mergedLabels.changePaymentButton
11411
- }
11412
- )
11646
+ paymentStep === "pay" && /* @__PURE__ */ jsxs(Fragment, { children: [
11647
+ /* @__PURE__ */ jsx(
11648
+ Button,
11649
+ {
11650
+ appearance: "primary",
11651
+ disabled: disableNextButton,
11652
+ onClick: onNext,
11653
+ shape: "circular",
11654
+ size: "large",
11655
+ style: { width: "100%" },
11656
+ children: mergedLabels.viewBookingButton
11657
+ }
11658
+ ),
11659
+ /* @__PURE__ */ jsx(
11660
+ Button,
11661
+ {
11662
+ appearance: "secondary",
11663
+ shape: "circular",
11664
+ size: "large",
11665
+ className: styles.secondaryButton,
11666
+ onClick: onPrevious,
11667
+ children: mergedLabels.changePaymentButton
11668
+ }
11669
+ )
11670
+ ] }),
11671
+ reservationStep === "manifest" && /* @__PURE__ */ jsxs(Fragment, { children: [
11672
+ /* @__PURE__ */ jsx(
11673
+ Button,
11674
+ {
11675
+ appearance: "outline",
11676
+ onClick: () => setCancelDialogOpen(true),
11677
+ shape: "circular",
11678
+ size: "large",
11679
+ className: styles.cancelButton,
11680
+ iconPosition: "before",
11681
+ children: mergedLabels.cancelButton
11682
+ }
11683
+ ),
11684
+ /* @__PURE__ */ jsx(
11685
+ Dialog,
11686
+ {
11687
+ open: cancelDialogOpen,
11688
+ onOpenChange: (_, data) => setCancelDialogOpen(data.open),
11689
+ children: /* @__PURE__ */ jsx(DialogSurface, { style: { maxWidth: "479px", width: "479px" }, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
11690
+ /* @__PURE__ */ jsx(
11691
+ DialogTitle,
11692
+ {
11693
+ action: /* @__PURE__ */ jsx(DialogTrigger, { action: "close", children: /* @__PURE__ */ jsx(
11694
+ Button,
11695
+ {
11696
+ appearance: "subtle",
11697
+ "aria-label": "close",
11698
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-24-regular" })
11699
+ }
11700
+ ) }),
11701
+ children: /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.cancelDialogTitle })
11702
+ }
11703
+ ),
11704
+ /* @__PURE__ */ jsxs(DialogContent, { children: [
11705
+ /* @__PURE__ */ jsx(Body1, { children: mergedLabels.cancelDialogBody }),
11706
+ /* @__PURE__ */ jsx(
11707
+ Button,
11708
+ {
11709
+ className: styles.dialogDismissButton,
11710
+ size: "large",
11711
+ onClick: () => setCancelDialogOpen(false),
11712
+ children: mergedLabels.cancelDialogDismiss
11713
+ }
11714
+ ),
11715
+ /* @__PURE__ */ jsx(
11716
+ Button,
11717
+ {
11718
+ className: styles.dialogConfirmButton,
11719
+ size: "large",
11720
+ onClick: () => {
11721
+ setCancelDialogOpen(false);
11722
+ onCancel();
11723
+ },
11724
+ children: mergedLabels.cancelDialogConfirm
11725
+ }
11726
+ )
11727
+ ] })
11728
+ ] }) })
11729
+ }
11730
+ )
11731
+ ] })
11413
11732
  ] })
11414
11733
  ] })
11415
11734
  ] }) });
@@ -13515,14 +13834,16 @@ var DEFAULT_LABELS38 = {
13515
13834
  maxSizeWarning: "Maksimal {maxSize}MB per file dalam format PDF, JPG, JPEG, PNG.",
13516
13835
  sizeLabel: "Ukuran",
13517
13836
  preview: "Pratinjau",
13518
- requiredError: "wajib diisi"
13837
+ requiredError: "wajib diisi",
13838
+ downloadTemplateDocument: "Download Template Dokumen"
13519
13839
  },
13520
13840
  en: {
13521
13841
  placeholder: "Tap to select a file",
13522
13842
  maxSizeWarning: "Maximum {maxSize}MB per file in PDF, JPG, JPEG, PNG format.",
13523
13843
  sizeLabel: "Size",
13524
13844
  preview: "Preview",
13525
- requiredError: "is required"
13845
+ requiredError: "is required",
13846
+ downloadTemplateDocument: "Download Template Document"
13526
13847
  }
13527
13848
  };
13528
13849
  var useStyles40 = makeStyles({
@@ -13662,7 +13983,8 @@ var FileUpload = React.forwardRef(
13662
13983
  disabled = false,
13663
13984
  language = "id",
13664
13985
  labels: customLabels,
13665
- pdfIcon
13986
+ pdfIcon,
13987
+ downloadTemplateDocument = false
13666
13988
  }, ref) => {
13667
13989
  const mergedLabels = { ...DEFAULT_LABELS38[language], ...customLabels };
13668
13990
  const styles = uploadStyles();
@@ -13747,6 +14069,20 @@ var FileUpload = React.forwardRef(
13747
14069
  }
13748
14070
  }
13749
14071
  };
14072
+ const handleDownloadFile = (e, file) => {
14073
+ e.stopPropagation();
14074
+ if (!(file instanceof File)) {
14075
+ return;
14076
+ }
14077
+ const fileUrl = URL.createObjectURL(file);
14078
+ const link = document.createElement("a");
14079
+ link.href = fileUrl;
14080
+ link.download = file.name;
14081
+ document.body.appendChild(link);
14082
+ link.click();
14083
+ document.body.removeChild(link);
14084
+ URL.revokeObjectURL(fileUrl);
14085
+ };
13750
14086
  const getContainerStyle = (hasFile, hasError) => {
13751
14087
  if (disabled && hasFile) return styles.containerDisabled;
13752
14088
  if (hasError) return styles.containerError;
@@ -13856,202 +14192,216 @@ var FileUpload = React.forwardRef(
13856
14192
  }
13857
14193
  );
13858
14194
  }
13859
- return /* @__PURE__ */ jsxs(
13860
- Field,
13861
- {
13862
- ref,
13863
- required,
13864
- label: /* @__PURE__ */ jsx(Body1, { children: label }),
13865
- className: styles.fieldContainer,
13866
- children: [
13867
- /* @__PURE__ */ jsxs(
13868
- Container,
13869
- {
13870
- className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
13871
- onClick: handleClick,
13872
- onDrop: (e) => handleDrop(e, onChange),
13873
- onDragOver: handleDragOver,
13874
- onDragLeave: handleDragLeave,
13875
- fluid: true,
13876
- children: [
13877
- /* @__PURE__ */ jsxs(
13878
- Row,
13879
- {
13880
- nogutter: true,
13881
- style: { gap: tokens.spacingVerticalL },
13882
- justify: "center",
13883
- align: "center",
13884
- children: [
13885
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsx(
13886
- Icon,
13887
- {
13888
- icon: "fluent:warning-32-regular",
13889
- style: {
13890
- color: tokens.colorStatusWarningBackground3,
13891
- maxWidth: "32px",
13892
- width: "32px",
13893
- maxHeight: "32px",
13894
- height: "32px"
14195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
14196
+ /* @__PURE__ */ jsxs(
14197
+ Field,
14198
+ {
14199
+ ref,
14200
+ required,
14201
+ label: /* @__PURE__ */ jsx(Body1, { children: label }),
14202
+ className: styles.fieldContainer,
14203
+ children: [
14204
+ /* @__PURE__ */ jsxs(
14205
+ Container,
14206
+ {
14207
+ className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
14208
+ onClick: handleClick,
14209
+ onDrop: (e) => handleDrop(e, onChange),
14210
+ onDragOver: handleDragOver,
14211
+ onDragLeave: handleDragLeave,
14212
+ fluid: true,
14213
+ children: [
14214
+ /* @__PURE__ */ jsxs(
14215
+ Row,
14216
+ {
14217
+ nogutter: true,
14218
+ style: { gap: tokens.spacingVerticalL },
14219
+ justify: "center",
14220
+ align: "center",
14221
+ children: [
14222
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsx(
14223
+ Icon,
14224
+ {
14225
+ icon: "fluent:warning-32-regular",
14226
+ style: {
14227
+ color: tokens.colorStatusWarningBackground3,
14228
+ maxWidth: "32px",
14229
+ width: "32px",
14230
+ maxHeight: "32px",
14231
+ height: "32px"
14232
+ }
13895
14233
  }
13896
- }
13897
- ) : /* @__PURE__ */ jsx(
13898
- Icon,
13899
- {
13900
- icon: "fluent:arrow-upload-32-filled",
13901
- style: {
13902
- color: brandColors2[80],
13903
- maxWidth: "32px",
13904
- width: "32px",
13905
- maxHeight: "32px",
13906
- height: "32px"
14234
+ ) : /* @__PURE__ */ jsx(
14235
+ Icon,
14236
+ {
14237
+ icon: "fluent:arrow-upload-32-filled",
14238
+ style: {
14239
+ color: brandColors2[80],
14240
+ maxWidth: "32px",
14241
+ width: "32px",
14242
+ maxHeight: "32px",
14243
+ height: "32px"
14244
+ }
13907
14245
  }
13908
- }
13909
- ) }) }),
13910
- /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
13911
- Row,
13912
- {
13913
- direction: "column",
13914
- nogutter: true,
13915
- style: { rowGap: tokens.spacingVerticalXS },
13916
- children: [
13917
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx(Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
13918
- displayFile instanceof File ? /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsxs(Row, { nogutter: true, style: { gap: tokens.spacingHorizontalS }, children: [
13919
- /* @__PURE__ */ jsx(
13920
- Col,
13921
- {
13922
- xs: "content",
13923
- style: {
13924
- display: "flex",
13925
- justifyContent: "center",
13926
- alignItems: "center",
13927
- width: "max-content"
13928
- },
13929
- children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsx(
13930
- "img",
13931
- {
13932
- src: previewUrl,
13933
- alt: "preview",
13934
- className: styles.filePreviewImage
13935
- }
13936
- ) : pdfIcon ? /* @__PURE__ */ jsx(
13937
- "img",
13938
- {
13939
- src: pdfIcon,
13940
- alt: "PDF Icon",
13941
- width: 32,
13942
- height: 32,
13943
- style: { flexShrink: 0 }
13944
- }
13945
- ) : /* @__PURE__ */ jsx(
13946
- Icon,
13947
- {
13948
- icon: "fluent:document-pdf-32-regular",
13949
- width: 32,
13950
- height: 32,
13951
- style: { flexShrink: 0, color: brandColors2[80] }
13952
- }
13953
- )
13954
- }
13955
- ),
13956
- /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
13957
- "div",
13958
- {
13959
- style: { display: "flex", flexDirection: "column" },
13960
- children: [
13961
- /* @__PURE__ */ jsx(Caption1Strong, { children: getDisplayFileName(displayFile) }),
13962
- /* @__PURE__ */ jsxs(
13963
- Caption2,
14246
+ ) }) }),
14247
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
14248
+ Row,
14249
+ {
14250
+ direction: "column",
14251
+ nogutter: true,
14252
+ style: { rowGap: tokens.spacingVerticalXS },
14253
+ children: [
14254
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx(Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
14255
+ displayFile instanceof File ? /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsxs(Row, { nogutter: true, style: { gap: tokens.spacingHorizontalS }, children: [
14256
+ /* @__PURE__ */ jsx(
14257
+ Col,
14258
+ {
14259
+ xs: "content",
14260
+ style: {
14261
+ display: "flex",
14262
+ justifyContent: "center",
14263
+ alignItems: "center",
14264
+ width: "max-content"
14265
+ },
14266
+ children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsx(
14267
+ "img",
13964
14268
  {
13965
- style: { color: tokens.colorNeutralForeground3 },
13966
- children: [
13967
- mergedLabels.sizeLabel,
13968
- ": ",
13969
- formatFileSize(displayFile.size),
13970
- (error || sizeError) && /* @__PURE__ */ jsxs(
13971
- "span",
13972
- {
13973
- style: {
13974
- color: tokens.colorStatusWarningForeground1,
13975
- marginLeft: tokens.spacingHorizontalXS
13976
- },
13977
- children: [
13978
- "(",
13979
- sizeError || error?.message,
13980
- ")"
13981
- ]
13982
- }
13983
- )
13984
- ]
14269
+ src: previewUrl,
14270
+ alt: "preview",
14271
+ className: styles.filePreviewImage
13985
14272
  }
13986
- )
13987
- ]
13988
- }
13989
- ) }),
13990
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsxs(
13991
- "div",
13992
- {
13993
- style: {
13994
- display: "flex",
13995
- gap: tokens.spacingVerticalS,
13996
- justifyContent: "center",
13997
- alignItems: "center",
13998
- width: "max-content",
13999
- height: "100%"
14000
- },
14001
- children: [
14002
- /* @__PURE__ */ jsx(
14003
- Button,
14273
+ ) : pdfIcon ? /* @__PURE__ */ jsx(
14274
+ "img",
14004
14275
  {
14005
- appearance: "transparent",
14006
- size: "small",
14007
- style: { color: brandColors2[80] },
14008
- onClick: (e) => handlePreview(e, displayFile),
14009
- children: mergedLabels.preview
14276
+ src: pdfIcon,
14277
+ alt: "PDF Icon",
14278
+ width: 32,
14279
+ height: 32,
14280
+ style: { flexShrink: 0 }
14010
14281
  }
14011
- ),
14012
- /* @__PURE__ */ jsx(
14013
- Button,
14282
+ ) : /* @__PURE__ */ jsx(
14283
+ Icon,
14014
14284
  {
14015
- appearance: "transparent",
14016
- size: "small",
14017
- onClick: (e) => handleRemoveFile(e, onChange),
14018
- icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-16-regular" })
14285
+ icon: "fluent:document-pdf-32-regular",
14286
+ width: 32,
14287
+ height: 32,
14288
+ style: { flexShrink: 0, color: brandColors2[80] }
14019
14289
  }
14020
14290
  )
14021
- ]
14291
+ }
14292
+ ),
14293
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
14294
+ "div",
14295
+ {
14296
+ style: { display: "flex", flexDirection: "column" },
14297
+ children: [
14298
+ /* @__PURE__ */ jsx(Caption1Strong, { children: getDisplayFileName(displayFile) }),
14299
+ /* @__PURE__ */ jsxs(
14300
+ Caption2,
14301
+ {
14302
+ style: { color: tokens.colorNeutralForeground3 },
14303
+ children: [
14304
+ mergedLabels.sizeLabel,
14305
+ ": ",
14306
+ formatFileSize(displayFile.size),
14307
+ (error || sizeError) && /* @__PURE__ */ jsxs(
14308
+ "span",
14309
+ {
14310
+ style: {
14311
+ color: tokens.colorStatusWarningForeground1,
14312
+ marginLeft: tokens.spacingHorizontalXS
14313
+ },
14314
+ children: [
14315
+ "(",
14316
+ sizeError || error?.message,
14317
+ ")"
14318
+ ]
14319
+ }
14320
+ )
14321
+ ]
14322
+ }
14323
+ )
14324
+ ]
14325
+ }
14326
+ ) }),
14327
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsxs(
14328
+ "div",
14329
+ {
14330
+ style: {
14331
+ display: "flex",
14332
+ gap: tokens.spacingVerticalS,
14333
+ justifyContent: "center",
14334
+ alignItems: "center",
14335
+ width: "max-content",
14336
+ height: "100%"
14337
+ },
14338
+ children: [
14339
+ /* @__PURE__ */ jsx(
14340
+ Button,
14341
+ {
14342
+ appearance: "transparent",
14343
+ size: "small",
14344
+ style: { color: brandColors2[80] },
14345
+ onClick: (e) => handlePreview(e, displayFile),
14346
+ children: mergedLabels.preview
14347
+ }
14348
+ ),
14349
+ /* @__PURE__ */ jsx(
14350
+ Button,
14351
+ {
14352
+ appearance: "transparent",
14353
+ size: "small",
14354
+ onClick: (e) => handleRemoveFile(e, onChange),
14355
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-16-regular" })
14356
+ }
14357
+ )
14358
+ ]
14359
+ }
14360
+ ) })
14361
+ ] }) }) : /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsx(
14362
+ Caption1,
14363
+ {
14364
+ style: { color: tokens.colorNeutralForeground3 },
14365
+ children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
14022
14366
  }
14023
14367
  ) })
14024
- ] }) }) : /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsx(
14025
- Caption1,
14026
- {
14027
- style: { color: tokens.colorNeutralForeground3 },
14028
- children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
14029
- }
14030
- ) })
14031
- ]
14032
- }
14033
- ) })
14034
- ]
14035
- }
14036
- ),
14037
- /* @__PURE__ */ jsx(
14038
- "input",
14039
- {
14040
- ref: fileInputRef,
14041
- type: "file",
14042
- accept,
14043
- onChange: (e) => handleFileSelect(e.target.files, onChange),
14044
- className: styles.hiddenInput,
14045
- disabled
14046
- }
14047
- )
14048
- ]
14049
- }
14050
- ),
14051
- /* @__PURE__ */ jsx(ModalPreviewImage, { imageUrl: previewUrl, open: isPreviewOpen, onOpenChange: setIsPreviewOpen })
14052
- ]
14053
- }
14054
- );
14368
+ ]
14369
+ }
14370
+ ) })
14371
+ ]
14372
+ }
14373
+ ),
14374
+ /* @__PURE__ */ jsx(
14375
+ "input",
14376
+ {
14377
+ ref: fileInputRef,
14378
+ type: "file",
14379
+ accept,
14380
+ onChange: (e) => handleFileSelect(e.target.files, onChange),
14381
+ className: styles.hiddenInput,
14382
+ disabled
14383
+ }
14384
+ )
14385
+ ]
14386
+ }
14387
+ ),
14388
+ /* @__PURE__ */ jsx(ModalPreviewImage, { imageUrl: previewUrl, open: isPreviewOpen, onOpenChange: setIsPreviewOpen })
14389
+ ]
14390
+ }
14391
+ ),
14392
+ downloadTemplateDocument && /* @__PURE__ */ jsx(
14393
+ Button,
14394
+ {
14395
+ appearance: "transparent",
14396
+ size: "small",
14397
+ icon: /* @__PURE__ */ jsx(ArrowDownloadRegular, {}),
14398
+ style: { display: "flex", justifyContent: "end", color: brandColors2[80], width: "100%" },
14399
+ onClick: (e) => handleDownloadFile(e, displayFile),
14400
+ disabled: !(displayFile instanceof File),
14401
+ children: mergedLabels.downloadTemplateDocument
14402
+ }
14403
+ )
14404
+ ] });
14055
14405
  }
14056
14406
  }
14057
14407
  );
@@ -14060,6 +14410,19 @@ var FileUpload = React.forwardRef(
14060
14410
  FileUpload.displayName = "FileUpload";
14061
14411
  var FileUpload_default = FileUpload;
14062
14412
 
14413
+ // src/utils/color.ts
14414
+ function hexToRgba(hex, alpha = 1) {
14415
+ hex = hex.replace("#", "");
14416
+ if (hex.length === 3) {
14417
+ hex = hex.split("").map((c) => c + c).join("");
14418
+ }
14419
+ const bigint = parseInt(hex, 16);
14420
+ const r = bigint >> 16 & 255;
14421
+ const g = bigint >> 8 & 255;
14422
+ const b = bigint & 255;
14423
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
14424
+ }
14425
+
14063
14426
  // src/components/CardProfileMenu/CardProfileMenu.constants.ts
14064
14427
  var DEFAULT_LABELS39 = {
14065
14428
  id: {},
@@ -14155,6 +14518,6 @@ var CardProfileMenu = ({
14155
14518
  ) });
14156
14519
  };
14157
14520
 
14158
- export { API_CONFIG, API_ENDPOINTS, API_ERROR_MESSAGES, BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, COUNTRIES, CardAddon, CardBanner, CardBookingTicket, CardFAQ, CardMealCatalog, CardOrdererInfo, CardPassengerList, CardPaymentGuide, CardPaymentInfo, CardPaymentMethodList, CardPriceDetails, CardProfileMenu, CardPromo, CardReview, CardReviewPassenger, CardServiceMenu, CardStatusOrder, CardTicket, CardTicketSearch, DEFAULT_LABELS8 as CardTicketSearchDefaultLabels, CardTicketSearchSummary, DEFAULT_LABELS9 as CardTicketSearchSummaryDefaultLabels, CardVehicleDetail, CardVehicleOwnerForm, CarouselWithCustomNav, DEFAULT_DURATION_RANGE, DEFAULT_PRICE_RANGE, DEFAULT_SCROLL_AMOUNT, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS17 as DateFilterDefaultLabels, FileUpload_default as FileUpload, GENDER, HTTP_STATUS, IDENTITY_TYPE, InputDynamic_default as InputDynamic, LOAD_TYPE, MODAL_PRESETS, MY_TICKET_STATUS, MY_TICKET_TAB, ModalFilterTicket, DEFAULT_LABELS16 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListMenuService, ModalListPassenger, ModalPassengerForm, ModalPreviewImage, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, PASSENGER_TYPE, SortMenu, Stepper, getBadgeConfig, getModalPreset, getSortLabel };
14521
+ export { API_CONFIG, API_ENDPOINTS, API_ERROR_MESSAGES, BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, COUNTRIES, CardAddon, CardBanner, CardBookingTicket, CardFAQ, CardMealCatalog, CardOrdererInfo, CardPassengerList, CardPaymentGuide, CardPaymentInfo, CardPaymentMethodList, CardPriceDetails, CardProfileMenu, CardPromo, CardReview, CardReviewPassenger, CardServiceMenu, CardStatusOrder, CardTicket, CardTicketSearch, DEFAULT_LABELS8 as CardTicketSearchDefaultLabels, CardTicketSearchSummary, DEFAULT_LABELS9 as CardTicketSearchSummaryDefaultLabels, CardVehicleDetail, CardVehicleOwnerForm, CarouselWithCustomNav, DEFAULT_DURATION_RANGE, DEFAULT_PRICE_RANGE, DEFAULT_SCROLL_AMOUNT, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS17 as DateFilterDefaultLabels, FileUpload_default as FileUpload, GENDER, HTTP_STATUS, IDENTITY_TYPE, InputDynamic_default as InputDynamic, LOAD_TYPE, MODAL_PRESETS, MY_TICKET_STATUS, MY_TICKET_TAB, ModalFilterTicket, DEFAULT_LABELS16 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListMenuService, ModalListPassenger, ModalPassengerForm, ModalPreviewImage, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, PASSENGER_TYPE, SortMenu, Stepper, calculateAge, getBadgeConfig, getModalPreset, getSortLabel, hexToRgba };
14159
14522
  //# sourceMappingURL=index.mjs.map
14160
14523
  //# sourceMappingURL=index.mjs.map