@anker-in/headless-ui 1.1.73 → 1.1.74

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.
Files changed (220) hide show
  1. package/dist/cjs/biz-components/AccordionCards/index.d.ts +1 -39
  2. package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
  3. package/dist/cjs/biz-components/AccordionCards/index.js.map +2 -2
  4. package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
  5. package/dist/cjs/biz-components/AiuiProvider/index.js.map +3 -3
  6. package/dist/cjs/biz-components/AplusDesc/index.d.ts +1 -20
  7. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.d.ts +1 -5
  8. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
  9. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js.map +3 -3
  10. package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +1 -5
  11. package/dist/cjs/biz-components/Category/index.d.ts +1 -4
  12. package/dist/cjs/biz-components/Category/index.js +1 -1
  13. package/dist/cjs/biz-components/Category/index.js.map +2 -2
  14. package/dist/cjs/biz-components/CreativeModule/index.d.ts +1 -10
  15. package/dist/cjs/biz-components/DownLoad/index.d.ts +1 -9
  16. package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -4
  17. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  18. package/dist/cjs/biz-components/Evaluate/index.js.map +3 -3
  19. package/dist/cjs/biz-components/Faq/Faq.d.ts +2 -6
  20. package/dist/cjs/biz-components/FeatureCards/FeatureCards.d.ts +1 -6
  21. package/dist/cjs/biz-components/FeatureShowcase/FeatureShowcase.d.ts +1 -6
  22. package/dist/cjs/biz-components/FeaturedBlogPosts/index.js +1 -1
  23. package/dist/cjs/biz-components/FeaturedBlogPosts/index.js.map +2 -2
  24. package/dist/cjs/biz-components/Features/index.d.ts +1 -11
  25. package/dist/cjs/biz-components/FootCharger/index.d.ts +1 -10
  26. package/dist/cjs/biz-components/FooterNavigation/index.d.ts +1 -5
  27. package/dist/cjs/biz-components/GiftBox/index.d.ts +1 -10
  28. package/dist/cjs/biz-components/Graphic/index.d.ts +1 -4
  29. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  30. package/dist/cjs/biz-components/Graphic/index.js.map +3 -3
  31. package/dist/cjs/biz-components/GraphicAttractionBlock/index.d.ts +1 -4
  32. package/dist/cjs/biz-components/GraphicMore/index.d.ts +1 -10
  33. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.d.ts +2 -13
  34. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  35. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js.map +3 -3
  36. package/dist/cjs/biz-components/HeaderNavigation/index.d.ts +1 -6
  37. package/dist/cjs/biz-components/HeroBanner/HeroBanner.d.ts +1 -8
  38. package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
  39. package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
  40. package/dist/cjs/biz-components/ImageTextFeature/ImageTextFeature.d.ts +1 -6
  41. package/dist/cjs/biz-components/ImageWithText/ImageWithText.d.ts +1 -6
  42. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  43. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js.map +3 -3
  44. package/dist/cjs/biz-components/Ksp/index.d.ts +1 -4
  45. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +1 -14
  46. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -29
  47. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -4
  48. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -4
  49. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -4
  50. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -4
  51. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -4
  52. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -4
  53. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -4
  54. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.d.ts +1 -5
  55. package/dist/cjs/biz-components/Marquee/Marquee.d.ts +2 -6
  56. package/dist/cjs/biz-components/MarqueeReview/index.d.ts +1 -4
  57. package/dist/cjs/biz-components/MediaEndorsement/index.js +3 -3
  58. package/dist/cjs/biz-components/MediaEndorsement/index.js.map +2 -2
  59. package/dist/cjs/biz-components/MediaPlayerBase/index.d.ts +1 -5
  60. package/dist/cjs/biz-components/MediaPlayerBase/types.d.ts +1 -1
  61. package/dist/cjs/biz-components/MediaPlayerBase/types.js.map +1 -1
  62. package/dist/cjs/biz-components/MediaPlayerMulti/index.d.ts +1 -5
  63. package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
  64. package/dist/cjs/biz-components/MediaPlayerMulti/index.js.map +3 -3
  65. package/dist/cjs/biz-components/MediaPlayerSticky/index.d.ts +1 -8
  66. package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +1 -5
  67. package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.d.ts +2 -2
  68. package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.js +1 -1
  69. package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.js.map +3 -3
  70. package/dist/cjs/biz-components/MemberEquity/index.d.ts +1 -6
  71. package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
  72. package/dist/cjs/biz-components/MemberEquity/index.js.map +3 -3
  73. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +2 -20
  74. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  75. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +3 -3
  76. package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -4
  77. package/dist/cjs/biz-components/ProductHero/ProductHero.d.ts +1 -6
  78. package/dist/cjs/biz-components/ProductNav/ProductNav.d.ts +1 -5
  79. package/dist/cjs/biz-components/PromotionalBar/index.d.ts +1 -4
  80. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  81. package/dist/cjs/biz-components/SecondaryBanner/index.js.map +3 -3
  82. package/dist/cjs/biz-components/SelectStore/index.d.ts +1 -10
  83. package/dist/cjs/biz-components/ShelfDisplay/index.d.ts +1 -6
  84. package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
  85. package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
  86. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.d.ts +10 -1
  87. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js +1 -1
  88. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
  89. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
  90. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  91. package/dist/cjs/biz-components/Slogan/index.d.ts +1 -6
  92. package/dist/cjs/biz-components/Spacer/index.d.ts +1 -6
  93. package/dist/cjs/biz-components/Specs/index.d.ts +1 -4
  94. package/dist/cjs/biz-components/SpecsComparison/SpecsComparison.d.ts +1 -6
  95. package/dist/cjs/biz-components/TabWithImage/TabWithImage.d.ts +1 -6
  96. package/dist/cjs/biz-components/Tabs/Tabs.d.ts +1 -6
  97. package/dist/cjs/biz-components/TabsGroup/index.d.ts +1 -6
  98. package/dist/cjs/biz-components/TabsWithMedia/TabsWithMedia.d.ts +1 -6
  99. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +1 -6
  100. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  101. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js.map +3 -3
  102. package/dist/cjs/biz-components/Title/index.d.ts +1 -4
  103. package/dist/cjs/biz-components/VideoFeature/VideoFeature.d.ts +1 -6
  104. package/dist/cjs/biz-components/WhyChoose/WhyChoose.d.ts +2 -6
  105. package/dist/cjs/helpers/utils.d.ts +44 -2
  106. package/dist/cjs/helpers/utils.js +1 -1
  107. package/dist/cjs/helpers/utils.js.map +3 -3
  108. package/dist/cjs/shared/Styles.d.ts +1 -4
  109. package/dist/cjs/shared/Styles.js +1 -1
  110. package/dist/cjs/shared/Styles.js.map +3 -3
  111. package/dist/esm/biz-components/AccordionCards/index.d.ts +1 -39
  112. package/dist/esm/biz-components/AccordionCards/index.js +1 -1
  113. package/dist/esm/biz-components/AccordionCards/index.js.map +2 -2
  114. package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
  115. package/dist/esm/biz-components/AiuiProvider/index.js.map +3 -3
  116. package/dist/esm/biz-components/AplusDesc/index.d.ts +1 -20
  117. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.d.ts +1 -5
  118. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
  119. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js.map +3 -3
  120. package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +1 -5
  121. package/dist/esm/biz-components/Category/index.d.ts +1 -4
  122. package/dist/esm/biz-components/Category/index.js +1 -1
  123. package/dist/esm/biz-components/Category/index.js.map +2 -2
  124. package/dist/esm/biz-components/CreativeModule/index.d.ts +1 -10
  125. package/dist/esm/biz-components/DownLoad/index.d.ts +1 -9
  126. package/dist/esm/biz-components/Evaluate/index.d.ts +1 -4
  127. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  128. package/dist/esm/biz-components/Evaluate/index.js.map +3 -3
  129. package/dist/esm/biz-components/Faq/Faq.d.ts +2 -6
  130. package/dist/esm/biz-components/FeatureCards/FeatureCards.d.ts +1 -6
  131. package/dist/esm/biz-components/FeatureShowcase/FeatureShowcase.d.ts +1 -6
  132. package/dist/esm/biz-components/FeaturedBlogPosts/index.js +1 -1
  133. package/dist/esm/biz-components/FeaturedBlogPosts/index.js.map +2 -2
  134. package/dist/esm/biz-components/Features/index.d.ts +1 -11
  135. package/dist/esm/biz-components/FootCharger/index.d.ts +1 -10
  136. package/dist/esm/biz-components/FooterNavigation/index.d.ts +1 -5
  137. package/dist/esm/biz-components/GiftBox/index.d.ts +1 -10
  138. package/dist/esm/biz-components/Graphic/index.d.ts +1 -4
  139. package/dist/esm/biz-components/Graphic/index.js +1 -1
  140. package/dist/esm/biz-components/Graphic/index.js.map +3 -3
  141. package/dist/esm/biz-components/GraphicAttractionBlock/index.d.ts +1 -4
  142. package/dist/esm/biz-components/GraphicMore/index.d.ts +1 -10
  143. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.d.ts +2 -13
  144. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  145. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js.map +3 -3
  146. package/dist/esm/biz-components/HeaderNavigation/index.d.ts +1 -6
  147. package/dist/esm/biz-components/HeroBanner/HeroBanner.d.ts +1 -8
  148. package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
  149. package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
  150. package/dist/esm/biz-components/ImageTextFeature/ImageTextFeature.d.ts +1 -6
  151. package/dist/esm/biz-components/ImageWithText/ImageWithText.d.ts +1 -6
  152. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  153. package/dist/esm/biz-components/ImageWithText/ImageWithText.js.map +3 -3
  154. package/dist/esm/biz-components/Ksp/index.d.ts +1 -4
  155. package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +1 -14
  156. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -29
  157. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -4
  158. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -4
  159. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -4
  160. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -4
  161. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -4
  162. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -4
  163. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -4
  164. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.d.ts +1 -5
  165. package/dist/esm/biz-components/Marquee/Marquee.d.ts +2 -6
  166. package/dist/esm/biz-components/MarqueeReview/index.d.ts +1 -4
  167. package/dist/esm/biz-components/MediaEndorsement/index.js +3 -3
  168. package/dist/esm/biz-components/MediaEndorsement/index.js.map +2 -2
  169. package/dist/esm/biz-components/MediaPlayerBase/index.d.ts +1 -5
  170. package/dist/esm/biz-components/MediaPlayerBase/types.d.ts +1 -1
  171. package/dist/esm/biz-components/MediaPlayerMulti/index.d.ts +1 -5
  172. package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
  173. package/dist/esm/biz-components/MediaPlayerMulti/index.js.map +3 -3
  174. package/dist/esm/biz-components/MediaPlayerSticky/index.d.ts +1 -8
  175. package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +1 -5
  176. package/dist/esm/biz-components/MediaSceneSwitcherV2/index.d.ts +2 -2
  177. package/dist/esm/biz-components/MediaSceneSwitcherV2/index.js +1 -1
  178. package/dist/esm/biz-components/MediaSceneSwitcherV2/index.js.map +3 -3
  179. package/dist/esm/biz-components/MemberEquity/index.d.ts +1 -6
  180. package/dist/esm/biz-components/MemberEquity/index.js +2 -2
  181. package/dist/esm/biz-components/MemberEquity/index.js.map +3 -3
  182. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +2 -20
  183. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  184. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +3 -3
  185. package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -4
  186. package/dist/esm/biz-components/ProductHero/ProductHero.d.ts +1 -6
  187. package/dist/esm/biz-components/ProductNav/ProductNav.d.ts +1 -5
  188. package/dist/esm/biz-components/PromotionalBar/index.d.ts +1 -4
  189. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  190. package/dist/esm/biz-components/SecondaryBanner/index.js.map +3 -3
  191. package/dist/esm/biz-components/SelectStore/index.d.ts +1 -10
  192. package/dist/esm/biz-components/ShelfDisplay/index.d.ts +1 -6
  193. package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
  194. package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
  195. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.d.ts +10 -1
  196. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js +1 -1
  197. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
  198. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
  199. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  200. package/dist/esm/biz-components/Slogan/index.d.ts +1 -6
  201. package/dist/esm/biz-components/Spacer/index.d.ts +1 -6
  202. package/dist/esm/biz-components/Specs/index.d.ts +1 -4
  203. package/dist/esm/biz-components/SpecsComparison/SpecsComparison.d.ts +1 -6
  204. package/dist/esm/biz-components/TabWithImage/TabWithImage.d.ts +1 -6
  205. package/dist/esm/biz-components/Tabs/Tabs.d.ts +1 -6
  206. package/dist/esm/biz-components/TabsGroup/index.d.ts +1 -6
  207. package/dist/esm/biz-components/TabsWithMedia/TabsWithMedia.d.ts +1 -6
  208. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +1 -6
  209. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  210. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js.map +3 -3
  211. package/dist/esm/biz-components/Title/index.d.ts +1 -4
  212. package/dist/esm/biz-components/VideoFeature/VideoFeature.d.ts +1 -6
  213. package/dist/esm/biz-components/WhyChoose/WhyChoose.d.ts +2 -6
  214. package/dist/esm/helpers/utils.d.ts +44 -2
  215. package/dist/esm/helpers/utils.js +1 -1
  216. package/dist/esm/helpers/utils.js.map +3 -3
  217. package/dist/esm/shared/Styles.d.ts +1 -4
  218. package/dist/esm/shared/Styles.js +1 -1
  219. package/dist/esm/shared/Styles.js.map +3 -3
  220. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/ThreeDCarousel/ThreeDCarousel.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useRef, useImperativeHandle } from 'react'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport type { ThreeDCarouselProps } from './types.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Navigation, EffectCoverflow } from 'swiper/modules'\nimport type { Swiper as SwiperType } from 'swiper'\n\nimport 'swiper/css'\nimport 'swiper/css/navigation'\nimport 'swiper/css/pagination'\nimport 'swiper/css/effect-coverflow'\n\nconst componentType = 'carousel'\nconst componentName = 'three_d_carousel'\n\nconst ChevronLeft = () => (\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=\"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]\"\n >\n <circle cx=\"28\" cy=\"28\" r=\"28\" fill=\"currentColor\" fillOpacity=\"0.2\" />\n <path d=\"M32 20L24 28L32 36\" stroke=\"white\" strokeWidth=\"2.66667\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst ChevronRight = () => (\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=\"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]\"\n >\n <circle cx=\"28\" cy=\"28\" r=\"28\" fill=\"currentColor\" fillOpacity=\"0.2\" />\n <path d=\"M24 20L32 28L24 36\" stroke=\"white\" strokeWidth=\"2.66667\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst ThreeDCarousel = React.forwardRef<HTMLDivElement, ThreeDCarouselProps>(({ data, className }, ref) => {\n const { title, items = [] } = data\n const cloneItems = items.length < 4 ? [...items, ...items] : items\n const swiperRef = useRef<SwiperType | null>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n return (\n <section\n ref={boxRef}\n data-ui-component-id=\"ThreeDCarousel\"\n className={cn('three-d-carousel laptop:overflow-hidden w-full overflow-visible', className)}\n >\n <Heading as=\"h1\" size={4} html={title} className=\"three-d-carousel__title laptop:text-center text-left\" />\n\n {/* Desktop carousel with 3D effect */}\n <div className=\"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full px-4\">\n <Swiper\n onSwiper={swiper => (swiperRef.current = swiper)}\n centeredSlides={true}\n initialSlide={0}\n loop\n slidesPerView={'auto'}\n // loopAdditionalSlides={2}\n spaceBetween={0}\n grabCursor\n modules={[EffectCoverflow, Navigation]}\n slideToClickedSlide\n className=\"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible\"\n effect=\"coverflow\"\n coverflowEffect={{\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n }}\n breakpoints={{\n 1921: {\n coverflowEffect: {\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n },\n },\n 1490: {\n coverflowEffect: {\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n },\n },\n 1441: {\n coverflowEffect: {\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n },\n },\n 1025: {\n coverflowEffect: {\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n },\n },\n 769: {\n coverflowEffect: {\n rotate: 0,\n stretch: 70,\n depth: 300,\n // modifier: 1,\n slideShadows: true,\n },\n },\n }}\n >\n {cloneItems.map((item, index) => (\n <SwiperSlide\n key={index}\n className=\"three-d-carousel__slide relative !w-[62.23%] cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100\"\n >\n {({ isActive }) => (\n <>\n <Picture\n source={item.imageUrl?.url || ''}\n alt={item.imageUrl?.alt || item.title}\n className={cn('three-d-carousel__image rounded-box mx-auto h-full overflow-hidden')}\n imgClassName=\"h-full object-cover\"\n style={{\n filter: isActive ? '' : 'brightness(50%) contrast(120%)',\n }}\n />\n <div\n className={cn(\n 'three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]',\n {\n 'aiui-dark': item.theme === 'dark',\n 'opacity-0': !isActive,\n }\n )}\n >\n <Heading as=\"h2\" size={2} html={item.title} />\n <Text\n as=\"p\"\n size={4}\n html={item.description}\n className=\"three-d-carousel__image-description text-[14px]\"\n />\n {item.buttonText && (\n <a href={item.buttonLink || ''} className=\"three-d-carousel__image-link \">\n <Button\n size=\"base\"\n variant=\"secondary\"\n className=\"three-d-carousel__image-button desktop:mt-6 mt-4\"\n >\n {item.buttonText}\n </Button>\n </a>\n )}\n </div>\n </>\n )}\n </SwiperSlide>\n ))}\n </Swiper>\n <div className=\"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between\">\n <button\n className=\"three-d-carousel__nav-button three-d-carousel__nav-button--prev\"\n onClick={() => swiperRef.current?.slidePrev()}\n aria-label=\"Previous slide\"\n >\n <ChevronLeft />\n </button>\n <button\n className=\"three-d-carousel__nav-button three-d-carousel__nav-button--next\"\n onClick={() => swiperRef.current?.slideNext()}\n aria-label=\"Next slide\"\n >\n <ChevronRight />\n </button>\n </div>\n </div>\n\n {/* Mobile carousel */}\n <div className=\"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible\">\n <Swiper\n loop={true}\n loopAdditionalSlides={1}\n slidesPerView={'auto'}\n spaceBetween={12}\n grabCursor\n className=\"three-d-carousel__swiper-mobile relative w-full !overflow-visible\"\n >\n {cloneItems.map((item, index) => (\n <SwiperSlide\n key={index}\n className=\"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden\"\n >\n <Picture\n source={item.mobImageUrl?.url || item.imageUrl?.url || ''}\n alt={item.mobImageUrl?.alt || item.title}\n className=\"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden\"\n imgClassName=\"h-full object-cover\"\n />\n <div\n className={cn(\n 'three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]',\n {\n 'aiui-dark': item.theme === 'dark',\n }\n )}\n >\n <Heading as=\"h2\" size={2} html={item.title} />\n <Text\n as=\"p\"\n size={4}\n html={item.description}\n className=\"three-d-carousel__image-mobile-description text-[14px]\"\n />\n {item.buttonText && (\n <a href={item.buttonLink || ''} className=\"three-d-carousel__image-mobile-link \">\n <Button size=\"base\" variant=\"secondary\" className=\"three-d-carousel__image-mobile-button mt-3\">\n {item.buttonText}\n </Button>\n </a>\n )}\n </div>\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n </section>\n )\n})\n\nThreeDCarousel.displayName = 'ThreeDCarousel'\n\nexport default withLayout(ThreeDCarousel, { style: 'overflow: hidden;' })\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAoBE,IAAAI,EAAA,6BAnBFC,EAAmD,oBACnDC,EAA+C,qCAC/CC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA4B,sCAE5BJ,EAAoC,wBACpCK,EAA4C,0BAG5CC,EAAO,sBACPC,EAAO,iCACPC,EAAO,iCACPC,EAAO,uCAEP,MAAMC,EAAgB,WAChBC,EAAgB,mBAEhBC,EAAc,OAClB,QAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAU,8FAEV,oBAAC,UAAO,GAAG,KAAK,GAAG,KAAK,EAAE,KAAK,KAAK,eAAe,YAAY,MAAM,KACrE,OAAC,QAAK,EAAE,qBAAqB,OAAO,QAAQ,YAAY,UAAU,cAAc,QAAQ,eAAe,QAAQ,GACjH,EAGIC,EAAe,OACnB,QAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAU,8FAEV,oBAAC,UAAO,GAAG,KAAK,GAAG,KAAK,EAAE,KAAK,KAAK,eAAe,YAAY,MAAM,KACrE,OAAC,QAAK,EAAE,qBAAqB,OAAO,QAAQ,YAAY,UAAU,cAAc,QAAQ,eAAe,QAAQ,GACjH,EAGIC,EAAiB,EAAAC,QAAM,WAAgD,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACzG,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAQ,CAAC,CAAE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,IACH,KAAM,EACN,KAAMA,EAAK,YACX,UAAU,yDACZ,EACCA,EAAK,eACJ,OAAC,KAAE,KAAMA,EAAK,YAAc,GAAI,UAAU,uCACxC,mBAAC,UAAO,KAAK,OAAO,QAAQ,YAAY,UAAU,6CAC/C,SAAAA,EAAK,WACR,EACF,GAEJ,IA/BKC,CAgCP,CACD,EACH,EACF,GACF,CAEJ,CAAC,EAEDZ,EAAe,YAAc,iBAE7B,IAAOjB,KAAQ,cAAWiB,EAAgB,CAAE,MAAO,mBAAoB,CAAC",
6
- "names": ["ThreeDCarousel_exports", "__export", "ThreeDCarousel_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_Styles", "import_useExposure", "import_modules", "import_css", "import_navigation", "import_pagination", "import_effect_coverflow", "componentType", "componentName", "ChevronLeft", "ChevronRight", "ThreeDCarousel", "React", "data", "className", "ref", "title", "items", "cloneItems", "swiperRef", "boxRef", "swiper", "item", "index", "isActive"]
4
+ "sourcesContent": ["'use client'\nimport React, { useRef, useImperativeHandle } from 'react'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport { cn, getLocalizedPath } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport type { ThreeDCarouselProps } from './types.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Navigation, EffectCoverflow } from 'swiper/modules'\nimport type { Swiper as SwiperType } from 'swiper'\n\nimport 'swiper/css'\nimport 'swiper/css/navigation'\nimport 'swiper/css/pagination'\nimport 'swiper/css/effect-coverflow'\n\nconst componentType = 'carousel'\nconst componentName = 'three_d_carousel'\n\nconst ChevronLeft = () => (\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=\"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]\"\n >\n <circle cx=\"28\" cy=\"28\" r=\"28\" fill=\"currentColor\" fillOpacity=\"0.2\" />\n <path d=\"M32 20L24 28L32 36\" stroke=\"white\" strokeWidth=\"2.66667\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst ChevronRight = () => (\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=\"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]\"\n >\n <circle cx=\"28\" cy=\"28\" r=\"28\" fill=\"currentColor\" fillOpacity=\"0.2\" />\n <path d=\"M24 20L32 28L24 36\" stroke=\"white\" strokeWidth=\"2.66667\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst ThreeDCarousel = React.forwardRef<HTMLDivElement, ThreeDCarouselProps>(({ data, className }, ref) => {\n const { title, items = [] } = data\n const cloneItems = items.length < 4 ? [...items, ...items] : items\n const swiperRef = useRef<SwiperType | null>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n const [stretchValue, setStretchValue] = React.useState(180)\n const { locale = 'us' } = useAiuiContext()\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n // \u52A8\u6001\u8BA1\u7B97 stretch \u503C\uFF0C\u8BA9\u4E09\u4E2A slide \u521A\u597D\u5360\u6EE1\u5BB9\u5668\u5BBD\u5EA6\n React.useEffect(() => {\n const container = containerRef.current\n if (!container) return\n\n const updateStretch = () => {\n const containerWidth = container.offsetWidth\n // stretch \u7EA6\u4E3A\u5BB9\u5668\u5BBD\u5EA6\u7684 18%\uFF0C\u8BA9\u4E09\u4E2A slide (50% + 2*25%) \u521A\u597D\u5360\u6EE1\n const newStretch = Math.round(containerWidth * 0.18)\n setStretchValue(newStretch)\n\n // \u66F4\u65B0 Swiper \u914D\u7F6E\n if (swiperRef.current?.params?.coverflowEffect) {\n swiperRef.current.params.coverflowEffect.stretch = newStretch\n swiperRef.current.update()\n }\n }\n\n // \u521D\u59CB\u5316\u8BA1\u7B97\n updateStretch()\n\n // \u76D1\u542C\u5BB9\u5668\u5C3A\u5BF8\u53D8\u5316\n const resizeObserver = new ResizeObserver(updateStretch)\n resizeObserver.observe(container)\n\n return () => resizeObserver.disconnect()\n }, [])\n\n return (\n <section\n ref={boxRef}\n data-ui-component-id=\"ThreeDCarousel\"\n className={cn('three-d-carousel laptop:overflow-hidden w-full overflow-visible', className)}\n >\n <Heading as=\"h1\" size={4} html={title} className=\"three-d-carousel__title laptop:text-center text-left\" />\n\n {/* Desktop carousel with 3D effect */}\n <div\n ref={containerRef}\n className=\"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full px-4\"\n >\n <Swiper\n onSwiper={swiper => (swiperRef.current = swiper)}\n centeredSlides={true}\n initialSlide={0}\n loop\n slidesPerView={'auto'}\n // loopAdditionalSlides={2}\n spaceBetween={0}\n grabCursor\n modules={[EffectCoverflow, Navigation]}\n slideToClickedSlide\n className=\"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible\"\n effect=\"coverflow\"\n coverflowEffect={{\n rotate: 0,\n stretch: stretchValue,\n depth: 300,\n modifier: 1,\n slideShadows: true,\n }}\n >\n {cloneItems.map((item, index) => (\n <SwiperSlide\n key={index}\n className=\"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100\"\n >\n {({ isActive }) => (\n <>\n <Picture\n source={item.imageUrl?.url || ''}\n alt={item.imageUrl?.alt || item.title}\n className={cn('three-d-carousel__image rounded-box mx-auto h-full overflow-hidden')}\n imgClassName=\"h-full object-cover\"\n style={{\n filter: isActive ? '' : 'brightness(50%) contrast(120%)',\n }}\n />\n <div\n className={cn(\n 'three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]',\n {\n 'aiui-dark': item.theme === 'dark',\n 'opacity-0': !isActive,\n }\n )}\n >\n <Heading as=\"h2\" size={2} html={item.title} />\n <Text\n as=\"p\"\n size={4}\n html={item.description}\n className=\"three-d-carousel__image-description text-[14px]\"\n />\n {item.buttonText && (\n <a\n href={getLocalizedPath(item.buttonLink || '', locale)}\n className=\"three-d-carousel__image-link \"\n >\n <Button\n size=\"base\"\n variant=\"secondary\"\n className=\"three-d-carousel__image-button desktop:mt-6 mt-4\"\n >\n {item.buttonText}\n </Button>\n </a>\n )}\n </div>\n </>\n )}\n </SwiperSlide>\n ))}\n </Swiper>\n <div className=\"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between\">\n <button\n className=\"three-d-carousel__nav-button three-d-carousel__nav-button--prev\"\n onClick={() => swiperRef.current?.slidePrev()}\n aria-label=\"Previous slide\"\n >\n <ChevronLeft />\n </button>\n <button\n className=\"three-d-carousel__nav-button three-d-carousel__nav-button--next\"\n onClick={() => swiperRef.current?.slideNext()}\n aria-label=\"Next slide\"\n >\n <ChevronRight />\n </button>\n </div>\n </div>\n\n {/* Mobile carousel */}\n <div className=\"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible\">\n <Swiper\n loop={true}\n loopAdditionalSlides={1}\n slidesPerView={'auto'}\n spaceBetween={12}\n grabCursor\n className=\"three-d-carousel__swiper-mobile relative w-full !overflow-visible\"\n >\n {cloneItems.map((item, index) => (\n <SwiperSlide\n key={index}\n className=\"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden\"\n >\n <Picture\n source={item.mobImageUrl?.url || item.imageUrl?.url || ''}\n alt={item.mobImageUrl?.alt || item.title}\n className=\"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden\"\n imgClassName=\"h-full object-cover\"\n />\n <div\n className={cn(\n 'three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]',\n {\n 'aiui-dark': item.theme === 'dark',\n }\n )}\n >\n <Heading as=\"h2\" size={2} html={item.title} />\n <Text\n as=\"p\"\n size={4}\n html={item.description}\n className=\"three-d-carousel__image-mobile-description text-[14px]\"\n />\n {item.buttonText && (\n <a\n href={getLocalizedPath(item.buttonLink || '', locale)}\n className=\"three-d-carousel__image-mobile-link \"\n >\n <Button size=\"base\" variant=\"secondary\" className=\"three-d-carousel__image-mobile-button mt-3\">\n {item.buttonText}\n </Button>\n </a>\n )}\n </div>\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n </section>\n )\n})\n\nThreeDCarousel.displayName = 'ThreeDCarousel'\n\nexport default withLayout(ThreeDCarousel, { style: 'overflow: hidden;' })\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAqBE,IAAAI,EAAA,6BApBFC,EAAmD,oBACnDC,EAA+C,qCAC/CC,EAAqC,kCACrCC,EAA2B,kCAC3BC,EAA4B,sCAC5BC,EAA+B,oCAE/BL,EAAoC,wBACpCM,EAA4C,0BAG5CC,EAAO,sBACPC,EAAO,iCACPC,EAAO,iCACPC,EAAO,uCAEP,MAAMC,EAAgB,WAChBC,EAAgB,mBAEhBC,EAAc,OAClB,QAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAU,8FAEV,oBAAC,UAAO,GAAG,KAAK,GAAG,KAAK,EAAE,KAAK,KAAK,eAAe,YAAY,MAAM,KACrE,OAAC,QAAK,EAAE,qBAAqB,OAAO,QAAQ,YAAY,UAAU,cAAc,QAAQ,eAAe,QAAQ,GACjH,EAGIC,EAA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BAACV,EAAA,EAAY,EACf,KACA,OAAC,UACC,UAAU,kEACV,QAAS,IAAMU,EAAU,SAAS,UAAU,EAC5C,aAAW,aAEX,mBAACT,EAAA,EAAa,EAChB,GACF,GACF,KAGA,OAAC,OAAI,UAAU,iFACb,mBAAC,UACC,KAAM,GACN,qBAAsB,EACtB,cAAe,OACf,aAAc,GACd,WAAU,GACV,UAAU,oEAET,SAAAQ,EAAW,IAAI,CAACa,EAAMC,OACrB,QAAC,eAEC,UAAU,4FAEV,oBAAC,WACC,OAAQD,EAAK,aAAa,KAAOA,EAAK,UAAU,KAAO,GACvD,IAAKA,EAAK,aAAa,KAAOA,EAAK,MACnC,UAAU,4EACV,aAAa,sBACf,KACA,QAAC,OACC,aAAW,MACT,qKACA,CACE,YAAaA,EAAK,QAAU,MAC9B,CACF,EAEA,oBAAC,WAAQ,GAAG,KAAK,KAAM,EAAG,KAAMA,EAAK,MAAO,KAC5C,OAAC,QACC,GAAG,IACH,KAAM,EACN,KAAMA,EAAK,YACX,UAAU,yDACZ,EACCA,EAAK,eACJ,OAAC,KACC,QAAM,oBAAiBA,EAAK,YAAc,GAAIP,CAAM,EACpD,UAAU,uCAEV,mBAAC,UAAO,KAAK,OAAO,QAAQ,YAAY,UAAU,6CAC/C,SAAAO,EAAK,WACR,EACF,GAEJ,IAlCKC,CAmCP,CACD,EACH,EACF,GACF,CAEJ,CAAC,EAEDrB,EAAe,YAAc,iBAE7B,IAAOlB,KAAQ,cAAWkB,EAAgB,CAAE,MAAO,mBAAoB,CAAC",
6
+ "names": ["ThreeDCarousel_exports", "__export", "ThreeDCarousel_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_Styles", "import_useExposure", "import_AiuiProvider", "import_modules", "import_css", "import_navigation", "import_pagination", "import_effect_coverflow", "componentType", "componentName", "ChevronLeft", "ChevronRight", "ThreeDCarousel", "React", "data", "className", "ref", "title", "items", "cloneItems", "swiperRef", "boxRef", "containerRef", "stretchValue", "setStretchValue", "locale", "container", "updateStretch", "containerWidth", "newStretch", "resizeObserver", "swiper", "item", "index", "isActive"]
7
7
  }
@@ -2,8 +2,5 @@ import React from 'react';
2
2
  import type { TitlePropsBase } from './types.js';
3
3
  export interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {
4
4
  }
5
- declare const _default: React.ForwardRefExoticComponent<Omit<TitleProps & React.RefAttributes<HTMLDivElement> & {
6
- style?: string | React.CSSProperties;
7
- container?: import("../../shared/Styles.js").ContainerProps["container"];
8
- }, "ref"> & React.RefAttributes<any>>;
5
+ declare const _default: any;
9
6
  export default _default;
@@ -1,7 +1,2 @@
1
- import React from 'react';
2
- import type { VideoFeatureProps } from './types.js';
3
- declare const _default: React.ForwardRefExoticComponent<Omit<VideoFeatureProps & React.RefAttributes<HTMLDivElement> & {
4
- style?: string | React.CSSProperties;
5
- container?: import("../../shared/Styles.js").ContainerProps["container"];
6
- }, "ref"> & React.RefAttributes<any>>;
1
+ declare const _default: any;
7
2
  export default _default;
@@ -1,14 +1,10 @@
1
- import React from 'react';
2
- import type { WhyChooseProps, WhyChooseItem as ItemType } from './types.js';
1
+ import type { WhyChooseItem as ItemType } from './types.js';
3
2
  declare const WhyChooseItem: {
4
3
  ({ data }: {
5
4
  data: ItemType;
6
5
  }): import("react/jsx-runtime").JSX.Element;
7
6
  displayName: string;
8
7
  };
9
- declare const _default: React.ForwardRefExoticComponent<Omit<WhyChooseProps & React.RefAttributes<HTMLDivElement> & {
10
- style?: string | React.CSSProperties;
11
- container?: import("../../shared/Styles.js").ContainerProps["container"];
12
- }, "ref"> & React.RefAttributes<any>>;
8
+ declare const _default: any;
13
9
  export default _default;
14
10
  export { WhyChooseItem };
@@ -12,8 +12,50 @@ export declare const spaceToHyphen: (str: string) => string;
12
12
  export declare const highlightSearchWord: (text: string, searchText: string) => string;
13
13
  /**
14
14
  * 获取本地化路径
15
- * @param path 路径
16
- * @param locale 语言标识
15
+ *
16
+ * 根据语言标识为路径添加对应的 locale 前缀。
17
+ * - 'us' 为默认语言,不添加前缀
18
+ * - 其他语言会添加 `/{locale}` 前缀
19
+ * - 完整 URL(http/https)不做处理
20
+ * - 自动处理路径格式(补充前导斜杠、移除尾部斜杠)
21
+ *
22
+ * @param path - 原始路径
23
+ * @param locale - 语言标识(如 'us', 'uk', 'de', 'jp' 等)
17
24
  * @returns 本地化后的路径
25
+ *
26
+ * @example
27
+ * // 基本用法 - 默认语言 'us' 不添加前缀
28
+ * getLocalizedPath('/products', 'us') // => '/products'
29
+ * getLocalizedPath('/about', 'us') // => '/about'
30
+ *
31
+ * @example
32
+ * // 其他语言添加前缀
33
+ * getLocalizedPath('/products', 'uk') // => '/uk/products'
34
+ * getLocalizedPath('/about/team', 'de') // => '/de/about/team'
35
+ * getLocalizedPath('/contact', 'jp') // => '/jp/contact'
36
+ *
37
+ * @example
38
+ * // 根路径处理
39
+ * getLocalizedPath('/', 'us') // => '/'
40
+ * getLocalizedPath('/', 'uk') // => '/uk'
41
+ *
42
+ * @example
43
+ * // 自动格式化路径
44
+ * getLocalizedPath('products', 'uk') // => '/uk/products' (补充前导斜杠)
45
+ * getLocalizedPath('/products/', 'uk') // => '/uk/products' (移除尾部斜杠)
46
+ * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (移除多余斜杠)
47
+ *
48
+ * @example
49
+ * // 已包含 locale 的路径不重复添加
50
+ * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'
51
+ *
52
+ * @example
53
+ * // 完整 URL 不处理
54
+ * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'
55
+ * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'
56
+ *
57
+ * @example
58
+ * // 空路径处理
59
+ * getLocalizedPath('', 'uk') // => ''
18
60
  */
19
61
  export declare const getLocalizedPath: (path: string, locale: string) => string;
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!l.call(t,n)&&n!==r&&s(t,n,{get:()=>e[n],enumerable:!(i=g(e,n))||i.enumerable});return t};var f=t=>p(s({},"__esModule",{value:!0}),t);var S={};x(S,{atobID:()=>m,cn:()=>u,getLocalizedPath:()=>b,highlightSearchWord:()=>W,noop:()=>d,spaceToHyphen:()=>y});module.exports=f(S);var o=require("clsx"),a=require("tailwind-merge");const h=(0,a.extendTailwindMerge)({extend:{theme:{borderRadius:["btn"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function u(...t){return h((0,o.clsx)(t))}function d(){}function m(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const y=t=>t?.replace(/\s+/g,"-"),$=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=(t,e)=>{try{if(!t||!e)return t;const r=$(e),i=new RegExp(r,"gi");return t.replace(i,n=>`<span class='text-brand-0 font-bold'>${n}</span>`)}catch(r){return console.error("highlightSearchWord error:",r),t}},b=(t,e)=>{if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;let r=t.startsWith("/")?t:`/${t}`;const i=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r,n=e==="us"?"":`/${e}`;return i==="/"?n||"/":i.split("/").filter(Boolean)[0]===e?i:`${n}${i}`};
1
+ "use strict";var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!x.call(t,n)&&n!==r&&o(t,n,{get:()=>e[n],enumerable:!(i=g(e,n))||i.enumerable});return t};var f=t=>p(o({},"__esModule",{value:!0}),t);var S={};l(S,{atobID:()=>y,cn:()=>h,getLocalizedPath:()=>w,highlightSearchWord:()=>b,noop:()=>d,spaceToHyphen:()=>m});module.exports=f(S);var s=require("clsx"),a=require("tailwind-merge");const u=(0,a.extendTailwindMerge)({extend:{theme:{borderRadius:["btn"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function h(...t){return u((0,s.clsx)(t))}function d(){}function y(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const m=t=>t?.replace(/\s+/g,"-"),$=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=(t,e)=>{try{if(!t||!e)return t;const r=$(e),i=new RegExp(r,"gi");return t.replace(i,n=>`<span class='text-brand-0 font-bold'>${n}</span>`)}catch(r){return console.error("highlightSearchWord error:",r),t}},w=(t,e)=>{if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;const r=t.split("/").filter(Boolean);return r.length===0?e==="us"?"/":`/${e}`:r[0]===e?`/${r.join("/")}`:`${e==="us"?"":`/${e}`}/${r.join("/")}`};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/utils.ts"],
4
- "sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n * @param path \u8DEF\u5F84\n * @param locale \u8BED\u8A00\u6807\u8BC6\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n */\nexport const getLocalizedPath = (path: string, locale: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\uFF0C\u4E0D\u5904\u7406\n if (path.startsWith('http://') || path.startsWith('https://')) {\n return path\n }\n\n // \u5982\u679C\u4E0D\u662F\u4EE5 '/' \u5F00\u5934\uFF0C\u8865\u4E0A '/'\n let formattedPath = path.startsWith('/') ? path : `/${path}`\n\n // \u53BB\u9664\u672B\u5C3E\u7684 '/'\n const normalizedPath =\n formattedPath.endsWith('/') && formattedPath !== '/' ? formattedPath.slice(0, -1) : formattedPath\n\n // \u83B7\u53D6 locale \u524D\u7F00\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n\n // \u5982\u679C\u8DEF\u5F84\u662F '/'\uFF0C\u76F4\u63A5\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (normalizedPath === '/') {\n return localePrefix || '/'\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n const pathSegments = normalizedPath.split('/').filter(Boolean)\n if (pathSegments[0] === locale) {\n return normalizedPath\n }\n\n // \u62FC\u63A5 locale \u524D\u7F00\n return `${localePrefix}${normalizedPath}`\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,OAAAC,EAAA,qBAAAC,EAAA,wBAAAC,EAAA,SAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAR,GAAA,IAAAS,EAAsC,gBACtCC,EAAoC,0BAEpC,MAAMC,KAAU,uBAAoB,CAClC,OAAQ,CACN,MAAO,CACL,aAAc,CAAC,KAAK,CACtB,EACA,YAAa,CACX,YAAa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AO,EAC5C,CAAC,IAAMF,EACfE,EAIF,GAAGC,CAAY,GAAGD,CAAc,EACzC",
6
- "names": ["utils_exports", "__export", "atobID", "cn", "getLocalizedPath", "highlightSearchWord", "noop", "spaceToHyphen", "__toCommonJS", "import_clsx", "import_tailwind_merge", "twMerge", "inputs", "id", "str", "escapeRegExp", "text", "searchText", "escapedSearchText", "regex", "match", "e", "path", "locale", "formattedPath", "normalizedPath", "localePrefix"]
4
+ "sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n *\n * \u6839\u636E\u8BED\u8A00\u6807\u8BC6\u4E3A\u8DEF\u5F84\u6DFB\u52A0\u5BF9\u5E94\u7684 locale \u524D\u7F00\u3002\n * - 'us' \u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u4E0D\u6DFB\u52A0\u524D\u7F00\n * - \u5176\u4ED6\u8BED\u8A00\u4F1A\u6DFB\u52A0 `/{locale}` \u524D\u7F00\n * - \u5B8C\u6574 URL\uFF08http/https\uFF09\u4E0D\u505A\u5904\u7406\n * - \u81EA\u52A8\u5904\u7406\u8DEF\u5F84\u683C\u5F0F\uFF08\u8865\u5145\u524D\u5BFC\u659C\u6760\u3001\u79FB\u9664\u5C3E\u90E8\u659C\u6760\uFF09\n *\n * @param path - \u539F\u59CB\u8DEF\u5F84\n * @param locale - \u8BED\u8A00\u6807\u8BC6\uFF08\u5982 'us', 'uk', 'de', 'jp' \u7B49\uFF09\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n *\n * @example\n * // \u57FA\u672C\u7528\u6CD5 - \u9ED8\u8BA4\u8BED\u8A00 'us' \u4E0D\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'us') // => '/products'\n * getLocalizedPath('/about', 'us') // => '/about'\n *\n * @example\n * // \u5176\u4ED6\u8BED\u8A00\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'uk') // => '/uk/products'\n * getLocalizedPath('/about/team', 'de') // => '/de/about/team'\n * getLocalizedPath('/contact', 'jp') // => '/jp/contact'\n *\n * @example\n * // \u6839\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('/', 'us') // => '/'\n * getLocalizedPath('/', 'uk') // => '/uk'\n *\n * @example\n * // \u81EA\u52A8\u683C\u5F0F\u5316\u8DEF\u5F84\n * getLocalizedPath('products', 'uk') // => '/uk/products' (\u8865\u5145\u524D\u5BFC\u659C\u6760)\n * getLocalizedPath('/products/', 'uk') // => '/uk/products' (\u79FB\u9664\u5C3E\u90E8\u659C\u6760)\n * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (\u79FB\u9664\u591A\u4F59\u659C\u6760)\n *\n * @example\n * // \u5DF2\u5305\u542B locale \u7684\u8DEF\u5F84\u4E0D\u91CD\u590D\u6DFB\u52A0\n * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'\n *\n * @example\n * // \u5B8C\u6574 URL \u4E0D\u5904\u7406\n * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'\n * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'\n *\n * @example\n * // \u7A7A\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('', 'uk') // => ''\n */\nexport const getLocalizedPath = (path: string, locale: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\uFF0C\u4E0D\u5904\u7406\n if (path.startsWith('http://') || path.startsWith('https://')) {\n return path\n }\n\n // \u5206\u5272\u8DEF\u5F84\u5E76\u8FC7\u6EE4\u7A7A\u6BB5\uFF08\u5904\u7406\u591A\u4E2A\u8FDE\u7EED\u659C\u6760\u7684\u60C5\u51B5\uFF09\n const pathSegments = path.split('/').filter(Boolean)\n\n // \u5982\u679C\u6CA1\u6709\u6709\u6548\u8DEF\u5F84\u6BB5\uFF0C\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (pathSegments.length === 0) {\n return locale === 'us' ? '/' : `/${locale}`\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n if (pathSegments[0] === locale) {\n return `/${pathSegments.join('/')}`\n }\n\n // \u83B7\u53D6 locale \u524D\u7F00\u5E76\u62FC\u63A5\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n return `${localePrefix}/${pathSegments.join('/')}`\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,OAAAC,EAAA,qBAAAC,EAAA,wBAAAC,EAAA,SAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAR,GAAA,IAAAS,EAAsC,gBACtCC,EAAoC,0BAEpC,MAAMC,KAAU,uBAAoB,CAClC,OAAQ,CACN,MAAO,CACL,aAAc,CAAC,KAAK,CACtB,EACA,YAAa,CACX,YAAa,CACX,iBACA,iBACA,iBACA,iBACA,iBACA,cACA,cACA,aACF,EACA,aAAc,CACZ,oBACA,sBACA,qBACA,uBACA,iBACF,EACA,QAAS,CAAC,gBAAiB,iBAAkB,eAAe,CAC9D,CACF,CACF,CAAC,EAEM,SAASR,KAAMS,EAAsB,CAC1C,OAAOD,KAAQ,QAAKC,CAAM,CAAC,CAC7B,CAEO,SAASN,GAAY,CAAC,CAEtB,SAASJ,EAAOW,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX,CACO,MAAMN,EAAiBO,GAAgBA,GAAK,QAAQ,OAAQ,GAAG,EAOhEC,EAAgBD,GACbA,EAAI,QAAQ,sBAAuB,MAAM,EASrCT,EAAsB,CAACW,EAAcC,IAAuB,CACvE,GAAI,CACF,GAAI,CAACD,GAAQ,CAACC,EACZ,OAAOD,EAIT,MAAME,EAAoBH,EAAaE,CAAU,EAC3CE,EAAQ,IAAI,OAAOD,EAAmB,IAAI,EAGhD,OAAOF,EAAK,QAAQG,EAAOC,GAAS,wCAAwCA,CAAK,SAAS,CAC5F,OAASC,EAAG,CACV,eAAQ,MAAM,6BAA8BA,CAAC,EACtCL,CACT,CACF,EAkDaZ,EAAmB,CAACkB,EAAcC,IAA2B,CAIxE,GAHI,CAACD,GAGDA,EAAK,WAAW,SAAS,GAAKA,EAAK,WAAW,UAAU,EAC1D,OAAOA,EAIT,MAAME,EAAeF,EAAK,MAAM,GAAG,EAAE,OAAO,OAAO,EAGnD,OAAIE,EAAa,SAAW,EACnBD,IAAW,KAAO,IAAM,IAAIA,CAAM,GAIvCC,EAAa,CAAC,IAAMD,EACf,IAAIC,EAAa,KAAK,GAAG,CAAC,GAK5B,GADcD,IAAW,KAAO,GAAK,IAAIA,CAAM,EAChC,IAAIC,EAAa,KAAK,GAAG,CAAC,EAClD",
6
+ "names": ["utils_exports", "__export", "atobID", "cn", "getLocalizedPath", "highlightSearchWord", "noop", "spaceToHyphen", "__toCommonJS", "import_clsx", "import_tailwind_merge", "twMerge", "inputs", "id", "str", "escapeRegExp", "text", "searchText", "escapedSearchText", "regex", "match", "e", "path", "locale", "pathSegments"]
7
7
  }
@@ -34,7 +34,4 @@ export declare const useStyles: (styleProps: Partial<StylesProps>, data?: Record
34
34
  * @param WrappedComponent - 需要包装的组件
35
35
  * @param defaultLayoutProps - 默认样式属性
36
36
  */
37
- export declare function withLayout<P>(WrappedComponent: React.ComponentType<P>, defaultLayoutProps?: Partial<StylesProps & ContainerProps>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P & {
38
- style?: string | React.CSSProperties;
39
- container?: ContainerProps["container"];
40
- }> & React.RefAttributes<any>>;
37
+ export declare function withLayout<P>(WrappedComponent: React.ComponentType<P>, defaultLayoutProps?: Partial<StylesProps & ContainerProps>): any;
@@ -1,2 +1,2 @@
1
- "use strict";var G=Object.create;var i=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of W(e))!I.call(t,a)&&a!==n&&i(t,a,{get:()=>e[a],enumerable:!(s=K(e,a))||s.enumerable});return t};var y=(t,e,n)=>(n=t!=null?G(B(t)):{},S(e||!t||!t.__esModule?i(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>S(i({},"__esModule",{value:!0}),t);var F={};L(F,{getStylesProps:()=>$,useStyles:()=>R,withLayout:()=>D});module.exports=O(F);var o=require("react/jsx-runtime"),l=y(require("react")),g=require("./simpleHash.js"),C=y(require("./getKeyPropsString.js")),c=require("../components/grid.js"),f=require("../components/container.js"),P=y(require("./ErrorBoundary.js"));const _={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},E={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},b=t=>{const e=(0,C.default)(t);return`style_${(0,g.simpleHash)(e)}`},$=t=>{const{style:e,uid:n,disabled:s}=t;return{style:e,uid:n,disabled:s}},H=({style:t,uid:e=b({}),disabled:n=!1})=>!t||n?null:(0,o.jsx)("style",{suppressHydrationWarning:!0,"data-style-id":e,children:`.block-${e} { ${t} }`}),R=(t,e)=>{const n=(0,l.useMemo)(()=>t?.uid||b({...t,data:e}),[e,t]),s=(0,l.useMemo)(()=>(0,o.jsx)(H,{...t,uid:n}),[t,n]);return{className:`block-${n} `,StyleComponent:s,uid:n}},A=t=>{const{desktopSpan:e,mobileSpan:n}=t?.container||{},s=n?_[n]:"",a=e?E[e]:"";return`${s} ${a}`.trim()};function D(t,e){const n=l.default.forwardRef((s,a)=>{const d=$(s),N=r=>r?typeof r=="string"?r:typeof r=="object"&&Object.entries(r).length<=0?"":Object.entries(r).map(([T,j])=>`${T.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${j}`).join("; ")+";":"",p=[e?.style,d?.style].map(N).filter(r=>!!r).map(r=>r.trim().endsWith(";")?r:`${r};`).join(" "),h={...e,...d,...p&&{style:p}},{className:u,StyleComponent:k}=R(h,s?.data),w=r=>(0,o.jsx)(f.Container,{className:`${u} ${r?.className||""}`.trim(),children:(0,o.jsx)(c.Grid,{className:"container_grid",children:(0,o.jsx)(c.GridItem,{className:A(r),children:(0,o.jsx)(t,{...r,ref:a})})})}),x=r=>(0,o.jsx)(t,{...r,className:`${u} ${r?.className||""||""}`.trim(),ref:a}),{style:M,...m}=s;return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(P.default,{children:[k,Reflect.ownKeys(m?.container||{})?.length>0?w(m):x(m)]})})});return n.displayName=`WithLayout${t.displayName||t.name||"Component"}`,n}
1
+ "use strict";var _=Object.create;var l=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of B(e))!G.call(t,a)&&a!==n&&l(t,a,{get:()=>e[a],enumerable:!(o=j(e,a))||o.enumerable});return t};var m=(t,e,n)=>(n=t!=null?_(E(t)):{},S(e||!t||!t.__esModule?l(n,"default",{value:t,enumerable:!0}):n,t)),W=t=>S(l({},"__esModule",{value:!0}),t);var F={};K(F,{getStylesProps:()=>R,useStyles:()=>N,withLayout:()=>H});module.exports=W(F);var s=require("react/jsx-runtime"),i=m(require("react")),P=require("./simpleHash.js"),f=m(require("./getKeyPropsString.js")),c=require("../components/grid.js"),C=require("../components/container.js"),$=m(require("./ErrorBoundary.js"));const I={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},M={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},b=t=>{const e=(0,f.default)(t);return`style_${(0,P.simpleHash)(e)}`},R=t=>{const{style:e,uid:n,disabled:o}=t;return{style:e,uid:n,disabled:o}},A=({style:t,uid:e=b({}),disabled:n=!1})=>!t||n?null:(0,s.jsx)("style",{suppressHydrationWarning:!0,"data-style-id":e,children:`.block-${e} { ${t} }`}),N=(t,e)=>{const n=(0,i.useMemo)(()=>t?.uid||b({...t,data:e}),[e,t]),o=(0,i.useMemo)(()=>(0,s.jsx)(A,{...t,uid:n}),[t,n]);return{className:`block-${n} `,StyleComponent:o,uid:n}},D=t=>{const{desktopSpan:e,mobileSpan:n}=t?.container||{},o=n?I[n]:"",a=e?M[e]:"";return`${o} ${a}`.trim()},g=Symbol("withLayoutWrapped");function H(t,e){if(t[g])return t;const n=i.default.forwardRef((o,a)=>{const d=R(o),h=r=>r?typeof r=="string"?r:typeof r=="object"&&Object.entries(r).length<=0?"":Object.entries(r).map(([x,L])=>`${x.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${L}`).join("; ")+";":"",u=[e?.style,d?.style].map(h).filter(r=>!!r).map(r=>r.trim().endsWith(";")?r:`${r};`).join(" "),w={...e,...d,...u&&{style:u}},{className:p,StyleComponent:k}=N(w,o?.data),O=r=>(0,s.jsx)(C.Container,{className:`${p} ${r?.className||""}`.trim(),children:(0,s.jsx)(c.Grid,{className:"container_grid",children:(0,s.jsx)(c.GridItem,{className:D(r),children:(0,s.jsx)(t,{...r,ref:a})})})}),T=r=>(0,s.jsx)(t,{...r,className:`${p} ${r?.className||""||""}`.trim(),ref:a}),{style:U,...y}=o;return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)($.default,{children:[k,Reflect.ownKeys(y?.container||{})?.length>0?O(y):T(y)]})})});return n.displayName=`WithLayout${t.displayName||t.name||"Component"}`,n[g]=!0,n}
2
2
  //# sourceMappingURL=Styles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/shared/Styles.tsx"],
4
- "sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n /** \u684C\u9762\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n desktopSpan: number\n /** \u79FB\u52A8\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32\u6216\u5BF9\u8C61 */\n style?: string | React.CSSProperties\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return <style suppressHydrationWarning data-style-id={uid}>{`.block-${uid} { ${style} }`}</style>\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\nconst getContainerClassName = (props?: Partial<StylesProps & ContainerProps>) => {\n const { desktopSpan, mobileSpan } = props?.container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\n/**\n * \u9AD8\u9636\u7EC4\u4EF6\u901A\u8FC7 withLayout \u5305\u88C5\u7EC4\u4EF6\uFF0C\u81EA\u52A8\u5E94\u7528\u6837\u5F0F\u548C\u5BB9\u5668\u5E03\u5C40\n *\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultLayoutProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\nexport function withLayout<P>(\n WrappedComponent: React.ComponentType<P>,\n defaultLayoutProps?: Partial<StylesProps & ContainerProps>\n) {\n // \u4F7F\u7528\u60A8\u7684\u7B80\u6D01\u65B9\u6CD5\uFF1A\u76F4\u63A5\u7528\u6CDB\u578B\u4FDD\u7559\u7C7B\u578B\n const withLayout = React.forwardRef<\n any,\n P & { style?: string | React.CSSProperties; container?: ContainerProps['container'] }\n >((props, ref) => {\n const propsStyleProps = getStylesProps(props)\n\n // \u5C06 style \u5BF9\u8C61\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32\n const styleToString = (style?: string | React.CSSProperties): string => {\n if (!style) return ''\n if (typeof style === 'string') return style\n if (typeof style === 'object' && Object.entries(style).length <= 0) return ''\n return (\n Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase()\n return `${cssKey}: ${value}`\n })\n .join('; ') + ';'\n )\n }\n\n // \u5408\u5E76 style \u5B57\u6BB5\uFF0C\u907F\u514D\u8986\u76D6\uFF0C\u786E\u4FDD\u6BCF\u4E2A\u6837\u5F0F\u90FD\u4EE5\u5206\u53F7\u7ED3\u5C3E\n const mergedStyle = [defaultLayoutProps?.style, propsStyleProps?.style]\n .map(styleToString)\n .filter((style): style is string => Boolean(style))\n .map(style => (style.trim().endsWith(';') ? style : `${style};`))\n .join(' ')\n\n const finalStyleProps = {\n ...defaultLayoutProps,\n ...propsStyleProps,\n ...(mergedStyle && { style: mergedStyle }),\n }\n\n const { className, StyleComponent } = useStyles(finalStyleProps, (props as any)?.data)\n\n const WithContainerWrapper = (props: any) => {\n return (\n <Container className={`${className} ${(props as any)?.className || ''}`.trim()}>\n <Grid className=\"container_grid\">\n <GridItem className={getContainerClassName(props)}>\n <WrappedComponent {...props} ref={ref} />\n </GridItem>\n </Grid>\n </Container>\n )\n }\n\n const WithoutContainerWrapper = (props: any) => {\n return <WrappedComponent {...props} className={`${className} ${props?.className || '' || ''}`.trim()} ref={ref} />\n }\n\n // @ts-ignore\n // eslint-disable-next-line no-unused-vars\n const { style: _style, ...withOutStyleProps } = props\n\n return (\n <>\n <ErrorBoundary>\n {StyleComponent}\n {Reflect.ownKeys((withOutStyleProps as any)?.container || {})?.length > 0\n ? WithContainerWrapper(withOutStyleProps)\n : WithoutContainerWrapper(withOutStyleProps)}\n </ErrorBoundary>\n </>\n )\n })\n\n withLayout.displayName = `WithLayout${WrappedComponent.displayName || WrappedComponent.name || 'Component'}`\n return withLayout\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GAkES,IAAAM,EAAA,6BAlETC,EAA+B,oBAC/BC,EAA2B,2BAC3BC,EAA8B,qCAC9BC,EAA+B,iCAC/BC,EAA0B,sCAC1BC,EAA0B,iCAE1B,MAAMC,EAA4C,CAChD,GAAI,yBACJ,GAAI,yBACJ,EAAG,yBACH,EAAG,yBACH,EAAG,uBACL,EAGMC,EAAkD,CACtD,GAAI,uCACJ,GAAI,uCACJ,EAAG,uCACH,EAAG,uCACH,EAAG,qCACL,EAuBMC,EAAeC,GAA+B,CAClD,MAAMC,KAAY,EAAAC,SAAkBF,CAAK,EACzC,MAAO,YAAS,cAAWC,CAAS,CAAC,EACvC,EAKaf,EAAqDc,GAAwC,CACxG,KAAM,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,EAAIL,EACjC,MAAO,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,CAChC,EAKMC,EAAgC,CA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,IAAIC,CAAa,EACjB,OAAQjB,GAA2B,EAAQA,CAAM,EACjD,IAAIA,GAAUA,EAAM,KAAK,EAAE,SAAS,GAAG,EAAIA,EAAQ,GAAGA,CAAK,GAAI,EAC/D,KAAK,GAAG,EAELqB,EAAkB,CACtB,GAAGR,EACH,GAAGG,EACH,GAAII,GAAe,CAAE,MAAOA,CAAY,CAC1C,EAEM,CAAE,UAAAE,EAAW,eAAAhB,CAAe,EAAItB,EAAUqC,EAAkBxB,GAAe,IAAI,EAE/E0B,EAAwB1B,MAE1B,OAAC,aAAU,UAAW,GAAGyB,CAAS,IAAKzB,GAAe,WAAa,EAAE,GAAG,KAAK,EAC3E,mBAAC,QAAK,UAAU,iBACd,mBAAC,YAAS,UAAWU,EAAsBV,CAAK,EAC9C,mBAACe,EAAA,CAAkB,GAAGf,EAAO,IAAKkB,EAAK,EACzC,EACF,EACF,EAIES,EAA2B3B,MACxB,OAACe,EAAA,CAAkB,GAAGf,EAAO,UAAW,GAAGyB,CAAS,IAAIzB,GAAO,WAAa,IAAM,EAAE,GAAG,KAAK,EAAG,IAAKkB,EAAK,EAK5G,CAAE,MAAOU,EAAQ,GAAGC,CAAkB,EAAI7B,EAEhD,SACE,mBACE,oBAAC,EAAA8B,QAAA,CACE,UAAArB,EACA,QAAQ,QAASoB,GAA2B,WAAa,CAAC,CAAC,GAAG,OAAS,EACpEH,EAAqBG,CAAiB,EACtCF,EAAwBE,CAAiB,GAC/C,EACF,CAEJ,CAAC,EAED,OAAAzC,EAAW,YAAc,aAAa2B,EAAiB,aAAeA,EAAiB,MAAQ,WAAW,GACnG3B,CACT",
6
- "names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withLayout", "__toCommonJS", "import_jsx_runtime", "import_react", "import_simpleHash", "import_getKeyPropsString", "import_grid", "import_container", "import_ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getKeyPropsString", "style", "uid", "disabled", "Styles", "styleProps", "data", "StyleComponent", "getContainerClassName", "desktopSpan", "mobileSpan", "mobileClasses", "desktopClasses", "WrappedComponent", "defaultLayoutProps", "React", "ref", "propsStyleProps", "styleToString", "key", "value", "mergedStyle", "finalStyleProps", "className", "WithContainerWrapper", "WithoutContainerWrapper", "_style", "withOutStyleProps", "ErrorBoundary"]
4
+ "sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n /** \u684C\u9762\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n desktopSpan: number\n /** \u79FB\u52A8\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32\u6216\u5BF9\u8C61 */\n style?: string | React.CSSProperties\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return <style suppressHydrationWarning data-style-id={uid}>{`.block-${uid} { ${style} }`}</style>\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\nconst getContainerClassName = (props?: Partial<StylesProps & ContainerProps>) => {\n const { desktopSpan, mobileSpan } = props?.container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\n/**\n * \u6807\u8BB0\u7EC4\u4EF6\u662F\u5426\u5DF2\u88AB withLayout \u5305\u88C5\n */\nconst WRAPPED_COMPONENT_SYMBOL = Symbol('withLayoutWrapped')\n\n/**\n * \u9AD8\u9636\u7EC4\u4EF6\u901A\u8FC7 withLayout \u5305\u88C5\u7EC4\u4EF6\uFF0C\u81EA\u52A8\u5E94\u7528\u6837\u5F0F\u548C\u5BB9\u5668\u5E03\u5C40\n *\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultLayoutProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\nexport function withLayout<P>(\n WrappedComponent: React.ComponentType<P>,\n defaultLayoutProps?: Partial<StylesProps & ContainerProps>\n) {\n // \u9632\u6B62\u91CD\u590D\u5305\u88C5\n if ((WrappedComponent as any)[WRAPPED_COMPONENT_SYMBOL]) {\n return WrappedComponent as any\n }\n // \u4F7F\u7528\u60A8\u7684\u7B80\u6D01\u65B9\u6CD5\uFF1A\u76F4\u63A5\u7528\u6CDB\u578B\u4FDD\u7559\u7C7B\u578B\n const withLayout = React.forwardRef<\n any,\n P & { style?: string | React.CSSProperties; container?: ContainerProps['container'] }\n >((props, ref) => {\n const propsStyleProps = getStylesProps(props)\n\n // \u5C06 style \u5BF9\u8C61\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32\n const styleToString = (style?: string | React.CSSProperties): string => {\n if (!style) return ''\n if (typeof style === 'string') return style\n if (typeof style === 'object' && Object.entries(style).length <= 0) return ''\n return (\n Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase()\n return `${cssKey}: ${value}`\n })\n .join('; ') + ';'\n )\n }\n\n // \u5408\u5E76 style \u5B57\u6BB5\uFF0C\u907F\u514D\u8986\u76D6\uFF0C\u786E\u4FDD\u6BCF\u4E2A\u6837\u5F0F\u90FD\u4EE5\u5206\u53F7\u7ED3\u5C3E\n const mergedStyle = [defaultLayoutProps?.style, propsStyleProps?.style]\n .map(styleToString)\n .filter((style): style is string => Boolean(style))\n .map(style => (style.trim().endsWith(';') ? style : `${style};`))\n .join(' ')\n\n const finalStyleProps = {\n ...defaultLayoutProps,\n ...propsStyleProps,\n ...(mergedStyle && { style: mergedStyle }),\n }\n\n const { className, StyleComponent } = useStyles(finalStyleProps, (props as any)?.data)\n\n const WithContainerWrapper = (props: any) => {\n return (\n <Container className={`${className} ${(props as any)?.className || ''}`.trim()}>\n <Grid className=\"container_grid\">\n <GridItem className={getContainerClassName(props)}>\n <WrappedComponent {...props} ref={ref} />\n </GridItem>\n </Grid>\n </Container>\n )\n }\n\n const WithoutContainerWrapper = (props: any) => {\n return <WrappedComponent {...props} className={`${className} ${props?.className || '' || ''}`.trim()} ref={ref} />\n }\n\n // @ts-ignore\n // eslint-disable-next-line no-unused-vars\n const { style: _style, ...withOutStyleProps } = props\n\n return (\n <>\n <ErrorBoundary>\n {StyleComponent}\n {Reflect.ownKeys((withOutStyleProps as any)?.container || {})?.length > 0\n ? WithContainerWrapper(withOutStyleProps)\n : WithoutContainerWrapper(withOutStyleProps)}\n </ErrorBoundary>\n </>\n )\n })\n\n withLayout.displayName = `WithLayout${WrappedComponent.displayName || WrappedComponent.name || 'Component'}`\n\n // \u6807\u8BB0\u7EC4\u4EF6\u5DF2\u88AB\u5305\u88C5\n ;(withLayout as any)[WRAPPED_COMPONENT_SYMBOL] = true\n return withLayout\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GAkES,IAAAM,EAAA,6BAlETC,EAA+B,oBAC/BC,EAA2B,2BAC3BC,EAA8B,qCAC9BC,EAA+B,iCAC/BC,EAA0B,sCAC1BC,EAA0B,iCAE1B,MAAMC,EAA4C,CAChD,GAAI,yBACJ,GAAI,yBACJ,EAAG,yBACH,EAAG,yBACH,EAAG,uBACL,EAGMC,EAAkD,CACtD,GAAI,uCACJ,GAAI,uCACJ,EAAG,uCACH,EAAG,uCACH,EAAG,qCACL,EAuBMC,EAAeC,GAA+B,CAClD,MAAMC,KAAY,EAAAC,SAAkBF,CAAK,EACzC,MAAO,YAAS,cAAWC,CAAS,CAAC,EACvC,EAKaf,EAAqDc,GAAwC,CACxG,KAAM,CAAE,MAAAG,EAAO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 "names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withLayout", "__toCommonJS", "import_jsx_runtime", "import_react", "import_simpleHash", "import_getKeyPropsString", "import_grid", "import_container", "import_ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getKeyPropsString", "style", "uid", "disabled", "Styles", "styleProps", "data", "StyleComponent", "getContainerClassName", "desktopSpan", "mobileSpan", "mobileClasses", "desktopClasses", "WRAPPED_COMPONENT_SYMBOL", "WrappedComponent", "defaultLayoutProps", "React", "ref", "propsStyleProps", "styleToString", "key", "value", "mergedStyle", "finalStyleProps", "className", "WithContainerWrapper", "WithoutContainerWrapper", "_style", "withOutStyleProps", "ErrorBoundary"]
7
7
  }
@@ -48,43 +48,5 @@ export type AccordionCardsType = Omit<React.HTMLAttributes<HTMLDivElement>, 'cla
48
48
  primaryButton?: (_v: any, _index: number) => void;
49
49
  };
50
50
  };
51
- declare const _default: React.ForwardRefExoticComponent<Omit<Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
52
- className?: string;
53
- data: {
54
- key?: string;
55
- title?: string;
56
- products: Array<ItemType>;
57
- /** 按钮形状 */
58
- shape?: "round" | "square";
59
- /** 卡片形状 */
60
- itemShape?: "round" | "square";
61
- /** 主按钮配置 */
62
- primaryButton?: string;
63
- theme?: "light" | "dark";
64
- };
65
- /**
66
- * 自动播放配置
67
- */
68
- autoplay?: {
69
- /**
70
- * 是否开启自动播放
71
- */
72
- enabled: boolean;
73
- /**
74
- * 是否循环播放
75
- */
76
- loop?: boolean;
77
- /**
78
- * 自动播放间隔时间,单位毫秒
79
- */
80
- interval?: number;
81
- };
82
- /** 按钮事件*/
83
- event?: {
84
- primaryButton?: (_v: any, _index: number) => void;
85
- };
86
- } & React.RefAttributes<HTMLDivElement> & {
87
- style?: string | React.CSSProperties;
88
- container?: import("../../shared/Styles.js").ContainerProps["container"];
89
- }, "ref"> & React.RefAttributes<any>>;
51
+ declare const _default: any;
90
52
  export default _default;
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as r,jsxs as a}from"react/jsx-runtime";import B from"../Title/index.js";import{cn as o}from"../../helpers/utils.js";import _ from"../../components/picture.js";import N from"../../components/button.js";import S from"../SwiperBox/index.js";import{withLayout as C}from"../../shared/Styles.js";import D,{useState as L,useRef as g,useCallback as A,useImperativeHandle as j,useEffect as M}from"react";import{useExposure as H}from"../../hooks/useExposure.js";import{trackUrlRef as T}from"../../shared/trackUrlRef.js";import z from"../../shared/throttle.js";import{Heading as R}from"../../components/heading.js";const l="image",s="scene_banner",P=({item:e,idx:t,itemShape:m,hoverIndex:v,getRef:w,handleSwiperItemClick:b,contentWidth:d,primaryButton:c,event:p,data:u,accordionRef:k})=>{const h=v===t,y=h?8:1;return H({current:k.current[t]},{componentType:l,componentName:s,componentTitle:e?.title,position:t+1,componentDescription:e?.subTitle}),a("div",{style:{flex:`${y} 1 0%`,transition:"all 0.6s"},ref:x=>{x&&w(t,x)},className:o("relative cursor-pointer overflow-hidden",m==="round"?"rounded-2xl":""),onMouseEnter:()=>b(t),onClick:()=>{b(t)},children:[r("a",{href:T(e?.imgLink,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:r(_,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}),a("div",{style:{width:d},className:o("absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in",h&&d?"opacity-100":"opacity-0"),children:[a("div",{className:"mr-16 flex-1 overflow-hidden",children:[r(R,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",children:e?.title}),r(R,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",children:e?.subTitle})]}),c&&a(N,{className:o("mb-1.5 font-bold"),as:"a",href:T(e?.link,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${c}`,onClick:()=>p?.primaryButton?.(u,t),children:[c,r("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},t)},O=({data:e,configuration:t})=>{const m=g(null);return H(m,{componentType:l,componentName:s,componentTitle:e?.title,position:t?.index+1,componentDescription:e?.subTitle}),a("div",{ref:m,className:o("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid",t?.itemShape==="round"?"rounded-2xl":""),children:[r("a",{href:T(e?.imgLink,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-postion":`''#${t?.index+1}`,children:r(_,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}),a("div",{className:o("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[a("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[r("h3",{className:"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]",dangerouslySetInnerHTML:{__html:e?.title}}),r("h4",{className:"text-info-primary line-clamp-2 text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}})]}),t?.primaryButton&&r(N,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:o("text-info-primary text-sm font-bold"),href:T(e.link,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-nav-postion":`''#${t?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,children:t?.primaryButton})]})]})},E=D.forwardRef(({data:e,autoplay:t={enabled:!1,loop:!1,interval:1500},className:m="",event:v,...w},b)=>{const[d,c]=L(0),p=g(0),u=g([]),[k,h]=L(0),y=g(null);j(b,()=>y.current);const x=(n,i)=>{i&&(u.current[n]=i)};M(()=>{const n=()=>{u.current[p.current]&&h(u.current[p.current].offsetWidth)};n();const i=z(n,300);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const I=A(n=>{d!==n&&(c(n),p.current=n)},[e?.products,d]);return M(()=>{let n;return t?.enabled&&(n=setInterval(()=>{c(i=>{const $=i??0;let f;if(t.loop!==!1)f=($+1)%e?.products?.length;else if(f=$+1,f>=e?.products?.length)return f=e?.products?.length-1,n&&clearInterval(n),$;return p.current=f,f})},t?.interval)),()=>{n&&clearInterval(n)}},[t?.enabled,t?.interval,t?.loop,e?.products?.length,I]),a("div",{...w,ref:y,children:[e?.title&&r(B,{data:{title:e?.title}}),r("div",{className:o("laptop:block hidden",{"aiui-dark":e?.theme==="dark"}),children:r("div",{className:o("lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden",m),children:e?.products?.map((n,i)=>r(P,{item:n,idx:i,itemShape:e?.itemShape,hoverIndex:d,getRef:x,handleSwiperItemClick:I,contentWidth:k,primaryButton:e?.primaryButton,event:v,data:e,accordionRef:u},i))})}),r("div",{className:o("laptop:hidden block",{"aiui-dark":e?.theme==="dark"}),children:r(S,{className:o("h-[400px] !overflow-visible",m),id:"AccordionCards"+e?.key,data:{list:e?.products,configuration:{shape:e?.shape,itemShape:e?.itemShape,primaryButton:e?.primaryButton,event:v,title:e?.title}},Slide:O,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});E.displayName="AccordionCards";var Z=C(E);export{Z as default};
1
+ "use client";import{jsx as r,jsxs as a}from"react/jsx-runtime";import B from"../Title/index.js";import{cn as o}from"../../helpers/utils.js";import _ from"../../components/picture.js";import N from"../../components/button.js";import S from"../SwiperBox/index.js";import{withLayout as C}from"../../shared/Styles.js";import D,{useState as L,useRef as g,useCallback as A,useImperativeHandle as j,useEffect as M}from"react";import{useExposure as H}from"../../hooks/useExposure.js";import{trackUrlRef as T}from"../../shared/trackUrlRef.js";import z from"../../shared/throttle.js";import{Heading as R}from"../../components/heading.js";const l="image",s="scene_banner",P=({item:e,idx:t,itemShape:m,hoverIndex:v,getRef:w,handleSwiperItemClick:b,contentWidth:d,primaryButton:c,event:p,data:u,accordionRef:k})=>{const h=v===t,y=h?8:1;return H({current:k.current[t]},{componentType:l,componentName:s,componentTitle:e?.title,position:t+1,componentDescription:e?.subTitle}),a("div",{style:{flex:`${y} 1 0%`,transition:"all 0.6s"},ref:x=>{x&&w(t,x)},className:o("relative cursor-pointer overflow-hidden",m==="round"?"rounded-2xl":""),onMouseEnter:()=>b(t),onClick:()=>{b(t)},children:[r("a",{href:T(e?.imgLink,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:r(_,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}),a("div",{style:{width:d},className:o("absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in",h&&d?"opacity-100":"opacity-0"),children:[a("div",{className:"mr-16 flex-1 overflow-hidden",children:[r(R,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",children:e?.title}),r(R,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",children:e?.subTitle})]}),c&&a(N,{className:o("mb-1.5 font-bold"),as:"a",href:T(e?.link,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${c}`,onClick:()=>p?.primaryButton?.(u,t),children:[c,r("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},t)},O=({data:e,configuration:t})=>{const m=g(null);return H(m,{componentType:l,componentName:s,componentTitle:e?.title,position:t?.index+1,componentDescription:e?.subTitle}),a("div",{ref:m,className:o("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid",t?.itemShape==="round"?"rounded-2xl":""),children:[r("a",{href:T(e?.imgLink,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-position":`''#${t?.index+1}`,children:r(_,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}),a("div",{className:o("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[a("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[r("h3",{className:"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]",dangerouslySetInnerHTML:{__html:e?.title}}),r("h4",{className:"text-info-primary line-clamp-2 text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}})]}),t?.primaryButton&&r(N,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:o("text-info-primary text-sm font-bold"),href:T(e.link,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-nav-position":`''#${t?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,children:t?.primaryButton})]})]})},E=D.forwardRef(({data:e,autoplay:t={enabled:!1,loop:!1,interval:1500},className:m="",event:v,...w},b)=>{const[d,c]=L(0),p=g(0),u=g([]),[k,h]=L(0),y=g(null);j(b,()=>y.current);const x=(n,i)=>{i&&(u.current[n]=i)};M(()=>{const n=()=>{u.current[p.current]&&h(u.current[p.current].offsetWidth)};n();const i=z(n,300);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const I=A(n=>{d!==n&&(c(n),p.current=n)},[e?.products,d]);return M(()=>{let n;return t?.enabled&&(n=setInterval(()=>{c(i=>{const $=i??0;let f;if(t.loop!==!1)f=($+1)%e?.products?.length;else if(f=$+1,f>=e?.products?.length)return f=e?.products?.length-1,n&&clearInterval(n),$;return p.current=f,f})},t?.interval)),()=>{n&&clearInterval(n)}},[t?.enabled,t?.interval,t?.loop,e?.products?.length,I]),a("div",{...w,ref:y,children:[e?.title&&r(B,{data:{title:e?.title}}),r("div",{className:o("laptop:block hidden",{"aiui-dark":e?.theme==="dark"}),children:r("div",{className:o("lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden",m),children:e?.products?.map((n,i)=>r(P,{item:n,idx:i,itemShape:e?.itemShape,hoverIndex:d,getRef:x,handleSwiperItemClick:I,contentWidth:k,primaryButton:e?.primaryButton,event:v,data:e,accordionRef:u},i))})}),r("div",{className:o("laptop:hidden block",{"aiui-dark":e?.theme==="dark"}),children:r(S,{className:o("h-[400px] !overflow-visible",m),id:"AccordionCards"+e?.key,data:{list:e?.products,configuration:{shape:e?.shape,itemShape:e?.itemShape,primaryButton:e?.primaryButton,event:v,title:e?.title}},Slide:O,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});E.displayName="AccordionCards";var Z=C(E);export{Z as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/AccordionCards/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport React, { useState, useRef, useCallback, useImperativeHandle, useEffect, type RefObject } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport throttle from '../../shared/throttle.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'scene_banner'\n\n/** Hook\uFF1A\u76D1\u542C\u7A97\u53E3\u5BBD\u5EA6 */\ntype ItemType = {\n /** \u6807\u9898\u6587\u672C */\n title: string\n /** \u56FE\u7247*/\n img: Img\n mobileImg?: Img\n /** \u5185\u5BB9\u8282\u70B9 */\n subTitle: string\n link?: string\n imgLink?: string\n}\n\nexport type AccordionCardsType = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {\n className?: string\n data: {\n key?: string\n title?: string\n products: Array<ItemType>\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n theme?: 'light' | 'dark'\n }\n /**\n * \u81EA\u52A8\u64AD\u653E\u914D\u7F6E\n */\n autoplay?: {\n /**\n * \u662F\u5426\u5F00\u542F\u81EA\u52A8\u64AD\u653E\n */\n enabled: boolean\n /**\n * \u662F\u5426\u5FAA\u73AF\u64AD\u653E\n */\n loop?: boolean\n /**\n * \u81EA\u52A8\u64AD\u653E\u95F4\u9694\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\n */\n interval?: number\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n}\n\nconst AccordionCardsPcItem = ({\n item,\n idx,\n itemShape,\n hoverIndex,\n getRef,\n handleSwiperItemClick,\n contentWidth,\n primaryButton,\n event,\n data,\n accordionRef,\n}: {\n item: ItemType\n idx: number\n itemShape: 'round' | 'square' | undefined\n hoverIndex: number | null\n getRef: (_idx: number, _el: HTMLDivElement) => void\n handleSwiperItemClick: (_idx: number) => void\n contentWidth: number\n primaryButton: string | undefined\n event: any\n data: AccordionCardsType['data']\n accordionRef: React.MutableRefObject<HTMLDivElement[]>\n}) => {\n const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\n\n useExposure({ current: accordionRef.current[idx] } as RefObject<HTMLDivElement>, {\n componentType,\n componentName,\n componentTitle: item?.title,\n position: idx + 1,\n componentDescription: item?.subTitle,\n })\n\n return (\n <div\n key={idx}\n style={{\n flex: `${flexValue} 1 0%`,\n transition: 'all 0.6s',\n }}\n ref={(el: HTMLDivElement | null) => {\n if (el) getRef(idx, el)\n }}\n className={cn('relative cursor-pointer overflow-hidden', itemShape === 'round' ? 'rounded-2xl' : '')}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onClick={() => {\n handleSwiperItemClick(idx)\n }}\n >\n <a\n href={trackUrlRef(item?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}`}\n >\n <Picture\n source={item?.img?.url}\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n alt={item?.img?.alt || ''}\n />\n </a>\n <div\n style={{\n width: contentWidth,\n }}\n className={cn(\n 'absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in',\n isExpanded && contentWidth ? 'opacity-100' : 'opacity-0'\n )}\n >\n <div className=\"mr-16 flex-1 overflow-hidden\">\n <Heading as=\"h3\" className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\">\n {item?.title}\n </Heading>\n <Heading\n as=\"h4\"\n className=\"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]\"\n >\n {item?.subTitle}\n </Heading>\n </div>\n {primaryButton && (\n <Button\n className={cn('mb-1.5 font-bold')}\n as=\"a\"\n href={trackUrlRef(item?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}#${primaryButton}`}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n position: configuration?.index + 1,\n componentDescription: data?.subTitle,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n >\n <a\n href={trackUrlRef(data?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}@${data?.subTitle}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n >\n <Picture\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n source={data?.mobileImg?.url || ''}\n alt={data?.mobileImg?.alt || ''}\n />\n </a>\n <div className={cn('absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4')}>\n <div className=\"tablet:mb-6 mb-4 flex-1 overflow-hidden\">\n <h3\n className=\"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n ></h3>\n <h4\n className=\"text-info-primary line-clamp-2 text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n ></h4>\n </div>\n\n {configuration?.primaryButton && (\n <Button\n as=\"a\"\n variant=\"secondary\"\n aria-label={data?.title ?? data?.subTitle}\n className={cn('text-info-primary text-sm font-bold')}\n href={trackUrlRef(data.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-title-desc-button={`${data?.title}#${data?.subTitle}#${configuration?.primaryButton}`}\n >\n {configuration?.primaryButton}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(\n ({ data, autoplay = { enabled: false, loop: false, interval: 1500 }, className = '', event, ...rest }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n const getRef = (index: number, el: HTMLDivElement) => {\n if (el) {\n accordionRef.current[index] = el\n }\n }\n\n useEffect(() => {\n const handleResize = () => {\n if (accordionRef.current[hoverIndexRef.current]) {\n setContentWidth(accordionRef.current[hoverIndexRef.current].offsetWidth)\n }\n }\n handleResize()\n const throttleResize = throttle(handleResize, 300)\n window.addEventListener('resize', throttleResize)\n return () => window.removeEventListener('resize', throttleResize)\n }, [])\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx) return\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data?.products, hoverIndex]\n )\n\n useEffect(() => {\n let autoPlayTimer: NodeJS.Timeout\n if (autoplay?.enabled) {\n autoPlayTimer = setInterval(() => {\n setHoverIndex(prev => {\n const currentIndex = prev ?? 0\n let nextIndex: number\n\n if (autoplay.loop !== false) {\n // \u9ED8\u8BA4\u5FAA\u73AF\u64AD\u653E\n nextIndex = (currentIndex + 1) % data?.products?.length\n } else {\n // \u4E0D\u5FAA\u73AF\uFF1A\u64AD\u653E\u5230\u6700\u540E\u4E00\u4E2A\u540E\u505C\u6B62\n nextIndex = currentIndex + 1\n if (nextIndex >= data?.products?.length) {\n nextIndex = data?.products?.length - 1\n // \u505C\u6B62\u81EA\u52A8\u64AD\u653E\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n return currentIndex // \u4FDD\u6301\u5728\u6700\u540E\u4E00\u4E2A\n }\n }\n\n hoverIndexRef.current = nextIndex\n return nextIndex\n })\n }, autoplay?.interval)\n }\n return () => {\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n }\n }, [autoplay?.enabled, autoplay?.interval, autoplay?.loop, data?.products?.length, handleSwiperItemClick])\n\n return (\n <div {...rest} ref={innerRef}>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div className={cn('laptop:block hidden', { 'aiui-dark': data?.theme === 'dark' })}>\n <div\n className={cn(\n 'lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden',\n className\n )}\n >\n {data?.products?.map((item, idx) => (\n <AccordionCardsPcItem\n key={idx}\n item={item}\n idx={idx}\n itemShape={data?.itemShape}\n hoverIndex={hoverIndex}\n getRef={getRef}\n handleSwiperItemClick={handleSwiperItemClick}\n contentWidth={contentWidth}\n primaryButton={data?.primaryButton}\n event={event}\n data={data}\n accordionRef={accordionRef}\n />\n ))}\n </div>\n </div>\n <div className={cn('laptop:hidden block', { 'aiui-dark': data?.theme === 'dark' })}>\n <SwiperBox\n className={cn('h-[400px] !overflow-visible', className)}\n id={'AccordionCards' + data?.key}\n data={{\n list: data?.products,\n configuration: {\n shape: data?.shape,\n itemShape: data?.itemShape,\n primaryButton: data?.primaryButton,\n event: event,\n title: data?.title,\n },\n }}\n Slide={MobileItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nAccordionCards.displayName = 'AccordionCards'\nexport default withLayout(AccordionCards)\n"],
5
- "mappings": "aA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AAI,UAAWG,EAAG,sBAAuB,CAAE,YAAa2B,GAAM,QAAU,MAAO,CAAC,EAC/E,SAAA9B,EAAC,OACC,UAAWG,EACT,2KACAqC,CACF,EAEC,SAAAV,GAAM,UAAU,IAAI,CAACT,EAAMC,IAC1BtB,EAACoB,EAAA,CAEC,KAAMC,EACN,IAAKC,EACL,UAAWQ,GAAM,UACjB,WAAYN,EACZ,OAAQC,EACR,sBAAuBC,EACvB,aAAcC,EACd,cAAeG,GAAM,cACrB,MAAOD,EACP,KAAMC,EACN,aAAcC,GAXTT,CAYP,CACD,EACH,EACF,EACAtB,EAAC,OAAI,UAAWG,EAAG,sBAAuB,CAAE,YAAa2B,GAAM,QAAU,MAAO,CAAC,EAC/E,SAAA9B,EAACM,EAAA,CACC,UAAWH,EAAG,8BAA+BqC,CAAS,EACtD,GAAI,iBAAmBV,GAAM,IAC7B,KAAM,CACJ,KAAMA,GAAM,SACZ,cAAe,CACb,MAAOA,GAAM,MACb,UAAWA,GAAM,UACjB,cAAeA,GAAM,cACrB,MAAOD,EACP,MAAOC,GAAM,KACf,CACF,EACA,MAAOK,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,CACF,EACF,EACF,GACF,CAEJ,CACF,EAEAG,EAAe,YAAc,iBAC7B,IAAOe,EAAQ9C,EAAW+B,CAAc",
4
+ "sourcesContent": ["'use client'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport React, { useState, useRef, useCallback, useImperativeHandle, useEffect, type RefObject } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport throttle from '../../shared/throttle.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'scene_banner'\n\n/** Hook\uFF1A\u76D1\u542C\u7A97\u53E3\u5BBD\u5EA6 */\ntype ItemType = {\n /** \u6807\u9898\u6587\u672C */\n title: string\n /** \u56FE\u7247*/\n img: Img\n mobileImg?: Img\n /** \u5185\u5BB9\u8282\u70B9 */\n subTitle: string\n link?: string\n imgLink?: string\n}\n\nexport type AccordionCardsType = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {\n className?: string\n data: {\n key?: string\n title?: string\n products: Array<ItemType>\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n theme?: 'light' | 'dark'\n }\n /**\n * \u81EA\u52A8\u64AD\u653E\u914D\u7F6E\n */\n autoplay?: {\n /**\n * \u662F\u5426\u5F00\u542F\u81EA\u52A8\u64AD\u653E\n */\n enabled: boolean\n /**\n * \u662F\u5426\u5FAA\u73AF\u64AD\u653E\n */\n loop?: boolean\n /**\n * \u81EA\u52A8\u64AD\u653E\u95F4\u9694\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\n */\n interval?: number\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n}\n\nconst AccordionCardsPcItem = ({\n item,\n idx,\n itemShape,\n hoverIndex,\n getRef,\n handleSwiperItemClick,\n contentWidth,\n primaryButton,\n event,\n data,\n accordionRef,\n}: {\n item: ItemType\n idx: number\n itemShape: 'round' | 'square' | undefined\n hoverIndex: number | null\n getRef: (_idx: number, _el: HTMLDivElement) => void\n handleSwiperItemClick: (_idx: number) => void\n contentWidth: number\n primaryButton: string | undefined\n event: any\n data: AccordionCardsType['data']\n accordionRef: React.MutableRefObject<HTMLDivElement[]>\n}) => {\n const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\n\n useExposure({ current: accordionRef.current[idx] } as RefObject<HTMLDivElement>, {\n componentType,\n componentName,\n componentTitle: item?.title,\n position: idx + 1,\n componentDescription: item?.subTitle,\n })\n\n return (\n <div\n key={idx}\n style={{\n flex: `${flexValue} 1 0%`,\n transition: 'all 0.6s',\n }}\n ref={(el: HTMLDivElement | null) => {\n if (el) getRef(idx, el)\n }}\n className={cn('relative cursor-pointer overflow-hidden', itemShape === 'round' ? 'rounded-2xl' : '')}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onClick={() => {\n handleSwiperItemClick(idx)\n }}\n >\n <a\n href={trackUrlRef(item?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}`}\n >\n <Picture\n source={item?.img?.url}\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n alt={item?.img?.alt || ''}\n />\n </a>\n <div\n style={{\n width: contentWidth,\n }}\n className={cn(\n 'absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in',\n isExpanded && contentWidth ? 'opacity-100' : 'opacity-0'\n )}\n >\n <div className=\"mr-16 flex-1 overflow-hidden\">\n <Heading as=\"h3\" className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\">\n {item?.title}\n </Heading>\n <Heading\n as=\"h4\"\n className=\"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]\"\n >\n {item?.subTitle}\n </Heading>\n </div>\n {primaryButton && (\n <Button\n className={cn('mb-1.5 font-bold')}\n as=\"a\"\n href={trackUrlRef(item?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}#${primaryButton}`}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n position: configuration?.index + 1,\n componentDescription: data?.subTitle,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n >\n <a\n href={trackUrlRef(data?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}@${data?.subTitle}`}\n data-headless-nav-position={`''#${configuration?.index + 1}`}\n >\n <Picture\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n source={data?.mobileImg?.url || ''}\n alt={data?.mobileImg?.alt || ''}\n />\n </a>\n <div className={cn('absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4')}>\n <div className=\"tablet:mb-6 mb-4 flex-1 overflow-hidden\">\n <h3\n className=\"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n ></h3>\n <h4\n className=\"text-info-primary line-clamp-2 text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n ></h4>\n </div>\n\n {configuration?.primaryButton && (\n <Button\n as=\"a\"\n variant=\"secondary\"\n aria-label={data?.title ?? data?.subTitle}\n className={cn('text-info-primary text-sm font-bold')}\n href={trackUrlRef(data.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-nav-position={`''#${configuration?.index + 1}`}\n data-headless-title-desc-button={`${data?.title}#${data?.subTitle}#${configuration?.primaryButton}`}\n >\n {configuration?.primaryButton}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(\n ({ data, autoplay = { enabled: false, loop: false, interval: 1500 }, className = '', event, ...rest }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n const getRef = (index: number, el: HTMLDivElement) => {\n if (el) {\n accordionRef.current[index] = el\n }\n }\n\n useEffect(() => {\n const handleResize = () => {\n if (accordionRef.current[hoverIndexRef.current]) {\n setContentWidth(accordionRef.current[hoverIndexRef.current].offsetWidth)\n }\n }\n handleResize()\n const throttleResize = throttle(handleResize, 300)\n window.addEventListener('resize', throttleResize)\n return () => window.removeEventListener('resize', throttleResize)\n }, [])\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx) return\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data?.products, hoverIndex]\n )\n\n useEffect(() => {\n let autoPlayTimer: NodeJS.Timeout\n if (autoplay?.enabled) {\n autoPlayTimer = setInterval(() => {\n setHoverIndex(prev => {\n const currentIndex = prev ?? 0\n let nextIndex: number\n\n if (autoplay.loop !== false) {\n // \u9ED8\u8BA4\u5FAA\u73AF\u64AD\u653E\n nextIndex = (currentIndex + 1) % data?.products?.length\n } else {\n // \u4E0D\u5FAA\u73AF\uFF1A\u64AD\u653E\u5230\u6700\u540E\u4E00\u4E2A\u540E\u505C\u6B62\n nextIndex = currentIndex + 1\n if (nextIndex >= data?.products?.length) {\n nextIndex = data?.products?.length - 1\n // \u505C\u6B62\u81EA\u52A8\u64AD\u653E\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n return currentIndex // \u4FDD\u6301\u5728\u6700\u540E\u4E00\u4E2A\n }\n }\n\n hoverIndexRef.current = nextIndex\n return nextIndex\n })\n }, autoplay?.interval)\n }\n return () => {\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n }\n }, [autoplay?.enabled, autoplay?.interval, autoplay?.loop, data?.products?.length, handleSwiperItemClick])\n\n return (\n <div {...rest} ref={innerRef}>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div className={cn('laptop:block hidden', { 'aiui-dark': data?.theme === 'dark' })}>\n <div\n className={cn(\n 'lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden',\n className\n )}\n >\n {data?.products?.map((item, idx) => (\n <AccordionCardsPcItem\n key={idx}\n item={item}\n idx={idx}\n itemShape={data?.itemShape}\n hoverIndex={hoverIndex}\n getRef={getRef}\n handleSwiperItemClick={handleSwiperItemClick}\n contentWidth={contentWidth}\n primaryButton={data?.primaryButton}\n event={event}\n data={data}\n accordionRef={accordionRef}\n />\n ))}\n </div>\n </div>\n <div className={cn('laptop:hidden block', { 'aiui-dark': data?.theme === 'dark' })}>\n <SwiperBox\n className={cn('h-[400px] !overflow-visible', className)}\n id={'AccordionCards' + data?.key}\n data={{\n list: data?.products,\n configuration: {\n shape: data?.shape,\n itemShape: data?.itemShape,\n primaryButton: data?.primaryButton,\n event: event,\n title: data?.title,\n },\n }}\n Slide={MobileItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nAccordionCards.displayName = 'AccordionCards'\nexport default withLayout(AccordionCards)\n"],
5
+ "mappings": "a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,OAAI,UAAWG,EAAG,sBAAuB,CAAE,YAAa2B,GAAM,QAAU,MAAO,CAAC,EAC/E,SAAA9B,EAAC,OACC,UAAWG,EACT,2KACAqC,CACF,EAEC,SAAAV,GAAM,UAAU,IAAI,CAACT,EAAMC,IAC1BtB,EAACoB,EAAA,CAEC,KAAMC,EACN,IAAKC,EACL,UAAWQ,GAAM,UACjB,WAAYN,EACZ,OAAQC,EACR,sBAAuBC,EACvB,aAAcC,EACd,cAAeG,GAAM,cACrB,MAAOD,EACP,KAAMC,EACN,aAAcC,GAXTT,CAYP,CACD,EACH,EACF,EACAtB,EAAC,OAAI,UAAWG,EAAG,sBAAuB,CAAE,YAAa2B,GAAM,QAAU,MAAO,CAAC,EAC/E,SAAA9B,EAACM,EAAA,CACC,UAAWH,EAAG,8BAA+BqC,CAAS,EACtD,GAAI,iBAAmBV,GAAM,IAC7B,KAAM,CACJ,KAAMA,GAAM,SACZ,cAAe,CACb,MAAOA,GAAM,MACb,UAAWA,GAAM,UACjB,cAAeA,GAAM,cACrB,MAAOD,EACP,MAAOC,GAAM,KACf,CACF,EACA,MAAOK,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,CACF,EACF,EACF,GACF,CAEJ,CACF,EAEAG,EAAe,YAAc,iBAC7B,IAAOe,EAAQ9C,EAAW+B,CAAc",
6
6
  "names": ["jsx", "jsxs", "Title", "cn", "Picture", "Button", "SwiperBox", "withLayout", "React", "useState", "useRef", "useCallback", "useImperativeHandle", "useEffect", "useExposure", "trackUrlRef", "throttle", "Heading", "componentType", "componentName", "AccordionCardsPcItem", "item", "idx", "itemShape", "hoverIndex", "getRef", "handleSwiperItemClick", "contentWidth", "primaryButton", "event", "data", "accordionRef", "isExpanded", "flexValue", "el", "MobileItem", "configuration", "ref", "AccordionCards", "autoplay", "className", "rest", "setHoverIndex", "hoverIndexRef", "setContentWidth", "innerRef", "index", "handleResize", "throttleResize", "autoPlayTimer", "prev", "currentIndex", "nextIndex", "AccordionCards_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as v}from"react/jsx-runtime";import{gaTrack as g}from"../../shared/track.js";import{createContext as b,useContext as l,useEffect as h}from"react";const r=b({trackingData:{},locale:void 0,copyWriting:{}}),C=()=>{if(!l(r))throw new Error("useAiui must be used in <AiuiProvider>");return l(r)},f=({children:i,...s})=>(h(()=>{const c=(t,e)=>{const n={};if(!e||!e.attributes)return n;for(const y of Array.from(e.attributes)){const a=y?.name;a?.startsWith("data-headless-")&&(n[a]=e.getAttribute(a))}const m=n?.["data-headless-sku"],p=n?.["data-headless-type-name"]?.split?.("#"),o=n?.["data-headless-title-desc-button"]?.split?.("#"),d=n?.["data-headless-nav-postion"]?.split?.("#");g({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:s?.trackingData?.pageGroup||"Home Page",component_type:p?.[0]||"",component_name:p?.[1]||"",position:d?.[1]||"",navigation:d?.[0]||"",button_name:o?.[2]||"",SKU:m||"",component_title:o?.[0]||"",component_description:o?.[1]||""}})},u=new MutationObserver(()=>{document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",e=>c(e,t)),t.setAttribute("data-headless-track-bound","true"))})});return u.observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",e=>c(e,t)),t.setAttribute("data-headless-track-bound","true"))}),()=>u.disconnect()},[]),v(r.Provider,{value:s,children:i}));var E=f;export{r as AiuiContext,E as default,C as useAiuiContext};
1
+ import{jsx as v}from"react/jsx-runtime";import{gaTrack as y}from"../../shared/track.js";import{createContext as g,useContext as b,useEffect as h}from"react";const d=g({trackingData:{},locale:void 0,copyWriting:{}}),C=()=>{const a=b(d);if(!a)throw new Error("useAiui must be used in <AiuiProvider>");return a},f=({children:a,...i})=>(h(()=>{const s=(t,e)=>{const n={};if(!e||!e.attributes)return n;for(const m of Array.from(e.attributes)){const r=m?.name;r?.startsWith("data-headless-")&&(n[r]=e.getAttribute(r))}const l=n?.["data-headless-sku"],u=n?.["data-headless-type-name"]?.split?.("#"),o=n?.["data-headless-title-desc-button"]?.split?.("#"),p=n?.["data-headless-nav-position"]?.split?.("#");y({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:i?.trackingData?.pageGroup||"Home Page",component_type:u?.[0]||"",component_name:u?.[1]||"",position:p?.[1]||"",navigation:p?.[0]||"",button_name:o?.[2]||"",SKU:l||"",component_title:o?.[0]||"",component_description:o?.[1]||""}})},c=new MutationObserver(()=>{document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",e=>s(e,t)),t.setAttribute("data-headless-track-bound","true"))})});return c.observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",e=>s(e,t)),t.setAttribute("data-headless-track-bound","true"))}),()=>c.disconnect()},[]),v(d.Provider,{value:i,children:a}));var E=f;export{d as AiuiContext,E as default,C as useAiuiContext};
2
2
  //# sourceMappingURL=index.js.map