@anker-in/headless-ui 1.3.52 → 1.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
.dialog-close-icon {
|
|
3
3
|
color: ${o?.closeColor||"#1D1D1F"};
|
|
4
4
|
}
|
|
5
|
-
`}),(0,e.jsxs)(c.Root,{value:o?.title,className:"w-full overflow-hidden",children:[i?.map(t=>(0,e.jsx)(c.Content,{value:t.title,children:(0,e.jsx)(a.Picture,{source:`${t?.img}, ${t?.mobileImg} 767`,className:"laptop-md:h-[480px] h-[304px] w-full",alt:t?.title||"",imgClassName:"object-cover h-full"})},t.title)),(0,e.jsxs)("div",{className:"laptop-md:py-6 w-full overflow-visible bg-white py-4",children:[(0,e.jsx)("div",{ref:d,style:{scrollbarWidth:"none",msOverflowStyle:"none"},className:"laptop-md:px-6 overflow-x-auto px-4",children:(0,e.jsx)("div",{className:"rounded-btn w-fit bg-[#EAEAEC]",children:(0,e.jsx)(c.List,{className:"flex w-max p-1",children:i?.map((t,u)=>(0,e.jsx)(c.Trigger,{ref:g=>{g&&(s.current[u]=g)},className:(0,v.cn)("lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]",t.title===o?.title&&"bg-white"),onClick:()=>{p(t),r(t),l(t?.title)},value:t.title,children:(0,e.jsx)(a.Text,{html:t.title,className:"text-[14px] font-bold leading-[1.2]"})},u+t.title))})})}),(0,e.jsx)("div",{className:"laptop-md:px-6 mt-4 px-4",children:i?.map((t,u)=>(0,e.jsx)(c.Content,{value:t.title,className:"laptop-md:text-[18px] text-[14px] font-bold"
|
|
5
|
+
`}),(0,e.jsxs)(c.Root,{value:o?.title,className:"w-full overflow-hidden",children:[i?.map(t=>(0,e.jsx)(c.Content,{value:t.title,children:(0,e.jsx)(a.Picture,{source:`${t?.img}, ${t?.mobileImg} 767`,className:"laptop-md:h-[480px] h-[304px] w-full",alt:t?.title||"",imgClassName:"object-cover h-full"})},t.title)),(0,e.jsxs)("div",{className:"laptop-md:py-6 w-full overflow-visible bg-white py-4",children:[(0,e.jsx)("div",{ref:d,style:{scrollbarWidth:"none",msOverflowStyle:"none"},className:"laptop-md:px-6 overflow-x-auto px-4",children:(0,e.jsx)("div",{className:"rounded-btn w-fit bg-[#EAEAEC]",children:(0,e.jsx)(c.List,{className:"flex w-max p-1",children:i?.map((t,u)=>(0,e.jsx)(c.Trigger,{ref:g=>{g&&(s.current[u]=g)},className:(0,v.cn)("lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]",t.title===o?.title&&"bg-white"),onClick:()=>{p(t),r(t),l(t?.title)},value:t.title,children:(0,e.jsx)(a.Text,{html:t.title,className:"text-[14px] font-bold leading-[1.2]"})},u+t.title))})})}),(0,e.jsx)("div",{className:"laptop-md:px-6 mt-4 px-4",children:i?.map((t,u)=>(0,e.jsx)(c.Content,{value:t.title,children:(0,e.jsx)(a.Text,{html:t.description,className:"laptop-md:text-[18px] text-[14px] font-bold"})},u+t.title))})]})]})]})};var P=(0,w.withLayout)(A);
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Picture, Button, Dialog, DialogContent, DialogTrigger } from '../../../../../../components/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { gaTrack } from '../../../../../../shared/track.js'\n\nconst ProductHighlight = () => {\n const { variant } = useBizProductContext()\n const [open, setOpen] = useState(false)\n\n const productHighlightData = useComponentData('ProductHighlight') ?? {}\n\n const [activeKspItem, setActiveKspItem] = useState(productHighlightData?.ksp?.[0])\n\n const gaTrackEvent = useCallback(\n (buttonName?: string) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n position: productHighlightData?.title || '',\n button_name: buttonName || productHighlightData?.view || '',\n },\n })\n },\n [productHighlightData?.title, productHighlightData?.view, variant.sku]\n )\n\n if (!Reflect.ownKeys(productHighlightData).length) return null\n\n return (\n <div className=\"ipc-product-detail-highlight\">\n <div className=\"flex items-center justify-between\">\n {productHighlightData?.title && (\n <Text\n className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\"\n html={productHighlightData?.title}\n />\n )}\n <Dialog open={open} onOpenChange={setOpen}>\n {productHighlightData?.view && (\n <DialogTrigger asChild>\n <Button\n variant=\"link\"\n className=\"!p-0 text-[14px] lg-desktop:text-[16px] font-bold\"\n onClick={() => gaTrackEvent()}\n >\n {productHighlightData?.view}\n </Button>\n </DialogTrigger>\n )}\n <ProductHighlightModal\n ksp={productHighlightData?.ksp || []}\n activeKspItem={activeKspItem}\n setActiveKspItem={setActiveKspItem}\n gaTrackEvent={gaTrackEvent}\n />\n </Dialog>\n </div>\n <ul className=\"lg-desktop:mt-4 mt-3 flex list-disc flex-col gap-1 pl-5\">\n {productHighlightData?.ksp?.map((item: any) => (\n <li key={item?.title} className=\"product-highlight-item cursor-pointer\">\n <Text\n size={3}\n onClick={() => {\n if (!item?.img) return\n setActiveKspItem(item)\n setOpen(true)\n gaTrackEvent(item?.title)\n }}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-1 overflow-hidden break-all text-[14px] font-bold text-[#080A0F]\"\n html={item?.title}\n />\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nconst ProductHighlightModal = ({\n ksp,\n activeKspItem,\n setActiveKspItem,\n gaTrackEvent,\n}: {\n ksp: any[]\n activeKspItem: any\n setActiveKspItem: (_activeKspItem: any) => void\n gaTrackEvent: (_buttonName: string) => void\n}) => {\n const highlightRef = useRef<HTMLButtonElement[]>([])\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n const autoScrollToActiveItem = useCallback(\n (activeKspItem: any) => {\n const curIndex = ksp.findIndex(item => item.title === activeKspItem?.title)\n const curRef = highlightRef.current[curIndex]\n\n if (curRef && scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = curRef\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n },\n [ksp]\n )\n\n useEffect(() => {\n if (!activeKspItem) return\n // setActiveKspItem(clickActiveKspItem)\n\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u7B49\u5F85 Dialog \u548C\u5185\u90E8\u5143\u7D20\u5B8C\u5168\u6E32\u67D3\n setTimeout(() => {\n autoScrollToActiveItem(activeKspItem)\n }, 100)\n }, [autoScrollToActiveItem, activeKspItem])\n\n return (\n <DialogContent className=\"tablet:max-w-[90vw] tablet:w-[896px] [&_.dialog-close-icon]:laptop:size-6 !rounded-box mx-auto w-full max-w-[326px] overflow-hidden border-none bg-transparent p-0 [&_.dialog-close-icon]:size-4\">\n <style>{`\n .dialog-close-icon {\n color: ${activeKspItem?.closeColor || '#1D1D1F'};\n }\n `}</style>\n <Root value={activeKspItem?.title} className=\"w-full overflow-hidden\">\n {ksp?.map(item => (\n <Content value={item.title} key={item.title}>\n <Picture\n source={`${item?.img}, ${item?.mobileImg} 767`}\n className=\"laptop-md:h-[480px] h-[304px] w-full\"\n alt={item?.title || ''}\n imgClassName=\"object-cover h-full\"\n />\n </Content>\n ))}\n <div className=\"laptop-md:py-6 w-full overflow-visible bg-white py-4\">\n <div\n ref={scrollContainerRef}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n className=\"laptop-md:px-6 overflow-x-auto px-4\"\n >\n <div className=\"rounded-btn w-fit bg-[#EAEAEC]\">\n <List className=\"flex w-max p-1\">\n {ksp?.map((item, index) => (\n <Trigger\n ref={el => {\n if (el) {\n highlightRef.current[index] = el\n }\n }}\n className={cn(\n 'lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]',\n item.title === activeKspItem?.title && 'bg-white'\n )}\n onClick={() => {\n autoScrollToActiveItem(item)\n setActiveKspItem(item)\n gaTrackEvent(item?.title)\n }}\n key={index + item.title}\n value={item.title}\n >\n <Text html={item.title} className=\"text-[14px] font-bold leading-[1.2]\" />\n </Trigger>\n ))}\n </List>\n </div>\n </div>\n <div className=\"laptop-md:px-6 mt-4 px-4\">\n {ksp?.map((item, index) => (\n <Content\n value={item.title}\n key={index + item.title}\n className=\"laptop-md:text-[18px] text-[14px] font-bold\"
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsCU,IAAAI,EAAA,6BAtCVC,EAA4E,iDAC5EC,EAA6C,gCAC7CC,EAAkE,iBAClEC,EAAmB,8CACnBC,EAAqC,6CACrCC,EAAiC,iDACjCC,EAA2B,8CAC3BC,EAAwB,6CAExB,MAAMC,EAAmB,IAAM,CAC7B,KAAM,CAAE,QAAAC,CAAQ,KAAI,wBAAqB,EACnC,CAACC,EAAMC,CAAO,KAAI,YAAS,EAAK,EAEhCC,KAAuB,oBAAiB,kBAAkB,GAAK,CAAC,EAEhE,CAACC,EAAeC,CAAgB,KAAI,YAASF,GAAsB,MAA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,MAAO,UAAU,sCAAsC,GAHnEU,EAAQV,EAAK,KAIpB,CACD,EACH,EACF,EACF,KACA,OAAC,OAAI,UAAU,2BACZ,SAAAC,GAAK,IAAI,CAACD,EAAMU,OACf,OAAC,WACC,MAAOV,EAAK,
|
|
4
|
+
"sourcesContent": ["import { Text, Picture, Button, Dialog, DialogContent, DialogTrigger } from '../../../../../../components/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { gaTrack } from '../../../../../../shared/track.js'\n\nconst ProductHighlight = () => {\n const { variant } = useBizProductContext()\n const [open, setOpen] = useState(false)\n\n const productHighlightData = useComponentData('ProductHighlight') ?? {}\n\n const [activeKspItem, setActiveKspItem] = useState(productHighlightData?.ksp?.[0])\n\n const gaTrackEvent = useCallback(\n (buttonName?: string) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n position: productHighlightData?.title || '',\n button_name: buttonName || productHighlightData?.view || '',\n },\n })\n },\n [productHighlightData?.title, productHighlightData?.view, variant.sku]\n )\n\n if (!Reflect.ownKeys(productHighlightData).length) return null\n\n return (\n <div className=\"ipc-product-detail-highlight\">\n <div className=\"flex items-center justify-between\">\n {productHighlightData?.title && (\n <Text\n className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\"\n html={productHighlightData?.title}\n />\n )}\n <Dialog open={open} onOpenChange={setOpen}>\n {productHighlightData?.view && (\n <DialogTrigger asChild>\n <Button\n variant=\"link\"\n className=\"!p-0 text-[14px] lg-desktop:text-[16px] font-bold\"\n onClick={() => gaTrackEvent()}\n >\n {productHighlightData?.view}\n </Button>\n </DialogTrigger>\n )}\n <ProductHighlightModal\n ksp={productHighlightData?.ksp || []}\n activeKspItem={activeKspItem}\n setActiveKspItem={setActiveKspItem}\n gaTrackEvent={gaTrackEvent}\n />\n </Dialog>\n </div>\n <ul className=\"lg-desktop:mt-4 mt-3 flex list-disc flex-col gap-1 pl-5\">\n {productHighlightData?.ksp?.map((item: any) => (\n <li key={item?.title} className=\"product-highlight-item cursor-pointer\">\n <Text\n size={3}\n onClick={() => {\n if (!item?.img) return\n setActiveKspItem(item)\n setOpen(true)\n gaTrackEvent(item?.title)\n }}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-1 overflow-hidden break-all text-[14px] font-bold text-[#080A0F]\"\n html={item?.title}\n />\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nconst ProductHighlightModal = ({\n ksp,\n activeKspItem,\n setActiveKspItem,\n gaTrackEvent,\n}: {\n ksp: any[]\n activeKspItem: any\n setActiveKspItem: (_activeKspItem: any) => void\n gaTrackEvent: (_buttonName: string) => void\n}) => {\n const highlightRef = useRef<HTMLButtonElement[]>([])\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n const autoScrollToActiveItem = useCallback(\n (activeKspItem: any) => {\n const curIndex = ksp.findIndex(item => item.title === activeKspItem?.title)\n const curRef = highlightRef.current[curIndex]\n\n if (curRef && scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = curRef\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n },\n [ksp]\n )\n\n useEffect(() => {\n if (!activeKspItem) return\n // setActiveKspItem(clickActiveKspItem)\n\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u7B49\u5F85 Dialog \u548C\u5185\u90E8\u5143\u7D20\u5B8C\u5168\u6E32\u67D3\n setTimeout(() => {\n autoScrollToActiveItem(activeKspItem)\n }, 100)\n }, [autoScrollToActiveItem, activeKspItem])\n\n return (\n <DialogContent className=\"tablet:max-w-[90vw] tablet:w-[896px] [&_.dialog-close-icon]:laptop:size-6 !rounded-box mx-auto w-full max-w-[326px] overflow-hidden border-none bg-transparent p-0 [&_.dialog-close-icon]:size-4\">\n <style>{`\n .dialog-close-icon {\n color: ${activeKspItem?.closeColor || '#1D1D1F'};\n }\n `}</style>\n <Root value={activeKspItem?.title} className=\"w-full overflow-hidden\">\n {ksp?.map(item => (\n <Content value={item.title} key={item.title}>\n <Picture\n source={`${item?.img}, ${item?.mobileImg} 767`}\n className=\"laptop-md:h-[480px] h-[304px] w-full\"\n alt={item?.title || ''}\n imgClassName=\"object-cover h-full\"\n />\n </Content>\n ))}\n <div className=\"laptop-md:py-6 w-full overflow-visible bg-white py-4\">\n <div\n ref={scrollContainerRef}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n className=\"laptop-md:px-6 overflow-x-auto px-4\"\n >\n <div className=\"rounded-btn w-fit bg-[#EAEAEC]\">\n <List className=\"flex w-max p-1\">\n {ksp?.map((item, index) => (\n <Trigger\n ref={el => {\n if (el) {\n highlightRef.current[index] = el\n }\n }}\n className={cn(\n 'lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]',\n item.title === activeKspItem?.title && 'bg-white'\n )}\n onClick={() => {\n autoScrollToActiveItem(item)\n setActiveKspItem(item)\n gaTrackEvent(item?.title)\n }}\n key={index + item.title}\n value={item.title}\n >\n <Text html={item.title} className=\"text-[14px] font-bold leading-[1.2]\" />\n </Trigger>\n ))}\n </List>\n </div>\n </div>\n <div className=\"laptop-md:px-6 mt-4 px-4\">\n {ksp?.map((item, index) => (\n <Content\n value={item.title}\n key={index + item.title}\n >\n <Text html={item.description} className=\"laptop-md:text-[18px] text-[14px] font-bold\" />\n </Content>\n ))}\n </div>\n </div>\n </Root>\n </DialogContent>\n )\n}\n\nexport default withLayout(ProductHighlight)\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAA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sCAEV,mBAAC,OAAI,UAAU,iCACb,mBAAC,QAAK,UAAU,iBACb,SAAAF,GAAK,IAAI,CAACD,EAAMU,OACf,OAAC,WACC,IAAKC,GAAM,CACLA,IACFT,EAAa,QAAQQ,CAAK,EAAIC,EAElC,EACA,aAAW,MACT,oEACAX,EAAK,QAAUL,GAAe,OAAS,UACzC,EACA,QAAS,IAAM,CACbS,EAAuBJ,CAAI,EAC3BJ,EAAiBI,CAAI,EACrBH,EAAaG,GAAM,KAAK,CAC1B,EAEA,MAAOA,EAAK,MAEZ,mBAAC,QAAK,KAAMA,EAAK,MAAO,UAAU,sCAAsC,GAHnEU,EAAQV,EAAK,KAIpB,CACD,EACH,EACF,EACF,KACA,OAAC,OAAI,UAAU,2BACZ,SAAAC,GAAK,IAAI,CAACD,EAAMU,OACf,OAAC,WACC,MAAOV,EAAK,MAGZ,mBAAC,QAAK,KAAMA,EAAK,YAAa,UAAU,8CAA8C,GAFjFU,EAAQV,EAAK,KAGpB,CACD,EACH,GACF,GACF,GACF,CAEJ,EAEA,IAAOrB,KAAQ,cAAWW,CAAgB",
|
|
6
6
|
"names": ["ProductHighlight_exports", "__export", "ProductHighlight_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_react_tabs", "import_react", "import_helpers", "import_BizProductProvider", "import_useComponentData", "import_Styles", "import_track", "ProductHighlight", "variant", "open", "setOpen", "productHighlightData", "activeKspItem", "setActiveKspItem", "gaTrackEvent", "buttonName", "ProductHighlightModal", "item", "ksp", "highlightRef", "scrollContainerRef", "autoScrollToActiveItem", "curIndex", "curRef", "container", "button", "scrollLeft", "index", "el"]
|
|
7
7
|
}
|
|
@@ -2,5 +2,5 @@ import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Text as g,Picture as w,
|
|
|
2
2
|
.dialog-close-icon {
|
|
3
3
|
color: ${i?.closeColor||"#1D1D1F"};
|
|
4
4
|
}
|
|
5
|
-
`}),r(D,{value:i?.title,className:"w-full overflow-hidden",children:[l?.map(t=>e(f,{value:t.title,children:e(w,{source:`${t?.img}, ${t?.mobileImg} 767`,className:"laptop-md:h-[480px] h-[304px] w-full",alt:t?.title||"",imgClassName:"object-cover h-full"})},t.title)),r("div",{className:"laptop-md:py-6 w-full overflow-visible bg-white py-4",children:[e("div",{ref:n,style:{scrollbarWidth:"none",msOverflowStyle:"none"},className:"laptop-md:px-6 overflow-x-auto px-4",children:e("div",{className:"rounded-btn w-fit bg-[#EAEAEC]",children:e(T,{className:"flex w-max p-1",children:l?.map((t,s)=>e(E,{ref:c=>{c&&(d.current[s]=c)},className:A("lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]",t.title===i?.title&&"bg-white"),onClick:()=>{a(t),p(t),o(t?.title)},value:t.title,children:e(g,{html:t.title,className:"text-[14px] font-bold leading-[1.2]"})},s+t.title))})})}),e("div",{className:"laptop-md:px-6 mt-4 px-4",children:l?.map((t,s)=>e(f,{value:t.title,className:"laptop-md:text-[18px] text-[14px] font-bold"
|
|
5
|
+
`}),r(D,{value:i?.title,className:"w-full overflow-hidden",children:[l?.map(t=>e(f,{value:t.title,children:e(w,{source:`${t?.img}, ${t?.mobileImg} 767`,className:"laptop-md:h-[480px] h-[304px] w-full",alt:t?.title||"",imgClassName:"object-cover h-full"})},t.title)),r("div",{className:"laptop-md:py-6 w-full overflow-visible bg-white py-4",children:[e("div",{ref:n,style:{scrollbarWidth:"none",msOverflowStyle:"none"},className:"laptop-md:px-6 overflow-x-auto px-4",children:e("div",{className:"rounded-btn w-fit bg-[#EAEAEC]",children:e(T,{className:"flex w-max p-1",children:l?.map((t,s)=>e(E,{ref:c=>{c&&(d.current[s]=c)},className:A("lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]",t.title===i?.title&&"bg-white"),onClick:()=>{a(t),p(t),o(t?.title)},value:t.title,children:e(g,{html:t.title,className:"text-[14px] font-bold leading-[1.2]"})},s+t.title))})})}),e("div",{className:"laptop-md:px-6 mt-4 px-4",children:l?.map((t,s)=>e(f,{value:t.title,children:e(g,{html:t.description,className:"laptop-md:text-[18px] text-[14px] font-bold"})},s+t.title))})]})]})]})};var q=R(I);export{q as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Picture, Button, Dialog, DialogContent, DialogTrigger } from '../../../../../../components/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { gaTrack } from '../../../../../../shared/track.js'\n\nconst ProductHighlight = () => {\n const { variant } = useBizProductContext()\n const [open, setOpen] = useState(false)\n\n const productHighlightData = useComponentData('ProductHighlight') ?? {}\n\n const [activeKspItem, setActiveKspItem] = useState(productHighlightData?.ksp?.[0])\n\n const gaTrackEvent = useCallback(\n (buttonName?: string) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n position: productHighlightData?.title || '',\n button_name: buttonName || productHighlightData?.view || '',\n },\n })\n },\n [productHighlightData?.title, productHighlightData?.view, variant.sku]\n )\n\n if (!Reflect.ownKeys(productHighlightData).length) return null\n\n return (\n <div className=\"ipc-product-detail-highlight\">\n <div className=\"flex items-center justify-between\">\n {productHighlightData?.title && (\n <Text\n className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\"\n html={productHighlightData?.title}\n />\n )}\n <Dialog open={open} onOpenChange={setOpen}>\n {productHighlightData?.view && (\n <DialogTrigger asChild>\n <Button\n variant=\"link\"\n className=\"!p-0 text-[14px] lg-desktop:text-[16px] font-bold\"\n onClick={() => gaTrackEvent()}\n >\n {productHighlightData?.view}\n </Button>\n </DialogTrigger>\n )}\n <ProductHighlightModal\n ksp={productHighlightData?.ksp || []}\n activeKspItem={activeKspItem}\n setActiveKspItem={setActiveKspItem}\n gaTrackEvent={gaTrackEvent}\n />\n </Dialog>\n </div>\n <ul className=\"lg-desktop:mt-4 mt-3 flex list-disc flex-col gap-1 pl-5\">\n {productHighlightData?.ksp?.map((item: any) => (\n <li key={item?.title} className=\"product-highlight-item cursor-pointer\">\n <Text\n size={3}\n onClick={() => {\n if (!item?.img) return\n setActiveKspItem(item)\n setOpen(true)\n gaTrackEvent(item?.title)\n }}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-1 overflow-hidden break-all text-[14px] font-bold text-[#080A0F]\"\n html={item?.title}\n />\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nconst ProductHighlightModal = ({\n ksp,\n activeKspItem,\n setActiveKspItem,\n gaTrackEvent,\n}: {\n ksp: any[]\n activeKspItem: any\n setActiveKspItem: (_activeKspItem: any) => void\n gaTrackEvent: (_buttonName: string) => void\n}) => {\n const highlightRef = useRef<HTMLButtonElement[]>([])\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n const autoScrollToActiveItem = useCallback(\n (activeKspItem: any) => {\n const curIndex = ksp.findIndex(item => item.title === activeKspItem?.title)\n const curRef = highlightRef.current[curIndex]\n\n if (curRef && scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = curRef\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n },\n [ksp]\n )\n\n useEffect(() => {\n if (!activeKspItem) return\n // setActiveKspItem(clickActiveKspItem)\n\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u7B49\u5F85 Dialog \u548C\u5185\u90E8\u5143\u7D20\u5B8C\u5168\u6E32\u67D3\n setTimeout(() => {\n autoScrollToActiveItem(activeKspItem)\n }, 100)\n }, [autoScrollToActiveItem, activeKspItem])\n\n return (\n <DialogContent className=\"tablet:max-w-[90vw] tablet:w-[896px] [&_.dialog-close-icon]:laptop:size-6 !rounded-box mx-auto w-full max-w-[326px] overflow-hidden border-none bg-transparent p-0 [&_.dialog-close-icon]:size-4\">\n <style>{`\n .dialog-close-icon {\n color: ${activeKspItem?.closeColor || '#1D1D1F'};\n }\n `}</style>\n <Root value={activeKspItem?.title} className=\"w-full overflow-hidden\">\n {ksp?.map(item => (\n <Content value={item.title} key={item.title}>\n <Picture\n source={`${item?.img}, ${item?.mobileImg} 767`}\n className=\"laptop-md:h-[480px] h-[304px] w-full\"\n alt={item?.title || ''}\n imgClassName=\"object-cover h-full\"\n />\n </Content>\n ))}\n <div className=\"laptop-md:py-6 w-full overflow-visible bg-white py-4\">\n <div\n ref={scrollContainerRef}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n className=\"laptop-md:px-6 overflow-x-auto px-4\"\n >\n <div className=\"rounded-btn w-fit bg-[#EAEAEC]\">\n <List className=\"flex w-max p-1\">\n {ksp?.map((item, index) => (\n <Trigger\n ref={el => {\n if (el) {\n highlightRef.current[index] = el\n }\n }}\n className={cn(\n 'lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]',\n item.title === activeKspItem?.title && 'bg-white'\n )}\n onClick={() => {\n autoScrollToActiveItem(item)\n setActiveKspItem(item)\n gaTrackEvent(item?.title)\n }}\n key={index + item.title}\n value={item.title}\n >\n <Text html={item.title} className=\"text-[14px] font-bold leading-[1.2]\" />\n </Trigger>\n ))}\n </List>\n </div>\n </div>\n <div className=\"laptop-md:px-6 mt-4 px-4\">\n {ksp?.map((item, index) => (\n <Content\n value={item.title}\n key={index + item.title}\n className=\"laptop-md:text-[18px] text-[14px] font-bold\"
|
|
5
|
-
"mappings": "AAsCU,cAAAA,EAKF,QAAAC,MALE,oBAtCV,OAAS,QAA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gB,GAAe,MAAO,UAAU,yBAC1C,UAAAM,GAAK,IAAID,GACR/B,EAACQ,EAAA,CAAQ,MAAOuB,EAAK,MACnB,SAAA/B,EAACG,EAAA,CACC,OAAQ,GAAG4B,GAAM,GAAG,KAAKA,GAAM,SAAS,OACxC,UAAU,uCACV,IAAKA,GAAM,OAAS,GACpB,aAAa,sBACf,GAN+BA,EAAK,KAOtC,CACD,EACD9B,EAAC,OAAI,UAAU,uDACb,UAAAD,EAAC,OACC,IAAKkC,EACL,MAAO,CACL,eAAgB,OAChB,gBAAiB,MACnB,EACA,UAAU,sCAEV,SAAAlC,EAAC,OAAI,UAAU,iCACb,SAAAA,EAACS,EAAA,CAAK,UAAU,iBACb,SAAAuB,GAAK,IAAI,CAACD,EAAMU,IACfzC,EAACW,EAAA,CACC,IAAK+B,GAAM,CACLA,IACFT,EAAa,QAAQQ,CAAK,EAAIC,EAElC,EACA,UAAW1B,EACT,oEACAe,EAAK,QAAUL,GAAe,OAAS,UACzC,EACA,QAAS,IAAM,CACbS,EAAuBJ,CAAI,EAC3BJ,EAAiBI,CAAI,EACrBH,EAAaG,GAAM,KAAK,CAC1B,EAEA,MAAOA,EAAK,MAEZ,SAAA/B,EAACE,EAAA,CAAK,KAAM6B,EAAK,MAAO,UAAU,sCAAsC,GAHnEU,EAAQV,EAAK,KAIpB,CACD,EACH,EACF,EACF,EACA/B,EAAC,OAAI,UAAU,2BACZ,SAAAgC,GAAK,IAAI,CAACD,EAAMU,IACfzC,EAACQ,EAAA,CACC,MAAOuB,EAAK,
|
|
4
|
+
"sourcesContent": ["import { Text, Picture, Button, Dialog, DialogContent, DialogTrigger } from '../../../../../../components/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { gaTrack } from '../../../../../../shared/track.js'\n\nconst ProductHighlight = () => {\n const { variant } = useBizProductContext()\n const [open, setOpen] = useState(false)\n\n const productHighlightData = useComponentData('ProductHighlight') ?? {}\n\n const [activeKspItem, setActiveKspItem] = useState(productHighlightData?.ksp?.[0])\n\n const gaTrackEvent = useCallback(\n (buttonName?: string) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n position: productHighlightData?.title || '',\n button_name: buttonName || productHighlightData?.view || '',\n },\n })\n },\n [productHighlightData?.title, productHighlightData?.view, variant.sku]\n )\n\n if (!Reflect.ownKeys(productHighlightData).length) return null\n\n return (\n <div className=\"ipc-product-detail-highlight\">\n <div className=\"flex items-center justify-between\">\n {productHighlightData?.title && (\n <Text\n className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\"\n html={productHighlightData?.title}\n />\n )}\n <Dialog open={open} onOpenChange={setOpen}>\n {productHighlightData?.view && (\n <DialogTrigger asChild>\n <Button\n variant=\"link\"\n className=\"!p-0 text-[14px] lg-desktop:text-[16px] font-bold\"\n onClick={() => gaTrackEvent()}\n >\n {productHighlightData?.view}\n </Button>\n </DialogTrigger>\n )}\n <ProductHighlightModal\n ksp={productHighlightData?.ksp || []}\n activeKspItem={activeKspItem}\n setActiveKspItem={setActiveKspItem}\n gaTrackEvent={gaTrackEvent}\n />\n </Dialog>\n </div>\n <ul className=\"lg-desktop:mt-4 mt-3 flex list-disc flex-col gap-1 pl-5\">\n {productHighlightData?.ksp?.map((item: any) => (\n <li key={item?.title} className=\"product-highlight-item cursor-pointer\">\n <Text\n size={3}\n onClick={() => {\n if (!item?.img) return\n setActiveKspItem(item)\n setOpen(true)\n gaTrackEvent(item?.title)\n }}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-1 overflow-hidden break-all text-[14px] font-bold text-[#080A0F]\"\n html={item?.title}\n />\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nconst ProductHighlightModal = ({\n ksp,\n activeKspItem,\n setActiveKspItem,\n gaTrackEvent,\n}: {\n ksp: any[]\n activeKspItem: any\n setActiveKspItem: (_activeKspItem: any) => void\n gaTrackEvent: (_buttonName: string) => void\n}) => {\n const highlightRef = useRef<HTMLButtonElement[]>([])\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n const autoScrollToActiveItem = useCallback(\n (activeKspItem: any) => {\n const curIndex = ksp.findIndex(item => item.title === activeKspItem?.title)\n const curRef = highlightRef.current[curIndex]\n\n if (curRef && scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = curRef\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n },\n [ksp]\n )\n\n useEffect(() => {\n if (!activeKspItem) return\n // setActiveKspItem(clickActiveKspItem)\n\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u7B49\u5F85 Dialog \u548C\u5185\u90E8\u5143\u7D20\u5B8C\u5168\u6E32\u67D3\n setTimeout(() => {\n autoScrollToActiveItem(activeKspItem)\n }, 100)\n }, [autoScrollToActiveItem, activeKspItem])\n\n return (\n <DialogContent className=\"tablet:max-w-[90vw] tablet:w-[896px] [&_.dialog-close-icon]:laptop:size-6 !rounded-box mx-auto w-full max-w-[326px] overflow-hidden border-none bg-transparent p-0 [&_.dialog-close-icon]:size-4\">\n <style>{`\n .dialog-close-icon {\n color: ${activeKspItem?.closeColor || '#1D1D1F'};\n }\n `}</style>\n <Root value={activeKspItem?.title} className=\"w-full overflow-hidden\">\n {ksp?.map(item => (\n <Content value={item.title} key={item.title}>\n <Picture\n source={`${item?.img}, ${item?.mobileImg} 767`}\n className=\"laptop-md:h-[480px] h-[304px] w-full\"\n alt={item?.title || ''}\n imgClassName=\"object-cover h-full\"\n />\n </Content>\n ))}\n <div className=\"laptop-md:py-6 w-full overflow-visible bg-white py-4\">\n <div\n ref={scrollContainerRef}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n className=\"laptop-md:px-6 overflow-x-auto px-4\"\n >\n <div className=\"rounded-btn w-fit bg-[#EAEAEC]\">\n <List className=\"flex w-max p-1\">\n {ksp?.map((item, index) => (\n <Trigger\n ref={el => {\n if (el) {\n highlightRef.current[index] = el\n }\n }}\n className={cn(\n 'lg-desktop:px-7 rounded-btn h-[38px] shrink-0 px-5 leading-[38px]',\n item.title === activeKspItem?.title && 'bg-white'\n )}\n onClick={() => {\n autoScrollToActiveItem(item)\n setActiveKspItem(item)\n gaTrackEvent(item?.title)\n }}\n key={index + item.title}\n value={item.title}\n >\n <Text html={item.title} className=\"text-[14px] font-bold leading-[1.2]\" />\n </Trigger>\n ))}\n </List>\n </div>\n </div>\n <div className=\"laptop-md:px-6 mt-4 px-4\">\n {ksp?.map((item, index) => (\n <Content\n value={item.title}\n key={index + item.title}\n >\n <Text html={item.description} className=\"laptop-md:text-[18px] text-[14px] font-bold\" />\n </Content>\n ))}\n </div>\n </div>\n </Root>\n </DialogContent>\n )\n}\n\nexport default withLayout(ProductHighlight)\n"],
|
|
5
|
+
"mappings": "AAsCU,cAAAA,EAKF,QAAAC,MALE,oBAtCV,OAAS,QAAAC,EAAM,WAAAC,EAAS,UAAAC,EAAQ,UAAAC,EAAQ,iBAAAC,EAAe,iBAAAC,MAAqB,wCAC5E,OAAS,WAAAC,EAAS,QAAAC,EAAM,QAAAC,EAAM,WAAAC,MAAe,uBAC7C,OAAS,eAAAC,EAAa,aAAAC,EAAoB,UAAAC,EAAQ,YAAAC,MAAgB,QAClE,OAAS,MAAAC,MAAU,qCACnB,OAAS,wBAAAC,MAA4B,oCACrC,OAAS,oBAAAC,MAAwB,wCACjC,OAAS,cAAAC,MAAkB,qCAC3B,OAAS,WAAAC,MAAe,oCAExB,MAAMC,EAAmB,IAAM,CAC7B,KAAM,CAAE,QAAAC,CAAQ,EAAIL,EAAqB,EACnC,CAACM,EAAMC,CA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AAI,CAACD,EAAMU,IACfzC,EAACW,EAAA,CACC,IAAK+B,GAAM,CACLA,IACFT,EAAa,QAAQQ,CAAK,EAAIC,EAElC,EACA,UAAW1B,EACT,oEACAe,EAAK,QAAUL,GAAe,OAAS,UACzC,EACA,QAAS,IAAM,CACbS,EAAuBJ,CAAI,EAC3BJ,EAAiBI,CAAI,EACrBH,EAAaG,GAAM,KAAK,CAC1B,EAEA,MAAOA,EAAK,MAEZ,SAAA/B,EAACE,EAAA,CAAK,KAAM6B,EAAK,MAAO,UAAU,sCAAsC,GAHnEU,EAAQV,EAAK,KAIpB,CACD,EACH,EACF,EACF,EACA/B,EAAC,OAAI,UAAU,2BACZ,SAAAgC,GAAK,IAAI,CAACD,EAAMU,IACfzC,EAACQ,EAAA,CACC,MAAOuB,EAAK,MAGZ,SAAA/B,EAACE,EAAA,CAAK,KAAM6B,EAAK,YAAa,UAAU,8CAA8C,GAFjFU,EAAQV,EAAK,KAGpB,CACD,EACH,GACF,GACF,GACF,CAEJ,EAEA,IAAOY,EAAQxB,EAAWE,CAAgB",
|
|
6
6
|
"names": ["jsx", "jsxs", "Text", "Picture", "Button", "Dialog", "DialogContent", "DialogTrigger", "Content", "List", "Root", "Trigger", "useCallback", "useEffect", "useRef", "useState", "cn", "useBizProductContext", "useComponentData", "withLayout", "gaTrack", "ProductHighlight", "variant", "open", "setOpen", "productHighlightData", "activeKspItem", "setActiveKspItem", "gaTrackEvent", "buttonName", "ProductHighlightModal", "item", "ksp", "highlightRef", "scrollContainerRef", "autoScrollToActiveItem", "curIndex", "curRef", "container", "button", "scrollLeft", "index", "el", "ProductHighlight_default"]
|
|
7
7
|
}
|