@evolve.ui/core-components 1.0.0 → 1.1.0
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/Checkbox.d.cts +1 -1
- package/Checkbox.d.mts +1 -1
- package/{DateInput-B8XQZPTx.d.cts → DateInput-CFxTZu3m.d.mts} +2 -2
- package/{DateInput-B8XQZPTx.d.cts.map → DateInput-CFxTZu3m.d.mts.map} +1 -1
- package/{DateInput-CfNmywqQ.d.mts → DateInput-DstMICTl.d.cts} +2 -2
- package/{DateInput-CfNmywqQ.d.mts.map → DateInput-DstMICTl.d.cts.map} +1 -1
- package/{FavoriteButton-CowOPoqo.d.cts → FavoriteButton-BGF-3dze.d.cts} +2 -2
- package/{FavoriteButton-BRY8FVpV.d.mts.map → FavoriteButton-BGF-3dze.d.cts.map} +1 -1
- package/{FavoriteButton-BRY8FVpV.d.mts → FavoriteButton-BZEGWrRo.d.mts} +2 -2
- package/{FavoriteButton-CowOPoqo.d.cts.map → FavoriteButton-BZEGWrRo.d.mts.map} +1 -1
- package/Input.d.cts +1 -1
- package/Input.d.mts +1 -1
- package/Radio.d.cts +1 -1
- package/Radio.d.mts +1 -1
- package/{TextInput-BhkeQZh4.d.cts → TextInput-B7lqQ1gh.d.cts} +3 -3
- package/{TextInput-BhkeQZh4.d.cts.map → TextInput-B7lqQ1gh.d.cts.map} +1 -1
- package/{TextInput-CWCeR18b.d.mts → TextInput-CxoT3np_.d.mts} +3 -3
- package/{TextInput-CWCeR18b.d.mts.map → TextInput-CxoT3np_.d.mts.map} +1 -1
- package/dateInput.d.cts +1 -1
- package/dateInput.d.mts +1 -1
- package/datePicker.d.cts +1 -1
- package/datePicker.d.mts +1 -1
- package/evolve-ui.entries.json +556 -0
- package/favoriteButton.d.cts +1 -1
- package/favoriteButton.d.mts +1 -1
- package/featureFlags/hooks.d.cts +1 -1
- package/featureFlags/hooks.d.mts +1 -1
- package/fileUpload/testUtils/mockFilesAndImages.d.cts +3 -3
- package/fileUpload/testUtils/mockFilesAndImages.d.cts.map +1 -1
- package/fileUpload/testUtils/mockFilesAndImages.d.mts +3 -3
- package/fileUpload/testUtils/mockFilesAndImages.d.mts.map +1 -1
- package/fileUpload/testUtils/testUtils.d.cts +1 -1
- package/fileUpload/testUtils/testUtils.d.cts.map +1 -1
- package/fileUpload/testUtils/testUtils.d.mts +1 -1
- package/fileUpload/testUtils/testUtils.d.mts.map +1 -1
- package/{index-BVb-FJDo.d.mts → index-BYPklw8m.d.mts} +2 -2
- package/{index-BVb-FJDo.d.mts.map → index-BYPklw8m.d.mts.map} +1 -1
- package/{index-3V0Y3AU3.d.mts → index-Bvn6svaT.d.cts} +2 -2
- package/{index-3V0Y3AU3.d.mts.map → index-Bvn6svaT.d.cts.map} +1 -1
- package/{index-Bu7c6X7O.d.mts → index-C2zPeUs9.d.mts} +5 -5
- package/{index-Bu7c6X7O.d.mts.map → index-C2zPeUs9.d.mts.map} +1 -1
- package/{index-BXz3rMMk.d.cts → index-Cmz2OD6x.d.cts} +2 -2
- package/{index-BXz3rMMk.d.cts.map → index-Cmz2OD6x.d.cts.map} +1 -1
- package/{index-kchg551L.d.cts → index-DsZAxqnF.d.mts} +2 -2
- package/{index-kchg551L.d.cts.map → index-DsZAxqnF.d.mts.map} +1 -1
- package/{index-BzN9RaXe.d.cts → index-QtMvgJcp.d.cts} +5 -5
- package/{index-BzN9RaXe.d.cts.map → index-QtMvgJcp.d.cts.map} +1 -1
- package/{index-dpfLYhgI.d.mts → index-hrztez-b.d.mts} +2 -2
- package/{index-DBYqF9Sr.d.cts.map → index-hrztez-b.d.mts.map} +1 -1
- package/{index-DBYqF9Sr.d.cts → index-o9dwzLLE.d.cts} +2 -2
- package/{index-dpfLYhgI.d.mts.map → index-o9dwzLLE.d.cts.map} +1 -1
- package/index.d.cts +7 -7
- package/index.d.mts +7 -7
- package/package.json +2 -2
- package/providers.d.cts +1 -1
- package/providers.d.mts +1 -1
- package/src/Accordion/Accordion.tsx +233 -0
- package/src/AddressDisplay/AddressDisplay.tsx +43 -0
- package/src/AddressDisplay/components/addressComponents.tsx +111 -0
- package/src/AddressDisplay/components/addressField.tsx +25 -0
- package/src/AddressDisplay/components/addressSection.tsx +8 -0
- package/src/AddressDisplay/components/getCountryValue.tsx +31 -0
- package/src/AddressDisplay/types.ts +26 -0
- package/src/AutomatedCarousel/AutomatedCarousel.tsx +163 -0
- package/src/AutomatedCarousel/automatedCarousel.types.ts +7 -0
- package/src/AutomatedCarousel/components/CarouselProgressBar/CarouselProgressBar.tsx +139 -0
- package/src/AutomatedCarousel/components/CarouselProgressBar/components/CarouselProgressBarUnit/CarouselProgressBarUnit.tsx +165 -0
- package/src/Badge/Badge.tsx +104 -0
- package/src/Badge/Badge.types.ts +58 -0
- package/src/Badge/ItemBadge.tsx +97 -0
- package/src/Badge/LiveStatusBadge.tsx +93 -0
- package/src/BannerNotification/BannerNotification.tsx +157 -0
- package/src/BannerNotification/components/BannerNotificationSkeleton.tsx +39 -0
- package/src/BannerNotification/components/CalloutIcon/BannerIcon.tsx +48 -0
- package/src/BannerNotification/utils/getRandomTooltipId.ts +3 -0
- package/src/BottomSheet/BottomSheet.tsx +476 -0
- package/src/BottomSheet/components/BottomSheetBackdrop/BottomSheetBackdrop.tsx +47 -0
- package/src/BottomSheet/components/BottomSheetContentArea/BottomSheetContentArea.tsx +92 -0
- package/src/BottomSheet/components/BottomSheetOverlay/BottomSheetOverlayTranslate3d.tsx +196 -0
- package/src/BottomSheet/components/SheetDescription/SheetDescription.tsx +22 -0
- package/src/BottomSheet/components/SheetTitle/SheetTitle.tsx +21 -0
- package/src/BottomSheet/components/index.tsx +5 -0
- package/src/BottomSheet/hooks/index.tsx +13 -0
- package/src/BottomSheet/hooks/useAriaHider.tsx +91 -0
- package/src/BottomSheet/hooks/useBottomSheetServices.tsx +224 -0
- package/src/BottomSheet/hooks/useDragHandler.tsx +282 -0
- package/src/BottomSheet/hooks/useFocusTrap.tsx +113 -0
- package/src/BottomSheet/hooks/useLayoutEffect.tsx +4 -0
- package/src/BottomSheet/hooks/useOptimizedResizeObserver.tsx +94 -0
- package/src/BottomSheet/hooks/useOptimizedScrollState.tsx +87 -0
- package/src/BottomSheet/hooks/useReady.tsx +34 -0
- package/src/BottomSheet/hooks/useReducedMotion.tsx +22 -0
- package/src/BottomSheet/hooks/useScrollLock.tsx +143 -0
- package/src/BottomSheet/hooks/useSnapPoints.tsx +355 -0
- package/src/BottomSheet/hooks/useSpring.tsx +47 -0
- package/src/BottomSheet/hooks/useSpringInterpolationsTranslate3d.tsx +101 -0
- package/src/BottomSheet/index.tsx +237 -0
- package/src/BottomSheet/state/atoms.ts +147 -0
- package/src/BottomSheet/state/useBottomSheetStateMachine.ts +246 -0
- package/src/BottomSheet/types.ts +172 -0
- package/src/BottomSheet/utils.ts +65 -0
- package/src/Breadcrumbs/Breadcrumbs.tsx +126 -0
- package/src/Button/Button.tsx +164 -0
- package/src/Button/Button.types.ts +80 -0
- package/src/Button/buttonColorClasses.ts +53 -0
- package/src/Callout/Callout.tsx +136 -0
- package/src/Callout/Callout.types.ts +29 -0
- package/src/Callout/components/CalloutIcon/CalloutIcon.tsx +56 -0
- package/src/Card/CardGrid.tsx +263 -0
- package/src/Card/SingleCard.tsx +22 -0
- package/src/Card/cardFactory.tsx +176 -0
- package/src/Card/components/createBadge.tsx +34 -0
- package/src/Card/components/createFavoriteButton.tsx +40 -0
- package/src/Card/components/createImage.tsx +64 -0
- package/src/Card/components/createInfo.tsx +84 -0
- package/src/Card/components/createName.tsx +63 -0
- package/src/Card/components/createPriceStatus.tsx +100 -0
- package/src/Card/components/types.ts +4 -0
- package/src/Card/hooks/useCardVisibilityTracking.ts +82 -0
- package/src/Card/sharedProps.ts +12 -0
- package/src/Card/types.ts +62 -0
- package/src/Carousel/Carousel.tsx +513 -0
- package/src/Carousel/Carousel.types.ts +43 -0
- package/src/Carousel/Carousel.utils.ts +63 -0
- package/src/Carousel/components/DotButton/DotButton.tsx +42 -0
- package/src/Carousel/components/NavigationButtons/NavigationButtons.tsx +77 -0
- package/src/Carousel/components/TitleSection/TitleSection.tsx +61 -0
- package/src/Carousel/components/TitleSection/components/SubHeaderLeft/SubHeaderLeft.tsx +53 -0
- package/src/Carousel/components/TitleSection/components/Title/Title.tsx +46 -0
- package/src/Carousel/index.ts +2 -0
- package/src/Carousel/testUtils.ts +10 -0
- package/src/Chips/Chip.tsx +153 -0
- package/src/Chips/ChipGroup.tsx +173 -0
- package/src/Chips/SuggestionChip.tsx +15 -0
- package/src/Chips/chipTypes.ts +113 -0
- package/src/Chips/index.ts +4 -0
- package/src/ChoiceListItem/Checkbox.tsx +69 -0
- package/src/ChoiceListItem/Radio.tsx +61 -0
- package/src/ChoiceListItem/choiceListItem.tsx +99 -0
- package/src/ChoiceListItem/common.tsx +148 -0
- package/src/ChoiceListItem/index.ts +3 -0
- package/src/Collapsible/Collapsible.tsx +58 -0
- package/src/Confetti/Confetti.tsx +270 -0
- package/src/Confetti/index.ts +2 -0
- package/src/ContentPager/ContentPager.tsx +189 -0
- package/src/ContentPager/components/Page.tsx +24 -0
- package/src/CookieConsent/components/CookieCategoryRow/CookieCategoryRow.tsx +30 -0
- package/src/CookieConsent/components/CookieConsent/CookieConsent.tsx +74 -0
- package/src/CookieConsent/components/CookieConsentBanner/CookieConsentBanner.tsx +51 -0
- package/src/CookieConsent/components/CookieConsentModal/CookieConsentModal.tsx +64 -0
- package/src/CookieConsent/hooks/useCookieConsent.ts +170 -0
- package/src/CookieConsent/hooks/useCookieConsentState.ts +142 -0
- package/src/CookieConsent/index.ts +16 -0
- package/src/CookieConsent/types/cookieConsent.types.ts +79 -0
- package/src/CookieConsent/types/index.ts +7 -0
- package/src/Countdown/Countdown.tsx +161 -0
- package/src/Countdown/Countdown.types.ts +4 -0
- package/src/Countdown/hooks/useGetCountdown.ts +103 -0
- package/src/DateTimeInput/dateInput/DateInput.tsx +199 -0
- package/src/DateTimeInput/datePicker/DatePicker.tsx +138 -0
- package/src/DateTimeInput/datePicker/components/calendar/Calendar.tsx +72 -0
- package/src/DateTimeInput/datePicker/index.ts +2 -0
- package/src/DateTimeInput/timeInput/TimeInput.tsx +128 -0
- package/src/DateTimeInput/timePicker/TimePicker.tsx +118 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/AmPmSwitch.tsx +103 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimeFieldInput.tsx +26 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopover.tsx +84 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopover.utils.ts +67 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopoverActions.tsx +26 -0
- package/src/DateTimeInput/timePicker/index.ts +2 -0
- package/src/DateTimeInput/utils/getDisplayDate.ts +15 -0
- package/src/DateTimeInput/utils/getDisplayTime.ts +15 -0
- package/src/DateTimeInput/utils/index.ts +2 -0
- package/src/DateTimeInput/utils/parseTimeValue.ts +54 -0
- package/src/Drawer/Drawer.tsx +446 -0
- package/src/Drawer/atoms.ts +4 -0
- package/src/Drawer/components/DialogActions/DialogActions.tsx +33 -0
- package/src/Drawer/components/DialogContent/DialogContent.tsx +80 -0
- package/src/Drawer/components/DialogHeader/DialogHeader.tsx +68 -0
- package/src/EducationalPopover/EducationalPopover.tsx +174 -0
- package/src/FavoriteButton/FavoriteButton.tsx +64 -0
- package/src/FavoriteButton/components/IconOnlyFavoriteButton/IconOnlyFavoriteButton.tsx +80 -0
- package/src/FavoriteButton/components/LabeledAnimatedFavoriteButton/LabeledAnimatedFavoriteButton.tsx +179 -0
- package/src/FavoriteButton/components/LabeledFavoriteButton/LabeledFavoriteButton.tsx +71 -0
- package/src/FavoriteButton/components/SmallHeartStraightIcon/SmallHeartStraightIcon.tsx +14 -0
- package/src/FavoriteButton/hooks/useFavoriteButtonState.ts +30 -0
- package/src/FavoriteButton/index.ts +2 -0
- package/src/FavoriteButton/types/favoriteButton.ts +87 -0
- package/src/FeatureFlags/devTools/FeatureFlagDevToolsUI.tsx +226 -0
- package/src/FeatureFlags/devTools/getFeatureFlagCookieOverrides.ts +30 -0
- package/src/FeatureFlags/devTools/utils/cookies.ts +169 -0
- package/src/FeatureFlags/hooks/index.ts +2 -0
- package/src/FeatureFlags/hooks/useFeatureFlag.tsx +19 -0
- package/src/FeatureFlags/hooks/useFeatureFlags.tsx +15 -0
- package/src/FileUpload/components/FileCard/FileCard.tsx +50 -0
- package/src/FileUpload/components/FileDropzone/FileDropzone.tsx +221 -0
- package/src/FileUpload/components/FileDropzone/components/DropzoneContent/DropzoneContent.tsx +28 -0
- package/src/FileUpload/components/FileDropzone/components/DropzoneContent/DropzoneText.tsx +81 -0
- package/src/FileUpload/components/FileDropzone/components/FileDropzoneDebugger/FileDropzoneDebugger.tsx +40 -0
- package/src/FileUpload/components/FileDropzone/components/FileDropzoneDebugger/FileRejectionsDisplay.tsx +110 -0
- package/src/FileUpload/components/FileDropzoneOverlay/FileDropzoneOverlay.tsx +183 -0
- package/src/FileUpload/components/FileDropzoneOverlay/components/OverlayDropzoneContent.tsx +146 -0
- package/src/FileUpload/components/FileDropzoneOverlay/components/OverlayDropzoneDragText.tsx +42 -0
- package/src/FileUpload/components/FileDropzoneOverlay/styles.ts +79 -0
- package/src/FileUpload/components/FilePreviewList/FilePreviewList.tsx +251 -0
- package/src/FileUpload/components/FilePreviewList/virtualizerComponents/FilePreviewVirtualizedList/FilePreviewVirtualizedList.tsx +88 -0
- package/src/FileUpload/components/FileUpload/FileUpload.tsx +63 -0
- package/src/FileUpload/components/FileUploadCanvas/FileUploadCanvas.tsx +125 -0
- package/src/FileUpload/components/GridFileCard/GridFileCard.tsx +364 -0
- package/src/FileUpload/components/GridFileCard/utils/sortable.ts +48 -0
- package/src/FileUpload/components/ListFileCard/ListFileCard.tsx +259 -0
- package/src/FileUpload/components/types.ts +78 -0
- package/src/FileUpload/hooks/filePreview/useImageFilePreviewUrl.ts +62 -0
- package/src/FileUpload/hooks/index.ts +11 -0
- package/src/FileUpload/hooks/upload/useHandleDragEnter/useHandleDragEnter.ts +154 -0
- package/src/FileUpload/hooks/upload/useHandleDrop/createFileRejectionHelpers.ts +273 -0
- package/src/FileUpload/hooks/upload/useHandleDrop/useHandleDrop.ts +153 -0
- package/src/FileUpload/hooks/upload/useUploadAvailability/useUploadAvailability.ts +44 -0
- package/src/FileUpload/hooks/validation/createDropzoneValidator.ts +41 -0
- package/src/FileUpload/hooks/validation/useFileValidation.ts +25 -0
- package/src/FileUpload/hooks/validation/useFileValidationLogic.ts +107 -0
- package/src/FileUpload/hooks/validation/useValidationMessages.ts +92 -0
- package/src/FileUpload/hooks/validation/useValidationState.ts +171 -0
- package/src/FileUpload/index.ts +57 -0
- package/src/FileUpload/providers/FileUploadProvider.tsx +219 -0
- package/src/FileUpload/providers/UploadValidationProvider.tsx +159 -0
- package/src/FileUpload/testUtils/mockFilesAndImages.ts +64 -0
- package/src/FileUpload/testUtils/testUtils.ts +111 -0
- package/src/FileUpload/types/commonTypes.ts +267 -0
- package/src/FileUpload/types/index.ts +31 -0
- package/src/FileUpload/types/sharedTypes.ts +159 -0
- package/src/FileUpload/utils/constants.ts +79 -0
- package/src/FileUpload/utils/createMessageContext.ts +180 -0
- package/src/FileUpload/utils/getFileExtensionsFromAcceptedTypes.ts +73 -0
- package/src/FileUpload/utils/getFilePluralizationText.ts +68 -0
- package/src/FileUpload/utils/getMimeTypes.ts +26 -0
- package/src/FileUpload/utils/messageUtils.ts +41 -0
- package/src/FileUpload/utils/styles.ts +68 -0
- package/src/FormLabel/FormLabel.tsx +212 -0
- package/src/IconButton/IconButton.tsx +154 -0
- package/src/Icons/CreditCardIcon/CreditCardIcon.tsx +73 -0
- package/src/Icons/CreditCardIcon/cardIcons.tsx +270 -0
- package/src/Icons/IconBase.tsx +133 -0
- package/src/Icons/anyIcon.ts +3 -0
- package/src/Icons/generatedIcons/Archive.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowClockwise.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowDown.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowLeft.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowRight.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowSquareOut.tsx +51 -0
- package/src/Icons/generatedIcons/ArrowSquareRight.tsx +51 -0
- package/src/Icons/generatedIcons/ArrowUp.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsCounterClockwise.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsLeftRight.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsOutCardinal.tsx +48 -0
- package/src/Icons/generatedIcons/Bank.tsx +48 -0
- package/src/Icons/generatedIcons/Bell.tsx +51 -0
- package/src/Icons/generatedIcons/BookBookmark.tsx +51 -0
- package/src/Icons/generatedIcons/BookmarksSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Broadcast.tsx +48 -0
- package/src/Icons/generatedIcons/CalendarBlank.tsx +48 -0
- package/src/Icons/generatedIcons/CalendarStar.tsx +51 -0
- package/src/Icons/generatedIcons/Camera.tsx +51 -0
- package/src/Icons/generatedIcons/CaretDown.tsx +48 -0
- package/src/Icons/generatedIcons/CaretLeft.tsx +48 -0
- package/src/Icons/generatedIcons/CaretRight.tsx +48 -0
- package/src/Icons/generatedIcons/CaretUp.tsx +48 -0
- package/src/Icons/generatedIcons/Certificate.tsx +51 -0
- package/src/Icons/generatedIcons/ChartBar.tsx +48 -0
- package/src/Icons/generatedIcons/Check.tsx +51 -0
- package/src/Icons/generatedIcons/CheckCircle.tsx +48 -0
- package/src/Icons/generatedIcons/CirclesFour.tsx +51 -0
- package/src/Icons/generatedIcons/Clock.tsx +48 -0
- package/src/Icons/generatedIcons/ClockCountdown.tsx +48 -0
- package/src/Icons/generatedIcons/Close.tsx +51 -0
- package/src/Icons/generatedIcons/CloudArrowUp.tsx +51 -0
- package/src/Icons/generatedIcons/CloudWarning.tsx +51 -0
- package/src/Icons/generatedIcons/Code.tsx +48 -0
- package/src/Icons/generatedIcons/Compass.tsx +51 -0
- package/src/Icons/generatedIcons/Confetti.tsx +51 -0
- package/src/Icons/generatedIcons/Copy.tsx +48 -0
- package/src/Icons/generatedIcons/CornersOut.tsx +48 -0
- package/src/Icons/generatedIcons/CreditCard.tsx +48 -0
- package/src/Icons/generatedIcons/Crown.tsx +51 -0
- package/src/Icons/generatedIcons/CrownSimple.tsx +51 -0
- package/src/Icons/generatedIcons/CurrencyCircleDollar.tsx +48 -0
- package/src/Icons/generatedIcons/CurrencyDollarSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Desktop.tsx +51 -0
- package/src/Icons/generatedIcons/Detective.tsx +51 -0
- package/src/Icons/generatedIcons/DotOutline.tsx +46 -0
- package/src/Icons/generatedIcons/DotsSixVertical.tsx +51 -0
- package/src/Icons/generatedIcons/DotsThreeOutline.tsx +51 -0
- package/src/Icons/generatedIcons/DotsThreeOutlineVertical.tsx +51 -0
- package/src/Icons/generatedIcons/DownloadSimple.tsx +51 -0
- package/src/Icons/generatedIcons/EnvelopeSimple.tsx +48 -0
- package/src/Icons/generatedIcons/Eraser.tsx +51 -0
- package/src/Icons/generatedIcons/Eye.tsx +51 -0
- package/src/Icons/generatedIcons/EyeSlash.tsx +51 -0
- package/src/Icons/generatedIcons/FacebookLogo.tsx +48 -0
- package/src/Icons/generatedIcons/FileArchive.tsx +48 -0
- package/src/Icons/generatedIcons/FileArrowDown.tsx +48 -0
- package/src/Icons/generatedIcons/FileCsv.tsx +48 -0
- package/src/Icons/generatedIcons/FilePdf.tsx +48 -0
- package/src/Icons/generatedIcons/FileText.tsx +48 -0
- package/src/Icons/generatedIcons/Files.tsx +51 -0
- package/src/Icons/generatedIcons/Fire.tsx +51 -0
- package/src/Icons/generatedIcons/Flag.tsx +51 -0
- package/src/Icons/generatedIcons/FlagBannerFold.tsx +48 -0
- package/src/Icons/generatedIcons/FloppyDisk.tsx +51 -0
- package/src/Icons/generatedIcons/Gauge.tsx +51 -0
- package/src/Icons/generatedIcons/Gavel.tsx +51 -0
- package/src/Icons/generatedIcons/Gear.tsx +51 -0
- package/src/Icons/generatedIcons/GlobeHemisphereWest.tsx +51 -0
- package/src/Icons/generatedIcons/GoogleLogo.tsx +48 -0
- package/src/Icons/generatedIcons/GridNine.tsx +51 -0
- package/src/Icons/generatedIcons/HandCoins.tsx +51 -0
- package/src/Icons/generatedIcons/HandbagSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Headset.tsx +51 -0
- package/src/Icons/generatedIcons/HeartStraight.tsx +51 -0
- package/src/Icons/generatedIcons/HourglassLow.tsx +48 -0
- package/src/Icons/generatedIcons/House.tsx +51 -0
- package/src/Icons/generatedIcons/Image.tsx +51 -0
- package/src/Icons/generatedIcons/ImageSquare.tsx +51 -0
- package/src/Icons/generatedIcons/ImagesSquare.tsx +51 -0
- package/src/Icons/generatedIcons/Info.tsx +48 -0
- package/src/Icons/generatedIcons/InstagramLogo.tsx +51 -0
- package/src/Icons/generatedIcons/Lightning.tsx +48 -0
- package/src/Icons/generatedIcons/Link.tsx +51 -0
- package/src/Icons/generatedIcons/LinkedinLogo.tsx +51 -0
- package/src/Icons/generatedIcons/List.tsx +48 -0
- package/src/Icons/generatedIcons/Lock.tsx +51 -0
- package/src/Icons/generatedIcons/LockOpen.tsx +51 -0
- package/src/Icons/generatedIcons/MagnifyingGlass.tsx +48 -0
- package/src/Icons/generatedIcons/MapPin.tsx +51 -0
- package/src/Icons/generatedIcons/MapPinSimpleArea.tsx +48 -0
- package/src/Icons/generatedIcons/Medal.tsx +48 -0
- package/src/Icons/generatedIcons/Megaphone.tsx +48 -0
- package/src/Icons/generatedIcons/Minus.tsx +45 -0
- package/src/Icons/generatedIcons/Money.tsx +51 -0
- package/src/Icons/generatedIcons/Notches.tsx +48 -0
- package/src/Icons/generatedIcons/NotePencil.tsx +48 -0
- package/src/Icons/generatedIcons/Package.tsx +51 -0
- package/src/Icons/generatedIcons/PaintBrush.tsx +51 -0
- package/src/Icons/generatedIcons/PaperPlaneTilt.tsx +51 -0
- package/src/Icons/generatedIcons/Paperclip.tsx +51 -0
- package/src/Icons/generatedIcons/Pause.tsx +51 -0
- package/src/Icons/generatedIcons/PencilLine.tsx +51 -0
- package/src/Icons/generatedIcons/PencilRuler.tsx +51 -0
- package/src/Icons/generatedIcons/PencilSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Phone.tsx +51 -0
- package/src/Icons/generatedIcons/PinterestLogo.tsx +51 -0
- package/src/Icons/generatedIcons/Play.tsx +51 -0
- package/src/Icons/generatedIcons/Plus.tsx +51 -0
- package/src/Icons/generatedIcons/PlusCircle.tsx +48 -0
- package/src/Icons/generatedIcons/Printer.tsx +51 -0
- package/src/Icons/generatedIcons/Question.tsx +48 -0
- package/src/Icons/generatedIcons/Receipt.tsx +51 -0
- package/src/Icons/generatedIcons/Rows.tsx +51 -0
- package/src/Icons/generatedIcons/SealCheck.tsx +51 -0
- package/src/Icons/generatedIcons/SelectionSlash.tsx +48 -0
- package/src/Icons/generatedIcons/ShareNetwork.tsx +51 -0
- package/src/Icons/generatedIcons/ShieldCheck.tsx +51 -0
- package/src/Icons/generatedIcons/ShieldStar.tsx +51 -0
- package/src/Icons/generatedIcons/ShoppingCart.tsx +48 -0
- package/src/Icons/generatedIcons/ShuffleAngular.tsx +48 -0
- package/src/Icons/generatedIcons/SidebarSimple.tsx +48 -0
- package/src/Icons/generatedIcons/SlidersHorizontal.tsx +51 -0
- package/src/Icons/generatedIcons/Smiley.tsx +48 -0
- package/src/Icons/generatedIcons/Sparkle.tsx +51 -0
- package/src/Icons/generatedIcons/SpinnerGap.tsx +48 -0
- package/src/Icons/generatedIcons/StackPlus.tsx +48 -0
- package/src/Icons/generatedIcons/Star.tsx +51 -0
- package/src/Icons/generatedIcons/Storefront.tsx +51 -0
- package/src/Icons/generatedIcons/Swap.tsx +51 -0
- package/src/Icons/generatedIcons/Tag.tsx +51 -0
- package/src/Icons/generatedIcons/ThumbsDown.tsx +48 -0
- package/src/Icons/generatedIcons/ThumbsUp.tsx +48 -0
- package/src/Icons/generatedIcons/Toolbox.tsx +48 -0
- package/src/Icons/generatedIcons/Trash.tsx +48 -0
- package/src/Icons/generatedIcons/TrendUp.tsx +48 -0
- package/src/Icons/generatedIcons/Trophy.tsx +51 -0
- package/src/Icons/generatedIcons/Truck.tsx +51 -0
- package/src/Icons/generatedIcons/UploadSimple.tsx +51 -0
- package/src/Icons/generatedIcons/User.tsx +48 -0
- package/src/Icons/generatedIcons/Users.tsx +48 -0
- package/src/Icons/generatedIcons/UsersThree.tsx +51 -0
- package/src/Icons/generatedIcons/VideoCamera.tsx +51 -0
- package/src/Icons/generatedIcons/Warning.tsx +51 -0
- package/src/Icons/generatedIcons/WarningCircle.tsx +48 -0
- package/src/Icons/generatedIcons/WifiHigh.tsx +51 -0
- package/src/Icons/generatedIcons/XCircle.tsx +48 -0
- package/src/Icons/generatedIcons/XLogo.tsx +48 -0
- package/src/Icons/generatedIcons/YoutubeLogo.tsx +51 -0
- package/src/Icons/importedIcons.ts +152 -0
- package/src/Icons/index.ts +149 -0
- package/src/Icons/socialIcons/appleSocialIcon.tsx +50 -0
- package/src/Icons/socialIcons/facebookSocialIcon.tsx +41 -0
- package/src/Icons/socialIcons/googleSocialIcon.tsx +134 -0
- package/src/ImageCluster/ImageCluster.tsx +125 -0
- package/src/ImageSlider/ImageSlider.tsx +582 -0
- package/src/ImageSlider/ImageSlider.types.ts +90 -0
- package/src/ImageSlider/components/IndexIndicator/IndexIndicator.tsx +21 -0
- package/src/ImageSlider/components/NavigationButtons/NavigationButtons.tsx +113 -0
- package/src/ImageSlider/components/ResponsiveImage/ResponsiveImage.tsx +114 -0
- package/src/ImageSlider/components/ResponsiveImage/index.ts +1 -0
- package/src/ImageSlider/components/Thumbnails/Thumbnails.tsx +184 -0
- package/src/ImageSlider/constants.ts +59 -0
- package/src/ImageSlider/hooks/index.ts +3 -0
- package/src/ImageSlider/hooks/useImageSlider.ts +57 -0
- package/src/ImageSlider/hooks/useImageSliderNavigation.ts +133 -0
- package/src/ImageSlider/hooks/useImageSliderScrollHandler.ts +171 -0
- package/src/ImageSlider/index.ts +3 -0
- package/src/ImageSlider/utils/imageOptimization.ts +97 -0
- package/src/ImageSlider/utils/index.ts +1 -0
- package/src/InlineNotification/InlineNotification.tsx +95 -0
- package/src/JumpMenu/JumpMenu.tsx +395 -0
- package/src/JumpMenu/components/JumpMenuItem/JumpMenuItem.tsx +62 -0
- package/src/JumpMenu/hooks/useContainerTracking.ts +171 -0
- package/src/JumpMenu/hooks/useIntersectionObserver.ts +77 -0
- package/src/JumpMenu/hooks/useKeyboardNavigation.ts +102 -0
- package/src/JumpMenu/hooks/useResizeObserver.ts +53 -0
- package/src/JumpMenu/hooks/useSectionObserver.ts +102 -0
- package/src/JumpMenu/index.ts +2 -0
- package/src/JumpMenu/types/index.ts +19 -0
- package/src/Loading/Loading.tsx +39 -0
- package/src/Loading/components/LoadingDot/LoadingDot.tsx +16 -0
- package/src/LoadingSpinner/LoadingSpinner.tsx +20 -0
- package/src/Menu/Menu.tsx +372 -0
- package/src/Menu/components/MenuDivider/MenuDivider.tsx +5 -0
- package/src/Menu/components/MenuItem/MenuItem.tsx +298 -0
- package/src/Menu/context/menuContext.tsx +20 -0
- package/src/Menu/hooks/useMenu.tsx +18 -0
- package/src/Menu/index.ts +3 -0
- package/src/Modal/ComposableModal.tsx +313 -0
- package/src/Modal/Modal.tsx +231 -0
- package/src/Modal/components/BackButton/BackButton.tsx +43 -0
- package/src/Modal/components/Backdrop/Backdrop.tsx +62 -0
- package/src/Modal/components/CloseButton/CloseButton.tsx +55 -0
- package/src/Modal/components/ModalActions/ModalActions.tsx +135 -0
- package/src/Modal/components/ModalContent/ModalContent.tsx +163 -0
- package/src/Modal/components/ModalHeader/ModalHeader.tsx +84 -0
- package/src/Modal/components/ModalHeader/hooks/useHeaderAnimation.tsx +49 -0
- package/src/Modal/components/ModalProgressSteps/ModalProgressSteps.tsx +26 -0
- package/src/Modal/components/ModalSubTitle/ModalSubTitle.tsx +29 -0
- package/src/Modal/components/ModalTitle/ModalTitle.tsx +22 -0
- package/src/Modal/components/PreventModalScroll/PreventModalScroll.tsx +106 -0
- package/src/Modal/components/index.ts +12 -0
- package/src/Modal/context.ts +33 -0
- package/src/Modal/hooks/useCloseModal.ts +133 -0
- package/src/NotificationBadge/NotificationBadge.tsx +34 -0
- package/src/Pagination/AdvancedPagination.tsx +48 -0
- package/src/Pagination/Pagination.tsx +216 -0
- package/src/Pagination/components/AdvancedPaginator/AdvancedPaginator.tsx +52 -0
- package/src/Pagination/components/AdvancedPaginator/components/PageSelect/PageSelect.tsx +43 -0
- package/src/Pagination/components/ItemCountDisplay/ItemCountDisplay.tsx +32 -0
- package/src/Pagination/components/ItemCountSelect/ItemCountSelect.tsx +33 -0
- package/src/Pagination/index.tsx +3 -0
- package/src/Pagination/paginationProvider.tsx +234 -0
- package/src/Pagination/utils.tsx +36 -0
- package/src/PhoneInput/PhoneInput.tsx +509 -0
- package/src/PhoneInput/useDropdownLogic.tsx +163 -0
- package/src/ProgressCircle/ProgressCircle.tsx +246 -0
- package/src/ProgressCircle/hooks/useProgressStatusTransitions.ts +49 -0
- package/src/ProgressCircle/utils/progressCircle.constants.ts +27 -0
- package/src/ProgressSteps/ProgressSteps.tsx +160 -0
- package/src/SaveConfetti/SaveConfetti.tsx +277 -0
- package/src/SaveConfetti/index.ts +2 -0
- package/src/SearchInput/SearchInput.tsx +236 -0
- package/src/SegmentedControl/SegmentedControl.tsx +111 -0
- package/src/SegmentedControl/SegmentedControlGroup.tsx +94 -0
- package/src/SegmentedControl/index.ts +4 -0
- package/src/Select/Select.tsx +154 -0
- package/src/Select/SelectAsync.tsx +13 -0
- package/src/Select/SelectAsyncCreatable.tsx +14 -0
- package/src/Select/SelectCreatable.tsx +12 -0
- package/src/Select/reexportedComponents.tsx +5 -0
- package/src/Select/selectComponents.tsx +306 -0
- package/src/Skeleton/Skeleton.tsx +13 -0
- package/src/SplitButton/SplitButton.tsx +298 -0
- package/src/SplitButton/SplitButtonTrigger.tsx +55 -0
- package/src/StarRating/StarRating.tsx +165 -0
- package/src/StarRating/components/StarComponent/StarComponent.tsx +44 -0
- package/src/Table/Table.tsx +474 -0
- package/src/Table/components/TableHeader/TableHeader.tsx +166 -0
- package/src/Table/components/TablePagination/TablePagination.tsx +18 -0
- package/src/Table/components/TablePagination/components/ItemCountDisplay/ItemCountDisplay.tsx +17 -0
- package/src/Table/components/TablePagination/components/ItemCountSelect/ItemCountSelect.tsx +31 -0
- package/src/Table/components/TablePagination/components/TablePaginator/TablePaginator.tsx +37 -0
- package/src/Table/components/TablePagination/components/TablePaginator/components/PageSelect/PageSelect.tsx +32 -0
- package/src/Table/components/TableRow/TableRows.tsx +147 -0
- package/src/Table/components/TableRow/components/TableRowCell/TableRowCell.tsx +49 -0
- package/src/Table/components/TableShadow/TableShadow.tsx +46 -0
- package/src/Table/index.ts +2 -0
- package/src/Table/sharedState.ts +30 -0
- package/src/Table/sharedStyles.ts +1 -0
- package/src/Table/types.ts +55 -0
- package/src/Tabs/Tabs.tsx +358 -0
- package/src/TextArea/TextArea.tsx +157 -0
- package/src/TextInput/TextInput.tsx +173 -0
- package/src/Toast/Toast.tsx +64 -0
- package/src/Toast/components/ToastContainer/ToastContainer.tsx +48 -0
- package/src/Toast/index.ts +2 -0
- package/src/Toast/types/role.ts +1 -0
- package/src/Toast/utils/getIcon.tsx +41 -0
- package/src/ToggleSwitch/ToggleSwitch.tsx +188 -0
- package/src/Tooltip/InfoIconTooltip.tsx +47 -0
- package/src/Tooltip/Tooltip.tsx +41 -0
- package/src/Typography/InlineButton/InlineButton.tsx +166 -0
- package/src/Typography/Links/Links.tsx +113 -0
- package/src/Typography/Text/Text.tsx +239 -0
- package/src/ViewMore/ViewMore.tsx +226 -0
- package/src/WebRTCPlayer/WebRTCPlayer.tsx +325 -0
- package/src/WebRTCPlayer/adaptor/NativeWebRTCAdaptor.ts +588 -0
- package/src/WebRTCPlayer/hooks/useWebRTCStream.ts +571 -0
- package/src/WebRTCPlayer/index.ts +22 -0
- package/src/WebRTCPlayer/types.ts +95 -0
- package/src/breakpoints/index.tsx +1 -0
- package/src/breakpoints/utils.tsx +50 -0
- package/src/declarations.d.ts +7 -0
- package/src/grid/gridHighlighter.tsx +83 -0
- package/src/grid/index.ts +3 -0
- package/src/grid/pageGrid.tsx +37 -0
- package/src/grid/useSubGridCSS.tsx +214 -0
- package/src/hooks/useHorizontalScrollFade.ts +44 -0
- package/src/hooks/usePrevious.ts +14 -0
- package/src/index.ts +351 -0
- package/src/intl/index.ts +4 -0
- package/src/intl/utils.ts +67 -0
- package/src/mixins/horizontalScrollFadeMixin.ts +56 -0
- package/src/mixins/index.ts +18 -0
- package/src/mixins/propMixins.ts +389 -0
- package/src/providers/createContextProvider.ts +22 -0
- package/src/providers/designSystemProvider.tsx +218 -0
- package/src/providers/errorBoundaryProvider.tsx +179 -0
- package/src/providers/featureFlagProvider.tsx +18 -0
- package/src/providers/gridSizeProvider.tsx +23 -0
- package/src/providers/index.ts +12 -0
- package/src/providers/linkProvider.tsx +32 -0
- package/src/providers/normalize.tsx +93 -0
- package/src/providers/targets/DatePickerTarget.tsx +10 -0
- package/src/providers/targets/ModalTarget.tsx +14 -0
- package/src/providers/targets/TimePickerTarget.tsx +10 -0
- package/src/providers/themeContext.tsx +24 -0
- package/src/providers/windowSizeProvider.tsx +125 -0
- package/src/spacing/index.ts +1 -0
- package/src/spacing/spacing.ts +11 -0
- package/src/utils/countriesWithISOCodes.ts +1419 -0
- package/src/utils/dateTimeFormat.ts +257 -0
- package/src/utils/effectEventListener.ts +11 -0
- package/src/utils/formatFileSize.ts +18 -0
- package/src/utils/isClientSide.ts +1 -0
- package/src/utils/keepTransition.ts +15 -0
- package/src/utils/nodeEnv.ts +9 -0
- package/src/utils/smoothScrollTo.ts +47 -0
- package/src/utils/utilityTypes.ts +13 -0
- package/textInput.d.cts +1 -1
- package/textInput.d.mts +1 -1
- package/timePicker.d.cts +1 -1
- package/timePicker.d.mts +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RemoteFile } from '../types';
|
|
2
|
+
import { createMixedFilesAndImageUrls, createMockFiles, createMockRemoteFileImages } from './testUtils';
|
|
3
|
+
|
|
4
|
+
//Basic document (.pdf) file
|
|
5
|
+
export const mockPdfFile = new File(['test content'], 'sample-document.pdf', { type: 'application/pdf' });
|
|
6
|
+
|
|
7
|
+
//Image URLs - Images from the contrast test to test darker images with card overlays
|
|
8
|
+
export const mockDarkBlueImageUrl: RemoteFile = {
|
|
9
|
+
name: '(dark)-deep-blue.jpg',
|
|
10
|
+
type: 'image/jpeg',
|
|
11
|
+
url: '/contrast-test-images/(dark)-deep-blue.jpg',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const mockColorfulImageUrl: RemoteFile = {
|
|
15
|
+
name: '(colorful)-flowers.jpg',
|
|
16
|
+
type: 'image/jpeg',
|
|
17
|
+
url: '/contrast-test-images/(colorful)-flowers.jpg',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const mockNeutralImageUrl: RemoteFile = {
|
|
21
|
+
name: '(neutral)-train-on-bridge.jpg',
|
|
22
|
+
type: 'image/jpeg',
|
|
23
|
+
url: '/contrast-test-images/(neutral)-train-on-bridge.jpg',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const mockFordMotorImageUrl: RemoteFile = {
|
|
27
|
+
name: 'ford-motor.webp',
|
|
28
|
+
type: 'image/webp',
|
|
29
|
+
url: '/contrast-test-images/ford-motor.webp',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Non-image files
|
|
33
|
+
export const mockNonImageFiles = [
|
|
34
|
+
new File(['test content'], 'document1.pdf', { type: 'application/pdf' }),
|
|
35
|
+
new File(['test content'], 'document2.pdf', { type: 'application/pdf' }),
|
|
36
|
+
new File(['test content'], 'document3.pdf', { type: 'application/pdf' }),
|
|
37
|
+
new File(['test content'], 'document4.pdf', { type: 'application/pdf' }),
|
|
38
|
+
new File(['test content'], 'spreadsheet.xlsx', {
|
|
39
|
+
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
40
|
+
}),
|
|
41
|
+
new File(['test content'], 'maliciousVirus.txt', { type: 'text/plain' }),
|
|
42
|
+
new File(['test content'], 'embarrassingBlackmailInfo.pdf', { type: 'application/pdf' }),
|
|
43
|
+
new File(['test content'], 'SuperSafeWebsite.html', { type: 'text/html' }),
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
//Files and image URLs
|
|
47
|
+
export const mockFilesAndImageUrls = [
|
|
48
|
+
new File(['test content'], 'tax-return.pdf', { type: 'application/pdf' }),
|
|
49
|
+
mockDarkBlueImageUrl,
|
|
50
|
+
mockColorfulImageUrl,
|
|
51
|
+
new File(['test content'], 'sample-invoice.pdf', { type: 'application/pdf' }),
|
|
52
|
+
mockNeutralImageUrl,
|
|
53
|
+
mockFordMotorImageUrl,
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
// Create mock data with the helper functions
|
|
57
|
+
export const mock10Files = createMockFiles(10);
|
|
58
|
+
export const mock500Files = createMockFiles(500);
|
|
59
|
+
|
|
60
|
+
export const mock10ImageUrls = createMockRemoteFileImages(10);
|
|
61
|
+
export const mock500ImageUrls = createMockRemoteFileImages(500);
|
|
62
|
+
|
|
63
|
+
export const mock20FilesAndImageUrls = createMixedFilesAndImageUrls(10, 10);
|
|
64
|
+
export const mock1kFilesAndImageUrls = createMixedFilesAndImageUrls(500, 500);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { RemoteFile } from '../types';
|
|
2
|
+
|
|
3
|
+
// Array of all available image files in the card and contrast-test-images directories
|
|
4
|
+
const availableImages = [
|
|
5
|
+
// Card images
|
|
6
|
+
'/card/arne_wahl.jpg',
|
|
7
|
+
'/card/arne_wahl_2.png',
|
|
8
|
+
'/card/art_deco.jpg',
|
|
9
|
+
'/card/art_deco_2.png',
|
|
10
|
+
'/card/donghia.jpg',
|
|
11
|
+
'/card/donghia_2.png',
|
|
12
|
+
'/card/maximilian.jpg',
|
|
13
|
+
'/card/maximilian_2.png',
|
|
14
|
+
'/card/milo.jpg',
|
|
15
|
+
'/card/milo_2.png',
|
|
16
|
+
'/card/modern.png',
|
|
17
|
+
'/card/modern_2.png',
|
|
18
|
+
'/card/scalamandre.jpg',
|
|
19
|
+
'/card/scalamandre_2.png',
|
|
20
|
+
'/card/scandinavian.jpg',
|
|
21
|
+
'/card/scandinavian_2.png',
|
|
22
|
+
'/card/schriever.jpg',
|
|
23
|
+
'/card/schriever_2.png',
|
|
24
|
+
'/card/walnut_full.jpg',
|
|
25
|
+
'/card/walnut_full_2.png',
|
|
26
|
+
// Contrast test images
|
|
27
|
+
'/contrast-test-images/(neutral)-train-on-bridge.jpg',
|
|
28
|
+
'/contrast-test-images/ford-motor.webp',
|
|
29
|
+
'/contrast-test-images/(colorful)-flowers.jpg',
|
|
30
|
+
'/contrast-test-images/(dark)-deep-blue.jpg',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
// Function to get a random image from the available images
|
|
34
|
+
export const getRandomImage = () => {
|
|
35
|
+
const randomIndex = Math.floor(Math.random() * availableImages.length);
|
|
36
|
+
return availableImages[randomIndex];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Function to create a RemoteFile object from an image URL
|
|
40
|
+
export const createRemoteFileFromUrl = (url: string, index?: number): RemoteFile => {
|
|
41
|
+
const urlPart = url.split('/').pop();
|
|
42
|
+
const filename = urlPart && urlPart.length > 0 ? urlPart : `image-${index ?? 0}`;
|
|
43
|
+
const extension = filename.split('.').pop()?.toLowerCase();
|
|
44
|
+
|
|
45
|
+
// Determine MIME type based on extension
|
|
46
|
+
let type = 'image/jpeg'; // default
|
|
47
|
+
if (extension === 'png') {
|
|
48
|
+
type = 'image/png';
|
|
49
|
+
}
|
|
50
|
+
if (extension === 'webp') {
|
|
51
|
+
type = 'image/webp';
|
|
52
|
+
}
|
|
53
|
+
if (extension === 'gif') {
|
|
54
|
+
type = 'image/gif';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
name: filename,
|
|
59
|
+
type,
|
|
60
|
+
url,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const createTestFile = (name: string, type: string, sizeInBytes = 1024): File => {
|
|
65
|
+
// Create content with the specified size
|
|
66
|
+
const content = Array(Math.ceil(sizeInBytes / 10))
|
|
67
|
+
.fill('test content')
|
|
68
|
+
.join('');
|
|
69
|
+
|
|
70
|
+
// Create the File object with basic properties
|
|
71
|
+
const file = new File([content], name, {
|
|
72
|
+
lastModified: Date.now(),
|
|
73
|
+
type,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Override the size property to match the requested size
|
|
77
|
+
// This is needed because the actual content might not match exactly
|
|
78
|
+
Object.defineProperty(file, 'size', { value: sizeInBytes });
|
|
79
|
+
|
|
80
|
+
return file;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Shuffle an array using Fisher-Yates algorithm
|
|
84
|
+
export const shuffleArray = <T>(array: T[]): T[] => {
|
|
85
|
+
const shuffled = [...array];
|
|
86
|
+
for (let i = shuffled.length - 1; i > 0; i--) {
|
|
87
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
88
|
+
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
|
89
|
+
}
|
|
90
|
+
return shuffled;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Helper functions to create mock data
|
|
94
|
+
export const createMockFiles = (count: number): File[] => {
|
|
95
|
+
return Array.from({ length: count }, (_, index) =>
|
|
96
|
+
createTestFile(`file-${index}.pdf`, 'application/pdf', 1024 * (index + 1))
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const createMockRemoteFileImages = (count: number): RemoteFile[] => {
|
|
101
|
+
return Array.from({ length: count }, (_, index) => {
|
|
102
|
+
const randomUrl = getRandomImage();
|
|
103
|
+
return createRemoteFileFromUrl(randomUrl, index);
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const createMixedFilesAndImageUrls = (fileCount: number, imageUrlCount: number) => {
|
|
108
|
+
const files = createMockFiles(fileCount);
|
|
109
|
+
const imageUrls = createMockRemoteFileImages(imageUrlCount);
|
|
110
|
+
return [...files, ...imageUrls];
|
|
111
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { type FileRejection as ReactDropzoneFileRejection } from 'react-dropzone';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Possible error codes for file validation failures - these are the codes that are used in the validation messages.
|
|
5
|
+
* These are the codes used by React-Dropzone under the hood.
|
|
6
|
+
* @typedef {string} FileErrorCode
|
|
7
|
+
* @property {'file-invalid-type'} - File type not accepted
|
|
8
|
+
* @property {'file-too-large'} - File exceeds size limit
|
|
9
|
+
* @property {'too-many-files'} - Exceeds maximum file count
|
|
10
|
+
* @property {string} CustomError - Custom error message
|
|
11
|
+
*/
|
|
12
|
+
export type FileErrorCode = 'file-invalid-type' | 'file-too-large' | 'too-many-files' | string;
|
|
13
|
+
|
|
14
|
+
export type RemoteFile = {
|
|
15
|
+
id?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// FileResource is used to represent a file or a remote file
|
|
22
|
+
export type FileResource = File | RemoteFile;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Generic type for messages that can be either a string or a function that returns a string based on context
|
|
26
|
+
* This allows for dynamic messages that can incorporate data from the current validation context.
|
|
27
|
+
*
|
|
28
|
+
* @template T - The context type that will be passed to the message function
|
|
29
|
+
* @example
|
|
30
|
+
* // Static message
|
|
31
|
+
* const staticMessage: ContextAwareMessage<DynamicMessageContext> = "File type not supported";
|
|
32
|
+
*
|
|
33
|
+
* // Dynamic message that uses context
|
|
34
|
+
* const dynamicMessage: ContextAwareMessage<DynamicMessageContext> =
|
|
35
|
+
* (context) => `File exceeds the ${context.formattedMaxSize} limit`;
|
|
36
|
+
*/
|
|
37
|
+
export type ContextAwareMessage<T> = string | ((context: T) => string) | undefined;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base context with common properties used by all message types
|
|
41
|
+
* Contains the shared information needed to generate validation messages
|
|
42
|
+
* for both drag and drop events.
|
|
43
|
+
*
|
|
44
|
+
* @property acceptedFileExtensions - Comma-separated list of accepted file extensions (e.g., '.jpg, .png')
|
|
45
|
+
* @property errorCode - The validation error code triggering this message
|
|
46
|
+
* @property fileCount - Number of files involved in the validation event
|
|
47
|
+
* @property filePluralizationText - Properly pluralized text for file type (e.g., "image" or "images")
|
|
48
|
+
* @property formattedMaxSize - Human-readable maximum file size (e.g., "5 MB")
|
|
49
|
+
* @property maxFiles - Maximum number of files allowed
|
|
50
|
+
* @property maxFilesPluralizationText - Properly pluralized text for max files (e.g., "file" or "files")
|
|
51
|
+
* @property maxSizeBytes - Maximum file size in bytes
|
|
52
|
+
*/
|
|
53
|
+
export type BaseDynamicMessageContext = {
|
|
54
|
+
acceptedFileExtensions?: string;
|
|
55
|
+
errorCode: string;
|
|
56
|
+
fileCount?: number;
|
|
57
|
+
filePluralizationText?: string;
|
|
58
|
+
formattedMaxSize?: string;
|
|
59
|
+
maxFiles?: number;
|
|
60
|
+
maxFilesPluralizationText?: string;
|
|
61
|
+
maxSizeBytes?: number;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Context for drag events with drag-specific properties
|
|
66
|
+
* Used to generate validation messages during file drag operations.
|
|
67
|
+
*
|
|
68
|
+
* @property draggedItems - The DataTransferItemList containing all items being dragged (not just rejected ones)
|
|
69
|
+
* @property eventType - Always 'drag' for drag events
|
|
70
|
+
*/
|
|
71
|
+
export type DragMessageContext = BaseDynamicMessageContext & {
|
|
72
|
+
draggedItems?: DataTransferItemList;
|
|
73
|
+
eventType: 'drag';
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Context for drop events with drop-specific properties
|
|
78
|
+
* Used to generate validation messages after files have been dropped.
|
|
79
|
+
*
|
|
80
|
+
* @property eventType - Always 'drop' for drop events
|
|
81
|
+
* @property rejectedFileList - Comma-separated list of rejected file names
|
|
82
|
+
* @property rejectedFiles - Array of File objects that failed validation
|
|
83
|
+
*/
|
|
84
|
+
export type DropMessageContext = BaseDynamicMessageContext & {
|
|
85
|
+
eventType: 'drop';
|
|
86
|
+
rejectedFileList?: string;
|
|
87
|
+
rejectedFiles?: File[];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Guaranteed minimal properties available on all DynamicMessageContext variants.
|
|
92
|
+
* This type represents the contract for what you can ALWAYS safely destructure
|
|
93
|
+
* from any message context, regardless of whether it's a drag or drop event.
|
|
94
|
+
*
|
|
95
|
+
* Your custom validator message functions receive the full DynamicMessageContext,
|
|
96
|
+
* but you can safely destructure just these core properties for simple validators.
|
|
97
|
+
*
|
|
98
|
+
* @property fileCount - Number of files involved in the validation
|
|
99
|
+
* @property filePluralizationText - Properly pluralized text (e.g., "file" or "files")
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Simple validator - only uses guaranteed properties
|
|
103
|
+
* const validator: FileValidator = (file) => {
|
|
104
|
+
* if (invalid) {
|
|
105
|
+
* return [{
|
|
106
|
+
* code: 'custom-error',
|
|
107
|
+
* message: ({ fileCount, filePluralizationText }) =>
|
|
108
|
+
* `${fileCount} ${filePluralizationText} failed validation`
|
|
109
|
+
* }];
|
|
110
|
+
* }
|
|
111
|
+
* return null;
|
|
112
|
+
* };
|
|
113
|
+
*/
|
|
114
|
+
export type ValidationMessageContext = {
|
|
115
|
+
fileCount: number;
|
|
116
|
+
filePluralizationText: string;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Context object provided to dynamic message functions in validators.
|
|
121
|
+
* This is a union of drag and drop contexts, representing what's actually passed at runtime.
|
|
122
|
+
*
|
|
123
|
+
* While the full context includes many optional properties (like formattedMaxSize, maxFiles, etc.),
|
|
124
|
+
* you can always safely destructure the core properties: fileCount and filePluralizationText
|
|
125
|
+
* (see ValidationMessageContext for the guaranteed minimal subset).
|
|
126
|
+
*
|
|
127
|
+
* Use isDragContext or isDropContext type guards to access event-specific properties safely.
|
|
128
|
+
*/
|
|
129
|
+
export type DynamicMessageContext = DragMessageContext | DropMessageContext;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Type guard to check if a context is a drag context
|
|
133
|
+
* Use this before accessing drag-specific properties
|
|
134
|
+
*
|
|
135
|
+
* @param context - The message context to check
|
|
136
|
+
* @returns true if context is a drag context, false otherwise
|
|
137
|
+
*/
|
|
138
|
+
export const isDragContext = (context: DynamicMessageContext): context is DragMessageContext => {
|
|
139
|
+
return context.eventType === 'drag';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Type guard to check if a context is a drop context
|
|
144
|
+
* Use this before accessing drop-specific properties
|
|
145
|
+
*
|
|
146
|
+
* @param context - The message context to check
|
|
147
|
+
* @returns true if context is a drop context, false otherwise
|
|
148
|
+
*/
|
|
149
|
+
export const isDropContext = (context: DynamicMessageContext): context is DropMessageContext => {
|
|
150
|
+
return context.eventType === 'drop';
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Parameters for generating validation messages
|
|
155
|
+
* Used to create appropriate error messages for different validation scenarios.
|
|
156
|
+
*
|
|
157
|
+
* @property code - The error code that triggered the validation failure
|
|
158
|
+
* @property count - Optional number of files that failed this specific validation
|
|
159
|
+
* @property message - Optional message string or function that generates a message based on context
|
|
160
|
+
* @property messageType - Optional string indicating the type of message ('drag' or 'drop')
|
|
161
|
+
*/
|
|
162
|
+
export type ValidationMessageParams = {
|
|
163
|
+
code: FileErrorCode;
|
|
164
|
+
count?: number;
|
|
165
|
+
message?: ContextAwareMessage<DynamicMessageContext>;
|
|
166
|
+
messageType?: 'drag' | 'drop';
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Represents a file validation error that can include dynamic messaging
|
|
171
|
+
* Used during the validation process before messages are finalized.
|
|
172
|
+
* This type allows for context-aware messages that can be resolved
|
|
173
|
+
* at runtime based on the validation context.
|
|
174
|
+
*
|
|
175
|
+
* @property code - Error code identifying the type of validation failure
|
|
176
|
+
* @property message - Human-readable error message or function that generates one
|
|
177
|
+
* @remarks Used during validation process before messages are finalized
|
|
178
|
+
*/
|
|
179
|
+
export type DynamicFileError = {
|
|
180
|
+
code: FileErrorCode;
|
|
181
|
+
message: ContextAwareMessage<DynamicMessageContext>;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Structure for processed validation error responses
|
|
186
|
+
* The final form of validation errors after message resolution.
|
|
187
|
+
* Unlike DynamicFileError, FileError messages are always strings,
|
|
188
|
+
* as they have already been processed with context.
|
|
189
|
+
*
|
|
190
|
+
* @property code - Error code identifying the type of validation failure
|
|
191
|
+
* @property message - Human-readable error message
|
|
192
|
+
* @remarks Used for displaying validation results after message processing
|
|
193
|
+
*/
|
|
194
|
+
export type FileError = {
|
|
195
|
+
code: FileErrorCode;
|
|
196
|
+
message: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Union type for validation errors that can be either a FileError or a DynamicFileError
|
|
201
|
+
* This type allows for flexibility in handling different types of validation errors
|
|
202
|
+
* and provides a common interface for processing them
|
|
203
|
+
*/
|
|
204
|
+
export type ValidationError = FileError | DynamicFileError;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Represents a file rejection from the upload process
|
|
208
|
+
* Re-exported from react-dropzone for convenience
|
|
209
|
+
*
|
|
210
|
+
* @property file - The rejected file
|
|
211
|
+
* @property errors - Array of errors associated with the rejected file
|
|
212
|
+
*/
|
|
213
|
+
export type FileRejection = ReactDropzoneFileRejection;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Predefined categories of file types
|
|
217
|
+
* Used as a convenient shorthand for common file type groups
|
|
218
|
+
*
|
|
219
|
+
* @value 'images' - Common image formats (jpeg, png, gif, webp)
|
|
220
|
+
* @value 'pdfs' - PDF documents only
|
|
221
|
+
* @value 'documents' - Office and PDF documents (pdf, doc, docx, xls, xlsx)
|
|
222
|
+
*/
|
|
223
|
+
export type CommonFileTypes = 'images' | 'pdfs' | 'documents';
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Ensures numbers are greater than 0; used for validation parameters
|
|
227
|
+
* A type utility that prevents negative numbers or zero from being used
|
|
228
|
+
* in places where only positive numbers make sense (e.g., file size limits)
|
|
229
|
+
*/
|
|
230
|
+
export type PositiveNumber = number extends infer N
|
|
231
|
+
? N extends number
|
|
232
|
+
? N extends 0
|
|
233
|
+
? never
|
|
234
|
+
: N extends -1
|
|
235
|
+
? never
|
|
236
|
+
: number
|
|
237
|
+
: never
|
|
238
|
+
: never;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Custom validation function for file uploads
|
|
242
|
+
* Implement this to create custom validation rules beyond the built-in ones
|
|
243
|
+
*
|
|
244
|
+
* @param file - File or DataTransferItem to validate
|
|
245
|
+
* @returns An array of ValidationError objects if validation fails, null if passes
|
|
246
|
+
*/
|
|
247
|
+
export type FileValidator = (file: File | DataTransferItem) => ValidationError[] | null;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Configuration for file validation
|
|
251
|
+
* Used to set up validation rules and behavior for file uploads
|
|
252
|
+
*
|
|
253
|
+
* @property accept - Allowed file types (preset categories or MIME types/extensions)
|
|
254
|
+
* @property error - Optional custom error to display regardless of validation results
|
|
255
|
+
* @property maxFiles - Maximum number of files allowed
|
|
256
|
+
* @property maxSize - Maximum file size in bytes
|
|
257
|
+
* @property strictValidation - If true, rejects all files when any validation fails
|
|
258
|
+
* @property validator - Optional custom validation function
|
|
259
|
+
*/
|
|
260
|
+
export type ValidationConfig = {
|
|
261
|
+
accept?: CommonFileTypes | string[];
|
|
262
|
+
error?: FileError;
|
|
263
|
+
maxFiles?: number;
|
|
264
|
+
maxSize?: number;
|
|
265
|
+
strictValidation?: boolean;
|
|
266
|
+
validator?: FileValidator;
|
|
267
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package @evolve.ui/core-components/fileUpload/types
|
|
3
|
+
* Core type definitions for file upload functionality
|
|
4
|
+
*
|
|
5
|
+
* @typedef {number} PositiveNumber - Type representing numbers greater than 0
|
|
6
|
+
* @typedef {Function} FileValidator - Custom validation function for file uploads
|
|
7
|
+
* @typedef {Object} FileError - Structure for file validation error responses
|
|
8
|
+
* @typedef {Object} DynamicMessageContext - Context object for generating validation messages
|
|
9
|
+
* @typedef {Object} ValidationMessageContext - Guaranteed minimal properties on all message contexts
|
|
10
|
+
* @typedef {Object} FileResource - Type representing a file or a remote file
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export type {
|
|
14
|
+
PositiveNumber,
|
|
15
|
+
FileValidator,
|
|
16
|
+
FileError,
|
|
17
|
+
FileErrorCode,
|
|
18
|
+
FileRejection,
|
|
19
|
+
DynamicMessageContext,
|
|
20
|
+
ValidationMessageContext,
|
|
21
|
+
DynamicFileError,
|
|
22
|
+
ValidationError,
|
|
23
|
+
FileResource,
|
|
24
|
+
RemoteFile,
|
|
25
|
+
} from './commonTypes';
|
|
26
|
+
|
|
27
|
+
export { isDragContext, isDropContext } from './commonTypes';
|
|
28
|
+
|
|
29
|
+
// Provider Context Types
|
|
30
|
+
export type { FileUploadContextType } from '../providers/FileUploadProvider';
|
|
31
|
+
export type { UploadValidationContextType } from '../providers/UploadValidationProvider';
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains shared type definitions for the file upload system.
|
|
3
|
+
* It follows a composition pattern where complex component props are built
|
|
4
|
+
* from smaller, reusable type definitions.
|
|
5
|
+
*/
|
|
6
|
+
import { FilePreviewListProps } from '../components/FilePreviewList/FilePreviewList';
|
|
7
|
+
import { PreviewStyle } from '../components/types';
|
|
8
|
+
import { CommonFileTypes, FileError, FileRejection, FileResource, FileValidator } from './commonTypes';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Core functionality props shared across file upload components.
|
|
12
|
+
* These handle the main file upload behaviors and callbacks.
|
|
13
|
+
*/
|
|
14
|
+
type CoreUploadProps = {
|
|
15
|
+
/** Whether to disable early drag validation feedback*/
|
|
16
|
+
disableDragValidation?: boolean;
|
|
17
|
+
/** Whether the upload is disabled */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Error object to display custom validation errors */
|
|
20
|
+
error?: FileError;
|
|
21
|
+
/** Whether to hide error messages in the UI */
|
|
22
|
+
hideErrors?: boolean;
|
|
23
|
+
/** Maximum number of files (1 for single file, undefined for unlimited) */
|
|
24
|
+
maxFiles?: number;
|
|
25
|
+
/** Maximum allowed file size in bytes (Unrestricted by default) */
|
|
26
|
+
maxSize?: number;
|
|
27
|
+
/** Callback when files are dropped */
|
|
28
|
+
onDrop?: (acceptedFiles: File[], rejectedFiles: FileRejection[]) => void;
|
|
29
|
+
/** Callback when files are accepted */
|
|
30
|
+
onDropAccepted?: (files: File[]) => void;
|
|
31
|
+
/** Called when files fail validation with detailed rejection reasons
|
|
32
|
+
* Use case: Show specific error messages for each rejected file
|
|
33
|
+
* Example: "file.pdf is too large" or "file.exe is not an allowed type"
|
|
34
|
+
*/
|
|
35
|
+
onDropRejected?: (rejectedFiles: FileRejection[]) => void;
|
|
36
|
+
/** Called when user clicks delete button on a file preview
|
|
37
|
+
* Use case: Remove file from server/state, update UI
|
|
38
|
+
*/
|
|
39
|
+
onFileDelete?: (fileResource: FileResource) => void;
|
|
40
|
+
/** Simple callback for file changes - alternative to granular callbacks */
|
|
41
|
+
onFilesChange?: (files: FileResource[]) => void;
|
|
42
|
+
/** Whether to show the debugger display - to review file rejections and more*/
|
|
43
|
+
showDebugger?: boolean;
|
|
44
|
+
/** Reject all files if any fail validation (strict mode) */
|
|
45
|
+
strictValidation?: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* UI-specific props shared across file upload components.
|
|
50
|
+
* These control visual aspects and accessibility features.
|
|
51
|
+
*/
|
|
52
|
+
type UIProps = {
|
|
53
|
+
/** Custom styling for the file upload component */
|
|
54
|
+
className?: string;
|
|
55
|
+
/** Custom data-testid for the file upload component */
|
|
56
|
+
'data-testid'?: string;
|
|
57
|
+
/** Custom caption text displayed below the upload input */
|
|
58
|
+
helpText?: string;
|
|
59
|
+
/** Aligns the help text to the center, overriding the default left alignment */
|
|
60
|
+
helpTextAlignCenter?: boolean;
|
|
61
|
+
/** Whether to hide the help text */
|
|
62
|
+
hideHelpText?: boolean;
|
|
63
|
+
/** Custom label to show above the upload input */
|
|
64
|
+
labelText?: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Additional shared props that don't fit into core or UI categories.
|
|
69
|
+
* These handle file type restrictions and custom validation.
|
|
70
|
+
*/
|
|
71
|
+
type SharedUploadProps = {
|
|
72
|
+
/** Allowed file types - either preset categories or custom MIME types */
|
|
73
|
+
accept?: CommonFileTypes | string[];
|
|
74
|
+
/** Custom aria-label for the upload zone */
|
|
75
|
+
ariaLabel?: string;
|
|
76
|
+
/** Custom validator function for file validation - there are default validations for maxFiles and maxSize and accept (mime types) */
|
|
77
|
+
validator?: FileValidator;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Complete props for the FileDropzone component.
|
|
82
|
+
* Similar to FileUploadProps but with different component-specific options.
|
|
83
|
+
*/
|
|
84
|
+
export type FileDropzoneProps = CoreUploadProps &
|
|
85
|
+
UIProps &
|
|
86
|
+
SharedUploadProps & {
|
|
87
|
+
/** Array of accepted files - typically comes from external state or context
|
|
88
|
+
* (often used to display files in the preview list) */
|
|
89
|
+
files?: FileResource[];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type OverlayStyleOptions = {
|
|
93
|
+
/** Apply backdrop blur effect during drag. Default: false (opt-in for performance) */
|
|
94
|
+
blurOnDrag?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the overlay should fill the parent container's height.
|
|
97
|
+
* When true: Applies h-full to expand to parent height
|
|
98
|
+
* When false/undefined (default): Applies relative positioning for natural content flow
|
|
99
|
+
*/
|
|
100
|
+
fillParent?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Padding around the wrapped children (Tailwind spacing value).
|
|
103
|
+
* Default: undefined (no additional padding)
|
|
104
|
+
*/
|
|
105
|
+
innerPadding?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
106
|
+
/**
|
|
107
|
+
* Show outline borders (dashed when idle, thick blue when dragging).
|
|
108
|
+
* Default: true (important for visual feedback and accessibility)
|
|
109
|
+
*/
|
|
110
|
+
showDashedBorder?: boolean;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type FileDropzoneOverlayProps = Omit<FileDropzoneProps, 'helpTextAlignCenter' | 'hideErrors' | 'labelText'> & {
|
|
114
|
+
/** Content to wrap with the dropzone overlay - required for the component to have a visible drag area */
|
|
115
|
+
children: React.ReactNode;
|
|
116
|
+
/**
|
|
117
|
+
* Whether to disable clicking through the overlay to interact with wrapped children when not dragging files.
|
|
118
|
+
* When false (default): Overlay is transparent to clicks, allowing interaction with wrapped content.
|
|
119
|
+
* When true: Overlay captures all events like a normal file uploader (opens file picker on click).
|
|
120
|
+
*/
|
|
121
|
+
disableClickThrough?: boolean;
|
|
122
|
+
/** Text to display in the overlay when actively dragging files over the component */
|
|
123
|
+
dragText?: string;
|
|
124
|
+
/** Custom icon to display in the overlay during drag. If not provided, shows smart default based on accepted file types and maxFiles. */
|
|
125
|
+
icon?: React.ReactNode;
|
|
126
|
+
/** Configuration for visual styling options during drag operations */
|
|
127
|
+
styleOptions?: OverlayStyleOptions;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// FilePreviewList specific props for within the FileUpload component (Omitted props are handled by context in FileUpload)
|
|
131
|
+
type PreviewConfig = Omit<FilePreviewListProps, 'files' | 'onDelete' | 'previewStyle'>;
|
|
132
|
+
|
|
133
|
+
// FileDropzone specific props for within the FileUpload component (Omitted props are handled by context in FileUpload)
|
|
134
|
+
type DropzoneConfig = Omit<FileDropzoneProps, 'files'>;
|
|
135
|
+
|
|
136
|
+
// Complete FileUpload component props
|
|
137
|
+
export type FileUploadProps = DropzoneConfig & {
|
|
138
|
+
/** Whether to hide the file preview list */
|
|
139
|
+
hideFilePreview?: boolean;
|
|
140
|
+
/** Initial files to populate the uploader with when first mounted */
|
|
141
|
+
initialFiles?: FileResource[];
|
|
142
|
+
/** Enables more granular custom configuration for the file preview list. (See FilePreviewList for available props) */
|
|
143
|
+
previewConfig?: PreviewConfig;
|
|
144
|
+
/** Determines the view style for the file preview list */
|
|
145
|
+
previewStyle?: PreviewStyle;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// FileDropzoneOverlay specific props for within FileUploadCanvas (Omitted props are handled by context)
|
|
149
|
+
type DropzoneOverlayConfig = Omit<FileDropzoneOverlayProps, 'children' | 'files'>;
|
|
150
|
+
|
|
151
|
+
// Complete FileUploadCanvas component props
|
|
152
|
+
export type FileUploadCanvasProps = DropzoneOverlayConfig & {
|
|
153
|
+
/** Initial files to populate the uploader with when first mounted */
|
|
154
|
+
initialFiles?: FileResource[];
|
|
155
|
+
/** Enables more granular custom configuration for the file preview list. (See FilePreviewList for available props) */
|
|
156
|
+
previewConfig?: PreviewConfig;
|
|
157
|
+
/** Determines the view style for the file preview list */
|
|
158
|
+
previewStyle?: PreviewStyle;
|
|
159
|
+
};
|