@asdp/ferryui 0.1.22-dev.8766 → 0.1.22-dev.8783

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,8 @@
1
- import { makeStyles, tokens, shorthands, createLightTheme, createDarkTheme, Popover, PopoverTrigger, Input, PopoverSurface, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, Body1, Button, Carousel, CarouselViewport, CarouselSlider, CarouselNav, CarouselNavButton, mergeClasses, CarouselCard, Skeleton, SkeletonItem, Subtitle2, Card, Tooltip, Badge, Caption1, Title2, Caption2, Divider, Title3, Caption1Strong, Field, Label, Text, Body1Strong, Checkbox, MessageBar, MessageBarBody, Accordion, AccordionItem, AccordionHeader, AccordionPanel, RadioGroup, Radio, Menu, MenuTrigger, MenuPopover, MenuList, DialogActions, Caption2Strong, Subtitle1, Switch, Body1Stronger, Caption1Stronger, Display, Image, Title1, DialogTrigger, TabList, Tab, Body2, typographyStyles, Textarea, Link } from '@fluentui/react-components';
1
+ import { makeStyles, tokens, createLightTheme, createDarkTheme, shorthands, Popover, PopoverTrigger, Input, PopoverSurface, Field, Image, Caption1Strong, Caption2, Button, Dialog, DialogSurface, DialogBody, DialogTitle, DialogTrigger, DialogContent, Body1, Body1Strong, Caption1, 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, Switch, Body1Stronger, Caption1Stronger, Display, Title1, TabList, Tab, Body2, typographyStyles, Textarea, Link } from '@fluentui/react-components';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import React5, { forwardRef, useState, useCallback, useRef, useEffect, useMemo, Fragment as Fragment$1 } from 'react';
4
- import { Row, Col, Visible } from 'react-grid-system';
3
+ import React5, { forwardRef, useState, useRef, useEffect, useCallback, useMemo, Fragment as Fragment$1 } from 'react';
4
+ import { Dismiss24Regular, DismissRegular, SubtractRegular, AddRegular, DeleteRegular, InfoRegular } from '@fluentui/react-icons';
5
+ import { Container, Row, Col, Visible } from 'react-grid-system';
5
6
  import { Icon } from '@iconify/react';
6
7
  import { Controller, useForm, useWatch } from 'react-hook-form';
7
8
  import PhoneInputComponent from 'react-phone-input-2';
@@ -9,7 +10,6 @@ import Select from 'react-select';
9
10
  import { Calendar } from '@fluentui/react-calendar-compat';
10
11
  import moment from 'moment';
11
12
  import { Range } from 'react-range';
12
- import { SubtractRegular, AddRegular, DeleteRegular, InfoRegular } from '@fluentui/react-icons';
13
13
 
14
14
  // src/components/ModalIllustration/ModalIllustration.constants.ts
15
15
  var DEFAULT_LABELS = {
@@ -203,8 +203,148 @@ var DEFAULT_LABELS2 = {
203
203
  announcementTemplate: "Carousel slide {index} of {total}"
204
204
  }
205
205
  };
206
+
207
+ // src/constants/generated/tokens.ts
208
+ var brandColors = {
209
+ "10": "#000000",
210
+ "20": "#03060e",
211
+ "30": "#060b1c",
212
+ "40": "#09112a",
213
+ "50": "#0c1738",
214
+ "60": "#122255",
215
+ "70": "#182e71",
216
+ "80": "#1e398d",
217
+ "90": "#4b60a4",
218
+ "100": "#7787bb",
219
+ "110": "#a4afd1",
220
+ "120": "#bac2dd",
221
+ "130": "#d0d6e8",
222
+ "140": "#e7e9f4",
223
+ "150": "#fdfdff",
224
+ "160": "#ffffff"
225
+ };
226
+
227
+ // src/constants/generated/tokensV2.ts
228
+ var brandColors2 = {
229
+ "10": "#001a1bff",
230
+ "20": "#02383bff",
231
+ "30": "#002426",
232
+ "40": "#004044",
233
+ "50": "#005D62",
234
+ "60": "#007A81",
235
+ "70": "#00969F",
236
+ "80": "#00B3BD",
237
+ "90": "#29BFC8",
238
+ "100": "#52CBD2",
239
+ "110": "#7AD7DD",
240
+ "120": "#A3E4E7",
241
+ "130": "#CCF0F2",
242
+ "140": "#E1F7F8",
243
+ "150": "#fdfdff",
244
+ "160": "#ffffff"
245
+ };
246
+ var spacing2 = {
247
+ "360": 36};
248
+ var fontWeight = {
249
+ "Medium": 500};
250
+ var sharedColors = {
251
+ "Shared_Cranberry_Primary": "#c50f1f",
252
+ "Shared_Red_Primary": "#d13438",
253
+ "Shared_Green_Primary": "#107c10"};
254
+ var lightModeColors2 = {
255
+ "Neutral_Foreground_Disabled_Rest": "#bdbdbd",
256
+ "Brand_Stroke_1_Rest": "#00B3BD"};
257
+ var tokensV2_default = {
258
+ lightModeColors: lightModeColors2};
259
+
260
+ // src/constants/brandColors.ts
261
+ var isV2Path = typeof window !== "undefined" && window.location.pathname.startsWith("/v2");
262
+ var brandColors3 = !isV2Path ? brandColors2 : brandColors;
263
+ var customBrand = {
264
+ 10: brandColors3["10"],
265
+ 20: brandColors3["20"],
266
+ 30: brandColors3["30"],
267
+ 40: brandColors3["40"],
268
+ 50: brandColors3["50"],
269
+ 60: brandColors3["60"],
270
+ 70: brandColors3["70"],
271
+ 80: brandColors3["80"],
272
+ 90: brandColors3["90"],
273
+ 100: brandColors3["100"],
274
+ 110: brandColors3["110"],
275
+ 120: brandColors3["120"],
276
+ 130: brandColors3["130"],
277
+ 140: brandColors3["140"],
278
+ 150: brandColors3["150"],
279
+ 160: brandColors3["160"]
280
+ };
281
+
282
+ // src/constants/designTokens.ts
283
+ typeof window !== "undefined" && window.location.pathname.startsWith("/v2");
284
+ var designTokens = {
285
+ // Breakpoints for responsive design
286
+ breakpoints: {
287
+ xs: "320px",
288
+ sm: "480px",
289
+ md: "768px",
290
+ lg: "1024px",
291
+ xl: "1200px",
292
+ xxl: "1440px",
293
+ xxxl: "1600px"
294
+ }};
295
+
296
+ // src/constants/themes.ts
297
+ var extendedTokens = {
298
+ breakpointXs: designTokens.breakpoints.xs,
299
+ breakpointSm: designTokens.breakpoints.sm,
300
+ breakpointMd: designTokens.breakpoints.md,
301
+ breakpointLg: designTokens.breakpoints.lg,
302
+ breakpointXl: designTokens.breakpoints.xl,
303
+ breakpointXxl: designTokens.breakpoints.xxl,
304
+ breakpointXxxl: designTokens.breakpoints.xxxl
305
+ };
306
+ ({
307
+ ...createLightTheme(customBrand),
308
+ // Brand colors from Figma
309
+ colorBrandBackground: customBrand[80],
310
+ colorBrandBackgroundHover: customBrand[70],
311
+ colorBrandBackgroundPressed: customBrand[60],
312
+ colorBrandBackgroundSelected: customBrand[80],
313
+ colorBrandForeground1: customBrand[80],
314
+ colorBrandForeground2: customBrand[70],
315
+ colorBrandForegroundLink: customBrand[70],
316
+ colorBrandForegroundLinkHover: customBrand[60],
317
+ colorBrandForegroundLinkPressed: customBrand[50],
318
+ colorBrandForegroundLinkSelected: customBrand[70]});
319
+ ({
320
+ ...createDarkTheme(customBrand),
321
+ // Brand colors from Figma (inverted for dark mode)
322
+ colorBrandBackground: customBrand[100],
323
+ colorBrandBackgroundHover: customBrand[110],
324
+ colorBrandBackgroundPressed: customBrand[120],
325
+ colorBrandBackgroundSelected: customBrand[100],
326
+ colorBrandForeground1: customBrand[100],
327
+ colorBrandForeground2: customBrand[110],
328
+ colorBrandForegroundLink: customBrand[110],
329
+ colorBrandForegroundLinkHover: customBrand[120],
330
+ colorBrandForegroundLinkPressed: customBrand[130],
331
+ colorBrandForegroundLinkSelected: customBrand[110]});
206
332
  var useStyles2 = makeStyles({
207
333
  carousel: {},
334
+ carouselContainer: {
335
+ display: "flex",
336
+ gap: `${spacing2[360]}px`,
337
+ alignItems: "center",
338
+ justifyContent: "center",
339
+ [`@media (max-width: ${extendedTokens.breakpointMd})`]: {
340
+ gap: tokens.spacingVerticalXS
341
+ }
342
+ },
343
+ carouselContainerNoNav: {
344
+ display: "flex",
345
+ alignItems: "center",
346
+ justifyContent: "center"
347
+ },
208
348
  customCarouselNav: {
209
349
  display: "flex",
210
350
  gap: tokens.spacingHorizontalXS,
@@ -213,6 +353,39 @@ var useStyles2 = makeStyles({
213
353
  ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingVerticalM),
214
354
  borderRadius: tokens.borderRadiusCircular
215
355
  },
356
+ closeButton: {
357
+ width: "max-content",
358
+ height: "max-content",
359
+ backgroundColor: tokens.colorNeutralForeground2,
360
+ color: tokens.colorNeutralBackground1,
361
+ position: "absolute",
362
+ zIndex: 1,
363
+ insetInlineEnd: "0px",
364
+ top: "2%",
365
+ [`@media (max-width: ${extendedTokens.breakpointSm})`]: {
366
+ top: "2%"
367
+ }
368
+ },
369
+ closeButtonWithNav: {
370
+ insetInlineEnd: "14%",
371
+ [`@media (max-width: ${extendedTokens.breakpointSm})`]: {
372
+ insetInlineEnd: "15% !important"
373
+ },
374
+ [`@media (min-width: ${extendedTokens.breakpointMd}) and (max-width: ${extendedTokens.breakpointLg})`]: {
375
+ insetInlineEnd: "13% !important"
376
+ }
377
+ },
378
+ closeButtonWithoutNav: {
379
+ insetInlineEnd: "10px"
380
+ },
381
+ customeCarouselButton: {
382
+ borderRadius: tokens.borderRadiusCircular,
383
+ backgroundColor: tokens.colorNeutralBackgroundInverted,
384
+ color: tokens.colorNeutralBackground1,
385
+ ":hover": {
386
+ backgroundColor: tokens.colorNeutralForeground2
387
+ }
388
+ },
216
389
  carouselNavButton: {
217
390
  "& button": {
218
391
  padding: 0,
@@ -274,7 +447,10 @@ var CarouselWithCustomNav = ({
274
447
  ariaLabel: deprecatedAriaLabel,
275
448
  darkNavBackground = true,
276
449
  className,
277
- cardFocus = false
450
+ cardFocus = false,
451
+ showNavButtons = false,
452
+ showCloseButton = false,
453
+ onCloseClick
278
454
  }) => {
279
455
  const styles = useStyles2();
280
456
  const [internalIndex, setInternalIndex] = useState(0);
@@ -315,20 +491,53 @@ var CarouselWithCustomNav = ({
315
491
  activeIndex,
316
492
  onActiveIndexChange: (_, data) => handleIndexChange(data.index),
317
493
  children: [
318
- /* @__PURE__ */ jsx(CarouselViewport, { children: /* @__PURE__ */ jsx(
319
- CarouselSlider,
320
- {
321
- cardFocus,
322
- "aria-label": labels.carouselAriaLabel,
323
- children
324
- }
325
- ) }),
494
+ /* @__PURE__ */ jsxs("div", { className: showNavButtons ? styles.carouselContainer : styles.carouselContainerNoNav, children: [
495
+ showNavButtons && /* @__PURE__ */ jsx(
496
+ CarouselButton,
497
+ {
498
+ navType: "prev",
499
+ "aria-label": "Previous Carousel Page Button",
500
+ className: styles.customeCarouselButton
501
+ }
502
+ ),
503
+ /* @__PURE__ */ jsxs(CarouselViewport, { style: { overflow: "hidden", paddingBottom: "10px" }, children: [
504
+ showCloseButton && /* @__PURE__ */ jsx(
505
+ Button,
506
+ {
507
+ icon: /* @__PURE__ */ jsx(DismissRegular, {}),
508
+ shape: "circular",
509
+ onClick: onCloseClick,
510
+ "aria-label": "Close carousel",
511
+ className: mergeClasses(
512
+ styles.closeButton,
513
+ showNavButtons ? styles.closeButtonWithNav : styles.closeButtonWithoutNav
514
+ )
515
+ }
516
+ ),
517
+ /* @__PURE__ */ jsx(
518
+ CarouselSlider,
519
+ {
520
+ cardFocus,
521
+ "aria-label": labels.carouselAriaLabel,
522
+ children
523
+ }
524
+ )
525
+ ] }),
526
+ showNavButtons && /* @__PURE__ */ jsx(
527
+ CarouselButton,
528
+ {
529
+ navType: "next",
530
+ "aria-label": "Next Carousel Page Button",
531
+ className: styles.customeCarouselButton
532
+ }
533
+ )
534
+ ] }),
326
535
  /* @__PURE__ */ jsx(
327
536
  CarouselNav,
328
537
  {
329
538
  style: {
330
539
  backgroundColor: darkNavBackground ? tokens.colorSubtleBackgroundInverted : tokens.colorSubtleBackground,
331
- marginTop: tokens.spacingVerticalXL
540
+ marginTop: tokens.spacingVerticalXXL
332
541
  },
333
542
  appearance: "brand",
334
543
  className: styles.carouselNavButton,
@@ -652,154 +861,30 @@ var CardBanner = ({
652
861
  className: classes.bannerImage,
653
862
  src: imageUrl,
654
863
  alt,
655
- role: "presentation",
656
- onClick,
657
- style: { cursor: onClick ? "pointer" : "default" }
658
- }
659
- ) });
660
- };
661
- function useWindowSize() {
662
- const [windowSize, setWindowSize] = useState({
663
- width: 0,
664
- height: 0
665
- });
666
- useEffect(() => {
667
- function handleResize() {
668
- setWindowSize({
669
- width: window.innerWidth,
670
- height: window.innerHeight
671
- });
672
- }
673
- window.addEventListener("resize", handleResize);
674
- handleResize();
675
- return () => window.removeEventListener("resize", handleResize);
676
- }, []);
677
- return windowSize;
678
- }
679
-
680
- // src/constants/generated/tokens.ts
681
- var brandColors = {
682
- "10": "#000000",
683
- "20": "#03060e",
684
- "30": "#060b1c",
685
- "40": "#09112a",
686
- "50": "#0c1738",
687
- "60": "#122255",
688
- "70": "#182e71",
689
- "80": "#1e398d",
690
- "90": "#4b60a4",
691
- "100": "#7787bb",
692
- "110": "#a4afd1",
693
- "120": "#bac2dd",
694
- "130": "#d0d6e8",
695
- "140": "#e7e9f4",
696
- "150": "#fdfdff",
697
- "160": "#ffffff"
698
- };
699
-
700
- // src/constants/generated/tokensV2.ts
701
- var brandColors2 = {
702
- "10": "#001a1bff",
703
- "20": "#02383bff",
704
- "30": "#002426",
705
- "40": "#004044",
706
- "50": "#005D62",
707
- "60": "#007A81",
708
- "70": "#00969F",
709
- "80": "#00B3BD",
710
- "90": "#29BFC8",
711
- "100": "#52CBD2",
712
- "110": "#7AD7DD",
713
- "120": "#A3E4E7",
714
- "130": "#CCF0F2",
715
- "140": "#E1F7F8",
716
- "150": "#fdfdff",
717
- "160": "#ffffff"
718
- };
719
- var fontWeight = {
720
- "Medium": 500};
721
- var sharedColors = {
722
- "Shared_Cranberry_Primary": "#c50f1f",
723
- "Shared_Red_Primary": "#d13438",
724
- "Shared_Green_Primary": "#107c10"};
725
- var lightModeColors2 = {
726
- "Neutral_Foreground_Disabled_Rest": "#bdbdbd",
727
- "Brand_Stroke_1_Rest": "#00B3BD"};
728
- var tokensV2_default = {
729
- lightModeColors: lightModeColors2};
730
-
731
- // src/constants/brandColors.ts
732
- var isV2Path = typeof window !== "undefined" && window.location.pathname.startsWith("/v2");
733
- var brandColors3 = !isV2Path ? brandColors2 : brandColors;
734
- var customBrand = {
735
- 10: brandColors3["10"],
736
- 20: brandColors3["20"],
737
- 30: brandColors3["30"],
738
- 40: brandColors3["40"],
739
- 50: brandColors3["50"],
740
- 60: brandColors3["60"],
741
- 70: brandColors3["70"],
742
- 80: brandColors3["80"],
743
- 90: brandColors3["90"],
744
- 100: brandColors3["100"],
745
- 110: brandColors3["110"],
746
- 120: brandColors3["120"],
747
- 130: brandColors3["130"],
748
- 140: brandColors3["140"],
749
- 150: brandColors3["150"],
750
- 160: brandColors3["160"]
751
- };
752
-
753
- // src/constants/designTokens.ts
754
- typeof window !== "undefined" && window.location.pathname.startsWith("/v2");
755
- var designTokens = {
756
- // Breakpoints for responsive design
757
- breakpoints: {
758
- xs: "320px",
759
- sm: "480px",
760
- md: "768px",
761
- lg: "1024px",
762
- xl: "1200px",
763
- xxl: "1440px",
764
- xxxl: "1600px"
765
- }};
766
-
767
- // src/constants/themes.ts
768
- var extendedTokens = {
769
- breakpointXs: designTokens.breakpoints.xs,
770
- breakpointSm: designTokens.breakpoints.sm,
771
- breakpointMd: designTokens.breakpoints.md,
772
- breakpointLg: designTokens.breakpoints.lg,
773
- breakpointXl: designTokens.breakpoints.xl,
774
- breakpointXxl: designTokens.breakpoints.xxl,
775
- breakpointXxxl: designTokens.breakpoints.xxxl
776
- };
777
- ({
778
- ...createLightTheme(customBrand),
779
- // Brand colors from Figma
780
- colorBrandBackground: customBrand[80],
781
- colorBrandBackgroundHover: customBrand[70],
782
- colorBrandBackgroundPressed: customBrand[60],
783
- colorBrandBackgroundSelected: customBrand[80],
784
- colorBrandForeground1: customBrand[80],
785
- colorBrandForeground2: customBrand[70],
786
- colorBrandForegroundLink: customBrand[70],
787
- colorBrandForegroundLinkHover: customBrand[60],
788
- colorBrandForegroundLinkPressed: customBrand[50],
789
- colorBrandForegroundLinkSelected: customBrand[70]});
790
- ({
791
- ...createDarkTheme(customBrand),
792
- // Brand colors from Figma (inverted for dark mode)
793
- colorBrandBackground: customBrand[100],
794
- colorBrandBackgroundHover: customBrand[110],
795
- colorBrandBackgroundPressed: customBrand[120],
796
- colorBrandBackgroundSelected: customBrand[100],
797
- colorBrandForeground1: customBrand[100],
798
- colorBrandForeground2: customBrand[110],
799
- colorBrandForegroundLink: customBrand[110],
800
- colorBrandForegroundLinkHover: customBrand[120],
801
- colorBrandForegroundLinkPressed: customBrand[130],
802
- colorBrandForegroundLinkSelected: customBrand[110]});
864
+ role: "presentation",
865
+ onClick,
866
+ style: { cursor: onClick ? "pointer" : "default" }
867
+ }
868
+ ) });
869
+ };
870
+ function useWindowSize() {
871
+ const [windowSize, setWindowSize] = useState({
872
+ width: 0,
873
+ height: 0
874
+ });
875
+ useEffect(() => {
876
+ function handleResize() {
877
+ setWindowSize({
878
+ width: window.innerWidth,
879
+ height: window.innerHeight
880
+ });
881
+ }
882
+ window.addEventListener("resize", handleResize);
883
+ handleResize();
884
+ return () => window.removeEventListener("resize", handleResize);
885
+ }, []);
886
+ return windowSize;
887
+ }
803
888
 
804
889
  // src/components/CardTicket/CardTicket.constants.ts
805
890
  var DEFAULT_LABELS5 = {
@@ -11713,8 +11798,566 @@ var ModalPriceDetail = ({
11713
11798
  );
11714
11799
  };
11715
11800
 
11716
- // src/components/CardProfileMenu/CardProfileMenu.constants.ts
11801
+ // src/components/FileUpload/FileUpload.constants.ts
11802
+ var ACCEPTED_FILES = ".pdf,.jpg,.jpeg,.png";
11803
+ var MAX_FILE_SIZE_MB = 10;
11717
11804
  var DEFAULT_LABELS38 = {
11805
+ id: {
11806
+ placeholder: "Ketuk untuk pilih file",
11807
+ maxSizeWarning: "Maksimal {maxSize}MB per file dalam format PDF, JPG, JPEG, PNG.",
11808
+ sizeLabel: "Ukuran",
11809
+ preview: "Pratinjau",
11810
+ requiredError: "wajib diisi"
11811
+ },
11812
+ en: {
11813
+ placeholder: "Tap to select a file",
11814
+ maxSizeWarning: "Maximum {maxSize}MB per file in PDF, JPG, JPEG, PNG format.",
11815
+ sizeLabel: "Size",
11816
+ preview: "Preview",
11817
+ requiredError: "is required"
11818
+ }
11819
+ };
11820
+ var uploadStyles = makeStyles({
11821
+ container: {
11822
+ backgroundColor: "#F0FEFF",
11823
+ backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%2300B3BD' stroke-width='3' stroke-dasharray='25%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e")`,
11824
+ ...shorthands.padding(tokens.spacingHorizontalM, tokens.spacingHorizontalL),
11825
+ borderRadius: "16px",
11826
+ cursor: "pointer",
11827
+ width: "100%"
11828
+ },
11829
+ containerError: {
11830
+ backgroundColor: tokens.colorStatusWarningBackground1,
11831
+ backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%23F7630C' stroke-width='3' stroke-dasharray='25%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e")`,
11832
+ ...shorthands.padding(tokens.spacingHorizontalM, tokens.spacingHorizontalL),
11833
+ borderRadius: "16px",
11834
+ cursor: "pointer",
11835
+ width: "100%"
11836
+ },
11837
+ containerDisabled: {
11838
+ width: "100%"
11839
+ },
11840
+ fieldContainer: {
11841
+ display: "flex",
11842
+ flexDirection: "column",
11843
+ justifyContent: "end",
11844
+ height: "100%",
11845
+ gap: tokens.spacingHorizontalXS
11846
+ },
11847
+ disabledFileInfo: {
11848
+ display: "flex",
11849
+ flexDirection: "column"
11850
+ },
11851
+ disabledFileName: {
11852
+ color: tokens.colorNeutralForeground1
11853
+ },
11854
+ disabledFileSize: {
11855
+ color: tokens.colorNeutralForeground3
11856
+ },
11857
+ uploadIcon: {
11858
+ borderRadius: tokens.borderRadiusCircular,
11859
+ backgroundColor: tokens.colorNeutralBackground1,
11860
+ maxWidth: "48px",
11861
+ width: "48px",
11862
+ height: "48px",
11863
+ maxHeight: "48px",
11864
+ textAlign: "center",
11865
+ alignItems: "center",
11866
+ display: "flex",
11867
+ justifyContent: "center"
11868
+ },
11869
+ uploadText: {
11870
+ display: "flex",
11871
+ flexDirection: "column",
11872
+ gap: tokens.spacingVerticalXS,
11873
+ flex: 1
11874
+ },
11875
+ hiddenInput: {
11876
+ opacity: 0,
11877
+ position: "absolute",
11878
+ pointerEvents: "none"
11879
+ },
11880
+ filePreviewImage: {
11881
+ width: "48px",
11882
+ height: "48px",
11883
+ borderRadius: tokens.borderRadiusSmall,
11884
+ objectFit: "cover"
11885
+ },
11886
+ dialogImage: {
11887
+ maxWidth: "100%",
11888
+ maxHeight: "70vh",
11889
+ objectFit: "contain"
11890
+ }
11891
+ });
11892
+ var FileUpload = React5.forwardRef(
11893
+ ({
11894
+ name,
11895
+ control,
11896
+ label,
11897
+ required = false,
11898
+ accept = ACCEPTED_FILES,
11899
+ maxSize = MAX_FILE_SIZE_MB,
11900
+ placeholder: placeholderProp,
11901
+ disabled = false,
11902
+ language = "id",
11903
+ labels: customLabels
11904
+ }, ref) => {
11905
+ const mergedLabels = { ...DEFAULT_LABELS38[language], ...customLabels };
11906
+ const styles = uploadStyles();
11907
+ const fileInputRef = useRef(null);
11908
+ const [, setIsDragOver] = useState(false);
11909
+ const [previewUrl, setPreviewUrl] = useState(null);
11910
+ const [sizeError, setSizeError] = useState(null);
11911
+ const [currentFile, setCurrentFile] = useState(null);
11912
+ const [isPreviewOpen, setIsPreviewOpen] = useState(false);
11913
+ const formatFileSize = (bytes) => {
11914
+ if (bytes < 1024) return `${bytes} B`;
11915
+ const kb = bytes / 1024;
11916
+ if (kb < 1024) return `${kb.toFixed(1)} KB`;
11917
+ const mb = kb / 1024;
11918
+ return `${mb.toFixed(1)} MB`;
11919
+ };
11920
+ const isImageFile = (file) => {
11921
+ return file ? file.type.startsWith("image/") : false;
11922
+ };
11923
+ const getDisplayFileName = (file) => {
11924
+ if (!file) return "";
11925
+ if (file.type.startsWith("image/")) {
11926
+ return "Image";
11927
+ }
11928
+ const extension = file.name.split(".").pop()?.toLowerCase() || "";
11929
+ return `Document.${extension}`;
11930
+ };
11931
+ const handleFileSelect = (files, onChange) => {
11932
+ setSizeError(null);
11933
+ if (files && files.length > 0) {
11934
+ const file = files[0];
11935
+ setCurrentFile(file);
11936
+ if (file.size > maxSize * 1024 * 1024) {
11937
+ setSizeError("error");
11938
+ onChange(void 0);
11939
+ return;
11940
+ }
11941
+ onChange(file);
11942
+ setCurrentFile(null);
11943
+ }
11944
+ };
11945
+ const handleClick = () => {
11946
+ if (!disabled) {
11947
+ fileInputRef.current?.click();
11948
+ }
11949
+ };
11950
+ const handleDrop = (e, onChange) => {
11951
+ e.preventDefault();
11952
+ setIsDragOver(false);
11953
+ if (!disabled) {
11954
+ handleFileSelect(e.dataTransfer.files, onChange);
11955
+ }
11956
+ };
11957
+ const handleDragOver = (e) => {
11958
+ e.preventDefault();
11959
+ setIsDragOver(true);
11960
+ };
11961
+ const handleDragLeave = () => {
11962
+ setIsDragOver(false);
11963
+ };
11964
+ const handleRemoveFile = (e, onChange) => {
11965
+ e?.stopPropagation();
11966
+ setSizeError(null);
11967
+ setCurrentFile(null);
11968
+ onChange(void 0);
11969
+ if (previewUrl) {
11970
+ URL.revokeObjectURL(previewUrl);
11971
+ }
11972
+ setPreviewUrl(null);
11973
+ if (fileInputRef.current) fileInputRef.current.value = "";
11974
+ };
11975
+ const handlePreview = (e, file) => {
11976
+ e.stopPropagation();
11977
+ const fileToPreview = file;
11978
+ if (fileToPreview instanceof File) {
11979
+ if (isImageFile(fileToPreview)) {
11980
+ setIsPreviewOpen(true);
11981
+ } else {
11982
+ const fileUrl = URL.createObjectURL(fileToPreview);
11983
+ window.open(fileUrl, "_blank");
11984
+ setTimeout(() => URL.revokeObjectURL(fileUrl), 1e3);
11985
+ }
11986
+ }
11987
+ };
11988
+ const getContainerStyle = (hasFile, hasError) => {
11989
+ if (disabled && hasFile) return styles.containerDisabled;
11990
+ if (hasError) return styles.containerError;
11991
+ return styles.container;
11992
+ };
11993
+ return /* @__PURE__ */ jsx(
11994
+ Controller,
11995
+ {
11996
+ name,
11997
+ control,
11998
+ rules: { required: required ? `${label} ${mergedLabels.requiredError}` : false },
11999
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
12000
+ const displayFile = currentFile || value;
12001
+ useEffect(() => {
12002
+ const fileToPreview = currentFile || value;
12003
+ if (fileToPreview instanceof File) {
12004
+ if (fileToPreview.type.startsWith("image/")) {
12005
+ const url = URL.createObjectURL(fileToPreview);
12006
+ setPreviewUrl(url);
12007
+ return () => {
12008
+ URL.revokeObjectURL(url);
12009
+ setPreviewUrl(null);
12010
+ };
12011
+ } else {
12012
+ setPreviewUrl(null);
12013
+ }
12014
+ } else {
12015
+ setPreviewUrl(null);
12016
+ }
12017
+ }, [value, currentFile]);
12018
+ if (disabled && displayFile instanceof File) {
12019
+ return /* @__PURE__ */ jsxs(
12020
+ Field,
12021
+ {
12022
+ required,
12023
+ label: /* @__PURE__ */ jsx(Body1, { children: label }),
12024
+ className: styles.fieldContainer,
12025
+ children: [
12026
+ /* @__PURE__ */ jsx(
12027
+ Container,
12028
+ {
12029
+ style: { marginLeft: 0, width: "100%", padding: 0 },
12030
+ fluid: true,
12031
+ children: /* @__PURE__ */ jsxs(Row, { children: [
12032
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(Row, { children: [
12033
+ /* @__PURE__ */ jsx(
12034
+ Col,
12035
+ {
12036
+ xs: "content",
12037
+ style: {
12038
+ display: "flex",
12039
+ justifyContent: "center",
12040
+ alignItems: "center",
12041
+ width: "max-content"
12042
+ },
12043
+ children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsx(
12044
+ "img",
12045
+ {
12046
+ src: previewUrl,
12047
+ alt: "preview",
12048
+ className: styles.filePreviewImage
12049
+ }
12050
+ ) : /* @__PURE__ */ jsx(Image, { src: "/assets/images/icons/pdficon.svg", alt: "PDF Icon", width: 32, height: 32 })
12051
+ }
12052
+ ),
12053
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs("div", { className: styles.disabledFileInfo, children: [
12054
+ /* @__PURE__ */ jsx(Caption1Strong, { className: styles.disabledFileName, children: getDisplayFileName(displayFile) }),
12055
+ /* @__PURE__ */ jsxs(Caption2, { className: styles.disabledFileSize, children: [
12056
+ mergedLabels.sizeLabel,
12057
+ ": ",
12058
+ formatFileSize(displayFile.size)
12059
+ ] })
12060
+ ] }) })
12061
+ ] }) }),
12062
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx(
12063
+ Button,
12064
+ {
12065
+ appearance: "transparent",
12066
+ size: "small",
12067
+ style: { color: brandColors2[80] },
12068
+ onClick: (e) => handlePreview(e, displayFile),
12069
+ children: mergedLabels.preview
12070
+ }
12071
+ ) })
12072
+ ] })
12073
+ }
12074
+ ),
12075
+ /* @__PURE__ */ jsx(
12076
+ Dialog,
12077
+ {
12078
+ open: isPreviewOpen,
12079
+ onOpenChange: (_, data) => setIsPreviewOpen(data.open),
12080
+ children: /* @__PURE__ */ jsx(
12081
+ DialogSurface,
12082
+ {
12083
+ style: {
12084
+ maxWidth: "90vw",
12085
+ maxHeight: "90vh",
12086
+ backgroundColor: "transparent",
12087
+ boxShadow: "none"
12088
+ },
12089
+ children: /* @__PURE__ */ jsxs(DialogBody, { children: [
12090
+ /* @__PURE__ */ jsx(
12091
+ DialogTitle,
12092
+ {
12093
+ action: /* @__PURE__ */ jsx(DialogTrigger, { action: "close", children: /* @__PURE__ */ jsx(
12094
+ Button,
12095
+ {
12096
+ appearance: "subtle",
12097
+ "aria-label": "close",
12098
+ icon: /* @__PURE__ */ jsx(Dismiss24Regular, {})
12099
+ }
12100
+ ) })
12101
+ }
12102
+ ),
12103
+ /* @__PURE__ */ jsx(
12104
+ DialogContent,
12105
+ {
12106
+ style: { alignItems: "center", textAlign: "center" },
12107
+ children: previewUrl && /* @__PURE__ */ jsx(
12108
+ "img",
12109
+ {
12110
+ src: previewUrl,
12111
+ alt: "Preview",
12112
+ className: styles.dialogImage
12113
+ }
12114
+ )
12115
+ }
12116
+ )
12117
+ ] })
12118
+ }
12119
+ )
12120
+ }
12121
+ )
12122
+ ]
12123
+ }
12124
+ );
12125
+ }
12126
+ return /* @__PURE__ */ jsxs(
12127
+ Field,
12128
+ {
12129
+ ref,
12130
+ required,
12131
+ label: /* @__PURE__ */ jsx(Body1, { children: label }),
12132
+ className: styles.fieldContainer,
12133
+ children: [
12134
+ /* @__PURE__ */ jsxs(
12135
+ Container,
12136
+ {
12137
+ className: getContainerStyle(!!displayFile, !!(error && (value || currentFile)) || !!sizeError),
12138
+ onClick: handleClick,
12139
+ onDrop: (e) => handleDrop(e, onChange),
12140
+ onDragOver: handleDragOver,
12141
+ onDragLeave: handleDragLeave,
12142
+ fluid: true,
12143
+ children: [
12144
+ /* @__PURE__ */ jsxs(
12145
+ Row,
12146
+ {
12147
+ nogutter: true,
12148
+ style: { gap: tokens.spacingVerticalL },
12149
+ justify: "center",
12150
+ align: "center",
12151
+ children: [
12152
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx("div", { className: styles.uploadIcon, children: sizeError ? /* @__PURE__ */ jsx(
12153
+ Icon,
12154
+ {
12155
+ icon: "fluent:warning-32-regular",
12156
+ style: {
12157
+ color: tokens.colorStatusWarningBackground3,
12158
+ maxWidth: "32px",
12159
+ width: "32px",
12160
+ maxHeight: "32px",
12161
+ height: "32px"
12162
+ }
12163
+ }
12164
+ ) : /* @__PURE__ */ jsx(
12165
+ Icon,
12166
+ {
12167
+ icon: "fluent:arrow-upload-32-filled",
12168
+ style: {
12169
+ color: brandColors2[80],
12170
+ maxWidth: "32px",
12171
+ width: "32px",
12172
+ maxHeight: "32px",
12173
+ height: "32px"
12174
+ }
12175
+ }
12176
+ ) }) }),
12177
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
12178
+ Row,
12179
+ {
12180
+ direction: "column",
12181
+ nogutter: true,
12182
+ style: { rowGap: tokens.spacingVerticalXS },
12183
+ children: [
12184
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsx(Body1Strong, { children: placeholderProp || mergedLabels.placeholder }) }),
12185
+ displayFile instanceof File ? /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsxs(Row, { nogutter: true, style: { gap: tokens.spacingHorizontalS }, children: [
12186
+ /* @__PURE__ */ jsx(
12187
+ Col,
12188
+ {
12189
+ xs: "content",
12190
+ style: {
12191
+ display: "flex",
12192
+ justifyContent: "center",
12193
+ alignItems: "center",
12194
+ width: "max-content"
12195
+ },
12196
+ children: isImageFile(displayFile) && previewUrl ? /* @__PURE__ */ jsx(
12197
+ "img",
12198
+ {
12199
+ src: previewUrl,
12200
+ alt: "preview",
12201
+ className: styles.filePreviewImage
12202
+ }
12203
+ ) : /* @__PURE__ */ jsx(Image, { src: "/assets/images/icons/pdficon.svg", alt: "PDF Icon", width: 32, height: 32 })
12204
+ }
12205
+ ),
12206
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs(
12207
+ "div",
12208
+ {
12209
+ style: { display: "flex", flexDirection: "column" },
12210
+ children: [
12211
+ /* @__PURE__ */ jsx(Caption1Strong, { children: getDisplayFileName(displayFile) }),
12212
+ /* @__PURE__ */ jsxs(
12213
+ Caption2,
12214
+ {
12215
+ style: { color: tokens.colorNeutralForeground3 },
12216
+ children: [
12217
+ mergedLabels.sizeLabel,
12218
+ ": ",
12219
+ formatFileSize(displayFile.size),
12220
+ (error || sizeError) && /* @__PURE__ */ jsxs(
12221
+ "span",
12222
+ {
12223
+ style: {
12224
+ color: tokens.colorStatusWarningForeground1,
12225
+ marginLeft: tokens.spacingHorizontalXS
12226
+ },
12227
+ children: [
12228
+ "(",
12229
+ sizeError || error?.message,
12230
+ ")"
12231
+ ]
12232
+ }
12233
+ )
12234
+ ]
12235
+ }
12236
+ )
12237
+ ]
12238
+ }
12239
+ ) }),
12240
+ /* @__PURE__ */ jsx(Col, { xs: "content", children: /* @__PURE__ */ jsxs(
12241
+ "div",
12242
+ {
12243
+ style: {
12244
+ display: "flex",
12245
+ gap: tokens.spacingVerticalS,
12246
+ justifyContent: "center",
12247
+ alignItems: "center",
12248
+ width: "max-content",
12249
+ height: "100%"
12250
+ },
12251
+ children: [
12252
+ /* @__PURE__ */ jsx(
12253
+ Button,
12254
+ {
12255
+ appearance: "transparent",
12256
+ size: "small",
12257
+ style: { color: brandColors2[80] },
12258
+ onClick: (e) => handlePreview(e, displayFile),
12259
+ children: mergedLabels.preview
12260
+ }
12261
+ ),
12262
+ /* @__PURE__ */ jsx(
12263
+ Button,
12264
+ {
12265
+ appearance: "transparent",
12266
+ size: "small",
12267
+ onClick: (e) => handleRemoveFile(e, onChange),
12268
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-16-regular" })
12269
+ }
12270
+ )
12271
+ ]
12272
+ }
12273
+ ) })
12274
+ ] }) }) : /* @__PURE__ */ jsx(Col, { xs: 12, children: /* @__PURE__ */ jsx(
12275
+ Caption1,
12276
+ {
12277
+ style: { color: tokens.colorNeutralForeground3 },
12278
+ children: mergedLabels.maxSizeWarning.replace("{maxSize}", String(maxSize))
12279
+ }
12280
+ ) })
12281
+ ]
12282
+ }
12283
+ ) })
12284
+ ]
12285
+ }
12286
+ ),
12287
+ /* @__PURE__ */ jsx(
12288
+ "input",
12289
+ {
12290
+ ref: fileInputRef,
12291
+ type: "file",
12292
+ accept,
12293
+ onChange: (e) => handleFileSelect(e.target.files, onChange),
12294
+ className: styles.hiddenInput,
12295
+ disabled
12296
+ }
12297
+ )
12298
+ ]
12299
+ }
12300
+ ),
12301
+ /* @__PURE__ */ jsx(
12302
+ Dialog,
12303
+ {
12304
+ open: isPreviewOpen,
12305
+ onOpenChange: (_, data) => setIsPreviewOpen(data.open),
12306
+ children: /* @__PURE__ */ jsx(
12307
+ DialogSurface,
12308
+ {
12309
+ style: {
12310
+ maxWidth: "90vw",
12311
+ maxHeight: "90vh",
12312
+ backgroundColor: "transparent",
12313
+ boxShadow: "none"
12314
+ },
12315
+ children: /* @__PURE__ */ jsxs(DialogBody, { children: [
12316
+ /* @__PURE__ */ jsx(
12317
+ DialogTitle,
12318
+ {
12319
+ action: /* @__PURE__ */ jsx(DialogTrigger, { action: "close", children: /* @__PURE__ */ jsx(
12320
+ Button,
12321
+ {
12322
+ appearance: "subtle",
12323
+ "aria-label": "close",
12324
+ icon: /* @__PURE__ */ jsx(Dismiss24Regular, {})
12325
+ }
12326
+ ) })
12327
+ }
12328
+ ),
12329
+ /* @__PURE__ */ jsx(
12330
+ DialogContent,
12331
+ {
12332
+ style: { alignItems: "center", textAlign: "center" },
12333
+ children: previewUrl && /* @__PURE__ */ jsx(
12334
+ "img",
12335
+ {
12336
+ src: previewUrl,
12337
+ alt: "Preview",
12338
+ className: styles.dialogImage
12339
+ }
12340
+ )
12341
+ }
12342
+ )
12343
+ ] })
12344
+ }
12345
+ )
12346
+ }
12347
+ )
12348
+ ]
12349
+ }
12350
+ );
12351
+ }
12352
+ }
12353
+ );
12354
+ }
12355
+ );
12356
+ FileUpload.displayName = "FileUpload";
12357
+ var FileUpload_default = FileUpload;
12358
+
12359
+ // src/components/CardProfileMenu/CardProfileMenu.constants.ts
12360
+ var DEFAULT_LABELS39 = {
11718
12361
  id: {},
11719
12362
  en: {}
11720
12363
  };
@@ -11777,7 +12420,7 @@ var CardProfileMenu = ({
11777
12420
  onTabSelect
11778
12421
  }) => {
11779
12422
  const styles = useStyles39();
11780
- ({ ...DEFAULT_LABELS38[language], ...labels });
12423
+ ({ ...DEFAULT_LABELS39[language], ...labels });
11781
12424
  const handleTabSelect = (_, data) => {
11782
12425
  onTabSelect(data.value);
11783
12426
  };
@@ -11806,6 +12449,6 @@ var CardProfileMenu = ({
11806
12449
  ) });
11807
12450
  };
11808
12451
 
11809
- export { 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_CLASSES, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS17 as DateFilterDefaultLabels, InputDynamic_default as InputDynamic, MODAL_PRESETS, ModalFilterTicket, DEFAULT_LABELS16 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListPassenger, ModalPassengerForm, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, SortMenu, Stepper, getBadgeConfig, getModalPreset, getSortLabel };
12452
+ export { 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_CLASSES, DEFAULT_SERVICE_TYPES, DEFAULT_SORT_OPTIONS, DEFAULT_TIME_SLOTS, DEFAULT_VEHICLE_ICONS, DateFilter, DEFAULT_LABELS17 as DateFilterDefaultLabels, FileUpload_default as FileUpload, InputDynamic_default as InputDynamic, MODAL_PRESETS, ModalFilterTicket, DEFAULT_LABELS16 as ModalFilterTicketDefaultLabels, ModalIllustration, ModalListPassenger, ModalPassengerForm, ModalPriceDetail, ModalSearchHarbor, ModalSearchTicket, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, SortMenu, Stepper, getBadgeConfig, getModalPreset, getSortLabel };
11810
12453
  //# sourceMappingURL=index.mjs.map
11811
12454
  //# sourceMappingURL=index.mjs.map