@anker-in/headless-ui 1.0.14 → 1.0.16

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 (125) hide show
  1. package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
  2. package/dist/cjs/biz-components/AccordionCards/index.js.map +2 -2
  3. package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
  4. package/dist/cjs/biz-components/AiuiProvider/index.js.map +3 -3
  5. package/dist/cjs/biz-components/Category/index.js +1 -1
  6. package/dist/cjs/biz-components/Category/index.js.map +2 -2
  7. package/dist/cjs/biz-components/CreativeModule/index.js +1 -1
  8. package/dist/cjs/biz-components/CreativeModule/index.js.map +2 -2
  9. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  10. package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
  11. package/dist/cjs/biz-components/Faq/Faq.js +1 -1
  12. package/dist/cjs/biz-components/Faq/Faq.js.map +1 -1
  13. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  14. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  15. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  16. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js.map +2 -2
  17. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  18. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +2 -2
  19. package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
  20. package/dist/cjs/biz-components/MediaPlayerMulti/index.js.map +2 -2
  21. package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
  22. package/dist/cjs/biz-components/MemberEquity/index.js.map +2 -2
  23. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  24. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +3 -3
  25. package/dist/cjs/biz-components/ShelfDisplay/index.d.ts +1 -64
  26. package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -5
  27. package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
  28. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.d.ts +74 -0
  29. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js +1 -1
  30. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js.map +2 -2
  31. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +8 -0
  32. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +10 -0
  33. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +7 -0
  34. package/dist/cjs/biz-components/Slogan/index.js +1 -1
  35. package/dist/cjs/biz-components/Slogan/index.js.map +2 -2
  36. package/dist/cjs/biz-components/SwiperBox/index.js +1 -1
  37. package/dist/cjs/biz-components/SwiperBox/index.js.map +3 -3
  38. package/dist/cjs/biz-components/SwiperBox/types.d.ts +1 -0
  39. package/dist/cjs/biz-components/SwiperBox/types.js +1 -1
  40. package/dist/cjs/biz-components/SwiperBox/types.js.map +1 -1
  41. package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
  42. package/dist/cjs/biz-components/Tabs/Tabs.js.map +3 -3
  43. package/dist/cjs/biz-components/Tabs/types.d.ts +4 -1
  44. package/dist/cjs/biz-components/Tabs/types.js +1 -1
  45. package/dist/cjs/biz-components/Tabs/types.js.map +1 -1
  46. package/dist/cjs/biz-components/TextModal/index.js +1 -1
  47. package/dist/cjs/biz-components/TextModal/index.js.map +2 -2
  48. package/dist/cjs/biz-components/Title/index.js +1 -1
  49. package/dist/cjs/biz-components/Title/index.js.map +2 -2
  50. package/dist/cjs/biz-components/VideoModal/YouTubePlayer.js +1 -1
  51. package/dist/cjs/biz-components/VideoModal/YouTubePlayer.js.map +2 -2
  52. package/dist/cjs/biz-components/VideoModal/index.js +1 -1
  53. package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
  54. package/dist/cjs/biz-components/WhyChoose/WhyChoose.js +1 -1
  55. package/dist/cjs/biz-components/WhyChoose/WhyChoose.js.map +2 -2
  56. package/dist/cjs/components/button.d.ts +1 -0
  57. package/dist/cjs/components/button.js +1 -1
  58. package/dist/cjs/components/button.js.map +3 -3
  59. package/dist/cjs/components/tabs.js +1 -1
  60. package/dist/cjs/components/tabs.js.map +3 -3
  61. package/dist/cjs/stories/graphic.stories.d.ts +1 -1
  62. package/dist/cjs/stories/shelfDisplay.stories.d.ts +1 -1
  63. package/dist/esm/biz-components/AccordionCards/index.js +1 -1
  64. package/dist/esm/biz-components/AccordionCards/index.js.map +2 -2
  65. package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
  66. package/dist/esm/biz-components/AiuiProvider/index.js.map +3 -3
  67. package/dist/esm/biz-components/Category/index.js +1 -1
  68. package/dist/esm/biz-components/Category/index.js.map +2 -2
  69. package/dist/esm/biz-components/CreativeModule/index.js +1 -1
  70. package/dist/esm/biz-components/CreativeModule/index.js.map +2 -2
  71. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  72. package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
  73. package/dist/esm/biz-components/Faq/Faq.js +1 -1
  74. package/dist/esm/biz-components/Faq/Faq.js.map +1 -1
  75. package/dist/esm/biz-components/Graphic/index.js +1 -1
  76. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  77. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  78. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js.map +2 -2
  79. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  80. package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +2 -2
  81. package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
  82. package/dist/esm/biz-components/MediaPlayerMulti/index.js.map +2 -2
  83. package/dist/esm/biz-components/MemberEquity/index.js +2 -2
  84. package/dist/esm/biz-components/MemberEquity/index.js.map +2 -2
  85. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  86. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +3 -3
  87. package/dist/esm/biz-components/ShelfDisplay/index.d.ts +1 -64
  88. package/dist/esm/biz-components/ShelfDisplay/index.js +1 -5
  89. package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
  90. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.d.ts +74 -0
  91. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js +1 -1
  92. package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js.map +2 -2
  93. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +8 -0
  94. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +10 -0
  95. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +7 -0
  96. package/dist/esm/biz-components/Slogan/index.js +1 -1
  97. package/dist/esm/biz-components/Slogan/index.js.map +2 -2
  98. package/dist/esm/biz-components/SwiperBox/index.js +1 -1
  99. package/dist/esm/biz-components/SwiperBox/index.js.map +3 -3
  100. package/dist/esm/biz-components/SwiperBox/types.d.ts +1 -0
  101. package/dist/esm/biz-components/SwiperBox/types.js.map +1 -1
  102. package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
  103. package/dist/esm/biz-components/Tabs/Tabs.js.map +3 -3
  104. package/dist/esm/biz-components/Tabs/types.d.ts +4 -1
  105. package/dist/esm/biz-components/TextModal/index.js +1 -1
  106. package/dist/esm/biz-components/TextModal/index.js.map +2 -2
  107. package/dist/esm/biz-components/Title/index.js +1 -1
  108. package/dist/esm/biz-components/Title/index.js.map +2 -2
  109. package/dist/esm/biz-components/VideoModal/YouTubePlayer.js +1 -1
  110. package/dist/esm/biz-components/VideoModal/YouTubePlayer.js.map +2 -2
  111. package/dist/esm/biz-components/VideoModal/index.js +1 -1
  112. package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
  113. package/dist/esm/biz-components/WhyChoose/WhyChoose.js +1 -1
  114. package/dist/esm/biz-components/WhyChoose/WhyChoose.js.map +2 -2
  115. package/dist/esm/components/button.d.ts +1 -0
  116. package/dist/esm/components/button.js +1 -1
  117. package/dist/esm/components/button.js.map +3 -3
  118. package/dist/esm/components/tabs.js +1 -1
  119. package/dist/esm/components/tabs.js.map +3 -3
  120. package/dist/esm/stories/graphic.stories.d.ts +1 -1
  121. package/dist/esm/stories/shelfDisplay.stories.d.ts +1 -1
  122. package/dist/tokens/base.css +6 -0
  123. package/package.json +1 -1
  124. package/style.css +7 -4
  125. package/tailwind.config.js +2 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/WhyChoose/WhyChoose.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport type { WhyChooseProps, WhyChooseItem as ItemType } from './types.js'\nimport { Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\n// import { withStyles } from '../../shared/Styles.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\n\nconst WhyChoose = React.forwardRef<HTMLDivElement, WhyChooseProps>(({ data, className }, ref) => {\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current!)\n\n return (\n <div ref={innerRef} className={cn(className)}>\n <SwiperBox\n className=\"!overflow-visible [&_.swiper-wrapper]:flex\"\n data={{\n list: data?.productData || [],\n configuration: { shape: 'card', isTab: true },\n }}\n Slide={WhyChooseItem}\n breakpoints={{\n 0: { slidesPerView: 1, spaceBetween: 12 },\n 374: { slidesPerView: 1.2, spaceBetween: 12 },\n 768: { slidesPerView: 2.3, spaceBetween: 16 },\n 1025: { slidesPerView: 4, spaceBetween: 16 },\n 1440: { slidesPerView: 4, spaceBetween: 16 },\n 1920: { slidesPerView: 4, spaceBetween: 16 },\n }}\n id={''}\n />\n </div>\n )\n})\n\nWhyChoose.displayName = 'WhyChoose'\n\nconst WhyChooseItem = ({ data }: { data: ItemType }) => {\n return (\n <div className=\" laptop:p-[24px] laptop:shrink box-border w-full shrink-0 rounded-[16px] bg-[#EAEAEC] p-[16px]\">\n <Picture source={data.img.url} className=\"w-[36px]\" />\n <div className=\"py-[16px]\">\n <Text\n html={data?.title}\n className=\"line-clamp-2 overflow-hidden text-ellipsis text-[20px] font-bold leading-[1.2]\"\n />\n <div className=\"mt-[8px]\">\n <Text\n html={data?.desc}\n className=\"line-clamp-2 overflow-hidden text-ellipsis text-[14px] font-bold leading-[1.2]\"\n />\n </div>\n </div>\n </div>\n )\n}\n\nWhyChooseItem.displayName = 'WhyChooseItem'\n\nexport default withLayout(WhyChoose)\nexport { WhyChooseItem }\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAeM,IAAAK,EAAA,6BAdNC,EAAmD,oBAEnDC,EAA8B,qCAC9BC,EAAmB,kCAEnBC,EAA2B,kCAC3BC,EAAsB,oCAEtB,MAAMC,EAAY,EAAAC,QAAM,WAA2C,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CAC/F,MAAMC,KAAW,UAAuB,IAAI,EAC5C,gCAAoBD,EAAK,IAAMC,EAAS,OAAQ,KAG9C,OAAC,OAAI,IAAKA,EAAU,aAAW,MAAGF,CAAS,EACzC,mBAAC,EAAAG,QAAA,CACC,UAAU,6CACV,KAAM,CACJ,KAAMJ,GAAM,aAAe,CAAC,EAC5B,cAAe,CAAE,MAAO,OAAQ,MAAO,EAAK,CAC9C,EACA,MAAOX,EACP,YAAa,CACX,EAAG,CAAE,cAAe,EAAG,aAAc,EAAG,EACxC,IAAK,CAAE,cAAe,IAAK,aAAc,EAAG,EAC5C,IAAK,CAAE,cAAe,IAAK,aAAc,EAAG,EAC5C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,EAC3C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,EAC3C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,CAC7C,EACA,GAAI,GACN,EACF,CAEJ,CAAC,EAEDS,EAAU,YAAc,YAExB,MAAMT,EAAgB,CAAC,CAAE,KAAAW,CAAK,OAE1B,QAAC,OAAI,UAAU,iGACb,oBAAC,WAAQ,OAAQA,EAAK,IAAI,IAAK,UAAU,WAAW,KACpD,QAAC,OAAI,UAAU,YACb,oBAAC,QACC,KAAMA,GAAM,MACZ,UAAU,iFACZ,KACA,OAAC,OAAI,UAAU,WACb,mBAAC,QACC,KAAMA,GAAM,KACZ,UAAU,iFACZ,EACF,GACF,GACF,EAIJX,EAAc,YAAc,gBAE5B,IAAOC,KAAQ,cAAWQ,CAAS",
4
+ "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport type { WhyChooseProps, WhyChooseItem as ItemType } from './types.js'\nimport { Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\n// import { withStyles } from '../../shared/Styles.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\n\nconst WhyChoose = React.forwardRef<HTMLDivElement, WhyChooseProps>(({ data, className }, ref) => {\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current!)\n\n return (\n <div ref={innerRef} className={cn(className)}>\n <SwiperBox\n className=\"!overflow-visible [&_.swiper-wrapper]:flex\"\n data={{\n list: data?.productData || [],\n configuration: { shape: 'card', isTab: true },\n }}\n Slide={WhyChooseItem}\n breakpoints={{\n 0: { slidesPerView: 1, spaceBetween: 12 },\n 374: { slidesPerView: 1.2, spaceBetween: 12 },\n 768: { slidesPerView: 2.3, spaceBetween: 16 },\n 1025: { slidesPerView: 4, spaceBetween: 16 },\n 1440: { slidesPerView: 4, spaceBetween: 16 },\n 1920: { slidesPerView: 4, spaceBetween: 16 },\n }}\n id={''}\n />\n </div>\n )\n})\n\nWhyChoose.displayName = 'WhyChoose'\n\nconst WhyChooseItem = ({ data }: { data: ItemType }) => {\n return (\n <div className=\"whyChooseBlock laptop:p-[24px] laptop:shrink box-border w-full shrink-0 rounded-[16px] bg-[#EAEAEC] p-[16px]\">\n <Picture source={data.img.url} className=\"w-[36px]\" />\n <div className=\"mt-[16px]\">\n <Text\n html={data?.title}\n className=\"line-clamp-2 overflow-hidden text-ellipsis text-[20px] font-bold leading-[1.2]\"\n />\n <div className=\"mt-[8px]\">\n <Text\n html={data?.desc}\n className=\"line-clamp-2 overflow-hidden text-ellipsis text-[14px] font-bold leading-[1.2]\"\n />\n </div>\n </div>\n </div>\n )\n}\n\nWhyChooseItem.displayName = 'WhyChooseItem'\n\nexport default withLayout(WhyChoose)\nexport { WhyChooseItem }\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAeM,IAAAK,EAAA,6BAdNC,EAAmD,oBAEnDC,EAA8B,qCAC9BC,EAAmB,kCAEnBC,EAA2B,kCAC3BC,EAAsB,oCAEtB,MAAMC,EAAY,EAAAC,QAAM,WAA2C,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CAC/F,MAAMC,KAAW,UAAuB,IAAI,EAC5C,gCAAoBD,EAAK,IAAMC,EAAS,OAAQ,KAG9C,OAAC,OAAI,IAAKA,EAAU,aAAW,MAAGF,CAAS,EACzC,mBAAC,EAAAG,QAAA,CACC,UAAU,6CACV,KAAM,CACJ,KAAMJ,GAAM,aAAe,CAAC,EAC5B,cAAe,CAAE,MAAO,OAAQ,MAAO,EAAK,CAC9C,EACA,MAAOX,EACP,YAAa,CACX,EAAG,CAAE,cAAe,EAAG,aAAc,EAAG,EACxC,IAAK,CAAE,cAAe,IAAK,aAAc,EAAG,EAC5C,IAAK,CAAE,cAAe,IAAK,aAAc,EAAG,EAC5C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,EAC3C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,EAC3C,KAAM,CAAE,cAAe,EAAG,aAAc,EAAG,CAC7C,EACA,GAAI,GACN,EACF,CAEJ,CAAC,EAEDS,EAAU,YAAc,YAExB,MAAMT,EAAgB,CAAC,CAAE,KAAAW,CAAK,OAE1B,QAAC,OAAI,UAAU,+GACb,oBAAC,WAAQ,OAAQA,EAAK,IAAI,IAAK,UAAU,WAAW,KACpD,QAAC,OAAI,UAAU,YACb,oBAAC,QACC,KAAMA,GAAM,MACZ,UAAU,iFACZ,KACA,OAAC,OAAI,UAAU,WACb,mBAAC,QACC,KAAMA,GAAM,KACZ,UAAU,iFACZ,EACF,GACF,GACF,EAIJX,EAAc,YAAc,gBAE5B,IAAOC,KAAQ,cAAWQ,CAAS",
6
6
  "names": ["WhyChoose_exports", "__export", "WhyChooseItem", "WhyChoose_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_helpers", "import_Styles", "import_SwiperBox", "WhyChoose", "React", "data", "className", "ref", "innerRef", "SwiperBox"]
7
7
  }
@@ -33,6 +33,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
33
33
  /** 定义自组件作为父组件的类型, 详细使用方式请参考radix-ui */
34
34
  as?: 'button' | 'a';
35
35
  href?: string;
36
+ iconClassName?: string;
36
37
  /** 自定义loading */
37
38
  spinner?: React.ReactNode;
38
39
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var B=Object.create;var i=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of L(t))!C.call(e,o)&&o!==a&&i(e,o,{get:()=>t[o],enumerable:!(n=V(t,o))||n.enumerable});return e};var c=(e,t,a)=>(a=e!=null?B(z(e)):{},f(t||!e||!e.__esModule?i(a,"default",{value:e,enumerable:!0}):a,e)),H=e=>f(i({},"__esModule",{value:!0}),e);var T={};E(T,{default:()=>I,sizeMap:()=>v});module.exports=H(T);var r=require("react/jsx-runtime"),M=c(require("react")),g=require("@radix-ui/react-visually-hidden"),b=require("class-variance-authority"),y=c(require("../icons/spinner.js")),m=require("../helpers/index.js");const v={sm:{width:"16",height:"16"},base:{width:"18",height:"18"},lg:{width:"20",height:"20"}},N=({size:e="base"})=>{const{width:t,height:a}=v[e];return(0,r.jsx)("svg",{width:t,height:a,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},P=(0,b.cva)("rounded-btn inline-flex cursor-pointer items-center justify-center text-sm font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{primary:"bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active hover:text-btn-primary-active-foreground hover:bg-gradient-brand border-none ",secondary:"bg-btn-secondary outline-btn-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary-active-foreground border-solid outline outline-[1.6px] outline-offset-[-1.6px]",link:"text-info-primary hover:text-btn-primary-active border-none",ghost:"text-info-primary hover:bg-btn-primary hover:text-btn-primary-foreground"},size:{sm:"px-3 py-2 text-[12px] leading-tight",base:"px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",lg:"lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",icon:"size-10 rounded-full leading-tight"},hoverEffect:{none:"",slide:""},state:{default:"",disabled:"",loading:""}},compoundVariants:[{variant:"primary",hoverEffect:"slide",class:'before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"secondary",hoverEffect:"slide",class:'before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"primary",state:"loading",class:"bg-btn-primary-active disabled:border-btn-primary-disabled-border"},{variant:"secondary",state:"loading",class:"bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-primary-disabled"},{variant:"primary",state:"disabled",class:"disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground disabled:border-btn-primary-disabled"},{variant:"secondary",state:"disabled",class:"disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border"},{variant:"link",state:"disabled",class:"disabled:text-info-quaternary"}],defaultVariants:{variant:"primary",size:"lg",hoverEffect:"none",state:"default"}}),R=(0,b.cva)("",{variants:{variant:{primary:"stroke-btn-primary-foreground",secondary:"stroke-btn-secondary-foreground",link:"stroke-primary",ghost:"stroke-primary"}},defaultVariants:{variant:"primary"}}),u=M.forwardRef(({asChild:e=!1,as:t="button",href:a,size:n="lg",children:o,variant:s,hoverEffect:h="none",className:x,disabled:l=!1,loading:d=!1,spinner:p,...k},w)=>(0,r.jsx)(t,{disabled:l||d,className:(0,m.cn)(P({variant:s,size:n,hoverEffect:h,state:d?"loading":l?"disabled":"default"}),x),ref:w,...t==="a"?{href:a}:{},...k,children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0,children:o}),(0,r.jsx)("span",{className:"absolute",children:p||(0,r.jsx)(y.default,{className:R({variant:s})})}),(0,r.jsx)(g.VisuallyHidden,{children:o})]}):(0,r.jsxs)(r.Fragment,{children:[o,s==="link"&&n&&n!=="icon"&&(0,r.jsx)(N,{size:n})]})}));u.displayName="Button";var I=u;
1
+ "use strict";"use client";var V=Object.create;var i=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of N(t))!C.call(e,n)&&n!==a&&i(e,n,{get:()=>t[n],enumerable:!(o=L(t,n))||o.enumerable});return e};var c=(e,t,a)=>(a=e!=null?V(z(e)):{},f(t||!e||!e.__esModule?i(a,"default",{value:e,enumerable:!0}):a,e)),H=e=>f(i({},"__esModule",{value:!0}),e);var A={};E(A,{default:()=>T,sizeMap:()=>v});module.exports=H(A);var r=require("react/jsx-runtime"),M=c(require("react")),g=require("@radix-ui/react-visually-hidden"),b=require("class-variance-authority"),y=c(require("../icons/spinner.js")),m=require("../helpers/index.js");const v={sm:{width:"16",height:"16"},base:{width:"18",height:"18"},lg:{width:"20",height:"20"}},P=({size:e="base",...t})=>{const{width:a,height:o}=v[e];return(0,r.jsx)("svg",{width:a,height:o,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,r.jsx)("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},R=(0,b.cva)("rounded-btn inline-flex cursor-pointer items-center justify-center text-sm font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{primary:"bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active hover:text-btn-primary-active-foreground hover:bg-gradient-brand border-none ",secondary:"bg-btn-secondary outline-btn-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary-active-foreground border-solid outline outline-[1.6px] outline-offset-[-1.6px]",link:"text-info-primary hover:text-btn-primary-active border-none",ghost:"text-info-primary hover:bg-btn-primary hover:text-btn-primary-foreground"},size:{sm:"px-3 py-2 text-[12px] leading-tight",base:"px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",lg:"lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",icon:"size-10 rounded-full leading-tight"},hoverEffect:{none:"",slide:""},state:{default:"",disabled:"",loading:""}},compoundVariants:[{variant:"primary",hoverEffect:"slide",class:'before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"secondary",hoverEffect:"slide",class:'before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"primary",state:"loading",class:"bg-btn-primary-active disabled:border-btn-primary-disabled-border"},{variant:"secondary",state:"loading",class:"bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-primary-disabled"},{variant:"primary",state:"disabled",class:"disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground disabled:border-btn-primary-disabled"},{variant:"secondary",state:"disabled",class:"disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border"},{variant:"link",state:"disabled",class:"disabled:text-info-quaternary"}],defaultVariants:{variant:"primary",size:"lg",hoverEffect:"none",state:"default"}}),I=(0,b.cva)("",{variants:{variant:{primary:"stroke-btn-primary-foreground",secondary:"stroke-btn-secondary-foreground",link:"stroke-primary",ghost:"stroke-primary"}},defaultVariants:{variant:"primary"}}),u=M.forwardRef(({asChild:e=!1,as:t="button",href:a,size:o="lg",children:n,variant:s,hoverEffect:h="none",className:x,disabled:l=!1,loading:d=!1,spinner:p,iconClassName:k,...w},B)=>(0,r.jsx)(t,{disabled:l||d,className:(0,m.cn)(R({variant:s,size:o,hoverEffect:h,state:d?"loading":l?"disabled":"default"}),x),ref:B,...t==="a"?{href:a}:{},...w,children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0,children:n}),(0,r.jsx)("span",{className:"absolute",children:p||(0,r.jsx)(y.default,{className:I({variant:s})})}),(0,r.jsx)(g.VisuallyHidden,{children:n})]}):(0,r.jsxs)(r.Fragment,{children:[n,s==="link"&&o&&o!=="icon"&&(0,r.jsx)(P,{className:k,size:o})]})}));u.displayName="Button";var T=u;
2
2
  //# sourceMappingURL=button.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/button.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\nexport const sizeMap = {\n sm: {\n width: '16',\n height: '16',\n },\n base: {\n width: '18',\n height: '18',\n },\n lg: {\n width: '20',\n height: '20',\n },\n}\nconst LinkButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M7.5 5L12.5 10L7.5 15\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/**\n * Button Variants\n */\n// eslint-disable-next-line tailwindcss/enforces-negative-arbitrary-values\nconst buttonVariants = cva(\n 'rounded-btn inline-flex cursor-pointer items-center justify-center text-sm font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n primary:\n 'bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active hover:text-btn-primary-active-foreground hover:bg-gradient-brand border-none ',\n secondary:\n 'bg-btn-secondary outline-btn-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary-active-foreground border-solid outline outline-[1.6px] outline-offset-[-1.6px]',\n link: 'text-info-primary hover:text-btn-primary-active border-none',\n ghost: 'text-info-primary hover:bg-btn-primary hover:text-btn-primary-foreground',\n },\n size: {\n sm: 'px-3 py-2 text-[12px] leading-tight',\n base: 'px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n lg: 'lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n icon: 'size-10 rounded-full leading-tight',\n },\n /** hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C,\u9700\u8981\u6CE8\u610F\u4E0D\u540Cvariant \u4E0B\u7684\u6548\u679C */\n hoverEffect: {\n none: '',\n slide: '',\n },\n state: {\n default: '',\n disabled: '',\n loading: '',\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n hoverEffect: 'slide',\n class:\n 'before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'secondary',\n hoverEffect: 'slide',\n class:\n 'before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'primary',\n state: 'loading',\n class: 'bg-btn-primary-active disabled:border-btn-primary-disabled-border',\n },\n {\n variant: 'secondary',\n state: 'loading',\n class:\n 'bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-primary-disabled',\n },\n {\n variant: 'primary',\n state: 'disabled',\n class:\n 'disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground disabled:border-btn-primary-disabled',\n },\n {\n variant: 'secondary',\n state: 'disabled',\n class:\n 'disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border',\n },\n {\n variant: 'link',\n state: 'disabled',\n class: 'disabled:text-info-quaternary',\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'lg',\n hoverEffect: 'none',\n state: 'default',\n },\n }\n)\n\nconst loadingSvgVariants = cva('', {\n variants: {\n variant: {\n primary: 'stroke-btn-primary-foreground',\n secondary: 'stroke-btn-secondary-foreground',\n link: 'stroke-primary',\n ghost: 'stroke-primary',\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n})\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** \u8BBE\u7F6E\u6309\u94AE\u8F7D\u5165\u72B6\u6001 */\n loading?: boolean\n /** \u8BBE\u7F6E\u6309\u94AE\u5931\u6548\u72B6\u6001 */\n disabled?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui (\u5DF2\u4F5C\u5E9F\u8BF7\u52FF\u4F7F\u7528) */\n asChild?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n as?: 'button' | 'a'\n href?: string\n /** \u81EA\u5B9A\u4E49loading */\n spinner?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n // eslint-disable-next-line\n asChild = false,\n as = 'button',\n href,\n size = 'lg',\n children,\n variant,\n hoverEffect = 'none',\n className,\n disabled = false,\n loading = false,\n spinner,\n ...props\n }: ButtonProps,\n ref\n ) => {\n const Comp = as\n const isInactive = disabled || loading\n const state = loading ? 'loading' : disabled ? 'disabled' : 'default'\n\n return (\n <Comp\n disabled={isInactive}\n className={cn(buttonVariants({ variant, size, hoverEffect, state }), className)}\n ref={ref as any}\n {...(as === 'a' ? { href } : {})}\n {...(props as any)}\n >\n {loading ? (\n <>\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n <span className=\"absolute\">\n {spinner ? (\n spinner\n ) : (\n <Spinner\n className={loadingSvgVariants({\n variant,\n })}\n />\n )}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n </>\n ) : (\n <>\n {children}\n {variant === 'link' && size && size !== 'icon' && <LinkButtonAppendIcon size={size} />}\n </>\n )}\n </Comp>\n )\n }\n)\n\nButton.displayName = 'Button'\nexport default Button\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GA0BM,IAAAK,EAAA,6BAxBNC,EAAuB,oBACvBC,EAA+B,2CAC/BC,EAAuC,oCACvCC,EAAoB,kCACpBC,EAAmB,+BAEZ,MAAMP,EAAU,CACrB,GAAI,CACF,MAAO,KACP,OAAQ,IACV,EACA,KAAM,CACJ,MAAO,KACP,OAAQ,IACV,EACA,GAAI,CACF,MAAO,KACP,OAAQ,IACV,CACF,EACMQ,EAAuB,CAAC,CAAE,KAAAC,EAAO,MAAO,IAAsC,CAClF,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EAAIX,EAAQS,CAAI,EACtC,SACE,OAAC,OAAI,MAAOC,EAAO,OAAQC,EAAQ,QAAQ,YAAY,KAAK,OAAO,MAAM,6BACvE,mBAAC,QACC,EAAE,wBACF,OAAO,eACP,YAAY,UACZ,cAAc,QACd,eAAe,QACjB,EACF,CAEJ,EAMMC,KAAiB,OACrB,gMACA,CACE,SAAU,CACR,QAAS,CACP,QACE,uJACF,UACE,2MACF,KAAM,8DACN,MAAO,0EACT,EACA,KAAM,CACJ,GAAI,sCACJ,KAAM,qDACN,GAAI,sIACJ,KAAM,oCACR,EAEA,YAAa,CACX,KAAM,GACN,MAAO,EACT,EACA,MAAO,CACL,QAAS,GACT,SAAU,GACV,QAAS,EACX,CACF,EACA,iBAAkB,CAChB,CACE,QAAS,UACT,YAAa,QACb,MACE,8SACJ,EACA,CACE,QAAS,YACT,YAAa,QACb,MACE,mTACJ,EACA,CACE,QAAS,UACT,MAAO,UACP,MAAO,mEACT,EACA,CACE,QAAS,YACT,MAAO,UACP,MACE,0IACJ,EACA,CACE,QAAS,UACT,MAAO,WACP,MACE,qHACJ,EACA,CACE,QAAS,YACT,MAAO,WACP,MACE,kIACJ,EACA,CACE,QAAS,OACT,MAAO,WACP,MAAO,+BACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,KACN,YAAa,OACb,MAAO,SACT,CACF,CACF,EAEMC,KAAqB,OAAI,GAAI,CACjC,SAAU,CACR,QAAS,CACP,QAAS,gCACT,UAAW,kCACX,KAAM,iBACN,MAAO,gBACT,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CAAC,EAkBKC,EAASX,EAAM,WACnB,CACE,CAEE,QAAAY,EAAU,GACV,GAAAC,EAAK,SACL,KAAAC,EACA,KAAAR,EAAO,KACP,SAAAS,EACA,QAAAC,EACA,YAAAC,EAAc,OACd,UAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EAAU,GACV,QAAAC,EACA,GAAGC,CACL,EACAC,OAOE,OALWV,EAKV,CACC,SALeM,GAAYC,EAM3B,aAAW,MAAGX,EAAe,CAAE,QAAAO,EAAS,KAAAV,EAAM,YAAAW,EAAa,MALjDG,EAAU,UAAYD,EAAW,WAAa,SAKS,CAAC,EAAGD,CAAS,EAC9E,IAAKK,EACJ,GAAIV,IAAO,IAAM,CAAE,KAAAC,CAAK,EAAI,CAAC,EAC7B,GAAIQ,EAEJ,SAAAF,KACC,oBACE,oBAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,GACpE,SAAAL,EACH,KACA,OAAC,QAAK,UAAU,WACb,SAAAM,MAGC,OAAC,EAAAG,QAAA,CACC,UAAWd,EAAmB,CAC5B,QAAAM,CACF,CAAC,EACH,EAEJ,KACA,OAAC,kBAAgB,SAAAD,EAAS,GAC5B,KAEA,oBACG,UAAAA,EACAC,IAAY,QAAUV,GAAQA,IAAS,WAAU,OAACD,EAAA,CAAqB,KAAMC,EAAM,GACtF,EAEJ,CAGN,EAEAK,EAAO,YAAc,SACrB,IAAOf,EAAQe",
6
- "names": ["button_exports", "__export", "button_default", "sizeMap", "__toCommonJS", "import_jsx_runtime", "React", "import_react_visually_hidden", "import_class_variance_authority", "import_spinner", "import_helpers", "LinkButtonAppendIcon", "size", "width", "height", "buttonVariants", "loadingSvgVariants", "Button", "asChild", "as", "href", "children", "variant", "hoverEffect", "className", "disabled", "loading", "spinner", "props", "ref", "Spinner"]
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\nexport const sizeMap = {\n sm: {\n width: '16',\n height: '16',\n },\n base: {\n width: '18',\n height: '18',\n },\n lg: {\n width: '20',\n height: '20',\n },\n}\nconst LinkButtonAppendIcon = ({ size = 'base', ...rest }: { size: 'base' | 'lg' | 'sm'; className?: string }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...rest}>\n <path\n d=\"M7.5 5L12.5 10L7.5 15\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/**\n * Button Variants\n */\n// eslint-disable-next-line tailwindcss/enforces-negative-arbitrary-values\nconst buttonVariants = cva(\n 'rounded-btn inline-flex cursor-pointer items-center justify-center text-sm font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n primary:\n 'bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active hover:text-btn-primary-active-foreground hover:bg-gradient-brand border-none ',\n secondary:\n 'bg-btn-secondary outline-btn-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary-active-foreground border-solid outline outline-[1.6px] outline-offset-[-1.6px]',\n link: 'text-info-primary hover:text-btn-primary-active border-none',\n ghost: 'text-info-primary hover:bg-btn-primary hover:text-btn-primary-foreground',\n },\n size: {\n sm: 'px-3 py-2 text-[12px] leading-tight',\n base: 'px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n lg: 'lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n icon: 'size-10 rounded-full leading-tight',\n },\n /** hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C,\u9700\u8981\u6CE8\u610F\u4E0D\u540Cvariant \u4E0B\u7684\u6548\u679C */\n hoverEffect: {\n none: '',\n slide: '',\n },\n state: {\n default: '',\n disabled: '',\n loading: '',\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n hoverEffect: 'slide',\n class:\n 'before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'secondary',\n hoverEffect: 'slide',\n class:\n 'before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative z-[1] overflow-hidden before:absolute before:inset-y-0 before:-z-[1] before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'primary',\n state: 'loading',\n class: 'bg-btn-primary-active disabled:border-btn-primary-disabled-border',\n },\n {\n variant: 'secondary',\n state: 'loading',\n class:\n 'bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-primary-disabled',\n },\n {\n variant: 'primary',\n state: 'disabled',\n class:\n 'disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground disabled:border-btn-primary-disabled',\n },\n {\n variant: 'secondary',\n state: 'disabled',\n class:\n 'disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border',\n },\n {\n variant: 'link',\n state: 'disabled',\n class: 'disabled:text-info-quaternary',\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'lg',\n hoverEffect: 'none',\n state: 'default',\n },\n }\n)\n\nconst loadingSvgVariants = cva('', {\n variants: {\n variant: {\n primary: 'stroke-btn-primary-foreground',\n secondary: 'stroke-btn-secondary-foreground',\n link: 'stroke-primary',\n ghost: 'stroke-primary',\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n})\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {\n /** \u8BBE\u7F6E\u6309\u94AE\u8F7D\u5165\u72B6\u6001 */\n loading?: boolean\n /** \u8BBE\u7F6E\u6309\u94AE\u5931\u6548\u72B6\u6001 */\n disabled?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui (\u5DF2\u4F5C\u5E9F\u8BF7\u52FF\u4F7F\u7528) */\n asChild?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n as?: 'button' | 'a'\n href?: string\n iconClassName?: string\n /** \u81EA\u5B9A\u4E49loading */\n spinner?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n // eslint-disable-next-line\n asChild = false,\n as = 'button',\n href,\n size = 'lg',\n children,\n variant,\n hoverEffect = 'none',\n className,\n disabled = false,\n loading = false,\n spinner,\n iconClassName,\n ...props\n }: ButtonProps,\n ref\n ) => {\n const Comp = as\n const isInactive = disabled || loading\n const state = loading ? 'loading' : disabled ? 'disabled' : 'default'\n\n return (\n <Comp\n disabled={isInactive}\n className={cn(buttonVariants({ variant, size, hoverEffect, state }), className)}\n ref={ref as any}\n {...(as === 'a' ? { href } : {})}\n {...(props as any)}\n >\n {loading ? (\n <>\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n <span className=\"absolute\">\n {spinner ? (\n spinner\n ) : (\n <Spinner\n className={loadingSvgVariants({\n variant,\n })}\n />\n )}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n </>\n ) : (\n <>\n {children}\n {variant === 'link' && size && size !== 'icon' && <LinkButtonAppendIcon className={iconClassName} size={size} />}\n </>\n )}\n </Comp>\n )\n }\n)\n\nButton.displayName = 'Button'\nexport default Button\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GA0BM,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AI,CACjC,SAAU,CACR,QAAS,CACP,QAAS,gCACT,UAAW,kCACX,KAAM,iBACN,MAAO,gBACT,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CAAC,EAiBKC,EAASZ,EAAM,WACnB,CACE,CAEE,QAAAa,EAAU,GACV,GAAAC,EAAK,SACL,KAAAC,EACA,KAAAT,EAAO,KACP,SAAAU,EACA,QAAAC,EACA,YAAAC,EAAc,OACd,UAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EAAU,GACV,QAAAC,EACA,cAAAC,EACA,GAAGC,CACL,EACAC,OAOE,OALWX,EAKV,CACC,SALeM,GAAYC,EAM3B,aAAW,MAAGX,EAAe,CAAE,QAAAO,EAAS,KAAAX,EAAM,YAAAY,EAAa,MALjDG,EAAU,UAAYD,EAAW,WAAa,SAKS,CAAC,EAAGD,CAAS,EAC9E,IAAKM,EACJ,GAAIX,IAAO,IAAM,CAAE,KAAAC,CAAK,EAAI,CAAC,EAC7B,GAAIS,EAEJ,SAAAH,KACC,oBACE,oBAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,GACpE,SAAAL,EACH,KACA,OAAC,QAAK,UAAU,WACb,SAAAM,MAGC,OAAC,EAAAI,QAAA,CACC,UAAWf,EAAmB,CAC5B,QAAAM,CACF,CAAC,EACH,EAEJ,KACA,OAAC,kBAAgB,SAAAD,EAAS,GAC5B,KAEA,oBACG,UAAAA,EACAC,IAAY,QAAUX,GAAQA,IAAS,WAAU,OAACD,EAAA,CAAqB,UAAWkB,EAAe,KAAMjB,EAAM,GAChH,EAEJ,CAGN,EAEAM,EAAO,YAAc,SACrB,IAAOhB,EAAQgB",
6
+ "names": ["button_exports", "__export", "button_default", "sizeMap", "__toCommonJS", "import_jsx_runtime", "React", "import_react_visually_hidden", "import_class_variance_authority", "import_spinner", "import_helpers", "LinkButtonAppendIcon", "size", "rest", "width", "height", "buttonVariants", "loadingSvgVariants", "Button", "asChild", "as", "href", "children", "variant", "hoverEffect", "className", "disabled", "loading", "spinner", "iconClassName", "props", "ref", "Spinner"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var y=Object.create;var p=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var a in t)p(e,a,{get:t[a],enumerable:!0})},u=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of v(t))!C.call(e,s)&&s!==a&&p(e,s,{get:()=>t[s],enumerable:!(o=T(t,s))||o.enumerable});return e};var R=(e,t,a)=>(a=e!=null?y(P(e)):{},u(t||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),w=e=>u(p({},"__esModule",{value:!0}),e);var q={};N(q,{Tabs:()=>m,TabsContent:()=>b,TabsList:()=>c,TabsTrigger:()=>g});module.exports=w(q);var n=require("react/jsx-runtime"),i=R(require("react")),l=require("../helpers/index.js"),r=R(require("@radix-ui/react-tabs")),d=require("class-variance-authority");const f=i.createContext({align:"left",shape:"square"}),m=i.forwardRef(({children:e,align:t="left",shape:a="square",...o},s)=>(0,n.jsx)(r.Root,{ref:s,...o,children:(0,n.jsx)(f.Provider,{value:{align:t,shape:a},children:e})}));m.displayName="Tabs";const L=(0,d.cva)("",{variants:{align:{left:"justify-left",center:"justify-center",right:"justify-end"},shape:{rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{align:"left",shape:"square"}}),k=(0,d.cva)("",{variants:{shape:{rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"square"}}),c=i.forwardRef(({className:e,...t},a)=>{const{align:o,shape:s}=i.useContext(f);return(0,n.jsx)(r.List,{ref:a,className:(0,l.cn)("bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1",L({align:o,shape:s}),e),style:{scrollbarWidth:"none",msOverflowStyle:"none"},...t})});c.displayName=r.List.displayName;const g=i.forwardRef(({className:e,onClick:t,...a},o)=>{const{shape:s}=i.useContext(f),h=x=>{t?.(x)};return(0,n.jsx)(r.Trigger,{ref:o,className:(0,l.cn)("text-info-primary lg-desktop:text-[16px] disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-[20px] pb-[10px] pt-[11px] text-[14px] font-bold data-[state=active]:bg-white data-[state=active]:text-[#1d1d1d]",e,k({shape:s})),onClick:h,...a})});g.displayName=r.Trigger.displayName;const b=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)(r.Content,{ref:a,className:(0,l.cn)(e),...t}));b.displayName=r.Content.displayName;
1
+ "use strict";"use client";var N=Object.create;var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var q=(t,e)=>{for(var a in e)p(t,a,{get:e[a],enumerable:!0})},R=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of W(e))!k.call(t,o)&&o!==a&&p(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t};var y=(t,e,a)=>(a=t!=null?N(E(t)):{},R(e||!t||!t.__esModule?p(a,"default",{value:t,enumerable:!0}):a,t)),S=t=>R(p({},"__esModule",{value:!0}),t);var A={};q(A,{Tabs:()=>g,TabsContent:()=>T,TabsList:()=>u,TabsTrigger:()=>h});module.exports=S(A);var n=require("react/jsx-runtime"),i=y(require("react")),l=require("../helpers/index.js"),r=y(require("@radix-ui/react-tabs")),b=require("class-variance-authority");const c=i.createContext({align:"left",shape:"square"}),g=i.forwardRef(({children:t,align:e="left",shape:a="square",...s},o)=>(0,n.jsx)(r.Root,{ref:o,...s,children:(0,n.jsx)(c.Provider,{value:{align:e,shape:a},children:t})}));g.displayName="Tabs";const V=(0,b.cva)("",{variants:{align:{left:"justify-left",center:"justify-center",right:"justify-end"},shape:{rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{align:"left",shape:"square"}}),j=(0,b.cva)("",{variants:{shape:{rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"square"}}),u=i.forwardRef(({className:t,...e},a)=>{const{align:s,shape:o}=i.useContext(c);return(0,n.jsx)(r.List,{ref:a,className:(0,l.cn)("bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1",V({align:s,shape:o}),t),style:{scrollbarWidth:"none",msOverflowStyle:"none"},...e})});u.displayName=r.List.displayName;const h=i.forwardRef(({className:t,onClick:e,...a},s)=>{const{shape:o}=i.useContext(c),v=f=>{e?.(f);const d=f?.currentTarget,m=f?.currentTarget?.parentElement;if(d&&m){const x=d.offsetLeft,P=d.offsetWidth,C=m.offsetWidth,L=x-C/2+P/2;m.scrollTo({left:L,behavior:"smooth"})}};return(0,n.jsx)(r.Trigger,{ref:s,className:(0,l.cn)("text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#1d1d1d]",t,j({shape:o})),onClick:v,...a})});h.displayName=r.Trigger.displayName;const T=i.forwardRef(({className:t,...e},a)=>(0,n.jsx)(r.Content,{ref:a,className:(0,l.cn)(t),...e}));T.displayName=r.Content.displayName;
2
2
  //# sourceMappingURL=tabs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/tabs.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: Shape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: Shape\n }\n>(({ children, align = 'left', shape = 'square', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('', {\n variants: {\n align: {\n left: 'justify-left',\n center: 'justify-center',\n right: 'justify-end',\n },\n shape: {\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n align: 'left',\n shape: 'square',\n },\n})\n\nconst tabsTriggerVariants = cva('', {\n variants: {\n shape: {\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'square',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n return (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({\n align: alignFromParent,\n shape: shapeFromParent,\n }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n // e.currentTarget.scrollIntoView({\n // behavior: 'smooth',\n // inline: 'center',\n // block: 'nearest',\n // })\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-[16px] disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-[20px] pb-[10px] pt-[11px] text-[14px] font-bold data-[state=active]:bg-white data-[state=active]:text-[#1d1d1d]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(className)} {...props} />)\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,gBAAAC,EAAA,aAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAN,GAyBI,IAAAO,EAAA,6BAvBJC,EAAuB,oBACvBC,EAAmB,+BAEnBC,EAA+B,mCAC/BC,EAAoB,oCAGpB,MAAMC,EAAiBJ,EAAM,cAG1B,CACD,MAAO,OACP,MAAO,QACT,CAAC,EAEKN,EAAOM,EAAM,WAMjB,CAAC,CAAE,SAAAK,EAAU,MAAAC,EAAQ,OAAQ,MAAAC,EAAQ,SAAU,GAAGC,CAAM,EAAGC,OAC3D,OAACP,EAAc,KAAd,CAAmB,IAAKO,EAAM,GAAGD,EAChC,mBAACJ,EAAe,SAAf,CAAwB,MAAO,CAAE,MAAAE,EAAO,MAAAC,CAAM,EAAI,SAAAF,EAAS,EAC9D,CACD,EACDX,EAAK,YAAc,OAEnB,MAAMgB,KAAmB,OAAI,GAAI,CAC/B,SAAU,CACR,MAAO,CACL,KAAM,eACN,OAAQ,iBACR,MAAO,aACT,EACA,MAAO,CACL,QAAS,iBACT,OAAQ,cACV,CACF,EACA,gBAAiB,CACf,MAAO,OACP,MAAO,QACT,CACF,CAAC,EAEKC,KAAsB,OAAI,GAAI,CAClC,SAAU,CACR,MAAO,CACL,QAAS,iBACT,OAAQ,cACV,CACF,EACA,gBAAiB,CACf,MAAO,QACT,CACF,CAAC,EACKf,EAAWI,EAAM,WAGrB,CAAC,CAAE,UAAAY,EAAW,GAAGJ,CAAM,EAAGC,IAAQ,CAClC,KAAM,CAAE,MAAOI,EAAiB,MAAOC,CAAgB,EAAId,EAAM,WAAWI,CAAc,EAC1F,SACE,OAACF,EAAc,KAAd,CACC,IAAKO,EACL,aAAW,MACT,4DACAC,EAAiB,CACf,MAAOG,EACP,MAAOC,CACT,CAAC,EACDF,CACF,EACA,MAAO,CACL,eAAgB,OAChB,gBAAiB,MACnB,EACC,GAAGJ,EACN,CAEJ,CAAC,EACDZ,EAAS,YAAcM,EAAc,KAAK,YAE1C,MAAML,EAAcG,EAAM,WAGxB,CAAC,CAAE,UAAAY,EAAW,QAAAG,EAAS,GAAGP,CAAM,EAAGC,IAAQ,CAC3C,KAAM,CAAE,MAAOK,CAAgB,EAAId,EAAM,WAAWI,CAAc,EAC5DY,EAAeC,GAA2C,CAC9DF,IAAUE,CAAC,CAMb,EACA,SACE,OAACf,EAAc,QAAd,CACC,IAAKO,EACL,aAAW,MACT,4QACAG,EACAD,EAAoB,CAClB,MAAOG,CACT,CAAC,CACH,EACA,QAASE,EACR,GAAGR,EACN,CAEJ,CAAC,EACDX,EAAY,YAAcK,EAAc,QAAQ,YAEhD,MAAMP,EAAcK,EAAM,WAGxB,CAAC,CAAE,UAAAY,EAAW,GAAGJ,CAAM,EAAGC,OAAQ,OAACP,EAAc,QAAd,CAAsB,IAAKO,EAAK,aAAW,MAAGG,CAAS,EAAI,GAAGJ,EAAO,CAAE,EAC5Gb,EAAY,YAAcO,EAAc,QAAQ",
6
- "names": ["tabs_exports", "__export", "Tabs", "TabsContent", "TabsList", "TabsTrigger", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "TabsPrimitive", "import_class_variance_authority", "TabListContext", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "className", "alignFromParent", "shapeFromParent", "onClick", "handleClick", "e"]
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: Shape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: Shape\n }\n>(({ children, align = 'left', shape = 'square', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('', {\n variants: {\n align: {\n left: 'justify-left',\n center: 'justify-center',\n right: 'justify-end',\n },\n shape: {\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n align: 'left',\n shape: 'square',\n },\n})\n\nconst tabsTriggerVariants = cva('', {\n variants: {\n shape: {\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'square',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n return (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({\n align: alignFromParent,\n shape: shapeFromParent,\n }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n const tabElement = e?.currentTarget\n const container = e?.currentTarget?.parentElement\n if (tabElement && container) {\n const tabLeft = tabElement.offsetLeft\n const tabWidth = tabElement.offsetWidth\n const containerWidth = container.offsetWidth\n const scrollTo = tabLeft - containerWidth / 2 + tabWidth / 2\n container.scrollTo({\n left: scrollTo,\n behavior: 'smooth',\n })\n }\n // e.currentTarget.scrollIntoView({\n // behavior: 'smooth',\n // inline: 'center',\n // block: 'nearest',\n // })\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#1d1d1d]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(className)} {...props} />)\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,gBAAAC,EAAA,aAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAN,GAyBI,IAAAO,EAAA,6BAvBJC,EA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OK,CAAgB,EAAId,EAAM,WAAWI,CAAc,EAC5DY,EAAeC,GAA2C,CAC9DF,IAAUE,CAAC,EACX,MAAMC,EAAaD,GAAG,cAChBE,EAAYF,GAAG,eAAe,cACpC,GAAIC,GAAcC,EAAW,CAC3B,MAAMC,EAAUF,EAAW,WACrBG,EAAWH,EAAW,YACtBI,EAAiBH,EAAU,YAC3BI,EAAWH,EAAUE,EAAiB,EAAID,EAAW,EAC3DF,EAAU,SAAS,CACjB,KAAMI,EACN,SAAU,QACZ,CAAC,CACH,CAMF,EACA,SACE,OAACrB,EAAc,QAAd,CACC,IAAKO,EACL,aAAW,MACT,8PACAG,EACAD,EAAoB,CAClB,MAAOG,CACT,CAAC,CACH,EACA,QAASE,EACR,GAAGR,EACN,CAEJ,CAAC,EACDX,EAAY,YAAcK,EAAc,QAAQ,YAEhD,MAAMP,EAAcK,EAAM,WAGxB,CAAC,CAAE,UAAAY,EAAW,GAAGJ,CAAM,EAAGC,OAAQ,OAACP,EAAc,QAAd,CAAsB,IAAKO,EAAK,aAAW,MAAGG,CAAS,EAAI,GAAGJ,EAAO,CAAE,EAC5Gb,EAAY,YAAcO,EAAc,QAAQ",
6
+ "names": ["tabs_exports", "__export", "Tabs", "TabsContent", "TabsList", "TabsTrigger", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "TabsPrimitive", "import_class_variance_authority", "TabListContext", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "className", "alignFromParent", "shapeFromParent", "onClick", "handleClick", "e", "tabElement", "container", "tabLeft", "tabWidth", "containerWidth", "scrollTo"]
7
7
  }
@@ -18,8 +18,8 @@ declare const meta: {
18
18
  desktopSpan: number;
19
19
  mobileSpan: number;
20
20
  } | undefined;
21
- disabled?: boolean | undefined;
22
21
  className?: string | undefined;
22
+ disabled?: boolean | undefined;
23
23
  id?: string | undefined;
24
24
  style?: string | undefined;
25
25
  data: {
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: import("react").ForwardRefExoticComponent<Omit<Omit<import("../biz-components/ShelfDisplay/index.js").ShelfDisplayProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps & import("../shared/Styles.js").ContainerProps> & {
4
+ component: import("react").ForwardRefExoticComponent<Omit<Omit<import("../biz-components/ShelfDisplay/shelfDisplay.js").ShelfDisplayProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps & import("../shared/Styles.js").ContainerProps> & {
5
5
  className?: string;
6
6
  data?: Record<string, any>;
7
7
  }, "ref"> & import("react").RefAttributes<any>>;
@@ -1,2 +1,2 @@
1
- "use client";import{Fragment as V,jsx as r,jsxs as i}from"react/jsx-runtime";import H from"../Title/index.js";import{cn as n}from"../../helpers/utils.js";import w from"../../components/picture.js";import k from"../../components/button.js";import M from"../SwiperBox/index.js";import{withLayout as R}from"../../shared/Styles.js";import C,{useState as _,useRef as a,useCallback as S,useImperativeHandle as $,useEffect as z}from"react";import{useExposure as A}from"../../hooks/useExposure.js";import{trackUrlRef as m}from"../../shared/trackUrlRef.js";import{gaTrack as D}from"../../shared/track.js";import j from"../../shared/throttle.js";import{Heading as T}from"../../components/heading.js";const s="image",l="scene_banner",P=C.forwardRef(({data:t,className:v="",event:h},N)=>{const[c,I]=_(0),p=a(0),u=a([]),d=a(!1),[b,B]=_(0),f=a(null);$(N,()=>f.current),A(f,{componentType:s,componentName:l,componentTitle:t?.title});const E=(e,o)=>{o&&(u.current[e]=o)};z(()=>{const e=()=>{u.current[p.current]&&B(u.current[p.current].offsetWidth)};e();const o=j(e,300);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const L=({data:e,configuration:o})=>i("div",{className:n("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid",o?.itemShape==="round"?"rounded-2xl":""),children:[r("a",{href:m(e?.imgLink,`${s}_${l}`),children:r(w,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}),i("div",{className:n("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[i("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[r("p",{className:"text-info-primary text-2xl font-bold leading-[1.2]",children:e?.title}),r("h3",{className:"text-info-primary line-clamp-2 text-sm font-semibold",children:e?.subTitle})]}),r(k,{"aria-label":e?.title??e?.subTitle,variant:"secondary",className:n("text-info-primary text-sm font-bold"),as:"a",href:m(e.link,`${s}_${l}`),children:o?.primaryButton})]})]}),g=S(e=>{c===e||d.current||(d.current=!0,I(e),p.current=e,D({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:s,component_name:l,component_title:t?.products[e]?.title,component_description:t?.products[e]?.subTitle,position:e+1}}))},[t?.products,c]);return i(V,{children:[t?.title&&r(H,{data:{title:t?.title}}),r("div",{ref:f,className:n("laptop:block hidden",{"aiui-dark":t?.theme==="dark"}),children:r("div",{className: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",v),children:t?.products?.map((e,o)=>{const y=c===o;return i("div",{style:{flex:`${y?8:1} 1 0%`,transition:"all 0.6s"},ref:x=>{x&&E(o,x)},className:n("relative cursor-pointer overflow-hidden",t?.itemShape==="round"?"rounded-2xl":""),onMouseEnter:()=>g(o),onMouseLeave:()=>{d.current=!1},onClick:()=>{g(o)},children:[r("a",{href:m(e?.imgLink,`${s}_${l}`),children:r(w,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}),i("div",{style:{width:b},className: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",y&&b?"opacity-100":"opacity-0"),children:[i("div",{className:"mr-16 flex-1 overflow-hidden",children:[r(T,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",children:e?.title}),r(T,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",children:e?.subTitle})]}),i(k,{className:n("mb-1.5 font-bold"),as:"a",href:m(e?.link,`${s}_${l}`),onClick:()=>h?.primaryButton?.(t,o),children:[t?.primaryButton,r("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},o)})})}),r("div",{className:n("laptop:hidden block",{"aiui-dark":t?.theme==="dark"}),children:r(M,{className:n("h-[400px] !overflow-visible",v),id:"AccordionCards"+t?.key,data:{list:t?.products,configuration:{shape:t?.shape,itemShape:t?.itemShape,primaryButton:t?.primaryButton,event:h}},Slide:L,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});var te=R(P);export{te as default};
1
+ "use client";import{Fragment as V,jsx as r,jsxs as l}from"react/jsx-runtime";import L from"../Title/index.js";import{cn as n}from"../../helpers/utils.js";import w from"../../components/picture.js";import k from"../../components/button.js";import H from"../SwiperBox/index.js";import{withLayout as M}from"../../shared/Styles.js";import R,{useState as $,useRef as a,useCallback as C,useImperativeHandle as S,useEffect as z}from"react";import{useExposure as A}from"../../hooks/useExposure.js";import{trackUrlRef as m}from"../../shared/trackUrlRef.js";import{gaTrack as D}from"../../shared/track.js";import j from"../../shared/throttle.js";import{Heading as T}from"../../components/heading.js";const i="image",s="scene_banner",P=R.forwardRef(({data:t,className:v="",event:h},_)=>{const[p,N]=$(0),c=a(0),d=a([]),u=a(!1),[b,B]=$(0),f=a(null);S(_,()=>f.current),A(f,{componentType:i,componentName:s,componentTitle:t?.title});const I=(e,o)=>{o&&(d.current[e]=o)};z(()=>{const e=()=>{d.current[c.current]&&B(d.current[c.current].offsetWidth)};e();const o=j(e,300);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const E=({data:e,configuration:o})=>l("div",{className:n("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid",o?.itemShape==="round"?"rounded-2xl":""),children:[r("a",{href:m(e?.imgLink,`${i}_${s}`),"data-headless-type-name":`${i}#${s}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-postion":`''#${o?.index+1}`,children:r(w,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}),l("div",{className:n("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[l("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[r("p",{className:"text-info-primary text-2xl font-bold leading-[1.2]",children:e?.title}),r("h3",{className:"text-info-primary line-clamp-2 text-sm font-semibold",children:e?.subTitle})]}),r(k,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:n("text-info-primary text-sm font-bold"),href:m(e.link,`${i}_${s}`),"data-headless-type-name":`${i}#${s}`,"data-headless-nav-postion":`''#${o?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${o?.primaryButton}`,children:o?.primaryButton})]})]}),y=C(e=>{p===e||u.current||(u.current=!0,N(e),c.current=e,D({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:i,component_name:s,component_title:t?.products[e]?.title,component_description:t?.products[e]?.subTitle,position:e+1}}))},[t?.products,p]);return l(V,{children:[t?.title&&r(L,{data:{title:t?.title}}),r("div",{ref:f,className:n("laptop:block hidden",{"aiui-dark":t?.theme==="dark"}),children:r("div",{className: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",v),children:t?.products?.map((e,o)=>{const g=p===o;return l("div",{style:{flex:`${g?8:1} 1 0%`,transition:"all 0.6s"},ref:x=>{x&&I(o,x)},className:n("relative cursor-pointer overflow-hidden",t?.itemShape==="round"?"rounded-2xl":""),onMouseEnter:()=>y(o),onMouseLeave:()=>{u.current=!1},onClick:()=>{y(o)},children:[r("a",{href:m(e?.imgLink,`${i}_${s}`),"data-headless-type-name":`${i}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:r(w,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}),l("div",{style:{width:b},className: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",g&&b?"opacity-100":"opacity-0"),children:[l("div",{className:"mr-16 flex-1 overflow-hidden",children:[r(T,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",children:e?.title}),r(T,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",children:e?.subTitle})]}),l(k,{className:n("mb-1.5 font-bold"),as:"a",href:m(e?.link,`${i}_${s}`),"data-headless-type-name":`${i}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,onClick:()=>h?.primaryButton?.(t,o),children:[t?.primaryButton,r("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},o)})})}),r("div",{className:n("laptop:hidden block",{"aiui-dark":t?.theme==="dark"}),children:r(H,{className:n("h-[400px] !overflow-visible",v),id:"AccordionCards"+t?.key,data:{list:t?.products,configuration:{shape:t?.shape,itemShape:t?.itemShape,primaryButton:t?.primaryButton,event:h,title:t?.title}},Slide:E,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});var te=M(P);export{te 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 } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { gaTrack } from '../../shared/track.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 = {\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 /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(({ data, className = '', event }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const isAnimation = useRef<boolean>(false)\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\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 MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n return (\n <div\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 href={trackUrlRef(data?.imgLink, `${componentType}_${componentName}`)}>\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 <p className=\"text-info-primary text-2xl font-bold leading-[1.2]\">{data?.title}</p>\n <h3 className=\"text-info-primary line-clamp-2 text-sm font-semibold\">{data?.subTitle}</h3>\n </div>\n\n <Button\n aria-label={data?.title ?? data?.subTitle}\n variant=\"secondary\"\n className={cn('text-info-primary text-sm font-bold')}\n as=\"a\"\n href={trackUrlRef(data.link, `${componentType}_${componentName}`)}\n >\n {configuration?.primaryButton}\n </Button>\n </div>\n </div>\n )\n }\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx || isAnimation.current) return\n isAnimation.current = true\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: 'Home Page',\n component_type: componentType,\n component_name: componentName,\n component_title: data?.products[idx]?.title,\n component_description: data?.products[idx]?.subTitle,\n position: idx + 1,\n },\n })\n },\n [data?.products, hoverIndex]\n )\n\n return (\n <>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div ref={innerRef} 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 const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\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(\n 'relative cursor-pointer overflow-hidden',\n data?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onMouseLeave={() => {\n isAnimation.current = false\n }}\n onClick={() => {\n handleSwiperItemClick(idx)\n }}\n >\n <a href={trackUrlRef(item?.imgLink, `${componentType}_${componentName}`)}>\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\n as=\"h3\"\n className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\"\n >\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 <Button\n className={cn('mb-1.5 font-bold')}\n as=\"a\"\n href={trackUrlRef(item?.link, `${componentType}_${componentName}`)}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {data?.primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n </div>\n </div>\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 },\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 </>\n )\n})\nexport default withLayout(AccordionCards)\n"],
5
- "mappings": "aA8FU,OAkDN,YAAAA,EAlDM,OAAAC,EAOA,QAAAC,MAPA,oBA7FV,OAAOC,MAAW,oBAClB,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAOC,MAAY,6BACnB,OAAOC,MAAe,wBACtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,GAAS,YAAAC,EAAU,UAAAC,EAAQ,eAAAC,EAAa,uBAAAC,EAAqB,aAAAC,MAAiB,QACrF,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,WAAAC,MAAe,wBAExB,OAAOC,MAAc,2BACrB,OAAS,WAAAC,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AAOE,CACT,CACF,EACA,MAAOe,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,CAAC,EACD,IAAOM,GAAQtC,EAAWc,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 } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { gaTrack } from '../../shared/track.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 = {\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 /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(({ data, className = '', event }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const isAnimation = useRef<boolean>(false)\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\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 MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n return (\n <div\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 <p className=\"text-info-primary text-2xl font-bold leading-[1.2]\">{data?.title}</p>\n <h3 className=\"text-info-primary line-clamp-2 text-sm font-semibold\">{data?.subTitle}</h3>\n </div>\n\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 </div>\n </div>\n )\n }\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx || isAnimation.current) return\n isAnimation.current = true\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: 'Home Page',\n component_type: componentType,\n component_name: componentName,\n component_title: data?.products[idx]?.title,\n component_description: data?.products[idx]?.subTitle,\n position: idx + 1,\n },\n })\n },\n [data?.products, hoverIndex]\n )\n\n return (\n <>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div ref={innerRef} 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 const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\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(\n 'relative cursor-pointer overflow-hidden',\n data?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onMouseLeave={() => {\n isAnimation.current = false\n }}\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\n as=\"h3\"\n className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\"\n >\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 <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}#${data?.primaryButton}`}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {data?.primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n </div>\n </div>\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: {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GACjB,CACF,EACF,EACF,GACF,CAEJ,CAAC,EACD,IAAOM,GAAQtC,EAAWc,CAAc",
6
6
  "names": ["Fragment", "jsx", "jsxs", "Title", "cn", "Picture", "Button", "SwiperBox", "withLayout", "React", "useState", "useRef", "useCallback", "useImperativeHandle", "useEffect", "useExposure", "trackUrlRef", "gaTrack", "throttle", "Heading", "componentType", "componentName", "AccordionCards", "data", "className", "event", "ref", "hoverIndex", "setHoverIndex", "hoverIndexRef", "accordionRef", "isAnimation", "contentWidth", "setContentWidth", "innerRef", "getRef", "index", "el", "handleResize", "throttleResize", "MobileItem", "configuration", "handleSwiperItemClick", "idx", "item", "isExpanded", "AccordionCards_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as c}from"react/jsx-runtime";import{createContext as r,useContext as i}from"react";const t=r({trackingData:{},locale:void 0,copyWriting:{}}),d=()=>{if(!i(t))throw new Error("useAiui must be used in <AiuiProvider>");return i(t)},n=({children:e,...o})=>c(t.Provider,{value:o,children:e});var s=n;export{t as AiuiContext,s as default,d as useAiuiContext};
1
+ import{jsx as v}from"react/jsx-runtime";import{gaTrack as b}from"../../shared/track.js";import{createContext as y,useContext as l,useEffect as g}from"react";const r=y({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})=>(g(()=>{const c=(t,e)=>{t?.stopPropagation?.();const a={};if(!e||!e.attributes)return a;for(const h of Array.from(e.attributes)){const o=h?.name;o?.startsWith("data-headless-")&&(a[o]=e.getAttribute(o))}const m=a?.["data-headless-sku"],u=a?.["data-headless-type-name"]?.split?.("#"),n=a?.["data-headless-title-desc-button"]?.split?.("#"),p=a?.["data-headless-nav-postion"]?.split?.("#");b({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:s?.trackingData?.pageGroup||"Home Page",component_type:u?.[0]||"",component_name:u?.[1]||"",position:p?.[1]||"",navigation:p?.[0]||"",button_name:n?.[2]||"",SKU:m||"",component_title:n?.[0]||"",component_description:n?.[1]||""}})},d=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 d.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"))}),()=>d.disconnect()},[]),v(r.Provider,{value:s,children:i}));var _=f;export{r as AiuiContext,_ as default,C as useAiuiContext};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/AiuiProvider/index.tsx"],
4
- "sourcesContent": ["import React, { createContext, useContext } from 'react'\n\ninterface AiuiContextType {\n trackingData: Record<string, any>\n locale?: string\n copyWriting?: Record<string, string>\n}\n\nexport const AiuiContext = createContext<AiuiContextType>({\n trackingData: {},\n locale: undefined,\n copyWriting: {},\n})\n\nexport const useAiuiContext = () => {\n const context = useContext(AiuiContext)\n if (!context) {\n throw new Error('useAiui must be used in <AiuiProvider>')\n }\n return useContext(AiuiContext)\n}\n\nconst AiuiProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & AiuiContextType) => {\n return <AiuiContext.Provider value={rest}>{children}</AiuiContext.Provider>\n}\n\nexport default AiuiProvider\n"],
5
- "mappings": "AA4BS,cAAAA,MAAA,oBA5BT,OAAgB,iBAAAC,EAAe,cAAAC,MAAkB,QAQ1C,MAAMC,EAAcF,EAA+B,CACxD,aAAc,CAAC,EACf,OAAQ,OACR,YAAa,CAAC,CAChB,CAAC,EAEYG,EAAiB,IAAM,CAElC,GAAI,CADYF,EAAWC,CAAW,EAEpC,MAAM,IAAI,MAAM,wCAAwC,EAE1D,OAAOD,EAAWC,CAAW,CAC/B,EAEME,EAAe,CAAC,CACpB,SAAAC,EACA,GAAGC,CACL,IAGSP,EAACG,EAAY,SAAZ,CAAqB,MAAOI,EAAO,SAAAD,EAAS,EAGtD,IAAOE,EAAQH",
6
- "names": ["jsx", "createContext", "useContext", "AiuiContext", "useAiuiContext", "AiuiProvider", "children", "rest", "AiuiProvider_default"]
4
+ "sourcesContent": ["import { gaTrack } from '../../shared/track.js'\nimport React, { createContext, useContext, useEffect } from 'react'\n\ninterface AiuiContextType {\n trackingData: Record<string, any>\n locale?: string\n copyWriting?: Record<string, string>\n}\n\nexport const AiuiContext = createContext<AiuiContextType>({\n trackingData: {},\n locale: undefined,\n copyWriting: {},\n})\n\nexport const useAiuiContext = () => {\n const context = useContext(AiuiContext)\n if (!context) {\n throw new Error('useAiui must be used in <AiuiProvider>')\n }\n return useContext(AiuiContext)\n}\n\nconst AiuiProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & AiuiContextType) => {\n useEffect(() => {\n const handleTrackClick = (e: any, el: any) => {\n e?.stopPropagation?.()\n const out: any = {}\n if (!el || !el.attributes) return out\n for (const attr of Array.from(el.attributes)) {\n const name = (attr as any)?.name\n if (name?.startsWith('data-headless-')) {\n out[name] = el.getAttribute(name)\n }\n }\n const sku = out?.['data-headless-sku']\n const nameType = out?.['data-headless-type-name']?.split?.('#')\n const titleDesc = out?.['data-headless-title-desc-button']?.split?.('#')\n const navPosition = out?.['data-headless-nav-postion']?.split?.('#')\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: rest?.trackingData?.pageGroup || 'Home Page',\n component_type: nameType?.[0] || '',\n component_name: nameType?.[1] || '',\n position: navPosition?.[1] || '',\n navigation: navPosition?.[0] || '',\n button_name: titleDesc?.[2] || '',\n SKU: sku || '',\n component_title: titleDesc?.[0] || '',\n component_description: titleDesc?.[1] || '',\n },\n })\n }\n const observer = new MutationObserver(() => {\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true') // \u907F\u514D\u91CD\u590D\u7ED1\u5B9A\n }\n })\n })\n observer.observe(document.body, { childList: true, subtree: true })\n // \u521D\u59CB\u5316\u4E00\u6B21\u73B0\u6709\u8282\u70B9\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true')\n }\n })\n return () => observer.disconnect()\n }, [])\n\n return <AiuiContext.Provider value={rest}>{children}</AiuiContext.Provider>\n}\n\nexport default AiuiProvider\n"],
5
+ "mappings": "AA+ES,cAAAA,MAAA,oBA/ET,OAAS,WAAAC,MAAe,wBACxB,OAAgB,iBAAAC,EAAe,cAAAC,EAAY,aAAAC,MAAiB,QAQrD,MAAMC,EAAcH,EAA+B,CACxD,aAAc,CAAC,EACf,OAAQ,OACR,YAAa,CAAC,CAChB,CAAC,EAEYI,EAAiB,IAAM,CAElC,GAAI,CADYH,EAAWE,CAAW,EAEpC,MAAM,IAAI,MAAM,wCAAwC,EAE1D,OAAOF,EAAWE,CAAW,CAC/B,EAEME,EAAe,CAAC,CACpB,SAAAC,EACA,GAAGC,CACL,KAGEL,EAAU,IAAM,CACd,MAAMM,EAAmB,CAACC,EAAQC,IAAY,CAC5CD,GAAG,kBAAkB,EACrB,MAAME,EAAW,CAAC,EAClB,GAAI,CAACD,GAAM,CAACA,EAAG,WAAY,OAAOC,EAClC,UAAWC,KAAQ,MAAM,KAAKF,EAAG,UAAU,EAAG,CAC5C,MAAMG,EAAQD,GAAc,KACxBC,GAAM,WAAW,gBAAgB,IACnCF,EAAIE,CAAI,EAAIH,EAAG,aAAaG,CAAI,EAEpC,CACA,MAAMC,EAAMH,IAAM,mBAAmB,EAC/BI,EAAWJ,IAAM,yBAAyB,GAAG,QAAQ,GAAG,EACxDK,EAAYL,IAAM,iCAAiC,GAAG,QAAQ,GAAG,EACjEM,EAAcN,IAAM,2BAA2B,GAAG,QAAQ,GAAG,EACnEZ,EAAQ,CACN,MAAO,WACP,WAAY,kBACZ,iBAAkB,CAChB,WAAYQ,GAAM,cAAc,WAAa,YAC7C,eAAgBQ,IAAW,CAAC,GAAK,GACjC,eAAgBA,IAAW,CAAC,GAAK,GACjC,SAAUE,IAAc,CAAC,GAAK,GAC9B,WAAYA,IAAc,CAAC,GAAK,GAChC,YAAaD,IAAY,CAAC,GAAK,GAC/B,IAAKF,GAAO,GACZ,gBAAiBE,IAAY,CAAC,GAAK,GACnC,sBAAuBA,IAAY,CAAC,GAAK,EAC3C,CACF,CAAC,CACH,EACME,EAAW,IAAI,iBAAiB,IAAM,CAC1C,SAAS,iBAAiB,2BAA2B,EAAE,QAAQR,GAAM,CAC9DA,EAAG,aAAa,2BAA2B,IAC9CA,EAAG,iBAAiB,QAAS,GAAKF,EAAiB,EAAGE,CAAE,CAAC,EACzDA,EAAG,aAAa,4BAA6B,MAAM,EAEvD,CAAC,CACH,CAAC,EACD,OAAAQ,EAAS,QAAQ,SAAS,KAAM,CAAE,UAAW,GAAM,QAAS,EAAK,CAAC,EAElE,SAAS,iBAAiB,2BAA2B,EAAE,QAAQR,GAAM,CAC9DA,EAAG,aAAa,2BAA2B,IAC9CA,EAAG,iBAAiB,QAAS,GAAKF,EAAiB,EAAGE,CAAE,CAAC,EACzDA,EAAG,aAAa,4BAA6B,MAAM,EAEvD,CAAC,EACM,IAAMQ,EAAS,WAAW,CACnC,EAAG,CAAC,CAAC,EAEEpB,EAACK,EAAY,SAAZ,CAAqB,MAAOI,EAAO,SAAAD,EAAS,GAGtD,IAAOa,EAAQd",
6
+ "names": ["jsx", "gaTrack", "createContext", "useContext", "useEffect", "AiuiContext", "useAiuiContext", "AiuiProvider", "children", "rest", "handleTrackClick", "e", "el", "out", "attr", "name", "sku", "nameType", "titleDesc", "navPosition", "observer", "AiuiProvider_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as o,jsxs as i}from"react/jsx-runtime";import x,{useImperativeHandle as h,useRef as y}from"react";import{cn as n}from"../../helpers/utils.js";import s from"../../components/picture.js";import{withLayout as v}from"../../shared/Styles.js";import b from"../Title/index.js";import g from"./SwiperCategory.js";import{useExposure as k}from"../../hooks/useExposure.js";import{trackUrlRef as f}from"../../shared/trackUrlRef.js";import{Heading as w}from"../../components/heading.js";const m="image",c="category_banner",N=(e,t)=>{const r=[];for(let a=0;a<e.length;a+=t)r.push(e.slice(a,a+t));return r},C=({data:e,configuration:t})=>i("div",{className:n("tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]","tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8","bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[o("div",{className:"transition-all duration-300 group-hover:scale-110",children:o("a",{"aria-label":e?.name,href:f(e?.link,`${m}_${c}`),onClick:()=>t?.event?.primaryButton(e,t?.index),children:o(s,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover"})})}),o(w,{as:"h3",className:"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold",children:e?.name})]}),I=({data:e,configuration:t})=>i("div",{className:n("bg-container-secondary-1 box-border max-h-[126px] w-full overflow-hidden","hover:bg-info-white cursor-pointer px-3 py-4 duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[o("a",{href:f(e?.link,`${m}_${c}`),onClick:()=>t?.event?.primaryButton(e,t?.index),children:o(s,{alt:e?.image?.alt||"",className:"m-auto mb-2 flex size-[72px] justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",source:e?.image?.url||""})}),o("p",{className:"text-info-primary flex-1 truncate text-center text-sm font-bold",children:e?.name})]},`${e?.name}`),_=({data:e,configuration:t,index:r})=>i("div",{className:n("bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer p-4",r===0?"aspect-h-[252] row-span-2":"aspect-h-[120]",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[o("a",{href:e?.link||"",onClick:()=>t?.event?.primaryButton(e,t?.index),children:o(s,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:n("mb-2 flex h-full justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",r===0?"max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]")})}),o("p",{className:"text-info-primary line-clamp-2 text-center text-sm font-bold",children:e?.name})]}),j=({data:e,configuration:t})=>o("div",{className:"grid grid-cols-2 gap-3",children:e?.map((r,a)=>e?.length===5?o(_,{index:a,data:r,configuration:t},a):o(I,{data:r,configuration:t},a))}),S=x.forwardRef((e,t)=>{const{data:r,className:a="",key:p,event:d}=e,u=r?.isShowSelect?r?.products:r?.productData,l=y(null);return h(t,()=>l.current),k(l,{componentType:m,componentName:c,componentTitle:r?.title}),i("div",{ref:l,className:n("w-full overflow-hidden",a,{"aiui-dark":r?.theme==="dark"}),children:[r?.title&&o(b,{data:{title:r?.title},className:"text-4xl"}),o("div",{className:"tablet:block hidden",children:o(g,{id:`Category${p}`,Slide:C,data:{list:u,configuration:{shape:r?.shape,event:d}}})}),o("div",{className:"tablet:hidden block",children:o(g,{id:`Category1${p}`,Slide:j,data:{list:N(u,6),configuration:{shape:r?.shape,event:d}}})}),o("div",{className:"h-7"})]})});var L=v(S);export{L as default};
1
+ "use client";import{jsx as r,jsxs as s}from"react/jsx-runtime";import h,{useImperativeHandle as x,useRef as y}from"react";import{cn as n}from"../../helpers/utils.js";import c from"../../components/picture.js";import{withLayout as v}from"../../shared/Styles.js";import b from"../Title/index.js";import g from"./SwiperCategory.js";import{useExposure as k}from"../../hooks/useExposure.js";import{trackUrlRef as f}from"../../shared/trackUrlRef.js";import{Heading as w}from"../../components/heading.js";const i="image",l="category_banner",N=(e,t)=>{const o=[];for(let a=0;a<e.length;a+=t)o.push(e.slice(a,a+t));return o},C=({data:e,configuration:t})=>s("div",{className:n("tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]","tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8","bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[r("div",{className:"transition-all duration-300 group-hover:scale-110",children:r("a",{"aria-label":e?.name,href:f(e?.link,`${i}_${l}`),"data-headless-type-name":`${i}#${l}`,"data-headless-title-desc-button":`${e?.name}`,onClick:()=>t?.event?.primaryButton(e,t?.index),children:r(c,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover"})})}),r(w,{as:"h3",className:"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold",children:e?.name})]}),I=({data:e,configuration:t})=>s("div",{className:n("bg-container-secondary-1 box-border max-h-[126px] w-full overflow-hidden","hover:bg-info-white cursor-pointer px-3 py-4 duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[r("a",{href:f(e?.link,`${i}_${l}`),"data-headless-type-name":`${i}#${l}`,"data-headless-title-desc-button":`${e?.name}`,"data-headless-nav-postion":`''#${t?.index+1}`,onClick:()=>t?.event?.primaryButton(e,t?.index+1),children:r(c,{alt:e?.image?.alt||"",className:"m-auto mb-2 flex size-[72px] justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",source:e?.image?.url||""})}),r("p",{className:"text-info-primary flex-1 truncate text-center text-sm font-bold",children:e?.name})]},`${e?.name}`),$=({data:e,configuration:t,index:o})=>s("div",{className:n("bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer p-4",o===0?"aspect-h-[252] row-span-2":"aspect-h-[120]",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[r("a",{href:e?.link||"",onClick:()=>t?.event?.primaryButton(e,t?.index),children:r(c,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:n("mb-2 flex h-full justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",o===0?"max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]")})}),r("p",{className:"text-info-primary line-clamp-2 text-center text-sm font-bold",children:e?.name})]}),_=({data:e,configuration:t})=>r("div",{className:"grid grid-cols-2 gap-3",children:e?.map((o,a)=>e?.length===5?r($,{index:a,data:o,configuration:t},a):r(I,{data:o,configuration:t},a))}),j=h.forwardRef((e,t)=>{const{data:o,className:a="",key:p,event:d}=e,u=o?.isShowSelect?o?.products:o?.productData,m=y(null);return x(t,()=>m.current),k(m,{componentType:i,componentName:l,componentTitle:o?.title}),s("div",{ref:m,className:n("w-full overflow-hidden",a,{"aiui-dark":o?.theme==="dark"}),children:[o?.title&&r(b,{data:{title:o?.title},className:"text-4xl"}),r("div",{className:"tablet:block hidden",children:r(g,{id:`Category${p}`,Slide:C,data:{list:u,configuration:{shape:o?.shape,event:d,title:o?.title}}})}),r("div",{className:"tablet:hidden block",children:r(g,{id:`Category1${p}`,Slide:_,data:{list:N(u,6),configuration:{shape:o?.shape,event:d,title:o?.title}}})}),r("div",{className:"h-7"})]})});var L=v(j);export{L as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Category/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'category_banner'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: Img\n name: string\n link?: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n data: {\n isShowSelect: boolean\n products: CategoryItem[]\n productData: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n theme?: 'light' | 'dark'\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst CategoryPcItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]',\n 'tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8',\n 'bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <div className=\"transition-all duration-300 group-hover:scale-110\">\n <a\n aria-label={data?.name}\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}\n >\n <Picture\n alt={data?.image?.alt || ''}\n source={data?.image?.url || ''}\n className=\"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover\"\n />\n </a>\n </div>\n <Heading\n as=\"h3\"\n className=\"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold\"\n >\n {data?.name}\n </Heading>\n </div>\n )\n}\n\n// \u79FB\u52A8\u7AEF\nconst SingleItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n key={`${data?.name}`}\n className={cn(\n 'bg-container-secondary-1 box-border max-h-[126px] w-full overflow-hidden',\n 'hover:bg-info-white cursor-pointer px-3 py-4 duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <a\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}\n >\n <Picture\n alt={data?.image?.alt || ''}\n className=\"m-auto mb-2 flex size-[72px] justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover\"\n source={data?.image?.url || ''}\n />\n </a>\n <p className=\"text-info-primary flex-1 truncate text-center text-sm font-bold\">{data?.name}</p>\n </div>\n )\n}\n\n// soundcore mobile\u5C55\u793A\nconst SingleMobileCategoryItem = ({\n data,\n configuration,\n index,\n}: {\n data: CategoryItem\n configuration?: any\n index: number\n}) => {\n return (\n <div\n className={cn(\n 'bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden',\n 'hover:bg-info-white cursor-pointer p-4',\n index === 0 ? 'aspect-h-[252] row-span-2' : 'aspect-h-[120]',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <a href={data?.link || ''} onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}>\n <Picture\n source={data?.image?.url || ''}\n alt={data?.image?.alt || ''}\n className={cn(\n 'mb-2 flex h-full justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover',\n index === 0 ? 'max-h-[146px] overflow-hidden' : 'max-h-[72px] max-w-[72px]'\n )}\n />\n </a>\n <p className=\"text-info-primary line-clamp-2 text-center text-sm font-bold\">{data?.name}</p>\n </div>\n )\n}\n\n// \u5176\u5B83\u54C1\u724Cmobile\u5C55\u793A\nconst CategoryMobileItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return data?.length === 5 ? (\n <SingleMobileCategoryItem key={index} index={index} data={item} configuration={configuration} />\n ) : (\n <SingleItem key={index} data={item} configuration={configuration} />\n )\n })}\n </div>\n )\n}\n\nconst Category = React.forwardRef<HTMLDivElement, CategoryProps>((props, ref) => {\n const { data, className = '', key, event } = props\n // soundcore\u54C1\u724C\u54C1\u7C7B\u4E0D\u8D85\u8FC75\u4E2A\uFF0C\u5355\u72EC\u505A\u6837\u5F0F\u5904\u7406\n const currentData = data?.isShowSelect ? data?.products : data?.productData\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n return (\n <div ref={innerRef} className={cn('w-full overflow-hidden', className, { 'aiui-dark': data?.theme === 'dark' })}>\n {data?.title && <Title data={{ title: data?.title }} className=\"text-4xl\" />}\n <div className=\"tablet:block hidden\">\n <SwiperBox\n id={`Category${key}`}\n Slide={CategoryPcItem}\n data={{ list: currentData, configuration: { shape: data?.shape, event: event } }}\n />\n </div>\n <div className=\"tablet:hidden block\">\n <SwiperBox\n id={`Category1${key}`}\n Slide={CategoryMobileItem}\n data={{ list: chunkArray(currentData, 6), configuration: { shape: data?.shape, event: event } }}\n />\n </div>\n <div className=\"h-7\" />\n </div>\n )\n})\n\nexport default withLayout(Category)\n"],
5
- "mappings": "aAuDI,OAcM,OAAAA,EAdN,QAAAC,MAAA,oBAtDJ,OAAOC,GAAS,uBAAAC,EAAqB,UAAAC,MAAc,QACnD,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,MA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AAC,EAGCpB,EAAC,OAAI,IAAKkC,EAAU,UAAW9B,EAAG,yBAA0B0B,EAAW,CAAE,YAAaV,GAAM,QAAU,MAAO,CAAC,EAC3G,UAAAA,GAAM,OAASrB,EAACQ,EAAA,CAAM,KAAM,CAAE,MAAOa,GAAM,KAAM,EAAG,UAAU,WAAW,EAC1ErB,EAAC,OAAI,UAAU,sBACb,SAAAA,EAACS,EAAA,CACC,GAAI,WAAWuB,CAAG,GAClB,MAAOZ,EACP,KAAM,CAAE,KAAMc,EAAa,cAAe,CAAE,MAAOb,GAAM,MAAO,MAAOY,CAAM,CAAE,EACjF,EACF,EACAjC,EAAC,OAAI,UAAU,sBACb,SAAAA,EAACS,EAAA,CACC,GAAI,YAAYuB,CAAG,GACnB,MAAON,EACP,KAAM,CAAE,KAAMX,EAAWmB,EAAa,CAAC,EAAG,cAAe,CAAE,MAAOb,GAAM,MAAO,MAAOY,CAAM,CAAE,EAChG,EACF,EACAjC,EAAC,OAAI,UAAU,MAAM,GACvB,CAEJ,CAAC,EAED,IAAOoC,EAAQ7B,EAAWqB,CAAQ",
4
+ "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'category_banner'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: Img\n name: string\n link?: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n data: {\n isShowSelect: boolean\n products: CategoryItem[]\n productData: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n theme?: 'light' | 'dark'\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst CategoryPcItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]',\n 'tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8',\n 'bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <div className=\"transition-all duration-300 group-hover:scale-110\">\n <a\n aria-label={data?.name}\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.name}`}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}\n >\n <Picture\n alt={data?.image?.alt || ''}\n source={data?.image?.url || ''}\n className=\"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover\"\n />\n </a>\n </div>\n <Heading\n as=\"h3\"\n className=\"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold\"\n >\n {data?.name}\n </Heading>\n </div>\n )\n}\n\n// \u79FB\u52A8\u7AEF\nconst SingleItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n key={`${data?.name}`}\n className={cn(\n 'bg-container-secondary-1 box-border max-h-[126px] w-full overflow-hidden',\n 'hover:bg-info-white cursor-pointer px-3 py-4 duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <a\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.name}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index + 1)}\n >\n <Picture\n alt={data?.image?.alt || ''}\n className=\"m-auto mb-2 flex size-[72px] justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover\"\n source={data?.image?.url || ''}\n />\n </a>\n <p className=\"text-info-primary flex-1 truncate text-center text-sm font-bold\">{data?.name}</p>\n </div>\n )\n}\n\n// soundcore mobile\u5C55\u793A\nconst SingleMobileCategoryItem = ({\n data,\n configuration,\n index,\n}: {\n data: CategoryItem\n configuration?: any\n index: number\n}) => {\n return (\n <div\n className={cn(\n 'bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden',\n 'hover:bg-info-white cursor-pointer p-4',\n index === 0 ? 'aspect-h-[252] row-span-2' : 'aspect-h-[120]',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <a href={data?.link || ''} onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}>\n <Picture\n source={data?.image?.url || ''}\n alt={data?.image?.alt || ''}\n className={cn(\n 'mb-2 flex h-full justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover',\n index === 0 ? 'max-h-[146px] overflow-hidden' : 'max-h-[72px] max-w-[72px]'\n )}\n />\n </a>\n <p className=\"text-info-primary line-clamp-2 text-center text-sm font-bold\">{data?.name}</p>\n </div>\n )\n}\n\n// \u5176\u5B83\u54C1\u724Cmobile\u5C55\u793A\nconst CategoryMobileItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return data?.length === 5 ? (\n <SingleMobileCategoryItem key={index} index={index} data={item} configuration={configuration} />\n ) : (\n <SingleItem key={index} data={item} configuration={configuration} />\n )\n })}\n </div>\n )\n}\n\nconst Category = React.forwardRef<HTMLDivElement, CategoryProps>((props, ref) => {\n const { data, className = '', key, event } = props\n // soundcore\u54C1\u724C\u54C1\u7C7B\u4E0D\u8D85\u8FC75\u4E2A\uFF0C\u5355\u72EC\u505A\u6837\u5F0F\u5904\u7406\n const currentData = data?.isShowSelect ? data?.products : data?.productData\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n return (\n <div ref={innerRef} className={cn('w-full overflow-hidden', className, { 'aiui-dark': data?.theme === 'dark' })}>\n {data?.title && <Title data={{ title: data?.title }} className=\"text-4xl\" />}\n <div className=\"tablet:block hidden\">\n <SwiperBox\n id={`Category${key}`}\n Slide={CategoryPcItem}\n data={{ list: currentData, configuration: { shape: data?.shape, event: event, title: data?.title } }}\n />\n </div>\n <div className=\"tablet:hidden block\">\n <SwiperBox\n id={`Category1${key}`}\n Slide={CategoryMobileItem}\n data={{ list: chunkArray(currentData, 6), configuration: { shape: data?.shape, event: event, title: data?.title } }}\n />\n </div>\n <div className=\"h-7\" />\n </div>\n )\n})\n\nexport default withLayout(Category)\n"],
5
+ "mappings": "aAuDI,OAgBM,OAAAA,EAhBN,QAAAC,MAAA,oBAtDJ,OAAOC,GAAS,uBAAAC,EAAqB,UAAAC,MAAc,QACnD,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,MAAW,oBAClB,OAAOC,MAAe,sBACtB,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAE5B,OAAS,WAAAC,MAAe,8BAExB,MAAMC,EAAgB,QAChBC,EAAgB,kBAgChBC,EAAa,CAACC,EAAYC,IAAiB,CAC/C,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAG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C,EAAU,UAAW9B,EAAG,yBAA0B0B,EAAW,CAAE,YAAaV,GAAM,QAAU,MAAO,CAAC,EAC3G,UAAAA,GAAM,OAASrB,EAACQ,EAAA,CAAM,KAAM,CAAE,MAAOa,GAAM,KAAM,EAAG,UAAU,WAAW,EAC1ErB,EAAC,OAAI,UAAU,sBACb,SAAAA,EAACS,EAAA,CACC,GAAI,WAAWuB,CAAG,GAClB,MAAOZ,EACP,KAAM,CAAE,KAAMc,EAAa,cAAe,CAAE,MAAOb,GAAM,MAAO,MAAOY,EAAO,MAAOZ,GAAM,KAAM,CAAE,EACrG,EACF,EACArB,EAAC,OAAI,UAAU,sBACb,SAAAA,EAACS,EAAA,CACC,GAAI,YAAYuB,CAAG,GACnB,MAAON,EACP,KAAM,CAAE,KAAMX,EAAWmB,EAAa,CAAC,EAAG,cAAe,CAAE,MAAOb,GAAM,MAAO,MAAOY,EAAO,MAAOZ,GAAM,KAAM,CAAE,EACpH,EACF,EACArB,EAAC,OAAI,UAAU,MAAM,GACvB,CAEJ,CAAC,EAED,IAAOoC,EAAQ7B,EAAWqB,CAAQ",
6
6
  "names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "cn", "Picture", "withLayout", "Title", "SwiperBox", "useExposure", "trackUrlRef", "Heading", "componentType", "componentName", "chunkArray", "arr", "size", "chunks", "i", "CategoryPcItem", "data", "configuration", "SingleItem", "SingleMobileCategoryItem", "index", "CategoryMobileItem", "item", "Category", "props", "ref", "className", "key", "event", "currentData", "innerRef", "Category_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{Fragment as v,jsx as e,jsxs as o}from"react/jsx-runtime";import{cn as a}from"../../helpers/utils.js";import c from"../SwiperBox/index.js";import{withLayout as u}from"../../shared/Styles.js";import{Grid as f,GridItem as g}from"../../components/gird.js";import{Picture as m,Text as s}from"../../components/index.js";const x=({data:t,configuration:i})=>e("div",{className:a("text-info-primary aspect-h-[360] aspect-w-[296] relative flex-1 shrink-0 overflow-hidden md:basis-[296px]",i?.shape==="rounded"?"rounded-2xl":"rounded-none",{"aiui-dark":t.theme==="dark"}),children:o("div",{className:"absolute inset-0",children:[e(m,{className:"h-full",imgClassName:"h-full object-cover",source:t?.mobileImg?.url||t?.img?.url,alt:t?.mobileImg?.alt||t?.img?.alt||""}),o("div",{className:"z-1 absolute bottom-4 left-4 box-border flex w-full flex-col",children:[e(s,{html:t?.title,className:"graphic-title truncate text-xl font-bold leading-[1.2]"}),t?.description&&e(s,{html:t?.description,className:"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]"})]})]})}),b=t=>{const{data:i,className:r}=t,{productsTab:d,shape:p}=i;return o(v,{children:[e("div",{className:"laptop:block box-border hidden w-full overflow-hidden",children:e(f,{className:a("tablet:gap-4 grid grid-cols-12 gap-3 ",r),children:d?.map((l,n)=>o(g,{span:l.span,className:a("text-info-primary relative w-full cursor-pointer overflow-hidden",p==="rounded"?"rounded-2xl":"rounded-none","lg-desktop:max-h-[480px] desktop:max-h-[384px] laptop:max-h-[288px]",{"aiui-dark":l.theme==="dark"}),children:[e(m,{source:l.img.url,className:"size-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300"}),o("div",{className:"lg-desktop:bottom-8 lg-desktop:left-8 desktop:bottom-6 desktop:left-6 absolute bottom-4 left-4",children:[l.title&&e(s,{html:l.title,as:"p",className:"desktop:text-[32px] laptop:text-2xl text-xl font-bold"}),l.description&&e(s,{html:l.description,className:"desktop:text-lg text-sm font-bold"})]})]},n))})}),e("div",{className:"laptop:hidden block w-full",children:e(c,{id:"CreativeModule",className:a("!overflow-visible",r),data:{list:d||[],configuration:{shape:p}},Slide:x,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3}}})})]})};var M=u(b);export{M as default};
1
+ "use client";import{Fragment as h,jsx as e,jsxs as a}from"react/jsx-runtime";import{cn as o}from"../../helpers/utils.js";import c from"../SwiperBox/index.js";import{withLayout as u}from"../../shared/Styles.js";import{Grid as f,GridItem as x}from"../../components/gird.js";import{Picture as m,Text as i}from"../../components/index.js";const g=({data:t,configuration:s})=>e("div",{className:o("creativeModuleItem","text-info-primary aspect-h-[360] aspect-w-[296] relative flex-1 shrink-0 overflow-hidden md:basis-[296px]",s?.shape==="rounded"?"rounded-2xl":"rounded-none",{"aiui-dark":t.theme==="dark"}),children:a("div",{className:"absolute inset-0",children:[e(m,{className:"h-full",imgClassName:"h-full object-cover",source:t?.mobileImg?.url||t?.img?.url,alt:t?.mobileImg?.alt||t?.img?.alt||""}),a("div",{className:"z-1 absolute bottom-4 left-0 right-0 box-border flex w-full flex-col px-4 overflow-hidden",children:[e(i,{html:t?.title,className:"graphic-title truncate text-xl font-bold leading-[1.2]"}),t?.description&&e(i,{html:t?.description,className:"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]"})]})]})}),v=t=>{const{data:s,className:r}=t,{productsTab:d,shape:p}=s;return a(h,{children:[e("div",{className:o("creativeModuleBlock","laptop:block box-border hidden w-full overflow-hidden"),children:e(f,{className:o("tablet:gap-4 grid grid-cols-12 gap-3 ",r),children:d?.map((l,n)=>a(x,{span:l.span,className:o("text-info-primary relative w-full overflow-hidden",p==="rounded"?"rounded-2xl":"rounded-none","lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[288px]",{"aiui-dark":l.theme==="dark"}),children:[e(m,{source:l.img.url,className:"size-full",imgClassName:"h-full object-cover"}),a("div",{className:"lg-desktop:bottom-8 lg-desktop:px-8 desktop:bottom-6 desktop:px-6 absolute bottom-4 px-4 flex flex-col gap-[6px] left-0 right-0 overflow-hidden",children:[l.title&&e(i,{html:l.title,as:"p",className:"line-clamp-2 desktop:text-[32px] laptop:text-2xl text-xl font-bold"}),l.description&&e(i,{html:l.description,className:"line-clamp-2 desktop:text-lg text-sm font-bold"})]})]},n))})}),e("div",{className:"laptop:hidden block w-full",children:e(c,{id:"CreativeModule",className:o("!overflow-visible",r),data:{list:d||[],configuration:{shape:p}},Slide:g,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3}}})})]})};var M=u(v);export{M as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/CreativeModule/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport { Picture, Text } from '../../components/index.js'\n\nexport type CreativeModuleDataType = {\n img: Img\n mobileImg: Img\n title: string\n description: string\n theme: 'light' | 'dark'\n span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n}\n\ntype CreativeModuleType = {\n data: {\n shape?: 'rounded' | 'square'\n productsTab: CreativeModuleDataType[]\n }\n className?: string\n}\n\nconst Item = ({ data, configuration }: { data: CreativeModuleDataType; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'text-info-primary aspect-h-[360] aspect-w-[296] relative flex-1 shrink-0 overflow-hidden md:basis-[296px]',\n configuration?.shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div className=\"absolute inset-0\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.mobileImg?.url || data?.img?.url}\n alt={data?.mobileImg?.alt || data?.img?.alt || ''}\n />\n <div className=\"z-1 absolute bottom-4 left-4 box-border flex w-full flex-col\">\n <Text html={data?.title} className=\"graphic-title truncate text-xl font-bold leading-[1.2]\" />\n {data?.description && (\n <Text html={data?.description} className=\"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]\" />\n )}\n </div>\n </div>\n </div>\n )\n}\n\nconst CreativeModule = (props: CreativeModuleType) => {\n const { data, className } = props\n const { productsTab, shape } = data\n\n return (\n <>\n <div className=\"laptop:block box-border hidden w-full overflow-hidden\">\n <Grid className={cn('tablet:gap-4 grid grid-cols-12 gap-3 ', className)}>\n {productsTab?.map((item, index) => {\n return (\n <GridItem\n key={index}\n span={item.span}\n className={cn(\n 'text-info-primary relative w-full cursor-pointer overflow-hidden',\n shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:max-h-[480px] desktop:max-h-[384px] laptop:max-h-[288px]',\n {\n 'aiui-dark': item.theme === 'dark',\n }\n )}\n >\n <Picture\n source={item.img.url}\n className=\"size-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n />\n <div className=\"lg-desktop:bottom-8 lg-desktop:left-8 desktop:bottom-6 desktop:left-6 absolute bottom-4 left-4\">\n {item.title && (\n <Text html={item.title} as=\"p\" className=\"desktop:text-[32px] laptop:text-2xl text-xl font-bold\" />\n )}\n {item.description && <Text html={item.description} className=\"desktop:text-lg text-sm font-bold\" />}\n </div>\n </GridItem>\n )\n })}\n </Grid>\n </div>\n <div className=\"laptop:hidden block w-full\">\n <SwiperBox\n id=\"CreativeModule\"\n className={cn('!overflow-visible', className)}\n data={{\n list: productsTab || [],\n configuration: {\n shape,\n },\n }}\n Slide={Item}\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 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n }}\n />\n </div>\n </>\n )\n}\n\nexport default withLayout(CreativeModule)\n"],
5
- "mappings": "aAqCQ,OAsBJ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AU,iGACZ,UAAAgB,EAAK,OACJjB,EAACQ,EAAA,CAAK,KAAMS,EAAK,MAAO,GAAG,IAAI,UAAU,wDAAwD,EAElGA,EAAK,aAAejB,EAACQ,EAAA,CAAK,KAAMS,EAAK,YAAa,UAAU,oCAAoC,GACnG,IArBKC,CAsBP,CAEH,EACH,EACF,EACAlB,EAAC,OAAI,UAAU,6BACb,SAAAA,EAACG,EAAA,CACC,GAAG,iBACH,UAAWD,EAAG,oBAAqBY,CAAS,EAC5C,KAAM,CACJ,KAAMC,GAAe,CAAC,EACtB,cAAe,CACb,MAAAC,CACF,CACF,EACA,MAAOP,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,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EACF,EACF,GACF,CAEJ,EAEA,IAAOU,EAAQf,EAAWQ,CAAc",
4
+ "sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport { Picture, Text } from '../../components/index.js'\n\nexport type CreativeModuleDataType = {\n img: Img\n mobileImg: Img\n title: string\n description: string\n theme: 'light' | 'dark'\n span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n}\n\ntype CreativeModuleType = {\n data: {\n shape?: 'rounded' | 'square'\n productsTab: CreativeModuleDataType[]\n }\n className?: string\n}\n\nconst Item = ({ data, configuration }: { data: CreativeModuleDataType; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'creativeModuleItem',\n 'text-info-primary aspect-h-[360] aspect-w-[296] relative flex-1 shrink-0 overflow-hidden md:basis-[296px]',\n configuration?.shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div className=\"absolute inset-0\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.mobileImg?.url || data?.img?.url}\n alt={data?.mobileImg?.alt || data?.img?.alt || ''}\n />\n <div className=\"z-1 absolute bottom-4 left-0 right-0 box-border flex w-full flex-col px-4 overflow-hidden\">\n <Text html={data?.title} className=\"graphic-title truncate text-xl font-bold leading-[1.2]\" />\n {data?.description && (\n <Text html={data?.description} className=\"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]\" />\n )}\n </div>\n </div>\n </div>\n )\n}\n\nconst CreativeModule = (props: CreativeModuleType) => {\n const { data, className } = props\n const { productsTab, shape } = data\n\n return (\n <>\n <div className={cn('creativeModuleBlock', 'laptop:block box-border hidden w-full overflow-hidden')}>\n <Grid className={cn('tablet:gap-4 grid grid-cols-12 gap-3 ', className)}>\n {productsTab?.map((item, index) => {\n return (\n <GridItem\n key={index}\n span={item.span}\n className={cn(\n 'text-info-primary relative w-full overflow-hidden',\n shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[288px]',\n {\n 'aiui-dark': item.theme === 'dark',\n }\n )}\n >\n <Picture source={item.img.url} className=\"size-full\" imgClassName=\"h-full object-cover\" />\n <div className=\"lg-desktop:bottom-8 lg-desktop:px-8 desktop:bottom-6 desktop:px-6 absolute bottom-4 px-4 flex flex-col gap-[6px] left-0 right-0 overflow-hidden\">\n {item.title && (\n <Text\n html={item.title}\n as=\"p\"\n className=\"line-clamp-2 desktop:text-[32px] laptop:text-2xl text-xl font-bold\"\n />\n )}\n {item.description && (\n <Text html={item.description} className=\"line-clamp-2 desktop:text-lg text-sm font-bold\" />\n )}\n </div>\n </GridItem>\n )\n })}\n </Grid>\n </div>\n <div className=\"laptop:hidden block w-full\">\n <SwiperBox\n id=\"CreativeModule\"\n className={cn('!overflow-visible', className)}\n data={{\n list: productsTab || [],\n configuration: {\n shape,\n },\n }}\n Slide={Item}\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 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n }}\n />\n </div>\n </>\n )\n}\n\nexport default withLayout(CreativeModule)\n"],
5
+ "mappings": "aAsCQ,OAsBJ,YAAAA,EAtBI,OAAAC,EAMA,QAAAC,MANA,oBArCR,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAe,wBAEtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,QAAAC,EAAM,YAAAC,MAAgB,2BAC/B,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAmB9B,MAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAEhCX,EAAC,OACC,UAAWE,EACT,qBACA,4GACAS,GAAe,QAAU,UAAY,cAAgB,eACrD,CACE,YAAaD,EAAK,QAAU,MAC9B,CACF,EAEA,SAAAT,EAAC,OAAI,UAAU,mBACb,UAAAD,EAACO,EAAA,CACC,UAAU,SACV,aAAa,sBACb,OAAQG,GAAM,WAAW,KAAOA,GAAM,KAAK,IAC3C,IAAKA,GAAM,WAAW,KAAOA,GAAM,KAAK,KAAO,GACjD,EACAT,EAAC,OAAI,UAAU,4FACb,UAAAD,EAACQ,EAAA,CAAK,KAAME,GAAM,MAAO,UAAU,yDAAyD,EAC3FA,GAAM,aACLV,EAACQ,EAAA,CAAK,KAAME,GAAM,YAAa,UAAU,6DAA6D,GAE1G,GACF,EACF,EAIEE,EAAkBC,GAA8B,CACpD,KAAM,CAAE,KAAAH,EAAM,UAAAI,CAAU,EAAID,EACtB,CAAE,YAAAE,EAAa,MAAAC,CAAM,EAAIN,EAE/B,OACET,EAAAF,EAAA,CACE,UAAAC,EAAC,OAAI,UAAWE,EAAG,sBAAuB,uDAAuD,EAC/F,SAAAF,EAACK,EAAA,CAAK,UAAWH,EAAG,wCAAyCY,CAAS,EACnE,SAAAC,GAAa,IAAI,CAACE,EAAMC,IAErBjB,EAACK,EAAA,CAEC,KAAMW,EAAK,KACX,UAAWf,EACT,oDACAc,IAAU,UAAY,cAAgB,eACtC,0DACA,CACE,YAAaC,EAAK,QAAU,MAC9B,CACF,EAEA,UAAAjB,EAACO,EAAA,CAAQ,OAAQU,EAAK,IAAI,IAAK,UAAU,YAAY,aAAa,sBAAsB,EACxFhB,EAAC,OAAI,UAAU,kJACZ,UAAAgB,EAAK,OACJjB,EAACQ,EAAA,CACC,KAAMS,EAAK,MACX,GAAG,IACH,UAAU,qEACZ,EAEDA,EAAK,aACJjB,EAACQ,EAAA,CAAK,KAAMS,EAAK,YAAa,UAAU,iDAAiD,GAE7F,IAvBKC,CAwBP,CAEH,EACH,EACF,EACAlB,EAAC,OAAI,UAAU,6BACb,SAAAA,EAACG,EAAA,CACC,GAAG,iBACH,UAAWD,EAAG,oBAAqBY,CAAS,EAC5C,KAAM,CACJ,KAAMC,GAAe,CAAC,EACtB,cAAe,CACb,MAAAC,CACF,CACF,EACA,MAAOP,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,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EACF,EACF,GACF,CAEJ,EAEA,IAAOU,EAAQf,EAAWQ,CAAc",
6
6
  "names": ["Fragment", "jsx", "jsxs", "cn", "SwiperBox", "withLayout", "Grid", "GridItem", "Picture", "Text", "Item", "data", "configuration", "CreativeModule", "props", "className", "productsTab", "shape", "item", "index", "CreativeModule_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import u,{useImperativeHandle as x,useRef as w}from"react";import g from"../Title/index.js";import{cn as a}from"../../helpers/utils.js";import h from"../../components/picture.js";import b from"../SwiperBox/index.js";import{withLayout as k}from"../../shared/Styles.js";import{Avatar as N,AvatarImage as y,AvatarFallback as C}from"../../components/avatar.js";import{Container as L}from"../../components/container.js";import{Text as E}from"../../components/text.js";import{useExposure as P}from"../../hooks/useExposure.js";import{trackUrlRef as T}from"../../shared/trackUrlRef.js";const m="copy",d="product_review",B=({data:t,configuration:r})=>{const l=i=>i?Array.from(new Array(Number(i)))||[]:[];return e("div",{className:a("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300",r?.shape==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px]"),children:s("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4",children:[s("div",{className:a("lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between"),children:[s("div",{className:"flex-1",children:[t?.title?e("h4",{className:"laptop:text-lg text-sm font-bold",children:t?.title}):null,e("div",{className:"mt-1 flex items-center",children:l(t?.rating)?.map?.((i,o)=>e("div",{className:"mr-1",children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e("path",{d:"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z",fill:"#F77234"})})},o))})]}),e("div",{className:"desktop:size-12 size-10 overflow-hidden",children:t?.avatar?.url?s(N,{className:"size-full",isAdaptation:!t?.avatar?.url,children:[e(y,{src:t?.avatar?.url}),e(C,{children:t?.title})]}):null})]}),e("div",{className:"flex-1",children:e(E,{className:a("desktop:max-h-[151px] tablet:max-h-[140px]","lg-desktop:text-2xl text-info-primary line-clamp-5 break-words text-xl font-bold leading-[1.2]"),children:t?.description||""})}),e("a",{href:T(t?.link,`${m}_${d}`),onClick:()=>{r?.event?.primaryButton(t,r?.index)},children:s("div",{className:a("mt-3 flex items-center cursor-pointer overflow-hidden bg-[#F7F8F9] p-3",r?.shape==="round"?"rounded-lg":"rounded-none"),children:[e("div",{className:"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center",children:e(h,{className:"w-full object-cover",source:t?.img?.url,alt:t?.img?.alt||""})}),e("p",{className:"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]",children:t?.subTitle||""})]})})]})})},M=u.forwardRef(({className:t="",data:r,key:l,...i},o)=>{const{products:c,title:n,theme:v,...f}=r,p=w(null);return x(o,()=>p.current),P(p,{componentType:m,componentName:d,componentTitle:n}),e("div",{className:t,ref:p,children:e("div",{className:"evaluate-box",children:e(L,{...r?.containerProps||{},className:"overflow-hidden",children:s("div",{ref:o,className:a("w-full",t,{"aiui-dark":v==="dark"}),children:[n&&e(g,{data:{title:n}}),e(b,{className:"!overflow-visible",id:"Evaluate"+l,data:{list:c,configuration:{...f}},Slide:B,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}})]})})})})});var $=k(M);export{$ as default};
1
+ "use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import u,{useImperativeHandle as x,useRef as w}from"react";import h from"../Title/index.js";import{cn as i}from"../../helpers/utils.js";import b from"../../components/picture.js";import g from"../SwiperBox/index.js";import{withLayout as k}from"../../shared/Styles.js";import{Avatar as N,AvatarImage as y,AvatarFallback as C}from"../../components/avatar.js";import{Container as L}from"../../components/container.js";import{Text as T}from"../../components/text.js";import{useExposure as E}from"../../hooks/useExposure.js";import{trackUrlRef as P}from"../../shared/trackUrlRef.js";const d="copy",m="product_review",B=({data:t,configuration:r})=>{const n=a=>a?Array.from(new Array(Number(a)))||[]:[];return e("div",{className:i("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300",r?.shape==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px]"),children:s("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4",children:[s("div",{className:i("lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between"),children:[s("div",{className:"flex-1",children:[t?.title?e("h4",{className:"laptop:text-lg text-sm font-bold",children:t?.title}):null,e("div",{className:"mt-1 flex items-center",children:n(t?.rating)?.map?.((a,l)=>e("div",{className:"mr-1",children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e("path",{d:"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z",fill:"#F77234"})})},l))})]}),e("div",{className:"desktop:size-12 size-10 overflow-hidden",children:t?.avatar?.url?s(N,{className:"size-full",isAdaptation:!t?.avatar?.url,children:[e(y,{src:t?.avatar?.url}),e(C,{children:t?.title})]}):null})]}),e("div",{className:"flex-1",children:e(T,{className:i("desktop:max-h-[151px] tablet:max-h-[140px]","lg-desktop:text-2xl text-info-primary line-clamp-5 break-words text-xl font-bold leading-[1.2]"),children:t?.description||""})}),e("a",{href:P(t?.link,`${d}_${m}`),onClick:()=>{r?.event?.primaryButton(t,r?.index+1)},"data-headless-type-name":`${d}#${m}`,"data-headless-title-desc-button":`${t?.title}#${t?.description||t?.subTitle}`,"data-headless-nav-postion":`''#${r?.index+1}`,children:s("div",{className:i("mt-3 flex items-center cursor-pointer overflow-hidden bg-[#F7F8F9] p-3",r?.shape==="round"?"rounded-lg":"rounded-none"),children:[e("div",{className:"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center",children:e(b,{className:"w-full object-cover",source:t?.img?.url,alt:t?.img?.alt||""})}),e("p",{className:"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]",children:t?.subTitle||""})]})})]})})},M=u.forwardRef(({className:t="",data:r,key:n,...a},l)=>{const{products:c,title:o,theme:v,...f}=r,p=w(null);return x(l,()=>p.current),E(p,{componentType:d,componentName:m,componentTitle:o}),e("div",{className:t,ref:p,children:e("div",{className:"evaluate-box",children:e(L,{...r?.containerProps||{},className:"overflow-hidden",children:s("div",{ref:l,className:i("w-full",t,{"aiui-dark":v==="dark"}),children:[o&&e(h,{data:{title:o}}),e(g,{className:"!overflow-visible",id:"Evaluate"+n,data:{list:c,configuration:{...f,title:o}},Slide:B,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}})]})})})})});var S=k(M);export{S as default};
2
2
  //# sourceMappingURL=index.js.map