@anker-in/headless-ui 1.1.84 → 1.1.86
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/cjs/biz-components/AccordionCards/index.d.ts +36 -1
- package/dist/cjs/biz-components/ActiveShelf/index.d.ts +2 -2
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js.map +3 -3
- package/dist/cjs/biz-components/ActivitySchedule/index.d.ts +3 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.d.ts +1 -1
- package/dist/cjs/biz-components/AplusDesc/index.d.ts +17 -1
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.d.ts +2 -1
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +2 -1
- package/dist/cjs/biz-components/Category/index.d.ts +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.d.ts +7 -1
- package/dist/cjs/biz-components/DownLoad/index.d.ts +6 -1
- package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.d.ts +2 -7
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js.map +3 -3
- package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -2
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.d.ts +3 -1
- package/dist/cjs/biz-components/FeatureShowcase/FeatureShowcase.d.ts +3 -1
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.d.ts +1 -6
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.js +1 -1
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.js.map +3 -3
- package/dist/cjs/biz-components/Features/index.d.ts +9 -1
- package/dist/cjs/biz-components/FootCharger/index.d.ts +7 -1
- package/dist/cjs/biz-components/FooterNavigation/index.d.ts +2 -1
- package/dist/cjs/biz-components/GiftBox/index.d.ts +3 -1
- package/dist/cjs/biz-components/GiftShelf/index.d.ts +3 -1
- package/dist/cjs/biz-components/GiftTierShelf/index.d.ts +3 -1
- package/dist/cjs/biz-components/Graphic/index.d.ts +1 -1
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.d.ts +1 -1
- package/dist/cjs/biz-components/GraphicMore/index.d.ts +7 -1
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.d.ts +10 -2
- package/dist/cjs/biz-components/HeaderNavigation/index.d.ts +3 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.d.ts +5 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/cjs/biz-components/ImageOverlayShelf/index.d.ts +2 -2
- package/dist/cjs/biz-components/ImageOverlayShelf/index.js +1 -1
- package/dist/cjs/biz-components/ImageOverlayShelf/index.js.map +3 -3
- package/dist/cjs/biz-components/ImageTextFeature/ImageTextFeature.d.ts +3 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.d.ts +3 -1
- package/dist/cjs/biz-components/Ksp/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +11 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +26 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductPaidShipping/index.d.ts +11 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.d.ts +2 -1
- package/dist/cjs/biz-components/LotteryShared/BaseModal.d.ts +61 -0
- package/dist/cjs/biz-components/LotteryShared/BaseModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/BaseModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/ChanceMethods.d.ts +25 -0
- package/dist/cjs/biz-components/LotteryShared/ChanceMethods.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/ChanceMethods.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/ErrorModal.d.ts +47 -0
- package/dist/cjs/biz-components/LotteryShared/ErrorModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/ErrorModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/MyRewardsModal.d.ts +101 -0
- package/dist/cjs/biz-components/LotteryShared/MyRewardsModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/MyRewardsModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/PrizePool.d.ts +29 -0
- package/dist/cjs/biz-components/LotteryShared/PrizePool.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/PrizePool.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/RulesModal.d.ts +56 -0
- package/dist/cjs/biz-components/LotteryShared/RulesModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/RulesModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/ShareModal.d.ts +79 -0
- package/dist/cjs/biz-components/LotteryShared/ShareModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/ShareModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/WinnerModal.d.ts +27 -0
- package/dist/cjs/biz-components/LotteryShared/WinnerModal.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/WinnerModal.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/index.d.ts +23 -0
- package/dist/cjs/biz-components/LotteryShared/index.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/index.js.map +7 -0
- package/dist/cjs/biz-components/LotteryShared/types.d.ts +760 -0
- package/dist/cjs/biz-components/LotteryShared/types.js +2 -0
- package/dist/cjs/biz-components/LotteryShared/types.js.map +7 -0
- package/dist/cjs/biz-components/Marquee/Marquee.d.ts +3 -2
- package/dist/cjs/biz-components/MarqueeReview/index.d.ts +1 -1
- package/dist/cjs/biz-components/MediaEndorsement/index.d.ts +2 -1
- package/dist/cjs/biz-components/MediaEndorsement/index.js +2 -2
- package/dist/cjs/biz-components/MediaEndorsement/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaPlayerBase/index.d.ts +2 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.d.ts +2 -1
- package/dist/cjs/biz-components/MediaPlayerSticky/index.d.ts +7 -1
- package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +2 -1
- package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.d.ts +1 -1
- package/dist/cjs/biz-components/MediaShelf/index.d.ts +2 -2
- package/dist/cjs/biz-components/MediaShelf/index.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/index.js.map +3 -3
- package/dist/cjs/biz-components/MemberEquity/index.d.ts +3 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +17 -2
- package/dist/cjs/biz-components/NavigationSearch/index.d.ts +2 -1
- package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.d.ts +3 -1
- package/dist/cjs/biz-components/ProductLottery/MediaDrawArea.d.ts +4 -0
- package/dist/cjs/biz-components/ProductLottery/MediaDrawArea.js +2 -0
- package/dist/cjs/biz-components/ProductLottery/MediaDrawArea.js.map +7 -0
- package/dist/cjs/biz-components/ProductLottery/index.d.ts +17 -0
- package/dist/cjs/biz-components/ProductLottery/index.js +2 -0
- package/dist/cjs/biz-components/ProductLottery/index.js.map +7 -0
- package/dist/cjs/biz-components/ProductLottery/types.d.ts +363 -0
- package/dist/cjs/biz-components/ProductLottery/types.js +2 -0
- package/dist/cjs/biz-components/ProductLottery/types.js.map +7 -0
- package/dist/cjs/biz-components/ProductNav/ProductNav.d.ts +2 -1
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +1 -1
- package/dist/cjs/biz-components/SelectStore/index.d.ts +7 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.d.ts +3 -1
- package/dist/cjs/biz-components/Slogan/index.d.ts +3 -1
- package/dist/cjs/biz-components/Spacer/index.d.ts +3 -1
- package/dist/cjs/biz-components/Specs/index.d.ts +1 -1
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/biz-components/Specs/index.js.map +3 -3
- package/dist/cjs/biz-components/SpecsComparison/SpecsComparison.d.ts +3 -1
- package/dist/cjs/biz-components/Subscribe/index.js +2 -2
- package/dist/cjs/biz-components/Subscribe/index.js.map +2 -2
- package/dist/cjs/biz-components/TabWithImage/TabWithImage.d.ts +3 -1
- package/dist/cjs/biz-components/Tabs/Tabs.d.ts +3 -1
- package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
- package/dist/cjs/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/cjs/biz-components/TabsGroup/index.d.ts +3 -1
- package/dist/cjs/biz-components/TabsWithMedia/TabsWithMedia.d.ts +3 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +3 -1
- package/dist/cjs/biz-components/Title/index.d.ts +1 -1
- package/dist/cjs/biz-components/VideoFeature/VideoFeature.d.ts +3 -1
- package/dist/cjs/biz-components/WheelLottery/index.d.ts +12 -12
- package/dist/cjs/biz-components/WheelLottery/index.js +1 -1
- package/dist/cjs/biz-components/WheelLottery/index.js.map +3 -3
- package/dist/cjs/biz-components/WheelLottery/types.d.ts +17 -723
- package/dist/cjs/biz-components/WheelLottery/types.js +1 -1
- package/dist/cjs/biz-components/WheelLottery/types.js.map +3 -3
- package/dist/cjs/biz-components/WhyChoose/WhyChoose.d.ts +3 -2
- package/dist/cjs/biz-components/index.d.ts +2 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/shared/Styles.d.ts +7 -21
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/Styles.js.map +3 -3
- package/dist/esm/biz-components/AccordionCards/index.d.ts +36 -1
- package/dist/esm/biz-components/ActiveShelf/index.d.ts +2 -2
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js.map +3 -3
- package/dist/esm/biz-components/ActivitySchedule/index.d.ts +3 -1
- package/dist/esm/biz-components/AnchorNavigation/index.d.ts +1 -1
- package/dist/esm/biz-components/AplusDesc/index.d.ts +17 -1
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.d.ts +2 -1
- package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +2 -1
- package/dist/esm/biz-components/Category/index.d.ts +1 -1
- package/dist/esm/biz-components/CreativeModule/index.d.ts +7 -1
- package/dist/esm/biz-components/DownLoad/index.d.ts +6 -1
- package/dist/esm/biz-components/Evaluate/index.d.ts +1 -1
- package/dist/esm/biz-components/EventSchedule/index.d.ts +2 -7
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js.map +3 -3
- package/dist/esm/biz-components/Faq/Faq.d.ts +3 -2
- package/dist/esm/biz-components/FeatureCards/FeatureCards.d.ts +3 -1
- package/dist/esm/biz-components/FeatureShowcase/FeatureShowcase.d.ts +3 -1
- package/dist/esm/biz-components/FeaturedBlogPosts/index.d.ts +1 -6
- package/dist/esm/biz-components/FeaturedBlogPosts/index.js +1 -1
- package/dist/esm/biz-components/FeaturedBlogPosts/index.js.map +3 -3
- package/dist/esm/biz-components/Features/index.d.ts +9 -1
- package/dist/esm/biz-components/FootCharger/index.d.ts +7 -1
- package/dist/esm/biz-components/FooterNavigation/index.d.ts +2 -1
- package/dist/esm/biz-components/GiftBox/index.d.ts +3 -1
- package/dist/esm/biz-components/GiftShelf/index.d.ts +3 -1
- package/dist/esm/biz-components/GiftTierShelf/index.d.ts +3 -1
- package/dist/esm/biz-components/Graphic/index.d.ts +1 -1
- package/dist/esm/biz-components/GraphicAttractionBlock/index.d.ts +1 -1
- package/dist/esm/biz-components/GraphicMore/index.d.ts +7 -1
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.d.ts +10 -2
- package/dist/esm/biz-components/HeaderNavigation/index.d.ts +3 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.d.ts +5 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/esm/biz-components/ImageOverlayShelf/index.d.ts +2 -2
- package/dist/esm/biz-components/ImageOverlayShelf/index.js +1 -1
- package/dist/esm/biz-components/ImageOverlayShelf/index.js.map +3 -3
- package/dist/esm/biz-components/ImageTextFeature/ImageTextFeature.d.ts +3 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.d.ts +3 -1
- package/dist/esm/biz-components/Ksp/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +11 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +26 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductPaidShipping/index.d.ts +11 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.d.ts +2 -1
- package/dist/esm/biz-components/LotteryShared/BaseModal.d.ts +61 -0
- package/dist/esm/biz-components/LotteryShared/BaseModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/BaseModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/ChanceMethods.d.ts +25 -0
- package/dist/esm/biz-components/LotteryShared/ChanceMethods.js +2 -0
- package/dist/esm/biz-components/LotteryShared/ChanceMethods.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/ErrorModal.d.ts +47 -0
- package/dist/esm/biz-components/LotteryShared/ErrorModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/ErrorModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/MyRewardsModal.d.ts +101 -0
- package/dist/esm/biz-components/LotteryShared/MyRewardsModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/MyRewardsModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/PrizePool.d.ts +29 -0
- package/dist/esm/biz-components/LotteryShared/PrizePool.js +2 -0
- package/dist/esm/biz-components/LotteryShared/PrizePool.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/RulesModal.d.ts +56 -0
- package/dist/esm/biz-components/LotteryShared/RulesModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/RulesModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/ShareModal.d.ts +79 -0
- package/dist/esm/biz-components/LotteryShared/ShareModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/ShareModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/WinnerModal.d.ts +27 -0
- package/dist/esm/biz-components/LotteryShared/WinnerModal.js +2 -0
- package/dist/esm/biz-components/LotteryShared/WinnerModal.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/index.d.ts +23 -0
- package/dist/esm/biz-components/LotteryShared/index.js +2 -0
- package/dist/esm/biz-components/LotteryShared/index.js.map +7 -0
- package/dist/esm/biz-components/LotteryShared/types.d.ts +760 -0
- package/dist/esm/biz-components/LotteryShared/types.js +2 -0
- package/dist/esm/biz-components/LotteryShared/types.js.map +7 -0
- package/dist/esm/biz-components/Marquee/Marquee.d.ts +3 -2
- package/dist/esm/biz-components/MarqueeReview/index.d.ts +1 -1
- package/dist/esm/biz-components/MediaEndorsement/index.d.ts +2 -1
- package/dist/esm/biz-components/MediaEndorsement/index.js +2 -2
- package/dist/esm/biz-components/MediaEndorsement/index.js.map +3 -3
- package/dist/esm/biz-components/MediaPlayerBase/index.d.ts +2 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.d.ts +2 -1
- package/dist/esm/biz-components/MediaPlayerSticky/index.d.ts +7 -1
- package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +2 -1
- package/dist/esm/biz-components/MediaSceneSwitcherV2/index.d.ts +1 -1
- package/dist/esm/biz-components/MediaShelf/index.d.ts +2 -2
- package/dist/esm/biz-components/MediaShelf/index.js +1 -1
- package/dist/esm/biz-components/MediaShelf/index.js.map +3 -3
- package/dist/esm/biz-components/MemberEquity/index.d.ts +3 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +17 -2
- package/dist/esm/biz-components/NavigationSearch/index.d.ts +2 -1
- package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.d.ts +3 -1
- package/dist/esm/biz-components/ProductLottery/MediaDrawArea.d.ts +4 -0
- package/dist/esm/biz-components/ProductLottery/MediaDrawArea.js +2 -0
- package/dist/esm/biz-components/ProductLottery/MediaDrawArea.js.map +7 -0
- package/dist/esm/biz-components/ProductLottery/index.d.ts +17 -0
- package/dist/esm/biz-components/ProductLottery/index.js +2 -0
- package/dist/esm/biz-components/ProductLottery/index.js.map +7 -0
- package/dist/esm/biz-components/ProductLottery/types.d.ts +363 -0
- package/dist/esm/biz-components/ProductLottery/types.js +2 -0
- package/dist/esm/biz-components/ProductLottery/types.js.map +7 -0
- package/dist/esm/biz-components/ProductNav/ProductNav.d.ts +2 -1
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.d.ts +1 -1
- package/dist/esm/biz-components/SelectStore/index.d.ts +7 -1
- package/dist/esm/biz-components/ShelfDisplay/index.d.ts +3 -1
- package/dist/esm/biz-components/Slogan/index.d.ts +3 -1
- package/dist/esm/biz-components/Spacer/index.d.ts +3 -1
- package/dist/esm/biz-components/Specs/index.d.ts +1 -1
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/biz-components/Specs/index.js.map +3 -3
- package/dist/esm/biz-components/SpecsComparison/SpecsComparison.d.ts +3 -1
- package/dist/esm/biz-components/Subscribe/index.js +2 -2
- package/dist/esm/biz-components/Subscribe/index.js.map +2 -2
- package/dist/esm/biz-components/TabWithImage/TabWithImage.d.ts +3 -1
- package/dist/esm/biz-components/Tabs/Tabs.d.ts +3 -1
- package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
- package/dist/esm/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/esm/biz-components/TabsGroup/index.d.ts +3 -1
- package/dist/esm/biz-components/TabsWithMedia/TabsWithMedia.d.ts +3 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +3 -1
- package/dist/esm/biz-components/Title/index.d.ts +1 -1
- package/dist/esm/biz-components/VideoFeature/VideoFeature.d.ts +3 -1
- package/dist/esm/biz-components/WheelLottery/index.d.ts +12 -12
- package/dist/esm/biz-components/WheelLottery/index.js +1 -1
- package/dist/esm/biz-components/WheelLottery/index.js.map +3 -3
- package/dist/esm/biz-components/WheelLottery/types.d.ts +17 -723
- package/dist/esm/biz-components/WheelLottery/types.js +1 -1
- package/dist/esm/biz-components/WheelLottery/types.js.map +3 -3
- package/dist/esm/biz-components/WhyChoose/WhyChoose.d.ts +3 -2
- package/dist/esm/biz-components/index.d.ts +2 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/dist/esm/shared/Styles.d.ts +7 -21
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/Styles.js.map +3 -3
- package/package.json +1 -1
- package/style.css +77 -0
|
@@ -87,6 +87,6 @@ export interface ActiveShelfComponent extends React.ForwardRefExoticComponent<Ac
|
|
|
87
87
|
/** 独立的 ProductCard 组件 */
|
|
88
88
|
ProductCard: typeof ProductCard;
|
|
89
89
|
}
|
|
90
|
-
declare const
|
|
91
|
-
export default
|
|
90
|
+
declare const ActiveShelfWrapped: React.ForwardRefExoticComponent<Omit<ActiveShelfProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
export default ActiveShelfWrapped;
|
|
92
92
|
export type { StockDisplayMode, ActiveShelfSemanticName, ProductCardData };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as x}from"react/jsx-runtime";import*as n from"react";import{cn as D}from"../../helpers/index.js";import{
|
|
1
|
+
"use client";import{jsx as t,jsxs as x}from"react/jsx-runtime";import*as n from"react";import{cn as D}from"../../helpers/index.js";import{withLayout as H}from"../../shared/Styles.js";import{Text as z,Heading as $,Tabs as O,TabsList as V,TabsTrigger as I,TabsContent as W}from"../../components/index.js";import{Swiper as j,SwiperSlide as _}from"swiper/react";import{Navigation as q}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as N}from"./ProductCard.js";import{useExposure as Z}from"../../hooks/useExposure.js";const G="shelf",J="active_shelf",K=({disabled:i})=>x("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[t("path",{d:"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),t("path",{d:"M31 22L25 28L31 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Q=({disabled:i})=>x("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[t("path",{d:"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),t("path",{d:"M25 22L31 28L25 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),E=n.forwardRef(({products:i,layoutMode:o,className:S,copy:a,showTags:p,stockDisplayMode:r,stockThresholdValue:k,onLearnMore:B,onShopNow:l,onAddToCart:u,classNames:h,secondaryButtonText:m,secondaryButtonFun:y,primaryButtonText:g,primaryButtonFun:f,showOriginalPrice:T},P)=>{const v=n.useId().replace(/:/g,""),b=`swiper-button-next-custom-${v}`,M=`swiper-button-prev-custom-${v}`,[c,s]=n.useState({isBeginning:!0,isEnd:!1}),L=n.useRef(null),d=n.useCallback(()=>{const e=L.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(C=>{C.style.height="auto"});const w=Array.from(e.slides).map(C=>C.scrollHeight),A=Math.max(...w);A>0&&e.slides.forEach(C=>{C.style.height=`${A}px`})},[]);return n.useEffect(()=>{const e=()=>{requestAnimationFrame(d)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[d]),i?.length===0?null:t("div",{ref:P,className:S,children:o==="flex"?t("div",{className:"lg-desktop:gap-4 tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-4 laptop:gap-4 grid grid-cols-1 justify-start gap-3",children:i.map((e,w)=>t(N,{product:e,className:"shrink-0",showTags:p,stockDisplayMode:r,stockThresholdValue:k,onLearnMore:B,onShopNow:l,onAddToCart:u,classNames:h,secondaryButtonText:m,secondaryButtonFun:y,primaryButtonText:g,primaryButtonFun:f,showOriginalPrice:T,copy:a},e.shopify_id+"-"+e.sku||w))}):x("div",{className:"group relative",children:[t(j,{modules:[q],spaceBetween:16,slidesPerView:"auto",navigation:{nextEl:`.${b}`,prevEl:`.${M}`},onSwiper:e=>{L.current=e,s({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(d,100)},onReachEnd:()=>{s(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{s(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{s({isBeginning:!1,isEnd:!1})},className:"!overflow-visible",children:i.map((e,w)=>t(_,{className:"tablet:!w-[288px] desktop:!w-[316px] lg-desktop:!w-[404px] !w-[296px] overflow-hidden",children:t(N,{product:e,className:"w-full max-w-full",showTags:p,stockDisplayMode:r,stockThresholdValue:k,onLearnMore:B,onShopNow:l,onAddToCart:u,classNames:h,secondaryButtonText:m,secondaryButtonFun:y,primaryButtonText:g,primaryButtonFun:f,showOriginalPrice:T,copy:a})},e.shopify_id+"-"+e.sku||w))}),t("button",{className:`${M} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${c.isBeginning?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":a?.previousSlideLabel,children:t(K,{disabled:c.isBeginning})}),t("button",{className:`${b} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${c.isEnd?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":a?.nextSlideLabel,children:t(Q,{disabled:c.isEnd})})]})})});E.displayName="ProductsList";const F=n.forwardRef(({className:i,data:o,onLearnMore:S,onShopNow:a,onAddToCart:p,classNames:r,...k},B)=>{const l=n.useRef(null);Z(l,{componentType:G,componentName:J,componentTitle:o.title,componentDescription:o.description}),n.useImperativeHandle(B,()=>l.current);const{theme:u="light",layoutMode:h="flex",showTags:m=!0,stockDisplayMode:y,stockThresholdValue:g,showOriginalPrice:f=!0,secondaryButtonText:T,primaryButtonText:P,secondaryButtonFun:v,primaryButtonFun:b,isShowTab:M=!0,copy:c}=o,s=c||{},L=o.productsTab&&o.productsTab.length>0,d=M&&L;return x("div",{ref:l,className:D("w-full",{"aiui-dark":u==="dark"},i,r?.root),style:{"--progress-track-bg":u==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...k,children:[o.title&&t($,{as:"h2",html:o.title,size:4,className:D("text-info-primary mb-4",r?.title)}),o.description&&t(z,{size:3,as:"p",html:o.description,className:D("text-info-primary mb-6",r?.description)}),x(O,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[d&&t(V,{className:"mb-6",children:o.productsTab?.map(e=>t(I,{value:e.id,children:e.tab},"tab-"+e.id))}),d?o.productsTab?.map(e=>t(W,{value:e.id,children:t(E,{products:e.data,layoutMode:h,copy:s,showTags:m,stockDisplayMode:y,stockThresholdValue:g,onLearnMore:S,onShopNow:a,onAddToCart:p,classNames:r,secondaryButtonText:T,secondaryButtonFun:v,primaryButtonText:P,primaryButtonFun:b,showOriginalPrice:f})},"tab-content-"+e.id)):t(E,{products:o.productsCard,layoutMode:h,copy:s,showTags:m,stockDisplayMode:y,stockThresholdValue:g,onLearnMore:S,onShopNow:a,onAddToCart:p,classNames:r,secondaryButtonText:T,secondaryButtonFun:v,primaryButtonText:P,primaryButtonFun:b,showOriginalPrice:f})]})]})});F.displayName="ActiveShelf";const R=F;R.ProductCard=N;const U=H(R);var se=U;export{se as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ActiveShelf/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Heading, Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/index.js'\n\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Navigation } from 'swiper/modules'\n\n// Import Swiper styles\nimport 'swiper/css'\nimport 'swiper/css/navigation'\nimport type { ButtonFunctionType, CopyConfig } from './types.js'\nimport {\n ProductCard,\n type ProductCardData,\n type ActiveShelfSemanticName,\n type StockDisplayMode,\n} from './ProductCard.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'active_shelf'\n\n/**\n * \u7EC4\u4EF6\u5E03\u5C40\u6A21\u5F0F\n */\nexport type ActiveShelfLayoutMode = 'flex' | 'horizontal'\n\n/**\n * Code Channel \u914D\u7F6E - \u6298\u6263\u524D\u7F00\n */\nexport type CodeChannelConfig = string\n\nconst PrevIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"56\"\n height=\"56\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]\"\n >\n <path\n d=\"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M31 22L25 28L31 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst NextIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"56\"\n height=\"56\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]\"\n >\n <path\n d=\"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M25 22L31 28L25 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\n/**\n * \u4EA7\u54C1\u5206\u7EC4Tab\u6570\u636E\u63A5\u53E3\n */\nexport interface ProductTab {\n /** Tab ID */\n id: string\n /** Tab \u6807\u9898 */\n tab: string\n /** \u8BE5\u5206\u7EC4\u4E0B\u7684\u4EA7\u54C1\u6570\u636E */\n data: ProductCardData[]\n}\n\n/**\n * ActiveShelf \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface ActiveShelfData {\n theme?: 'light' | 'dark'\n /** \u7EC4\u4EF6\u6807\u9898 */\n title?: string\n /** \u7EC4\u4EF6\u63CF\u8FF0 */\n description?: string\n /** \u5206\u7EC4\u4EA7\u54C1Tab\u5217\u8868 */\n productsTab?: ProductTab[]\n /** \u662F\u5426\u663E\u793A Tab\uFF08\u9ED8\u8BA4\uFF1Atrue\uFF09 */\n isShowTab?: boolean\n /** \u4E86\u89E3\u66F4\u591A\u6309\u94AE\u6587\u672C */\n secondaryButtonText?: string\n secondaryButtonFun: ButtonFunctionType\n /** \u7ACB\u5373\u8D2D\u4E70\u6309\u94AE\u6587\u672C */\n primaryButtonText?: string\n primaryButtonFun: ButtonFunctionType\n /** \u5E03\u5C40\u6A21\u5F0F\uFF1A\u7F51\u683C\u5E03\u5C40\u6216\u6A2A\u5411\u6ED1\u52A8 */\n layoutMode?: ActiveShelfLayoutMode\n /** Code Channel \u914D\u7F6E - \u6298\u6263\u524D\u7F00 */\n codeChannel?: CodeChannelConfig\n /** \u662F\u5426\u5C55\u793A\u4F1A\u5458\u4EF7\u683C */\n showMemberPrice?: boolean\n /** \u662F\u5426\u5C55\u793A\u6298\u6263\u6807\u7B7E */\n showDiscount?: boolean\n /** \u662F\u5426\u5C55\u793A\u6807\u7B7E\u7CFB\u7EDF */\n showTags?: boolean\n /** \u5E93\u5B58\u5C55\u793A\u6A21\u5F0F */\n stockDisplayMode?: StockDisplayMode\n /** \u5E93\u5B58\u9608\u503C\uFF08\u5F53\u6A21\u5F0F\u4E3A below-quantity \u6216 below-percentage \u65F6\u4F7F\u7528\uFF09 */\n stockThresholdValue?: number\n /**\n * \u5E93\u5B58\u6587\u672C\u6A21\u677F\uFF0C\u652F\u6301 {count} \u5360\u4F4D\u7B26\n */\n stockDisplayText?: string\n /** \u662F\u5426\u5C55\u793A\u539F\u4EF7\uFF08\u5220\u9664\u7EBF\u4EF7\u683C\uFF09 */\n showOriginalPrice?: boolean\n /** \u6587\u6848\u914D\u7F6E */\n copy?: CopyConfig\n /**\n * \u4EA7\u54C1\u5217\u8868\uFF08\u5F53\u4E0D\u4F7F\u7528 Tab \u5206\u7EC4\u65F6\u53EF\u76F4\u63A5\u4F20\u5165\u4EA7\u54C1\u5217\u8868\uFF09\n */\n productsCard: ProductCardData[]\n}\n\nexport interface ActiveShelfProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: ActiveShelfData\n /** \u70B9\u51FB\u4E86\u89E3\u66F4\u591A\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData) => void\n /** \u70B9\u51FB\u7ACB\u5373\u8D2D\u4E70\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData) => void\n /** \u70B9\u51FB\u52A0\u5165\u8D2D\u7269\u8F66\u56DE\u8C03 */\n onAddToCart?: (product: ProductCardData) => void\n /** \u8BED\u4E49\u5316\u7C7B\u540D */\n classNames?: Partial<Record<ActiveShelfSemanticName, string>>\n}\n\n/**\n * ActiveShelf \u590D\u5408\u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49\n */\nexport interface ActiveShelfComponent extends React.ForwardRefExoticComponent<\n ActiveShelfProps & React.RefAttributes<HTMLDivElement>\n> {\n /** \u72EC\u7ACB\u7684 ProductCard \u7EC4\u4EF6 */\n ProductCard: typeof ProductCard\n}\n\n/**\n * \u4EA7\u54C1\u5217\u8868\u7EC4\u4EF6 Props\n */\ninterface ProductsListProps {\n products: ProductCardData[]\n layoutMode: ActiveShelfLayoutMode\n className?: string\n copy?: CopyConfig\n showTags?: boolean\n stockDisplayMode?: StockDisplayMode\n stockThresholdValue?: number\n onLearnMore?: (product: ProductCardData) => void\n onShopNow?: (product: ProductCardData) => void\n onAddToCart?: (product: ProductCardData) => void\n classNames?: Partial<Record<ActiveShelfSemanticName, string>>\n secondaryButtonText?: string\n secondaryButtonFun?: ButtonFunctionType\n primaryButtonText?: string\n primaryButtonFun?: ButtonFunctionType\n showOriginalPrice?: boolean\n}\n\n/**\n * \u4EA7\u54C1\u5217\u8868\u7EC4\u4EF6 - \u652F\u6301\u7F51\u683C\u548C\u6A2A\u5411\u6ED1\u52A8\u4E24\u79CD\u5E03\u5C40\n */\nconst ProductsList = React.forwardRef<HTMLDivElement, ProductsListProps>(\n (\n {\n products,\n layoutMode,\n className,\n copy,\n showTags,\n stockDisplayMode,\n stockThresholdValue,\n onLearnMore,\n onShopNow,\n onAddToCart,\n classNames,\n secondaryButtonText,\n secondaryButtonFun,\n primaryButtonText,\n primaryButtonFun,\n showOriginalPrice,\n },\n ref\n ) => {\n // \u751F\u6210\u552F\u4E00 ID\uFF0C\u79FB\u9664\u7279\u6B8A\u5B57\u7B26\u4EE5\u786E\u4FDD\u53EF\u7528\u4E8E CSS \u9009\u62E9\u5668\n const id = React.useId().replace(/:/g, '')\n // \u9884\u5B9A\u4E49\u5BFC\u822A\u6309\u94AE\u9009\u62E9\u5668\uFF0C\u907F\u514D\u591A\u6B21\u62FC\u63A5\n const nextButtonClass = `swiper-button-next-custom-${id}`\n const prevButtonClass = `swiper-button-prev-custom-${id}`\n\n // Swiper \u5BFC\u822A\u72B6\u6001\n const [swiperState, setSwiperState] = React.useState({\n isBeginning: true,\n isEnd: false,\n })\n\n // Swiper \u5B9E\u4F8B\u5F15\u7528\n const swiperRef = React.useRef<any>(null)\n\n // \u8BA1\u7B97\u5E76\u8BBE\u7F6E\u6240\u6709 slide \u4E3A\u6700\u9AD8\u9AD8\u5EA6\n const equalizeSlideHeights = React.useCallback(() => {\n const swiper = swiperRef.current\n if (!swiper?.slides || swiper.slides.length === 0) return\n\n // \u5148\u91CD\u7F6E\u6240\u6709 slide \u9AD8\u5EA6\u4EE5\u83B7\u53D6\u771F\u5B9E\u5185\u5BB9\u9AD8\u5EA6\n swiper.slides.forEach((slide: HTMLElement) => {\n slide.style.height = 'auto'\n })\n\n // \u8BA1\u7B97\u6700\u5927\u9AD8\u5EA6\n // @ts-ignore\n const heights = Array.from(swiper.slides).map((slide: HTMLElement) => slide.scrollHeight)\n const maxHeight = Math.max(...heights)\n\n // \u8BBE\u7F6E\u6240\u6709 slide \u4E3A\u6700\u5927\u9AD8\u5EA6\n if (maxHeight > 0) {\n swiper.slides.forEach((slide: HTMLElement) => {\n slide.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n // \u76D1\u542C\u7A97\u53E3 resize \u91CD\u65B0\u8BA1\u7B97\u9AD8\u5EA6\n React.useEffect(() => {\n const handleResize = () => {\n // \u4F7F\u7528 requestAnimationFrame \u786E\u4FDD DOM \u66F4\u65B0\u5B8C\u6210\n requestAnimationFrame(equalizeSlideHeights)\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [equalizeSlideHeights])\n\n if (products?.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={className}>\n {layoutMode === 'flex' ? (\n /* \u7F51\u683C\u5E03\u5C40 */\n <div className=\"lg-desktop:gap-4 tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-4 laptop:gap-4 grid grid-cols-1 justify-start gap-3\">\n {products.map((product, index) => (\n <ProductCard\n key={product.shopify_id + '-' + product.sku || index}\n product={product}\n className=\"shrink-0\"\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n copy={copy}\n />\n ))}\n </div>\n ) : (\n /* Swiper \u6A2A\u5411\u6ED1\u52A8\u5E03\u5C40 */\n <div className=\"group relative\">\n <Swiper\n modules={[Navigation]}\n spaceBetween={16}\n slidesPerView=\"auto\"\n navigation={{\n nextEl: `.${nextButtonClass}`,\n prevEl: `.${prevButtonClass}`,\n }}\n onSwiper={swiper => {\n swiperRef.current = swiper\n setSwiperState({\n isBeginning: swiper.isBeginning,\n isEnd: swiper.isEnd,\n })\n // \u5EF6\u8FDF\u6267\u884C\u4EE5\u786E\u4FDD\u5185\u5BB9\u6E32\u67D3\u5B8C\u6210\n setTimeout(equalizeSlideHeights, 100)\n }}\n onReachEnd={() => {\n setSwiperState(prev => ({ ...prev, isEnd: true }))\n }}\n onReachBeginning={() => {\n setSwiperState(prev => ({ ...prev, isBeginning: true }))\n }}\n onFromEdge={() => {\n setSwiperState({ isBeginning: false, isEnd: false })\n }}\n className=\"!overflow-visible\"\n >\n {products.map((product, index) => (\n <SwiperSlide\n key={product.shopify_id + '-' + product.sku || index}\n className=\"tablet:!w-[288px] desktop:!w-[316px] lg-desktop:!w-[404px] !w-[296px] overflow-hidden\"\n >\n <ProductCard\n product={product}\n className=\"w-full max-w-full\"\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n copy={copy}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n\n {/* \u81EA\u5B9A\u4E49\u5BFC\u822A\u6309\u94AE - \u9ED8\u8BA4\u9690\u85CF\uFF0Chover \u65F6\u663E\u793A\uFF0Cdisabled \u65F6\u9690\u85CF */}\n <button\n className={`${prevButtonClass} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${swiperState.isBeginning ? 'pointer-events-none opacity-0' : 'opacity-0 group-hover:opacity-100'}`}\n aria-label={copy?.previousSlideLabel}\n >\n <PrevIcon disabled={swiperState.isBeginning} />\n </button>\n <button\n className={`${nextButtonClass} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${swiperState.isEnd ? 'pointer-events-none opacity-0' : 'opacity-0 group-hover:opacity-100'}`}\n aria-label={copy?.nextSlideLabel}\n >\n <NextIcon disabled={swiperState.isEnd} />\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nProductsList.displayName = 'ProductsList'\n\n/**\n * ActiveShelf - \u6D3B\u52A8\u8D27\u67B6\n *\n * @description \u80FD\u591F\u5B9E\u65F6\u663E\u793A\u5546\u54C1\u5E93\u5B58\u4FE1\u606F\u548C\u4F1A\u5458\u4EF7\u7684\u8D27\u67B6\uFF0C\u652F\u6301\u54CD\u5E94\u5F0F\u5E03\u5C40\u548C\u591A\u79CD\u914D\u7F6E\u9009\u9879\n */\nconst ActiveShelf = React.forwardRef<HTMLDivElement, ActiveShelfProps>(\n ({ className, data, onLearnMore, onShopNow, onAddToCart, classNames, ...props }, ref) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: data.title,\n componentDescription: data.description,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n // \u4ECE data \u4E2D\u89E3\u6784\u914D\u7F6E\u9879\uFF0C\u5E76\u8BBE\u7F6E\u9ED8\u8BA4\u503C\n const {\n theme = 'light',\n layoutMode = 'flex',\n showTags = true,\n stockDisplayMode,\n stockThresholdValue,\n showOriginalPrice = true,\n secondaryButtonText,\n primaryButtonText,\n secondaryButtonFun,\n primaryButtonFun,\n isShowTab = true,\n copy,\n } = data\n\n // \u6784\u5EFA copy \u914D\u7F6E\uFF0C\u4F7F\u7528\u4F20\u5165\u7684 copy \u914D\u7F6E\n const finalCopy: CopyConfig = copy || {}\n\n // \u83B7\u53D6\u8981\u663E\u793A\u7684\u4EA7\u54C1\u6570\u636E\n const hasTabData = data.productsTab && data.productsTab.length > 0\n const shouldShowTab = isShowTab && hasTabData\n\n return (\n <div\n ref={boxRef}\n className={cn(\n 'w-full',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.root\n )}\n style={\n {\n '--progress-track-bg': theme === 'dark' ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)',\n } as React.CSSProperties\n }\n {...props}\n >\n {/* \u6807\u9898\u533A\u57DF */}\n {data.title && (\n <Heading as=\"h2\" html={data.title} size={4} className={cn('text-info-primary mb-4', classNames?.title)} />\n )}\n {data.description && (\n <Text\n size={3}\n as=\"p\"\n html={data.description}\n className={cn('text-info-primary mb-6', classNames?.description)}\n />\n )}\n\n {/* \u4EA7\u54C1\u5C55\u793A\u533A\u57DF */}\n\n <Tabs defaultValue={data.productsTab?.[0]?.id} className=\"w-full\">\n {shouldShowTab && (\n <TabsList className=\"mb-6\">\n {data.productsTab?.map(tab => (\n <TabsTrigger key={'tab-' + tab.id} value={tab.id}>\n {tab.tab}\n </TabsTrigger>\n ))}\n </TabsList>\n )}\n {shouldShowTab ? (\n data.productsTab?.map(tab => (\n <TabsContent key={'tab-content-' + tab.id} value={tab.id}>\n <ProductsList\n products={tab.data}\n layoutMode={layoutMode}\n copy={finalCopy}\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n />\n </TabsContent>\n ))\n ) : (\n <ProductsList\n products={data.productsCard}\n layoutMode={layoutMode}\n copy={finalCopy}\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n />\n )}\n </Tabs>\n </div>\n )\n }\n)\n\nActiveShelf.displayName = 'ActiveShelf'\n\n// \u521B\u5EFA\u590D\u5408\u7EC4\u4EF6\nconst ActiveShelfWithProductCard = ActiveShelf as ActiveShelfComponent\nActiveShelfWithProductCard.ProductCard = ProductCard\n\nexport default ActiveShelfWithProductCard\nexport type { StockDisplayMode, ActiveShelfSemanticName, ProductCardData }\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "Text", "Heading", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Swiper", "SwiperSlide", "Navigation", "ProductCard", "useExposure", "componentType", "componentName", "PrevIcon", "disabled", "NextIcon", "ProductsList", "products", "layoutMode", "className", "copy", "showTags", "stockDisplayMode", "stockThresholdValue", "onLearnMore", "onShopNow", "onAddToCart", "classNames", "secondaryButtonText", "secondaryButtonFun", "primaryButtonText", "primaryButtonFun", "showOriginalPrice", "ref", "id", "nextButtonClass", "prevButtonClass", "swiperState", "setSwiperState", "swiperRef", "equalizeSlideHeights", "swiper", "slide", "heights", "maxHeight", "handleResize", "product", "index", "prev", "ActiveShelf", "data", "props", "boxRef", "theme", "isShowTab", "finalCopy", "hasTabData", "shouldShowTab", "tab", "ActiveShelfWithProductCard", "ActiveShelf_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Text, Heading, Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/index.js'\n\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Navigation } from 'swiper/modules'\n\n// Import Swiper styles\nimport 'swiper/css'\nimport 'swiper/css/navigation'\nimport type { ButtonFunctionType, CopyConfig } from './types.js'\nimport {\n ProductCard,\n type ProductCardData,\n type ActiveShelfSemanticName,\n type StockDisplayMode,\n} from './ProductCard.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'active_shelf'\n\n/**\n * \u7EC4\u4EF6\u5E03\u5C40\u6A21\u5F0F\n */\nexport type ActiveShelfLayoutMode = 'flex' | 'horizontal'\n\n/**\n * Code Channel \u914D\u7F6E - \u6298\u6263\u524D\u7F00\n */\nexport type CodeChannelConfig = string\n\nconst PrevIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"56\"\n height=\"56\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]\"\n >\n <path\n d=\"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M31 22L25 28L31 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst NextIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"56\"\n height=\"56\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]\"\n >\n <path\n d=\"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M25 22L31 28L25 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\n/**\n * \u4EA7\u54C1\u5206\u7EC4Tab\u6570\u636E\u63A5\u53E3\n */\nexport interface ProductTab {\n /** Tab ID */\n id: string\n /** Tab \u6807\u9898 */\n tab: string\n /** \u8BE5\u5206\u7EC4\u4E0B\u7684\u4EA7\u54C1\u6570\u636E */\n data: ProductCardData[]\n}\n\n/**\n * ActiveShelf \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface ActiveShelfData {\n theme?: 'light' | 'dark'\n /** \u7EC4\u4EF6\u6807\u9898 */\n title?: string\n /** \u7EC4\u4EF6\u63CF\u8FF0 */\n description?: string\n /** \u5206\u7EC4\u4EA7\u54C1Tab\u5217\u8868 */\n productsTab?: ProductTab[]\n /** \u662F\u5426\u663E\u793A Tab\uFF08\u9ED8\u8BA4\uFF1Atrue\uFF09 */\n isShowTab?: boolean\n /** \u4E86\u89E3\u66F4\u591A\u6309\u94AE\u6587\u672C */\n secondaryButtonText?: string\n secondaryButtonFun: ButtonFunctionType\n /** \u7ACB\u5373\u8D2D\u4E70\u6309\u94AE\u6587\u672C */\n primaryButtonText?: string\n primaryButtonFun: ButtonFunctionType\n /** \u5E03\u5C40\u6A21\u5F0F\uFF1A\u7F51\u683C\u5E03\u5C40\u6216\u6A2A\u5411\u6ED1\u52A8 */\n layoutMode?: ActiveShelfLayoutMode\n /** Code Channel \u914D\u7F6E - \u6298\u6263\u524D\u7F00 */\n codeChannel?: CodeChannelConfig\n /** \u662F\u5426\u5C55\u793A\u4F1A\u5458\u4EF7\u683C */\n showMemberPrice?: boolean\n /** \u662F\u5426\u5C55\u793A\u6298\u6263\u6807\u7B7E */\n showDiscount?: boolean\n /** \u662F\u5426\u5C55\u793A\u6807\u7B7E\u7CFB\u7EDF */\n showTags?: boolean\n /** \u5E93\u5B58\u5C55\u793A\u6A21\u5F0F */\n stockDisplayMode?: StockDisplayMode\n /** \u5E93\u5B58\u9608\u503C\uFF08\u5F53\u6A21\u5F0F\u4E3A below-quantity \u6216 below-percentage \u65F6\u4F7F\u7528\uFF09 */\n stockThresholdValue?: number\n /**\n * \u5E93\u5B58\u6587\u672C\u6A21\u677F\uFF0C\u652F\u6301 {count} \u5360\u4F4D\u7B26\n */\n stockDisplayText?: string\n /** \u662F\u5426\u5C55\u793A\u539F\u4EF7\uFF08\u5220\u9664\u7EBF\u4EF7\u683C\uFF09 */\n showOriginalPrice?: boolean\n /** \u6587\u6848\u914D\u7F6E */\n copy?: CopyConfig\n /**\n * \u4EA7\u54C1\u5217\u8868\uFF08\u5F53\u4E0D\u4F7F\u7528 Tab \u5206\u7EC4\u65F6\u53EF\u76F4\u63A5\u4F20\u5165\u4EA7\u54C1\u5217\u8868\uFF09\n */\n productsCard: ProductCardData[]\n}\n\nexport interface ActiveShelfProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: ActiveShelfData\n /** \u70B9\u51FB\u4E86\u89E3\u66F4\u591A\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData) => void\n /** \u70B9\u51FB\u7ACB\u5373\u8D2D\u4E70\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData) => void\n /** \u70B9\u51FB\u52A0\u5165\u8D2D\u7269\u8F66\u56DE\u8C03 */\n onAddToCart?: (product: ProductCardData) => void\n /** \u8BED\u4E49\u5316\u7C7B\u540D */\n classNames?: Partial<Record<ActiveShelfSemanticName, string>>\n}\n\n/**\n * ActiveShelf \u590D\u5408\u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49\n */\nexport interface ActiveShelfComponent extends React.ForwardRefExoticComponent<\n ActiveShelfProps & React.RefAttributes<HTMLDivElement>\n> {\n /** \u72EC\u7ACB\u7684 ProductCard \u7EC4\u4EF6 */\n ProductCard: typeof ProductCard\n}\n\n/**\n * \u4EA7\u54C1\u5217\u8868\u7EC4\u4EF6 Props\n */\ninterface ProductsListProps {\n products: ProductCardData[]\n layoutMode: ActiveShelfLayoutMode\n className?: string\n copy?: CopyConfig\n showTags?: boolean\n stockDisplayMode?: StockDisplayMode\n stockThresholdValue?: number\n onLearnMore?: (product: ProductCardData) => void\n onShopNow?: (product: ProductCardData) => void\n onAddToCart?: (product: ProductCardData) => void\n classNames?: Partial<Record<ActiveShelfSemanticName, string>>\n secondaryButtonText?: string\n secondaryButtonFun?: ButtonFunctionType\n primaryButtonText?: string\n primaryButtonFun?: ButtonFunctionType\n showOriginalPrice?: boolean\n}\n\n/**\n * \u4EA7\u54C1\u5217\u8868\u7EC4\u4EF6 - \u652F\u6301\u7F51\u683C\u548C\u6A2A\u5411\u6ED1\u52A8\u4E24\u79CD\u5E03\u5C40\n */\nconst ProductsList = React.forwardRef<HTMLDivElement, ProductsListProps>(\n (\n {\n products,\n layoutMode,\n className,\n copy,\n showTags,\n stockDisplayMode,\n stockThresholdValue,\n onLearnMore,\n onShopNow,\n onAddToCart,\n classNames,\n secondaryButtonText,\n secondaryButtonFun,\n primaryButtonText,\n primaryButtonFun,\n showOriginalPrice,\n },\n ref\n ) => {\n // \u751F\u6210\u552F\u4E00 ID\uFF0C\u79FB\u9664\u7279\u6B8A\u5B57\u7B26\u4EE5\u786E\u4FDD\u53EF\u7528\u4E8E CSS \u9009\u62E9\u5668\n const id = React.useId().replace(/:/g, '')\n // \u9884\u5B9A\u4E49\u5BFC\u822A\u6309\u94AE\u9009\u62E9\u5668\uFF0C\u907F\u514D\u591A\u6B21\u62FC\u63A5\n const nextButtonClass = `swiper-button-next-custom-${id}`\n const prevButtonClass = `swiper-button-prev-custom-${id}`\n\n // Swiper \u5BFC\u822A\u72B6\u6001\n const [swiperState, setSwiperState] = React.useState({\n isBeginning: true,\n isEnd: false,\n })\n\n // Swiper \u5B9E\u4F8B\u5F15\u7528\n const swiperRef = React.useRef<any>(null)\n\n // \u8BA1\u7B97\u5E76\u8BBE\u7F6E\u6240\u6709 slide \u4E3A\u6700\u9AD8\u9AD8\u5EA6\n const equalizeSlideHeights = React.useCallback(() => {\n const swiper = swiperRef.current\n if (!swiper?.slides || swiper.slides.length === 0) return\n\n // \u5148\u91CD\u7F6E\u6240\u6709 slide \u9AD8\u5EA6\u4EE5\u83B7\u53D6\u771F\u5B9E\u5185\u5BB9\u9AD8\u5EA6\n swiper.slides.forEach((slide: HTMLElement) => {\n slide.style.height = 'auto'\n })\n\n // \u8BA1\u7B97\u6700\u5927\u9AD8\u5EA6\n // @ts-ignore\n const heights = Array.from(swiper.slides).map((slide: HTMLElement) => slide.scrollHeight)\n const maxHeight = Math.max(...heights)\n\n // \u8BBE\u7F6E\u6240\u6709 slide \u4E3A\u6700\u5927\u9AD8\u5EA6\n if (maxHeight > 0) {\n swiper.slides.forEach((slide: HTMLElement) => {\n slide.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n // \u76D1\u542C\u7A97\u53E3 resize \u91CD\u65B0\u8BA1\u7B97\u9AD8\u5EA6\n React.useEffect(() => {\n const handleResize = () => {\n // \u4F7F\u7528 requestAnimationFrame \u786E\u4FDD DOM \u66F4\u65B0\u5B8C\u6210\n requestAnimationFrame(equalizeSlideHeights)\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [equalizeSlideHeights])\n\n if (products?.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={className}>\n {layoutMode === 'flex' ? (\n /* \u7F51\u683C\u5E03\u5C40 */\n <div className=\"lg-desktop:gap-4 tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-4 laptop:gap-4 grid grid-cols-1 justify-start gap-3\">\n {products.map((product, index) => (\n <ProductCard\n key={product.shopify_id + '-' + product.sku || index}\n product={product}\n className=\"shrink-0\"\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n copy={copy}\n />\n ))}\n </div>\n ) : (\n /* Swiper \u6A2A\u5411\u6ED1\u52A8\u5E03\u5C40 */\n <div className=\"group relative\">\n <Swiper\n modules={[Navigation]}\n spaceBetween={16}\n slidesPerView=\"auto\"\n navigation={{\n nextEl: `.${nextButtonClass}`,\n prevEl: `.${prevButtonClass}`,\n }}\n onSwiper={swiper => {\n swiperRef.current = swiper\n setSwiperState({\n isBeginning: swiper.isBeginning,\n isEnd: swiper.isEnd,\n })\n // \u5EF6\u8FDF\u6267\u884C\u4EE5\u786E\u4FDD\u5185\u5BB9\u6E32\u67D3\u5B8C\u6210\n setTimeout(equalizeSlideHeights, 100)\n }}\n onReachEnd={() => {\n setSwiperState(prev => ({ ...prev, isEnd: true }))\n }}\n onReachBeginning={() => {\n setSwiperState(prev => ({ ...prev, isBeginning: true }))\n }}\n onFromEdge={() => {\n setSwiperState({ isBeginning: false, isEnd: false })\n }}\n className=\"!overflow-visible\"\n >\n {products.map((product, index) => (\n <SwiperSlide\n key={product.shopify_id + '-' + product.sku || index}\n className=\"tablet:!w-[288px] desktop:!w-[316px] lg-desktop:!w-[404px] !w-[296px] overflow-hidden\"\n >\n <ProductCard\n product={product}\n className=\"w-full max-w-full\"\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n copy={copy}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n\n {/* \u81EA\u5B9A\u4E49\u5BFC\u822A\u6309\u94AE - \u9ED8\u8BA4\u9690\u85CF\uFF0Chover \u65F6\u663E\u793A\uFF0Cdisabled \u65F6\u9690\u85CF */}\n <button\n className={`${prevButtonClass} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${swiperState.isBeginning ? 'pointer-events-none opacity-0' : 'opacity-0 group-hover:opacity-100'}`}\n aria-label={copy?.previousSlideLabel}\n >\n <PrevIcon disabled={swiperState.isBeginning} />\n </button>\n <button\n className={`${nextButtonClass} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${swiperState.isEnd ? 'pointer-events-none opacity-0' : 'opacity-0 group-hover:opacity-100'}`}\n aria-label={copy?.nextSlideLabel}\n >\n <NextIcon disabled={swiperState.isEnd} />\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nProductsList.displayName = 'ProductsList'\n\n/**\n * ActiveShelf - \u6D3B\u52A8\u8D27\u67B6\n *\n * @description \u80FD\u591F\u5B9E\u65F6\u663E\u793A\u5546\u54C1\u5E93\u5B58\u4FE1\u606F\u548C\u4F1A\u5458\u4EF7\u7684\u8D27\u67B6\uFF0C\u652F\u6301\u54CD\u5E94\u5F0F\u5E03\u5C40\u548C\u591A\u79CD\u914D\u7F6E\u9009\u9879\n */\nconst ActiveShelf = React.forwardRef<HTMLDivElement, ActiveShelfProps>(\n ({ className, data, onLearnMore, onShopNow, onAddToCart, classNames, ...props }, ref) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: data.title,\n componentDescription: data.description,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n // \u4ECE data \u4E2D\u89E3\u6784\u914D\u7F6E\u9879\uFF0C\u5E76\u8BBE\u7F6E\u9ED8\u8BA4\u503C\n const {\n theme = 'light',\n layoutMode = 'flex',\n showTags = true,\n stockDisplayMode,\n stockThresholdValue,\n showOriginalPrice = true,\n secondaryButtonText,\n primaryButtonText,\n secondaryButtonFun,\n primaryButtonFun,\n isShowTab = true,\n copy,\n } = data\n\n // \u6784\u5EFA copy \u914D\u7F6E\uFF0C\u4F7F\u7528\u4F20\u5165\u7684 copy \u914D\u7F6E\n const finalCopy: CopyConfig = copy || {}\n\n // \u83B7\u53D6\u8981\u663E\u793A\u7684\u4EA7\u54C1\u6570\u636E\n const hasTabData = data.productsTab && data.productsTab.length > 0\n const shouldShowTab = isShowTab && hasTabData\n\n return (\n <div\n ref={boxRef}\n className={cn(\n 'w-full',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.root\n )}\n style={\n {\n '--progress-track-bg': theme === 'dark' ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)',\n } as React.CSSProperties\n }\n {...props}\n >\n {/* \u6807\u9898\u533A\u57DF */}\n {data.title && (\n <Heading as=\"h2\" html={data.title} size={4} className={cn('text-info-primary mb-4', classNames?.title)} />\n )}\n {data.description && (\n <Text\n size={3}\n as=\"p\"\n html={data.description}\n className={cn('text-info-primary mb-6', classNames?.description)}\n />\n )}\n\n {/* \u4EA7\u54C1\u5C55\u793A\u533A\u57DF */}\n\n <Tabs defaultValue={data.productsTab?.[0]?.id} className=\"w-full\">\n {shouldShowTab && (\n <TabsList className=\"mb-6\">\n {data.productsTab?.map(tab => (\n <TabsTrigger key={'tab-' + tab.id} value={tab.id}>\n {tab.tab}\n </TabsTrigger>\n ))}\n </TabsList>\n )}\n {shouldShowTab ? (\n data.productsTab?.map(tab => (\n <TabsContent key={'tab-content-' + tab.id} value={tab.id}>\n <ProductsList\n products={tab.data}\n layoutMode={layoutMode}\n copy={finalCopy}\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n />\n </TabsContent>\n ))\n ) : (\n <ProductsList\n products={data.productsCard}\n layoutMode={layoutMode}\n copy={finalCopy}\n showTags={showTags}\n stockDisplayMode={stockDisplayMode}\n stockThresholdValue={stockThresholdValue}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onAddToCart={onAddToCart}\n classNames={classNames}\n secondaryButtonText={secondaryButtonText}\n secondaryButtonFun={secondaryButtonFun}\n primaryButtonText={primaryButtonText}\n primaryButtonFun={primaryButtonFun}\n showOriginalPrice={showOriginalPrice}\n />\n )}\n </Tabs>\n </div>\n )\n }\n)\n\nActiveShelf.displayName = 'ActiveShelf'\n\n// \u521B\u5EFA\u590D\u5408\u7EC4\u4EF6\nconst ActiveShelfWithProductCard = ActiveShelf as ActiveShelfComponent\nActiveShelfWithProductCard.ProductCard = ProductCard\n\nconst ActiveShelfWrapped = withLayout(ActiveShelfWithProductCard)\n\nexport default ActiveShelfWrapped\nexport type { StockDisplayMode, ActiveShelfSemanticName, ProductCardData }\n"],
|
|
5
|
+
"mappings": "aAoCE,OAQE,OAAAA,EARF,QAAAC,MAAA,oBAlCF,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,QAAAC,EAAM,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,eAAAC,MAAmB,4BAExE,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,eACpC,OAAS,cAAAC,MAAkB,iBAG3B,MAAO,aACP,MAAO,wBA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AA0C,MAAOqD,EAAI,GACpD,SAAA/D,EAACqB,EAAA,CACC,SAAU0C,EAAI,KACd,WAAYxC,EACZ,KAAMqC,EACN,SAAUlC,EACV,iBAAkBC,EAClB,oBAAqBC,EACrB,YAAaC,EACb,UAAWC,EACX,YAAaC,EACb,WAAYC,EACZ,oBAAqBC,EACrB,mBAAoBC,EACpB,kBAAmBC,EACnB,iBAAkBC,EAClB,kBAAmBC,EACrB,GAjBgB,eAAiB0B,EAAI,EAkBvC,CACD,EAED/D,EAACqB,EAAA,CACC,SAAUkC,EAAK,aACf,WAAYhC,EACZ,KAAMqC,EACN,SAAUlC,EACV,iBAAkBC,EAClB,oBAAqBC,EACrB,YAAaC,EACb,UAAWC,EACX,YAAaC,EACb,WAAYC,EACZ,oBAAqBC,EACrB,mBAAoBC,EACpB,kBAAmBC,EACnB,iBAAkBC,EAClB,kBAAmBC,EACrB,GAEJ,GACF,CAEJ,CACF,EAEAiB,EAAY,YAAc,cAG1B,MAAMU,EAA6BV,EACnCU,EAA2B,YAAclD,EAEzC,MAAMmD,EAAqB7D,EAAW4D,CAA0B,EAEhE,IAAOE,GAAQD",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "withLayout", "Text", "Heading", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Swiper", "SwiperSlide", "Navigation", "ProductCard", "useExposure", "componentType", "componentName", "PrevIcon", "disabled", "NextIcon", "ProductsList", "products", "layoutMode", "className", "copy", "showTags", "stockDisplayMode", "stockThresholdValue", "onLearnMore", "onShopNow", "onAddToCart", "classNames", "secondaryButtonText", "secondaryButtonFun", "primaryButtonText", "primaryButtonFun", "showOriginalPrice", "ref", "id", "nextButtonClass", "prevButtonClass", "swiperState", "setSwiperState", "swiperRef", "equalizeSlideHeights", "swiper", "slide", "heights", "maxHeight", "handleResize", "product", "index", "prev", "ActiveShelf", "data", "props", "boxRef", "theme", "isShowTab", "finalCopy", "hasTabData", "shouldShowTab", "tab", "ActiveShelfWithProductCard", "ActiveShelfWrapped", "ActiveShelf_default"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ActivityScheduleProps } from './types.js';
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ActivityScheduleProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
4
|
export default _default;
|
|
3
5
|
export type { ActivityScheduleProps, ActivityScheduleData, ActivityScheduleItem } from './types.js';
|
|
@@ -60,5 +60,5 @@ export interface AnchorNavigationProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
60
60
|
*/
|
|
61
61
|
buttonStyle?: AnchorButtonStyle;
|
|
62
62
|
}
|
|
63
|
-
declare const _default:
|
|
63
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<AnchorNavigationProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
64
|
export default _default;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Img } from '../../types/props.js';
|
|
2
|
+
type AplusItem = {
|
|
3
|
+
img: Img;
|
|
4
|
+
mobileImg: Img;
|
|
5
|
+
title: string;
|
|
6
|
+
desc: string;
|
|
7
|
+
theme: 'light' | 'dark';
|
|
8
|
+
};
|
|
9
|
+
interface AplusDescType extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
data: {
|
|
11
|
+
title: string;
|
|
12
|
+
img: Img;
|
|
13
|
+
mobileImg: Img;
|
|
14
|
+
list: AplusItem[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<AplusDescType, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & import("react").RefAttributes<unknown>>;
|
|
2
18
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BrandCardLinkProps } from './types.js';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<BrandCardLinkProps & import("react").RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BrandEquityProps } from './types.js';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<BrandEquityProps & import("react").RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
3
|
export default _default;
|
|
@@ -27,5 +27,5 @@ export interface CategoryProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
27
27
|
};
|
|
28
28
|
key?: string;
|
|
29
29
|
}
|
|
30
|
-
declare const _default:
|
|
30
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<CategoryProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
31
|
export default _default;
|
|
@@ -7,5 +7,11 @@ export type CreativeModuleDataType = {
|
|
|
7
7
|
theme: 'light' | 'dark';
|
|
8
8
|
span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
interface CreativeModuleType extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
data: {
|
|
12
|
+
shape?: 'rounded' | 'square';
|
|
13
|
+
productsTab: CreativeModuleDataType[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<CreativeModuleType, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & import("react").RefAttributes<unknown>>;
|
|
11
17
|
export default _default;
|
|
@@ -7,5 +7,10 @@ export type DownLoadDataType = {
|
|
|
7
7
|
line: Img;
|
|
8
8
|
icon: Img;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
interface DownLoadType extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
data: {
|
|
12
|
+
list: DownLoadDataType[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<DownLoadType, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & import("react").RefAttributes<unknown>>;
|
|
11
16
|
export default _default;
|
|
@@ -29,5 +29,5 @@ export interface EvaluateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
29
|
};
|
|
30
30
|
key?: string;
|
|
31
31
|
}
|
|
32
|
-
declare const _default:
|
|
32
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<EvaluateProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
33
|
export default _default;
|
|
@@ -60,10 +60,5 @@ export interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
60
60
|
data: EventScheduleData;
|
|
61
61
|
classNames?: Partial<Record<EventScheduleSemanticName, string>>;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
* @description 显示活动日程时间轴和活动卡片列表
|
|
67
|
-
*/
|
|
68
|
-
declare const EventSchedule: React.ForwardRefExoticComponent<EventScheduleProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
|
-
export default EventSchedule;
|
|
63
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<EventScheduleProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as h}from"react/jsx-runtime";import*as i from"react";import{cn as g}from"../../helpers/index.js";import{Text as D,Picture as
|
|
1
|
+
"use client";import{jsx as s,jsxs as h}from"react/jsx-runtime";import*as i from"react";import{cn as g}from"../../helpers/index.js";import{withLayout as R}from"../../shared/Styles.js";import{Text as D,Picture as z,Heading as j,Container as H}from"../../components/index.js";import{Swiper as L,SwiperSlide as F}from"swiper/react";import w from"dayjs";import{cva as b}from"class-variance-authority";const x=(r,t)=>{const d=w(),c=w(r).startOf("day"),u=w(t).endOf("day");return d.isAfter(u)?"completed":d.isBefore(c)?"not-started":"in-progress"},$=b("h-1 w-full overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),O=b("size-4 rounded-full transition-colors",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),k=b("font-bold leading-[1.2]",{variants:{state:{"in-progress-light":"text-[#080A0F]","in-progress-dark":"text-white","not-started-light":"text-[#080A0F]","not-started-dark":"text-[#F5F6F7]","completed-light":"text-[#4A4C56]/60","completed-dark":"text-[#F5F6F7]/60"}},defaultVariants:{state:"not-started-light"}}),q=b("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F4E8BC]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F4E8BC]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),G=({timeStatus:r,theme:t="light",className:d,index:c,nodeLength:u})=>{const o=`${r}-${t}`,n=c===0,a=c===u-1;return h("div",{className:"relative my-2 flex h-1 w-full items-center justify-center",children:[s("div",{className:g($({state:o}),n&&"rounded-l-full",a&&"rounded-r-full",d)}),s("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:s("div",{className:O({state:o})})})]})},J=(r,t)=>{if(r)return t==="in-progress"?r.active:t==="completed"&&r.completed||r.inactive},K=({timeStatus:r,item:t,theme:d="light",className:c,scheduleCount:u})=>{const o=i.useMemo(()=>J(t.icon,r),[t.icon,r]),n=`${r}-${d}`;return h("div",{className:g(q({state:n}),c),children:[o&&s("div",{className:"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]",children:s(z,{source:o.url,alt:o.alt,className:"aspect-square"})}),h("div",{className:"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8",children:[s(j,{html:t.title,className:g(u>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",k({state:n}))}),s("div",{className:"flex flex-col gap-0.5",children:t.items.map((a,l)=>h("div",{className:"flex items-center gap-2",children:[a.icon&&s(D,{className:g("desktop:size-6 size-5 shrink-0",k({state:n})),html:a.icon}),s(D,{html:a.label,className:g("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]",k({state:n}))})]},l))})]})]})},V=i.forwardRef(({classNames:r={},data:t,className:d,...c},u)=>{const o=t.theme||"light",n=i.useRef(null),a=i.useRef(null),l=i.useRef(!1),f=i.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),S=i.useMemo(()=>t.scheduleList.findIndex(e=>x(e.startDate,e.endDate)==="in-progress"),[t.scheduleList]),v=i.useCallback((e,m=!1)=>{const p=P=>{switch(P){case"mobile":return{slidesPerView:1.17};case"tablet":return e===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return e===2?{}:e===4?{slidesPerView:3.2}:{slidesPerView:e};case"desktop":return e===2?{slidesPerView:2}:{slidesPerView:e}}},T=p("mobile"),C=p("tablet"),N=p("laptop"),y=p("desktop");return m?{0:{...T,spaceBetween:12},768:{...C,spaceBetween:12},1024:{...N,spaceBetween:16},1440:{...y,spaceBetween:16}}:{0:T,768:C,1024:N,1440:y}},[]),A=i.useMemo(()=>v(f,!0),[f,v]),I=i.useMemo(()=>v(f,!1),[f,v]),E=t.showTimeline!==!1,M=i.useCallback(e=>{l.current||!a.current||(l.current=!0,a.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{l.current=!1},50))},[]),B=i.useCallback(e=>{l.current||!n.current||(l.current=!0,n.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{l.current=!1},50))},[]);return i.useEffect(()=>{n.current&&a.current&&S>=0&&setTimeout(()=>{l.current=!0,n.current?.slideTo(S,500),a.current?.slideTo(S,500),setTimeout(()=>{l.current=!1},600)},100)},[S]),h(H,{...c,ref:u,className:g("overflow-hidden",r?.root,d),children:[E&&s(L,{breakpoints:I,className:"h-4 w-full !overflow-visible",onSwiper:e=>{a.current=e},onSlideChange:B,children:t.scheduleList.map((e,m)=>{const p=x(e.startDate,e.endDate);return s(F,{className:"",children:s(G,{className:r?.timeline,timeStatus:p,theme:o,index:m,nodeLength:t.scheduleList.length})},"timelineNode"+m)})}),s(L,{breakpoints:A,className:"w-full !overflow-visible",onSwiper:e=>{n.current=e},onSlideChange:M,children:t.scheduleList.map((e,m)=>{const p=x(e.startDate,e.endDate);return s(F,{children:s(K,{timeStatus:p,className:g(E?"laptop:mt-4 mt-2":"",r?.eventScheduleCard),item:e,theme:o,scheduleCount:t.scheduleList.length})},"SwiperSlideItem"+m)})})]})});V.displayName="EventSchedule";var _=R(V);export{_ as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/EventSchedule/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Heading, Container } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u65F6\u95F4\u72B6\u6001\u7C7B\u578B\n */\nexport type TimeStatus = 'completed' | 'in-progress' | 'not-started'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807\uFF08\u8FDB\u884C\u4E2D\uFF09 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807\uFF08\u672A\u5F00\u59CB\uFF09 */\n inactive: Media\n /** \u5DF2\u5B8C\u6210\u72B6\u6001\u7684\u56FE\u6807\uFF08\u53EF\u9009\uFF0C\u4E0D\u63D0\u4F9B\u5219\u4F7F\u7528 inactive\uFF09 */\n completed?: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: string\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u83B7\u53D6\u65F6\u95F4\u72B6\u6001\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u65F6\u95F4\u72B6\u6001\uFF1Acompleted\uFF08\u5DF2\u5B8C\u6210\uFF09\u3001in-progress\uFF08\u8FDB\u884C\u4E2D\uFF09\u3001not-started\uFF08\u672A\u5F00\u59CB\uFF09\n */\nconst getTimeStatus = (startDate: string, endDate: string): TimeStatus => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u7ED3\u675F\u65F6\u95F4\u4E4B\u540E - \u5DF2\u5B8C\u6210\n if (now.isAfter(end)) {\n return 'completed'\n }\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u5F00\u59CB\u65F6\u95F4\u4E4B\u524D - \u672A\u5F00\u59CB\n if (now.isBefore(start)) {\n return 'not-started'\n }\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u5F00\u59CB\u548C\u7ED3\u675F\u4E4B\u95F4 - \u8FDB\u884C\u4E2D\n return 'in-progress'\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst timelineProgressActiveVariants = cva('h-1 w-full overflow-hidden', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F6CD4E]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\n 'completed-light': 'bg-[#F6CD4E]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F6CD4E]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\uFF08\u4E0E\u8FDB\u884C\u4E2D\u989C\u8272\u4E00\u81F4\uFF09\n 'completed-light': 'bg-[#F6CD4E]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\uFF08\u4FDD\u6301\u539F\u6709\u989C\u8272\uFF09\n 'in-progress-light': 'text-[#080A0F]',\n 'in-progress-dark': 'text-white',\n // \u672A\u5F00\u59CB\uFF0860% \u900F\u660E\u5EA6\uFF09\n 'not-started-light': 'text-[#080A0F]',\n 'not-started-dark': 'text-[#F5F6F7]',\n // \u5DF2\u5B8C\u6210\uFF0860% \u900F\u660E\u5EA6\uFF09\n 'completed-light': 'text-[#4A4C56]/60',\n 'completed-dark': 'text-[#F5F6F7]/60',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F4E8BC]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\n 'completed-light': 'bg-[#F4E8BC]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u65F6\u95F4\u72B6\u6001 */\n timeStatus: TimeStatus\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ timeStatus, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${timeStatus}-${theme}` as\n | 'in-progress-light'\n | 'in-progress-dark'\n | 'not-started-light'\n | 'not-started-dark'\n | 'completed-light'\n | 'completed-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-2 flex h-1 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u65F6\u95F4\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param timeStatus \u65F6\u95F4\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByTimeStatus = (icon: StateIcon | undefined, timeStatus: TimeStatus): Media | undefined => {\n if (!icon) return undefined\n // \u8FDB\u884C\u4E2D\u4F7F\u7528 active \u56FE\u6807\n if (timeStatus === 'in-progress') return icon.active\n // \u5DF2\u5B8C\u6210\u4F7F\u7528 completed \u56FE\u6807\uFF08\u5982\u679C\u6709\uFF09\uFF0C\u5426\u5219\u4F7F\u7528 inactive\n if (timeStatus === 'completed') return icon.completed || icon.inactive\n // \u672A\u5F00\u59CB\u4F7F\u7528 inactive \u56FE\u6807\n return icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n timeStatus,\n item,\n theme = 'light',\n className,\n scheduleCount,\n}: {\n timeStatus: TimeStatus\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n scheduleCount: number\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByTimeStatus(item.icon, timeStatus)\n }, [item.icon, timeStatus])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${timeStatus}-${theme}` as\n | 'in-progress-light'\n | 'in-progress-dark'\n | 'not-started-light'\n | 'not-started-dark'\n | 'completed-light'\n | 'completed-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8\">\n <Heading\n html={item.title}\n className={cn(\n scheduleCount >= 4 ? 'desktop:text-[24px]' : 'desktop:text-[32px]',\n 'laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <Text\n className={cn('desktop:size-6 size-5 shrink-0', cardTextVariants({ state: cardState }))}\n html={detail.icon}\n />\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(\n ({ classNames = {}, data, className, ...rest }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97\u8FDB\u884C\u4E2D item \u7684\u7D22\u5F15\uFF08\u7528\u4E8E\u81EA\u52A8\u6EDA\u52A8\uFF09\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return timeStatus === 'in-progress'\n })\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: 12 },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <Container {...rest} ref={ref} className={cn('overflow-hidden', classNames?.root, className)}>\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n timeStatus={timeStatus}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n timeStatus={timeStatus}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n scheduleCount={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </Container>\n )\n }\n)\n\nEventSchedule.displayName = 'EventSchedule'\nexport default EventSchedule\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "Text", "Picture", "Heading", "Container", "Swiper", "SwiperSlide", "dayjs", "cva", "getTimeStatus", "startDate", "endDate", "now", "start", "end", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "timeStatus", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByTimeStatus", "icon", "EventScheduleCard", "item", "scheduleCount", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "rest", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange", "EventSchedule_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Text, Picture, Heading, Container } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u65F6\u95F4\u72B6\u6001\u7C7B\u578B\n */\nexport type TimeStatus = 'completed' | 'in-progress' | 'not-started'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807\uFF08\u8FDB\u884C\u4E2D\uFF09 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807\uFF08\u672A\u5F00\u59CB\uFF09 */\n inactive: Media\n /** \u5DF2\u5B8C\u6210\u72B6\u6001\u7684\u56FE\u6807\uFF08\u53EF\u9009\uFF0C\u4E0D\u63D0\u4F9B\u5219\u4F7F\u7528 inactive\uFF09 */\n completed?: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: string\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u83B7\u53D6\u65F6\u95F4\u72B6\u6001\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u65F6\u95F4\u72B6\u6001\uFF1Acompleted\uFF08\u5DF2\u5B8C\u6210\uFF09\u3001in-progress\uFF08\u8FDB\u884C\u4E2D\uFF09\u3001not-started\uFF08\u672A\u5F00\u59CB\uFF09\n */\nconst getTimeStatus = (startDate: string, endDate: string): TimeStatus => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u7ED3\u675F\u65F6\u95F4\u4E4B\u540E - \u5DF2\u5B8C\u6210\n if (now.isAfter(end)) {\n return 'completed'\n }\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u5F00\u59CB\u65F6\u95F4\u4E4B\u524D - \u672A\u5F00\u59CB\n if (now.isBefore(start)) {\n return 'not-started'\n }\n\n // \u5F53\u524D\u65F6\u95F4\u5728\u5F00\u59CB\u548C\u7ED3\u675F\u4E4B\u95F4 - \u8FDB\u884C\u4E2D\n return 'in-progress'\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst timelineProgressActiveVariants = cva('h-1 w-full overflow-hidden', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F6CD4E]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\n 'completed-light': 'bg-[#F6CD4E]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F6CD4E]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\uFF08\u4E0E\u8FDB\u884C\u4E2D\u989C\u8272\u4E00\u81F4\uFF09\n 'completed-light': 'bg-[#F6CD4E]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\uFF08\u4FDD\u6301\u539F\u6709\u989C\u8272\uFF09\n 'in-progress-light': 'text-[#080A0F]',\n 'in-progress-dark': 'text-white',\n // \u672A\u5F00\u59CB\uFF0860% \u900F\u660E\u5EA6\uFF09\n 'not-started-light': 'text-[#080A0F]',\n 'not-started-dark': 'text-[#F5F6F7]',\n // \u5DF2\u5B8C\u6210\uFF0860% \u900F\u660E\u5EA6\uFF09\n 'completed-light': 'text-[#4A4C56]/60',\n 'completed-dark': 'text-[#F5F6F7]/60',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\uFF08\u652F\u6301\u4E09\u79CD\u65F6\u95F4\u72B6\u6001\uFF09\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n // \u8FDB\u884C\u4E2D\n 'in-progress-light': 'bg-[#F4E8BC]',\n 'in-progress-dark': 'bg-[#D79941]',\n // \u672A\u5F00\u59CB\n 'not-started-light': 'bg-[#EAEAEC]',\n 'not-started-dark': 'bg-[#1E2024]',\n // \u5DF2\u5B8C\u6210\n 'completed-light': 'bg-[#F4E8BC]',\n 'completed-dark': 'bg-[#D79941]',\n },\n },\n defaultVariants: {\n state: 'not-started-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u65F6\u95F4\u72B6\u6001 */\n timeStatus: TimeStatus\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ timeStatus, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${timeStatus}-${theme}` as\n | 'in-progress-light'\n | 'in-progress-dark'\n | 'not-started-light'\n | 'not-started-dark'\n | 'completed-light'\n | 'completed-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-2 flex h-1 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u65F6\u95F4\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param timeStatus \u65F6\u95F4\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByTimeStatus = (icon: StateIcon | undefined, timeStatus: TimeStatus): Media | undefined => {\n if (!icon) return undefined\n // \u8FDB\u884C\u4E2D\u4F7F\u7528 active \u56FE\u6807\n if (timeStatus === 'in-progress') return icon.active\n // \u5DF2\u5B8C\u6210\u4F7F\u7528 completed \u56FE\u6807\uFF08\u5982\u679C\u6709\uFF09\uFF0C\u5426\u5219\u4F7F\u7528 inactive\n if (timeStatus === 'completed') return icon.completed || icon.inactive\n // \u672A\u5F00\u59CB\u4F7F\u7528 inactive \u56FE\u6807\n return icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n timeStatus,\n item,\n theme = 'light',\n className,\n scheduleCount,\n}: {\n timeStatus: TimeStatus\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n scheduleCount: number\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByTimeStatus(item.icon, timeStatus)\n }, [item.icon, timeStatus])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${timeStatus}-${theme}` as\n | 'in-progress-light'\n | 'in-progress-dark'\n | 'not-started-light'\n | 'not-started-dark'\n | 'completed-light'\n | 'completed-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8\">\n <Heading\n html={item.title}\n className={cn(\n scheduleCount >= 4 ? 'desktop:text-[24px]' : 'desktop:text-[32px]',\n 'laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <Text\n className={cn('desktop:size-6 size-5 shrink-0', cardTextVariants({ state: cardState }))}\n html={detail.icon}\n />\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(\n ({ classNames = {}, data, className, ...rest }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97\u8FDB\u884C\u4E2D item \u7684\u7D22\u5F15\uFF08\u7528\u4E8E\u81EA\u52A8\u6EDA\u52A8\uFF09\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return timeStatus === 'in-progress'\n })\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: 12 },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <Container {...rest} ref={ref} className={cn('overflow-hidden', classNames?.root, className)}>\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n timeStatus={timeStatus}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const timeStatus = getTimeStatus(item.startDate, item.endDate)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n timeStatus={timeStatus}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n scheduleCount={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </Container>\n )\n }\n)\n\nEventSchedule.displayName = 'EventSchedule'\nexport default withLayout(EventSchedule)\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
|
|
5
|
+
"mappings": "aAmOI,OAEE,OAAAA,EAFF,QAAAC,MAAA,oBAjOJ,UAAY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B,IAAOwB,EAAQ5D,EAAWoC,CAAa",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "withLayout", "Text", "Picture", "Heading", "Container", "Swiper", "SwiperSlide", "dayjs", "cva", "getTimeStatus", "startDate", "endDate", "now", "start", "end", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "timeStatus", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByTimeStatus", "icon", "EventScheduleCard", "item", "scheduleCount", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "rest", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange", "EventSchedule_default"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js';
|
|
2
3
|
interface FaqItemProps {
|
|
3
4
|
data: ItemType;
|
|
4
5
|
defaultOpen?: boolean;
|
|
@@ -8,6 +9,6 @@ declare const FaqItem: {
|
|
|
8
9
|
({ data, defaultOpen, classNames }: FaqItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
11
|
-
declare const _default:
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<FaqProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
export default _default;
|
|
13
14
|
export { FaqItem };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FeatureCardsProps } from './types.js';
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<FeatureCardsProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
4
|
export default _default;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FeatureShowcaseProps } from './types.js';
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<FeatureShowcaseProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
4
|
export default _default;
|
|
@@ -47,10 +47,5 @@ export interface FeaturedBlogPostsProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
47
47
|
/** 卡片点击回调 */
|
|
48
48
|
onItemClick?: (item: FeaturedBlogPostItem, index: number, event: React.MouseEvent) => void;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
* FeaturedBlogPosts - 精选博文
|
|
52
|
-
*
|
|
53
|
-
* @description 展示经过筛选的优质文章,支持不同宽度和布局的卡片组合
|
|
54
|
-
*/
|
|
55
|
-
declare const FeaturedBlogPosts: React.ForwardRefExoticComponent<FeaturedBlogPostsProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
declare const FeaturedBlogPosts: React.ForwardRefExoticComponent<Omit<FeaturedBlogPostsProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
51
|
export default FeaturedBlogPosts;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as p}from"react/jsx-runtime";import*as u from"react";import{cn as r}from"../../helpers/index.js";import y from"../../components/picture.js";import{Heading as h,Text as m}from"../../index.js";import"../../shared/Styles.js";const
|
|
1
|
+
"use client";import{jsx as l,jsxs as p}from"react/jsx-runtime";import*as u from"react";import{cn as r}from"../../helpers/index.js";import y from"../../components/picture.js";import{Heading as h,Text as m}from"../../index.js";import{withLayout as P}from"../../shared/Styles.js";const F=o=>{const t=[{key:"lgDesktop",width:1920},{key:"desktop",width:1440},{key:"laptop",width:1024},{key:"pad",width:768},{key:"mobile",width:390}],s=t.filter(({key:a})=>o[a]?.url).map(({key:a,width:d})=>`${o[a].url} ${d}`);if(s.length>0)return s.join(", ");for(const{key:a}of t)if(o[a]?.url)return o[a].url;return""},B=(o,t)=>{const s=["desktop","laptop","pad","mobile","lgDesktop"];for(const a of s)if(o[a]?.alt)return o[a].alt;return t},I=(o="full")=>({full:"laptop:col-span-3","2/3":"laptop:col-span-2","1/3":"laptop:col-span-1"})[o],w=(o="full")=>o==="1/3"?"":"laptop:flex-row",R=(o="full")=>({full:"laptop:h-full laptop:w-2/3","2/3":"laptop:h-full laptop:w-1/2","1/3":"laptop:flex-1 h-[200px] lg-desktop:h-[240px]"})[o],k=u.forwardRef(({className:o,classNames:t={},data:s,onItemClick:a,...d},x)=>{const{title:n,subtitle:g,items:f}=s,b=u.useCallback((e,i)=>c=>{a?.(e,i,c)},[a]);return p("div",{ref:x,className:r("blog-posts-root","text-info-primary w-full",o,t.root),...d,children:[(n||g)&&p("div",{className:r("blog-posts-header mb-6",t.header),children:[n&&l(h,{as:"h2",size:4,html:n,className:r("blog-posts-title",t.title)}),g&&l(m,{as:"p",size:3,className:r("",t?.subtitle),html:g})]}),l("div",{className:r("blog-posts-grid","laptop:grid-cols-3 grid grid-cols-1 gap-4",t.grid),children:f.map((e,i)=>{const c=e.link?"a":"div",v=e.link?{href:e.link}:{};return p(u.Fragment,{children:[p(c,{...v,className:r("blog-posts-card rounded-box","flex cursor-pointer flex-col gap-4","laptop:h-[336px] desktop:h-[448px] lg-desktop:h-[560px]","laptop:bg-container-secondary-0 laptop:p-4 desktop:p-6 lg-desktop:p-8","laptop:overflow-hidden laptop:transition-opacity ","bg-container-secondary-1",I(e.width||"full"),w(e.width||"full"),t.card),onClick:b(e,i),children:[l("div",{className:r("blog-posts-card-image","relative w-full overflow-hidden","h-[200px] shrink-0",R(e.width||"full"),t.cardImage),children:l(y,{source:F(e.image),alt:B(e.image,e.title),className:"rounded-box h-full object-cover",imgClassName:"h-full"})}),p("div",{className:r("blog-posts-card-content","desktop:gap-6 flex flex-col justify-center gap-4",t.cardContent),children:[p("div",{className:"desktop:gap-2 flex flex-col gap-1",children:[l(h,{size:2,as:"h6",className:r("blog-posts-card-title line-clamp-3",t.cardTitle),html:e.title}),e.description&&l(m,{className:r("blog-posts-card-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-3 text-[14px]",t.cardDescription),html:e.description})]}),e.date&&l(m,{className:r("blog-posts-card-meta","text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",t.cardMeta),html:e.date})]})]}),i<f.length-1&&l("div",{className:r("blog-posts-separator","bg-lines-primary laptop:hidden h-px w-full",t.separator)})]},i)})})]})});k.displayName="FeaturedBlogPosts";const C=P(k);var z=C;export{z as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|