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