@asdp/ferryui 0.1.22-dev.9214 → 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.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],
@@ -614,20 +639,19 @@ var CarouselWithCustomNav = ({
614
639
  }),
615
640
  [language, customLabels, deprecatedAriaLabel]
616
641
  );
617
- const activeIndex = controlledIndex !== void 0 ? controlledIndex : internalIndex;
642
+ const activeIndex = isSingleSlide ? 0 : controlledIndex !== void 0 ? controlledIndex : internalIndex;
618
643
  const handleIndexChange = useCallback(
619
644
  (index) => {
645
+ if (isSingleSlide) return;
620
646
  if (controlledIndex === void 0) {
621
647
  setInternalIndex(index);
622
648
  }
623
649
  onActiveIndexChange?.(index);
624
650
  },
625
- [controlledIndex, onActiveIndexChange]
651
+ [controlledIndex, onActiveIndexChange, isSingleSlide]
626
652
  );
627
653
  React.useEffect(() => {
628
- if (!autoPlay) return;
629
- const totalSlides = React.Children.count(children);
630
- if (totalSlides <= 1) return;
654
+ if (!autoPlay || isSingleSlide) return;
631
655
  const intervalId = setInterval(() => {
632
656
  let nextIndex = activeIndex + 1;
633
657
  if (nextIndex >= totalSlides) {
@@ -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 };
@@ -3341,7 +3396,8 @@ var InputDynamic = ({
3341
3396
  const getPhoneAppearanceClass = () => {
3342
3397
  if (appearance === "underline") return styles.phoneInputUnderline;
3343
3398
  if (appearance === "filled-darker") return styles.phoneInputFilledDarker;
3344
- if (appearance === "filled-lighter") return styles.phoneInputFilledLighter;
3399
+ if (appearance === "filled-lighter")
3400
+ return styles.phoneInputFilledLighter;
3345
3401
  return "";
3346
3402
  };
3347
3403
  const phoneAppearanceClass = getPhoneAppearanceClass();
@@ -3374,9 +3430,21 @@ var InputDynamic = ({
3374
3430
  const fontSizeValuePhoneInput = size == "small" ? tokens.fontSizeBase200 : size === "medium" ? tokens.fontSizeBase300 : tokens.fontSizeBase400;
3375
3431
  const phoneInputSizeStyle = {
3376
3432
  fontSize: fontSizeValuePhoneInput,
3377
- ...size === "small" && { minHeight: "26px", height: "26px", padding: `0 ${tokens.spacingHorizontalS} 0 48px` },
3378
- ...size === "medium" && { minHeight: "34px", height: "34px", padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXXS} 48px` },
3379
- ...size === "large" && { minHeight: "40px", height: "40px", padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXS} 48px` }
3433
+ ...size === "small" && {
3434
+ minHeight: "26px",
3435
+ height: "26px",
3436
+ padding: `0 ${tokens.spacingHorizontalS} 0 48px`
3437
+ },
3438
+ ...size === "medium" && {
3439
+ minHeight: "34px",
3440
+ height: "34px",
3441
+ padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXXS} 48px`
3442
+ },
3443
+ ...size === "large" && {
3444
+ minHeight: "40px",
3445
+ height: "40px",
3446
+ padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXS} 48px`
3447
+ }
3380
3448
  };
3381
3449
  if (type === "emailOrPhone") {
3382
3450
  updateEmailOrPhoneType(field.value);
@@ -3413,10 +3481,15 @@ var InputDynamic = ({
3413
3481
  "div",
3414
3482
  {
3415
3483
  ref: emailOrPhoneInputRef,
3416
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3484
+ className: mergeClasses(
3485
+ styles.phoneInputWrapper,
3486
+ phoneAppearanceClass,
3487
+ error ? styles.phoneInputError : ""
3488
+ ),
3417
3489
  children: /* @__PURE__ */ jsx(
3418
3490
  PhoneInput,
3419
3491
  {
3492
+ countryCodeEditable: false,
3420
3493
  inputStyle: phoneInputSizeStyle,
3421
3494
  country: defaultCountry.toLowerCase(),
3422
3495
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
@@ -3516,10 +3589,15 @@ var InputDynamic = ({
3516
3589
  "div",
3517
3590
  {
3518
3591
  ref: phoneInputRef,
3519
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3592
+ className: mergeClasses(
3593
+ styles.phoneInputWrapper,
3594
+ phoneAppearanceClass,
3595
+ error ? styles.phoneInputError : ""
3596
+ ),
3520
3597
  children: /* @__PURE__ */ jsx(
3521
3598
  PhoneInput,
3522
3599
  {
3600
+ countryCodeEditable: false,
3523
3601
  country: defaultCountry.toLowerCase(),
3524
3602
  value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
3525
3603
  onChange: (value, data) => {
@@ -3651,7 +3729,9 @@ var InputDynamic = ({
3651
3729
  autoCapitalize: "off",
3652
3730
  spellCheck: "false"
3653
3731
  },
3654
- value: (options && options.length > 0 ? options : COUNTRIES).find((country) => country.value === field.value) || null,
3732
+ value: (options && options.length > 0 ? options : COUNTRIES).find(
3733
+ (country) => country.value === field.value
3734
+ ) || null,
3655
3735
  onChange: (selectedOption) => {
3656
3736
  field.onChange(selectedOption ? selectedOption.value : "");
3657
3737
  if (onChange) {
@@ -3709,12 +3789,16 @@ var InputDynamic = ({
3709
3789
  return /* @__PURE__ */ jsx(
3710
3790
  "div",
3711
3791
  {
3712
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3792
+ className: mergeClasses(
3793
+ styles.phoneInputWrapper,
3794
+ phoneAppearanceClass,
3795
+ error ? styles.phoneInputError : ""
3796
+ ),
3713
3797
  children: /* @__PURE__ */ jsx(
3714
3798
  PhoneInput,
3715
3799
  {
3800
+ countryCodeEditable: false,
3716
3801
  ...phoneInputProps,
3717
- onlyCountries,
3718
3802
  country: defaultCountry.toLowerCase(),
3719
3803
  disabled,
3720
3804
  disableSearchIcon: true,
@@ -3769,7 +3853,9 @@ var InputDynamic = ({
3769
3853
  size,
3770
3854
  onClick,
3771
3855
  style: inputStyle,
3772
- max: max ? String(max) : void 0
3856
+ max: max ? String(max) : void 0,
3857
+ min: min ? String(min) : void 0,
3858
+ disablePastDates
3773
3859
  }
3774
3860
  );
3775
3861
  }
@@ -4076,7 +4162,9 @@ var InputDynamic = ({
4076
4162
  if (!stringValue) return true;
4077
4163
  const detectedType = detectEmailOrPhoneStrict(stringValue);
4078
4164
  if (detectedType === "email") {
4079
- if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(stringValue)) {
4165
+ if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
4166
+ stringValue
4167
+ )) {
4080
4168
  return mergedLabels.invalidEmailFormatError;
4081
4169
  }
4082
4170
  } else if (detectedType === "phone") {
@@ -4105,7 +4193,9 @@ var InputDynamic = ({
4105
4193
  if (!stringValue) return true;
4106
4194
  const detectedType = detectIdentityType(stringValue);
4107
4195
  if (detectedType === "email") {
4108
- if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(stringValue)) {
4196
+ if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
4197
+ stringValue
4198
+ )) {
4109
4199
  return mergedLabels.invalidEmailFormatError;
4110
4200
  }
4111
4201
  } else if (detectedType === "phone") {
@@ -4152,29 +4242,40 @@ var InputDynamic = ({
4152
4242
  }
4153
4243
  ),
4154
4244
  renderInput(field, error?.message),
4155
- helperText && !error && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: "4px", marginTop: "4px" }, children: [
4156
- helperIcon && /* @__PURE__ */ jsx(
4157
- Icon,
4158
- {
4159
- icon: helperIcon,
4160
- style: {
4161
- color: tokens.colorNeutralForeground3,
4162
- flexShrink: 0
4163
- },
4164
- width: 16,
4165
- height: 16
4166
- }
4167
- ),
4168
- /* @__PURE__ */ jsx(
4169
- Text,
4170
- {
4171
- size: 200,
4172
- style: { textAlign: "left" },
4173
- className: styles.helperText,
4174
- children: helperText
4175
- }
4176
- )
4177
- ] })
4245
+ helperText && !error && /* @__PURE__ */ jsxs(
4246
+ "div",
4247
+ {
4248
+ style: {
4249
+ display: "flex",
4250
+ alignItems: "flex-start",
4251
+ gap: "4px",
4252
+ marginTop: "4px"
4253
+ },
4254
+ children: [
4255
+ helperIcon && /* @__PURE__ */ jsx(
4256
+ Icon,
4257
+ {
4258
+ icon: helperIcon,
4259
+ style: {
4260
+ color: tokens.colorNeutralForeground3,
4261
+ flexShrink: 0
4262
+ },
4263
+ width: 16,
4264
+ height: 16
4265
+ }
4266
+ ),
4267
+ /* @__PURE__ */ jsx(
4268
+ Text,
4269
+ {
4270
+ size: 200,
4271
+ style: { textAlign: "left" },
4272
+ className: styles.helperText,
4273
+ children: helperText
4274
+ }
4275
+ )
4276
+ ]
4277
+ }
4278
+ )
4178
4279
  ]
4179
4280
  }
4180
4281
  )
@@ -5289,7 +5390,8 @@ var DEFAULT_LABELS10 = {
5289
5390
  loadingData: "Memuat data...",
5290
5391
  harborNotFound: "Pelabuhan tidak ditemukan",
5291
5392
  closeAriaLabel: "Tutup",
5292
- popularHarborHeader: "Pelabuhan Populer"
5393
+ popularHarborHeader: "Pelabuhan Populer",
5394
+ favoriteHeader: "Favorit"
5293
5395
  },
5294
5396
  en: {
5295
5397
  title: "Select Harbor",
@@ -5300,7 +5402,8 @@ var DEFAULT_LABELS10 = {
5300
5402
  loadingData: "Loading data...",
5301
5403
  harborNotFound: "Harbor not found",
5302
5404
  closeAriaLabel: "Close",
5303
- popularHarborHeader: "Popular Harbor"
5405
+ popularHarborHeader: "Popular Harbor",
5406
+ favoriteHeader: "Favorite"
5304
5407
  }
5305
5408
  };
5306
5409
  var useStyles11 = makeStyles({
@@ -5369,10 +5472,20 @@ var useStyles11 = makeStyles({
5369
5472
  display: "flex",
5370
5473
  gap: "1rem",
5371
5474
  marginBottom: "1rem",
5372
- flexWrap: "wrap"
5475
+ flexWrap: "wrap",
5476
+ marginTop: "1rem"
5373
5477
  },
5374
5478
  circularButton: {
5375
- 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"
5376
5489
  },
5377
5490
  headerRow: {
5378
5491
  display: "flex",
@@ -5386,11 +5499,13 @@ var useStyles11 = makeStyles({
5386
5499
  historyItem: {
5387
5500
  display: "flex",
5388
5501
  justifyContent: "space-between",
5502
+ alignItems: "center",
5389
5503
  marginTop: "1rem",
5390
5504
  marginBottom: "1rem"
5391
5505
  },
5392
5506
  iconMargin: {
5393
- marginRight: "0.5rem"
5507
+ marginRight: "1rem"
5508
+ // fontSize: tokens.fontSizeBase400
5394
5509
  },
5395
5510
  cursorPointer: {
5396
5511
  cursor: "pointer"
@@ -5407,14 +5522,51 @@ var useStyles11 = makeStyles({
5407
5522
  },
5408
5523
  harborItem: {
5409
5524
  display: "flex",
5410
- justifyContent: "space-between"
5525
+ justifyContent: "space-between",
5526
+ alignItems: "center"
5411
5527
  },
5412
5528
  emptyState: {
5413
5529
  textAlign: "center",
5414
5530
  padding: "32px",
5415
5531
  color: tokens.colorNeutralForeground3
5532
+ },
5533
+ listContent: {
5534
+ cursor: "pointer",
5535
+ display: "flex",
5536
+ justifyContent: "center",
5537
+ alignItems: "center"
5416
5538
  }
5417
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
+ };
5418
5570
  var ModalSearchHarbor = ({
5419
5571
  language = "id",
5420
5572
  labels,
@@ -5433,6 +5585,7 @@ var ModalSearchHarbor = ({
5433
5585
  onAddLastSearched,
5434
5586
  onRemoveLastSearched,
5435
5587
  onClearLastSearched,
5588
+ onClearFavorite,
5436
5589
  popularHarbors,
5437
5590
  showButtonFavorite = true
5438
5591
  }) => {
@@ -5491,119 +5644,169 @@ var ModalSearchHarbor = ({
5491
5644
  size: "large"
5492
5645
  }
5493
5646
  ) }),
5494
- favoriteHarbors.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsx(
5495
- Button,
5496
- {
5497
- onClick: () => handleSelect(harbor),
5498
- size: "medium",
5499
- appearance: "outline",
5500
- iconPosition: "before",
5501
- className: styles.circularButton,
5502
- icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:ribbon-20-filled" }),
5503
- children: /* @__PURE__ */ jsx(Body1, { children: harbor.portName + ", " + harbor.branchName })
5504
- },
5505
- harbor.portId
5506
- )) }),
5507
- /* @__PURE__ */ jsx(Divider, {}),
5508
5647
  /* @__PURE__ */ jsxs("div", { className: styles.resultList, children: [
5509
- lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5648
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5510
5649
  /* @__PURE__ */ jsxs("div", { className: styles.headerRow, children: [
5511
- /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.lastSearchedHeader }),
5650
+ /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.favoriteHeader }),
5512
5651
  /* @__PURE__ */ jsx(
5513
5652
  Caption1,
5514
5653
  {
5515
- className: `${styles.dangerText} ${styles.cursorPointer}`,
5516
- onClick: onClearLastSearched,
5654
+ className: mergeClasses(
5655
+ styles.dangerText,
5656
+ styles.cursorPointer
5657
+ ),
5658
+ onClick: onClearFavorite,
5517
5659
  children: mergedLabels.clearAllButton
5518
5660
  }
5519
5661
  )
5520
5662
  ] }),
5521
- /* @__PURE__ */ jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsxs("div", { className: styles.historyItem, children: [
5522
- /* @__PURE__ */ jsxs(
5523
- "div",
5524
- {
5525
- style: { cursor: "pointer" },
5526
- onClick: () => handleSelect(harbor),
5527
- children: [
5528
- /* @__PURE__ */ jsx(
5529
- Icon,
5530
- {
5531
- icon: "fluent:vehicle-ship-24-regular",
5532
- className: styles.iconMargin
5533
- }
5534
- ),
5535
- harbor.portName + ", " + harbor.branchName
5536
- ]
5537
- }
5538
- ),
5539
- /* @__PURE__ */ jsx(
5540
- Icon,
5541
- {
5542
- onClick: () => onRemoveLastSearched(harbor),
5543
- icon: "fluent:dismiss-24-regular",
5544
- color: tokens.colorStatusDangerForeground1,
5545
- className: styles.cursorPointer
5546
- }
5547
- )
5548
- ] }, harbor.portId)) }),
5549
- /* @__PURE__ */ jsx(Divider, {})
5550
- ] }),
5551
- popularHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5552
- /* @__PURE__ */ jsx("div", { className: styles.headerRow, children: /* @__PURE__ */ jsx(Body1Strong, { children: mergedLabels.popularHarborHeader }) }),
5553
- /* @__PURE__ */ jsx("div", { children: popularHarbors.map((harbor) => /* @__PURE__ */ jsx("div", { className: styles.historyItem, children: /* @__PURE__ */ jsxs(
5554
- "div",
5663
+ favoriteHarbors.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsxs(
5664
+ Button,
5555
5665
  {
5556
- style: { cursor: "pointer" },
5557
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
+ ),
5558
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
+ ] }),
5559
5684
  /* @__PURE__ */ jsx(
5560
5685
  Icon,
5561
5686
  {
5562
- icon: "fluent:vehicle-ship-24-regular",
5563
- className: styles.iconMargin
5687
+ icon: "fluent:star-24-filled",
5688
+ fontSize: 20,
5689
+ color: tokens.colorBrandBackground,
5690
+ style: { marginLeft: 5 }
5564
5691
  }
5565
- ),
5566
- harbor.portName + ", " + harbor.branchName
5692
+ )
5567
5693
  ]
5568
- }
5569
- ) }, harbor.portId)) }),
5570
- /* @__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
+ )) })
5571
5745
  ] }),
5572
5746
  /* @__PURE__ */ jsx(Body1Strong, { className: styles.sectionTitle, children: mergedLabels.allHarborsHeader }),
5573
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: [
5574
- /* @__PURE__ */ jsxs(Skeleton, { style: { display: "flex", alignItems: "center", gap: "0.5rem", width: "70%" }, children: [
5575
- /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }),
5576
- /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "100%", height: "20px", borderRadius: "4px" } })
5577
- ] }),
5578
- showButtonFavorite && /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "24px", height: "24px", borderRadius: "4px" } }) })
5579
- ] }, item)) }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsxs("div", { className: styles.harborItem, children: [
5580
5748
  /* @__PURE__ */ jsxs(
5581
- "div",
5749
+ Skeleton,
5582
5750
  {
5583
- className: styles.cursorPointer,
5584
- onClick: () => handleSelect(harbor),
5751
+ style: {
5752
+ display: "flex",
5753
+ alignItems: "center",
5754
+ gap: "0.5rem",
5755
+ width: "70%"
5756
+ },
5585
5757
  children: [
5586
5758
  /* @__PURE__ */ jsx(
5587
- Icon,
5759
+ SkeletonItem,
5588
5760
  {
5589
- icon: "fluent:vehicle-ship-24-regular",
5590
- className: styles.iconMargin
5761
+ style: {
5762
+ width: "24px",
5763
+ height: "24px",
5764
+ borderRadius: "4px"
5765
+ }
5591
5766
  }
5592
5767
  ),
5593
- harbor.portName + ", " + harbor.branchName
5768
+ /* @__PURE__ */ jsx(
5769
+ SkeletonItem,
5770
+ {
5771
+ style: {
5772
+ width: "100%",
5773
+ height: "20px",
5774
+ borderRadius: "4px"
5775
+ }
5776
+ }
5777
+ )
5594
5778
  ]
5595
5779
  }
5596
5780
  ),
5597
- showButtonFavorite && /* @__PURE__ */ jsx(
5598
- Icon,
5781
+ showButtonFavorite && /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(
5782
+ SkeletonItem,
5599
5783
  {
5600
- icon: harbor.isFavorite ? "fluent:star-24-filled" : "fluent:star-24-regular",
5601
- color: tokens.colorBrandBackground,
5602
- className: styles.cursorPointer,
5603
- onClick: () => onToggleFavorite(harbor)
5784
+ style: {
5785
+ width: "24px",
5786
+ height: "24px",
5787
+ borderRadius: "4px"
5788
+ }
5604
5789
  }
5605
- )
5606
- ] }, 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 }) })
5607
5810
  ] })
5608
5811
  ] })
5609
5812
  ] }) })
@@ -8703,12 +8906,34 @@ var ModalListPassenger = ({
8703
8906
  }
8704
8907
  },
8705
8908
  children: [
8706
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Subtitle2, { children: [
8707
- passenger.fullName,
8708
- " (",
8709
- passenger.ageLabel,
8710
- " )"
8711
- ] }) }),
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
+ ] }),
8712
8937
  /* @__PURE__ */ jsx(
8713
8938
  Button,
8714
8939
  {
@@ -8766,8 +8991,10 @@ var DEFAULT_LABELS22 = {
8766
8991
  idTypePlaceholder: "Pilih",
8767
8992
  idNumberLabel: "Nomor Identitas",
8768
8993
  idNumberPlaceholder: "Masukkan Nomor Identitas",
8769
- ageLabel: "Usia",
8770
- agePlaceholder: "Masukkan Usia",
8994
+ age: "Usia",
8995
+ agePlaceholder: "0 Tahun 0 Bulan",
8996
+ yearLabel: "tahun",
8997
+ monthLabel: "bulan",
8771
8998
  dateLabel: "Tanggal Lahir",
8772
8999
  datePlaceholder: "Masukkan Tanggal Lahir",
8773
9000
  cityLabel: "Kota Kabupaten",
@@ -8812,6 +9039,7 @@ var DEFAULT_LABELS22 = {
8812
9039
  minAge: "Usia minimal 1 tahun",
8813
9040
  maxAge: "Usia maksimal 150 tahun",
8814
9041
  requiredDate: "Tanggal lahir harus diisi",
9042
+ birthDateFuture: "Tanggal lahir tidak boleh di masa depan",
8815
9043
  requiredCity: "Kota/Kabupaten harus diisi",
8816
9044
  requiredCountry: "Negara harus diisi",
8817
9045
  requiredPhoneNumber: "Nomor telepon harus diisi",
@@ -8829,8 +9057,10 @@ var DEFAULT_LABELS22 = {
8829
9057
  idTypePlaceholder: "Select",
8830
9058
  idNumberLabel: "Identity Number",
8831
9059
  idNumberPlaceholder: "Enter Identity Number",
8832
- ageLabel: "Age",
8833
- agePlaceholder: "Enter Age",
9060
+ age: "Age",
9061
+ agePlaceholder: "0 Year 0 Month",
9062
+ yearLabel: "year(s)",
9063
+ monthLabel: "month(s)",
8834
9064
  dateLabel: "Date of Birth",
8835
9065
  datePlaceholder: "Enter Date of Birth",
8836
9066
  cityLabel: "City/Regency",
@@ -8875,6 +9105,7 @@ var DEFAULT_LABELS22 = {
8875
9105
  minAge: "Age must be at least 1 year",
8876
9106
  maxAge: "Age must be at most 150 years",
8877
9107
  requiredDate: "Date of birth is required",
9108
+ birthDateFuture: "Date of birth cannot be in the future",
8878
9109
  requiredCity: "City/Regency is required",
8879
9110
  requiredCountry: "Country is required",
8880
9111
  requiredPhoneNumber: "Phone number is required",
@@ -8883,24 +9114,23 @@ var DEFAULT_LABELS22 = {
8883
9114
  }
8884
9115
  }
8885
9116
  };
8886
- var TYPE_OPTIONS = [
8887
- {
8888
- label: "KTP",
8889
- value: "ktp"
8890
- },
8891
- {
8892
- label: "SIM",
8893
- value: "sim"
8894
- },
8895
- {
8896
- label: "Paspor",
8897
- value: "paspor"
8898
- },
8899
- {
8900
- label: "Lainnya",
8901
- 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--;
8902
9127
  }
8903
- ];
9128
+ if (months < 0) {
9129
+ years--;
9130
+ months += 12;
9131
+ }
9132
+ return { years: Math.max(0, years), months: Math.max(0, months) };
9133
+ };
8904
9134
  var useStyles23 = makeStyles({
8905
9135
  dialogSurface: {
8906
9136
  maxWidth: "600px",
@@ -9066,16 +9296,18 @@ var useStyles23 = makeStyles({
9066
9296
  }
9067
9297
  });
9068
9298
  var ModalPassengerForm = ({
9299
+ defaultValues,
9069
9300
  language = "id",
9070
9301
  labels,
9071
9302
  open,
9303
+ onChange,
9072
9304
  onClose,
9073
- title,
9074
9305
  onSubmit,
9075
- defaultValues,
9076
- isAdultForm = true,
9306
+ title,
9077
9307
  titleOptions,
9308
+ countryOptions,
9078
9309
  cityOptions,
9310
+ idTypeOptions,
9079
9311
  ticketClassOptions,
9080
9312
  onScanComplete
9081
9313
  }) => {
@@ -9086,7 +9318,6 @@ var ModalPassengerForm = ({
9086
9318
  ...labels?.errors
9087
9319
  };
9088
9320
  const displayTitle = title || mergedLabels.title;
9089
- const idTypes = ["KTP", "SIM", "Paspor"];
9090
9321
  const [isModalSelectIdTypeOpen, setIsModalSelectIdTypeOpen] = useState(false);
9091
9322
  const [isModalScanOpen, setIsModalScanOpen] = useState(false);
9092
9323
  const [scannedIdType, setScannedIdType] = useState(null);
@@ -9098,20 +9329,46 @@ var ModalPassengerForm = ({
9098
9329
  const { control, handleSubmit, reset, watch, setValue } = useForm({
9099
9330
  defaultValues
9100
9331
  });
9101
- const idType = watch("idType");
9102
- 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]);
9103
9344
  useEffect(() => {
9104
9345
  reset(defaultValues);
9105
9346
  }, [defaultValues, reset]);
9106
9347
  useEffect(() => {
9107
- if (idType) {
9108
- setValue("idNumber", "");
9109
- }
9110
- }, [idType, watchPassportCountry, setValue]);
9111
- const stopCamera = useCallback(() => {
9112
- if (stream) {
9113
- stream.getTracks().forEach((track) => track.stop());
9114
- setStream(null);
9348
+ if (watchIdentityTypeId) {
9349
+ setValue("identityId", "");
9350
+ }
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
+ ]);
9368
+ const stopCamera = useCallback(() => {
9369
+ if (stream) {
9370
+ stream.getTracks().forEach((track) => track.stop());
9371
+ setStream(null);
9115
9372
  }
9116
9373
  if (videoRef.current) {
9117
9374
  videoRef.current.pause();
@@ -9143,7 +9400,7 @@ var ModalPassengerForm = ({
9143
9400
  ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
9144
9401
  setCapturedImage(canvas.toDataURL("image/jpeg"));
9145
9402
  stopCamera();
9146
- if (scannedIdType === "KTP") {
9403
+ if (scannedIdType === IDENTITY_TYPE.KTP) {
9147
9404
  setScanStatus("reading");
9148
9405
  } else {
9149
9406
  setScanStatus("error");
@@ -9216,14 +9473,14 @@ var ModalPassengerForm = ({
9216
9473
  }
9217
9474
  stopCamera();
9218
9475
  if (name) {
9219
- setValue("name", name, {
9476
+ setValue("fullName", name, {
9220
9477
  shouldValidate: true,
9221
9478
  shouldDirty: true
9222
9479
  });
9223
9480
  }
9224
9481
  if (idNumber && scannedIdType) {
9225
- setValue("idType", scannedIdType.toLowerCase());
9226
- setValue("idNumber", idNumber);
9482
+ setValue("identityTypeId", scannedIdType.toString());
9483
+ setValue("identityId", idNumber);
9227
9484
  }
9228
9485
  onScanComplete?.({ name, idNumber, city });
9229
9486
  setScanStatus("success");
@@ -9305,22 +9562,22 @@ var ModalPassengerForm = ({
9305
9562
  children: /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.selectIdTypeTitle })
9306
9563
  }
9307
9564
  ),
9308
- /* @__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(
9309
9566
  "div",
9310
9567
  {
9311
9568
  className: styles.idTypeItem,
9312
- onClick: () => handleSelectIdType(type),
9569
+ onClick: () => handleSelectIdType(Number(type.value)),
9313
9570
  onKeyDown: (e) => {
9314
9571
  if (e.key === "Enter" || e.key === " ") {
9315
9572
  e.preventDefault();
9316
- handleSelectIdType(type);
9573
+ handleSelectIdType(Number(type.value));
9317
9574
  }
9318
9575
  },
9319
9576
  role: "button",
9320
9577
  tabIndex: 0,
9321
- children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type })
9578
+ children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type.label })
9322
9579
  },
9323
- type
9580
+ type.value
9324
9581
  )) }) })
9325
9582
  ] }) })
9326
9583
  }
@@ -9587,7 +9844,7 @@ var ModalPassengerForm = ({
9587
9844
  /* @__PURE__ */ jsx(
9588
9845
  InputDynamic_default,
9589
9846
  {
9590
- name: "title",
9847
+ name: "titleId",
9591
9848
  control,
9592
9849
  type: "select",
9593
9850
  label: mergedLabels.titleLabel,
@@ -9603,7 +9860,7 @@ var ModalPassengerForm = ({
9603
9860
  /* @__PURE__ */ jsx(
9604
9861
  InputDynamic_default,
9605
9862
  {
9606
- name: "name",
9863
+ name: "fullName",
9607
9864
  control,
9608
9865
  type: "text",
9609
9866
  label: mergedLabels.nameLabel,
@@ -9622,22 +9879,23 @@ var ModalPassengerForm = ({
9622
9879
  /* @__PURE__ */ jsx(
9623
9880
  InputDynamic_default,
9624
9881
  {
9625
- name: "age",
9882
+ name: "birthdate",
9626
9883
  control,
9627
- type: "number",
9628
- label: mergedLabels.ageLabel,
9629
- placeholder: mergedLabels.agePlaceholder,
9884
+ type: "date",
9885
+ label: mergedLabels.dateLabel,
9886
+ placeholder: mergedLabels.datePlaceholder,
9630
9887
  size: "large",
9631
9888
  required: true,
9632
9889
  validationRules: {
9633
- required: mergedErrors.requiredAge,
9634
- min: {
9635
- value: 1,
9636
- message: mergedErrors.minAge
9637
- },
9638
- max: {
9639
- value: 150,
9640
- 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;
9641
9899
  }
9642
9900
  }
9643
9901
  }
@@ -9645,110 +9903,107 @@ var ModalPassengerForm = ({
9645
9903
  /* @__PURE__ */ jsx(
9646
9904
  InputDynamic_default,
9647
9905
  {
9648
- 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",
9649
9919
  control,
9650
9920
  type: "select",
9651
- label: mergedLabels.cityLabel,
9652
- options: cityOptions,
9653
- placeholder: mergedLabels.cityPlaceholder,
9921
+ label: mergedLabels.idTypeLabel,
9922
+ placeholder: mergedLabels.idTypePlaceholder,
9923
+ options: idTypeOptions,
9654
9924
  size: "large",
9655
9925
  required: true,
9656
9926
  validationRules: {
9657
- required: mergedErrors.requiredCity
9927
+ required: mergedErrors.requiredIdType
9658
9928
  }
9659
9929
  }
9660
9930
  ),
9661
- isAdultForm ? /* @__PURE__ */ jsxs(Fragment, { children: [
9662
- /* @__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(
9663
9948
  InputDynamic_default,
9664
9949
  {
9665
- name: "idType",
9950
+ menuPlacement: "top",
9951
+ name: "countryId",
9666
9952
  control,
9953
+ options: countryOptions,
9667
9954
  type: "select",
9668
- label: mergedLabels.idTypeLabel,
9669
- placeholder: mergedLabels.idTypePlaceholder,
9670
- options: TYPE_OPTIONS,
9955
+ label: mergedLabels.countryLabel,
9956
+ placeholder: mergedLabels.countryPlaceholder,
9671
9957
  size: "large",
9672
9958
  required: true,
9673
9959
  validationRules: {
9674
- required: mergedErrors.requiredIdType
9960
+ required: mergedErrors.requiredCountry
9675
9961
  }
9676
9962
  }
9677
9963
  ),
9678
- idType ? idType === "lainnya" ? /* @__PURE__ */ jsx(
9964
+ /* @__PURE__ */ jsx(
9679
9965
  InputDynamic_default,
9680
9966
  {
9681
- name: "idNumber",
9967
+ name: "identityId",
9682
9968
  control,
9683
- type: "date",
9684
- label: mergedLabels.idTypeOtherLabel,
9685
- placeholder: mergedLabels.idTypeOtherPlaceholder,
9969
+ type: watchIdentityTypeId === IDENTITY_TYPE.KTP.toString() ? "number" : "text",
9970
+ label: mergedLabels.idNumberLabel,
9971
+ placeholder: mergedLabels.idNumberPlaceholder,
9686
9972
  size: "large",
9687
9973
  required: true,
9688
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
9689
9974
  validationRules: {
9690
- required: mergedErrors.requiredDate
9691
- }
9692
- }
9693
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
9694
- idType === "paspor" && /* @__PURE__ */ jsx(
9695
- InputDynamic_default,
9696
- {
9697
- menuPlacement: "top",
9698
- name: "country",
9699
- control,
9700
- type: "country",
9701
- label: mergedLabels.countryLabel,
9702
- placeholder: mergedLabels.countryPlaceholder,
9703
- size: "large",
9704
- required: true,
9705
- validationRules: {
9706
- required: mergedErrors.requiredCountry
9707
- }
9708
- }
9709
- ),
9710
- /* @__PURE__ */ jsx(
9711
- InputDynamic_default,
9712
- {
9713
- name: "idNumber",
9714
- control,
9715
- type: idType === "ktp" ? "number" : "text",
9716
- label: mergedLabels.idNumberLabel,
9717
- placeholder: mergedLabels.idNumberPlaceholder,
9718
- size: "large",
9719
- required: true,
9720
- validationRules: {
9721
- required: mergedErrors.requiredIdNumber,
9722
- minLength: {
9723
- value: 6,
9724
- message: mergedErrors.minLengthIdNumber
9725
- }
9975
+ required: mergedErrors.requiredIdNumber,
9976
+ minLength: {
9977
+ value: 6,
9978
+ message: mergedErrors.minLengthIdNumber
9726
9979
  }
9727
9980
  }
9728
- )
9729
- ] }) : null
9730
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
9981
+ }
9982
+ )
9983
+ ] }) : null,
9984
+ /* @__PURE__ */ jsx(
9731
9985
  InputDynamic_default,
9732
9986
  {
9733
- name: "date",
9987
+ name: "regencyId",
9734
9988
  control,
9735
- type: "date",
9736
- label: mergedLabels.dateLabel,
9737
- placeholder: mergedLabels.datePlaceholder,
9989
+ type: "select",
9990
+ label: mergedLabels.cityLabel,
9991
+ options: cityOptions,
9992
+ placeholder: mergedLabels.cityPlaceholder,
9738
9993
  size: "large",
9739
9994
  required: true,
9740
9995
  validationRules: {
9741
- required: mergedErrors.requiredDate
9996
+ required: mergedErrors.requiredCity
9742
9997
  }
9743
9998
  }
9744
- ) }),
9999
+ ),
9745
10000
  /* @__PURE__ */ jsx("br", {}),
9746
10001
  /* @__PURE__ */ jsx(Divider, {}),
9747
10002
  /* @__PURE__ */ jsx("br", {}),
9748
10003
  /* @__PURE__ */ jsx(
9749
10004
  InputDynamic_default,
9750
10005
  {
9751
- name: "ticketClass",
10006
+ name: "passengerClassId",
9752
10007
  control,
9753
10008
  type: "radiobutton",
9754
10009
  label: mergedLabels.ticketClassLabel,
@@ -11084,11 +11339,16 @@ var DEFAULT_LABELS26 = {
11084
11339
  estimationPrefix: "Estimasi",
11085
11340
  totalPriceLabel: "Total Harga",
11086
11341
  nextButton: "Lanjutkan",
11342
+ cancelButton: "Batalkan Pesanan",
11087
11343
  previousButton: "Sebelumnya",
11088
11344
  viewBookingButton: "Lihat Pemesanan",
11089
11345
  changePaymentButton: "Ubah Metode Pembayaran",
11090
11346
  timezoneLabel: "WIB",
11091
- 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"
11092
11352
  },
11093
11353
  en: {
11094
11354
  bookingDetails: "Booking Details",
@@ -11096,11 +11356,16 @@ var DEFAULT_LABELS26 = {
11096
11356
  estimationPrefix: "Estimation",
11097
11357
  totalPriceLabel: "Total Price",
11098
11358
  nextButton: "Continue",
11359
+ cancelButton: "Cancel Booking",
11099
11360
  previousButton: "Previous",
11100
11361
  viewBookingButton: "View Booking",
11101
11362
  changePaymentButton: "Change Payment Method",
11102
11363
  timezoneLabel: "WIB",
11103
- 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"
11104
11369
  }
11105
11370
  };
11106
11371
  var useStyles27 = makeStyles({
@@ -11212,6 +11477,35 @@ var useStyles27 = makeStyles({
11212
11477
  border: "1px solid " + tokens.colorBrandStroke1,
11213
11478
  color: tokens.colorBrandBackground,
11214
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%"
11215
11509
  }
11216
11510
  });
11217
11511
  var CardBookingTicket = ({
@@ -11224,6 +11518,7 @@ var CardBookingTicket = ({
11224
11518
  departureDay,
11225
11519
  departureTime,
11226
11520
  departureLocation,
11521
+ disableNextButton,
11227
11522
  arrivalDay,
11228
11523
  arrivalTime,
11229
11524
  arrivalLocation,
@@ -11232,12 +11527,14 @@ var CardBookingTicket = ({
11232
11527
  reservationStep,
11233
11528
  paymentStep,
11234
11529
  onPriceDetailClick,
11530
+ onCancel,
11235
11531
  onNext,
11236
11532
  onPrevious,
11237
11533
  className
11238
11534
  }) => {
11239
11535
  const styles = useStyles27();
11240
11536
  const mergedLabels = { ...DEFAULT_LABELS26[language], ...labels };
11537
+ const [cancelDialogOpen, setCancelDialogOpen] = useState(false);
11241
11538
  return /* @__PURE__ */ jsx("div", { className: `${styles.container} ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: styles.bookingDetail, children: [
11242
11539
  /* @__PURE__ */ jsxs(Card, { className: styles.bookingDetailTop, children: [
11243
11540
  /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.bookingDetails }),
@@ -11321,6 +11618,7 @@ var CardBookingTicket = ({
11321
11618
  Button,
11322
11619
  {
11323
11620
  appearance: "primary",
11621
+ disabled: disableNextButton,
11324
11622
  onClick: onNext,
11325
11623
  shape: "circular",
11326
11624
  size: "large",
@@ -11344,31 +11642,93 @@ var CardBookingTicket = ({
11344
11642
  iconPosition: "before",
11345
11643
  children: mergedLabels.previousButton
11346
11644
  }
11347
- )
11348
- ] }),
11349
- paymentStep === "pay" && /* @__PURE__ */ jsxs("div", { className: styles.gapButton, children: [
11350
- /* @__PURE__ */ jsx(
11351
- Button,
11352
- {
11353
- appearance: "primary",
11354
- shape: "circular",
11355
- size: "large",
11356
- style: { width: "100%" },
11357
- onClick: onNext,
11358
- children: mergedLabels.viewBookingButton
11359
- }
11360
11645
  ),
11361
- /* @__PURE__ */ jsx(
11362
- Button,
11363
- {
11364
- appearance: "secondary",
11365
- shape: "circular",
11366
- size: "large",
11367
- className: styles.secondaryButton,
11368
- onClick: onPrevious,
11369
- children: mergedLabels.changePaymentButton
11370
- }
11371
- )
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
+ ] })
11372
11732
  ] })
11373
11733
  ] })
11374
11734
  ] }) });
@@ -13474,14 +13834,16 @@ var DEFAULT_LABELS38 = {
13474
13834
  maxSizeWarning: "Maksimal {maxSize}MB per file dalam format PDF, JPG, JPEG, PNG.",
13475
13835
  sizeLabel: "Ukuran",
13476
13836
  preview: "Pratinjau",
13477
- requiredError: "wajib diisi"
13837
+ requiredError: "wajib diisi",
13838
+ downloadTemplateDocument: "Download Template Dokumen"
13478
13839
  },
13479
13840
  en: {
13480
13841
  placeholder: "Tap to select a file",
13481
13842
  maxSizeWarning: "Maximum {maxSize}MB per file in PDF, JPG, JPEG, PNG format.",
13482
13843
  sizeLabel: "Size",
13483
13844
  preview: "Preview",
13484
- requiredError: "is required"
13845
+ requiredError: "is required",
13846
+ downloadTemplateDocument: "Download Template Document"
13485
13847
  }
13486
13848
  };
13487
13849
  var useStyles40 = makeStyles({
@@ -13621,7 +13983,8 @@ var FileUpload = React.forwardRef(
13621
13983
  disabled = false,
13622
13984
  language = "id",
13623
13985
  labels: customLabels,
13624
- pdfIcon
13986
+ pdfIcon,
13987
+ downloadTemplateDocument = false
13625
13988
  }, ref) => {
13626
13989
  const mergedLabels = { ...DEFAULT_LABELS38[language], ...customLabels };
13627
13990
  const styles = uploadStyles();
@@ -13706,6 +14069,20 @@ var FileUpload = React.forwardRef(
13706
14069
  }
13707
14070
  }
13708
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
+ };
13709
14086
  const getContainerStyle = (hasFile, hasError) => {
13710
14087
  if (disabled && hasFile) return styles.containerDisabled;
13711
14088
  if (hasError) return styles.containerError;
@@ -13815,202 +14192,216 @@ var FileUpload = React.forwardRef(
13815
14192
  }
13816
14193
  );
13817
14194
  }
13818
- return /* @__PURE__ */ jsxs(
13819
- Field,
13820
- {
13821
- ref,
13822
- required,
13823
- label: /* @__PURE__ */ jsx(Body1, { children: label }),
13824
- className: styles.fieldContainer,
13825
- children: [
13826
- /* @__PURE__ */ jsxs(
13827
- Container,
13828
- {
13829
- className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
13830
- onClick: handleClick,
13831
- onDrop: (e) => handleDrop(e, onChange),
13832
- onDragOver: handleDragOver,
13833
- onDragLeave: handleDragLeave,
13834
- fluid: true,
13835
- children: [
13836
- /* @__PURE__ */ jsxs(
13837
- Row,
13838
- {
13839
- nogutter: true,
13840
- style: { gap: tokens.spacingVerticalL },
13841
- justify: "center",
13842
- align: "center",
13843
- children: [
13844
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsx(
13845
- Icon,
13846
- {
13847
- icon: "fluent:warning-32-regular",
13848
- style: {
13849
- color: tokens.colorStatusWarningBackground3,
13850
- maxWidth: "32px",
13851
- width: "32px",
13852
- maxHeight: "32px",
13853
- 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
+ }
13854
14233
  }
13855
- }
13856
- ) : /* @__PURE__ */ jsx(
13857
- Icon,
13858
- {
13859
- icon: "fluent:arrow-upload-32-filled",
13860
- style: {
13861
- color: brandColors2[80],
13862
- maxWidth: "32px",
13863
- width: "32px",
13864
- maxHeight: "32px",
13865
- 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
+ }
13866
14245
  }
13867
- }
13868
- ) }) }),
13869
- /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
13870
- Row,
13871
- {
13872
- direction: "column",
13873
- nogutter: true,
13874
- style: { rowGap: tokens.spacingVerticalXS },
13875
- children: [
13876
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx(Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
13877
- displayFile instanceof File ? /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsxs(Row, { nogutter: true, style: { gap: tokens.spacingHorizontalS }, children: [
13878
- /* @__PURE__ */ jsx(
13879
- Col,
13880
- {
13881
- xs: "content",
13882
- style: {
13883
- display: "flex",
13884
- justifyContent: "center",
13885
- alignItems: "center",
13886
- width: "max-content"
13887
- },
13888
- children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsx(
13889
- "img",
13890
- {
13891
- src: previewUrl,
13892
- alt: "preview",
13893
- className: styles.filePreviewImage
13894
- }
13895
- ) : pdfIcon ? /* @__PURE__ */ jsx(
13896
- "img",
13897
- {
13898
- src: pdfIcon,
13899
- alt: "PDF Icon",
13900
- width: 32,
13901
- height: 32,
13902
- style: { flexShrink: 0 }
13903
- }
13904
- ) : /* @__PURE__ */ jsx(
13905
- Icon,
13906
- {
13907
- icon: "fluent:document-pdf-32-regular",
13908
- width: 32,
13909
- height: 32,
13910
- style: { flexShrink: 0, color: brandColors2[80] }
13911
- }
13912
- )
13913
- }
13914
- ),
13915
- /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
13916
- "div",
13917
- {
13918
- style: { display: "flex", flexDirection: "column" },
13919
- children: [
13920
- /* @__PURE__ */ jsx(Caption1Strong, { children: getDisplayFileName(displayFile) }),
13921
- /* @__PURE__ */ jsxs(
13922
- 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",
13923
14268
  {
13924
- style: { color: tokens.colorNeutralForeground3 },
13925
- children: [
13926
- mergedLabels.sizeLabel,
13927
- ": ",
13928
- formatFileSize(displayFile.size),
13929
- (error || sizeError) && /* @__PURE__ */ jsxs(
13930
- "span",
13931
- {
13932
- style: {
13933
- color: tokens.colorStatusWarningForeground1,
13934
- marginLeft: tokens.spacingHorizontalXS
13935
- },
13936
- children: [
13937
- "(",
13938
- sizeError || error?.message,
13939
- ")"
13940
- ]
13941
- }
13942
- )
13943
- ]
14269
+ src: previewUrl,
14270
+ alt: "preview",
14271
+ className: styles.filePreviewImage
13944
14272
  }
13945
- )
13946
- ]
13947
- }
13948
- ) }),
13949
- /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsxs(
13950
- "div",
13951
- {
13952
- style: {
13953
- display: "flex",
13954
- gap: tokens.spacingVerticalS,
13955
- justifyContent: "center",
13956
- alignItems: "center",
13957
- width: "max-content",
13958
- height: "100%"
13959
- },
13960
- children: [
13961
- /* @__PURE__ */ jsx(
13962
- Button,
14273
+ ) : pdfIcon ? /* @__PURE__ */ jsx(
14274
+ "img",
13963
14275
  {
13964
- appearance: "transparent",
13965
- size: "small",
13966
- style: { color: brandColors2[80] },
13967
- onClick: (e) => handlePreview(e, displayFile),
13968
- children: mergedLabels.preview
14276
+ src: pdfIcon,
14277
+ alt: "PDF Icon",
14278
+ width: 32,
14279
+ height: 32,
14280
+ style: { flexShrink: 0 }
13969
14281
  }
13970
- ),
13971
- /* @__PURE__ */ jsx(
13972
- Button,
14282
+ ) : /* @__PURE__ */ jsx(
14283
+ Icon,
13973
14284
  {
13974
- appearance: "transparent",
13975
- size: "small",
13976
- onClick: (e) => handleRemoveFile(e, onChange),
13977
- 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] }
13978
14289
  }
13979
14290
  )
13980
- ]
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))
13981
14366
  }
13982
14367
  ) })
13983
- ] }) }) : /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsx(
13984
- Caption1,
13985
- {
13986
- style: { color: tokens.colorNeutralForeground3 },
13987
- children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
13988
- }
13989
- ) })
13990
- ]
13991
- }
13992
- ) })
13993
- ]
13994
- }
13995
- ),
13996
- /* @__PURE__ */ jsx(
13997
- "input",
13998
- {
13999
- ref: fileInputRef,
14000
- type: "file",
14001
- accept,
14002
- onChange: (e) => handleFileSelect(e.target.files, onChange),
14003
- className: styles.hiddenInput,
14004
- disabled
14005
- }
14006
- )
14007
- ]
14008
- }
14009
- ),
14010
- /* @__PURE__ */ jsx(ModalPreviewImage, { imageUrl: previewUrl, open: isPreviewOpen, onOpenChange: setIsPreviewOpen })
14011
- ]
14012
- }
14013
- );
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
+ ] });
14014
14405
  }
14015
14406
  }
14016
14407
  );
@@ -14019,6 +14410,19 @@ var FileUpload = React.forwardRef(
14019
14410
  FileUpload.displayName = "FileUpload";
14020
14411
  var FileUpload_default = FileUpload;
14021
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
+
14022
14426
  // src/components/CardProfileMenu/CardProfileMenu.constants.ts
14023
14427
  var DEFAULT_LABELS39 = {
14024
14428
  id: {},
@@ -14114,6 +14518,6 @@ var CardProfileMenu = ({
14114
14518
  ) });
14115
14519
  };
14116
14520
 
14117
- 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 };
14118
14522
  //# sourceMappingURL=index.mjs.map
14119
14523
  //# sourceMappingURL=index.mjs.map