@anker-in/headless-ui 1.0.10-temp-onclick → 1.0.10-temp-21
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/apps/playground/utils/classnames.d.ts +1 -0
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/AccordionCards/index.js.map +2 -2
- package/dist/cjs/biz-components/AccordionCards/useDebounce.d.ts +6 -0
- package/dist/cjs/biz-components/CreativeModule/index.d.ts +2 -2
- package/dist/cjs/biz-components/CreativeModule/index.js +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.js.map +3 -3
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.d.ts +8 -0
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +2 -0
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js.map +7 -0
- package/dist/cjs/biz-components/GraphicOverlay/index.d.ts +2 -0
- package/dist/cjs/biz-components/GraphicOverlay/index.js +2 -0
- package/dist/cjs/biz-components/GraphicOverlay/index.js.map +7 -0
- package/dist/cjs/biz-components/GraphicOverlay/types.d.ts +33 -0
- package/dist/cjs/biz-components/GraphicOverlay/types.js +2 -0
- package/dist/cjs/biz-components/GraphicOverlay/types.js.map +7 -0
- package/dist/cjs/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +3 -0
- package/dist/cjs/biz-components/SectionHeading/SectionHeading.d.ts +4 -0
- package/dist/cjs/biz-components/SectionHeading/types.d.ts +6 -0
- package/dist/cjs/biz-components/Shelf/Shelf.d.ts +8 -0
- package/dist/cjs/biz-components/Shelf/index.d.ts +1 -0
- package/dist/cjs/biz-components/Shelf/types.d.ts +6 -0
- package/dist/cjs/biz-components/ShelfDisplay/index.js +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/tab.d.ts +7 -0
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/biz-components/Title/index.js.map +3 -3
- package/dist/cjs/biz-components/Title/types.d.ts +3 -2
- package/dist/cjs/biz-components/Title/types.js +1 -1
- package/dist/cjs/biz-components/Title/types.js.map +1 -1
- package/dist/cjs/biz-components/index.d.ts +1 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/col.d.ts +29 -0
- package/dist/cjs/components/dropdown.d.ts +27 -0
- package/dist/cjs/components/row.d.ts +18 -0
- package/dist/cjs/helpers/get-subtree.d.ts +12 -0
- package/dist/cjs/packages/ui/src/components/avatar.d.ts +26 -0
- package/dist/cjs/packages/ui/src/components/index.d.ts +20 -0
- package/dist/cjs/packages/ui/src/index.d.ts +1 -0
- package/dist/cjs/packages/ui/src/stories/avatar.stories.d.ts +40 -0
- package/dist/cjs/packages/ui/src/stories/badge.stories.d.ts +26 -0
- package/dist/cjs/packages/ui/src/stories/button.stories.d.ts +48 -0
- package/dist/cjs/packages/ui/src/stories/checkbox.stories.d.ts +46 -0
- package/dist/cjs/packages/ui/src/stories/container.stories.d.ts +36 -0
- package/dist/cjs/packages/ui/src/stories/dialog.stories.d.ts +20 -0
- package/dist/cjs/packages/ui/src/stories/grid.stories.d.ts +42 -0
- package/dist/cjs/packages/ui/src/stories/heading.stories.d.ts +82 -0
- package/dist/cjs/packages/ui/src/stories/input.stories.d.ts +35 -0
- package/dist/cjs/packages/ui/src/stories/picture.stories.d.ts +18 -0
- package/dist/cjs/packages/ui/src/stories/popover.stories.d.ts +17 -0
- package/dist/cjs/packages/ui/src/stories/radio.stories.d.ts +39 -0
- package/dist/cjs/packages/ui/src/stories/skeleton.stories.d.ts +20 -0
- package/dist/cjs/packages/ui/src/stories/text.stories.d.ts +94 -0
- package/dist/cjs/src/components/index.d.ts +21 -0
- package/dist/cjs/src/components/input-number.d.ts +47 -0
- package/dist/cjs/src/index.d.ts +1 -0
- package/dist/cjs/src/stories/avatar.stories.d.ts +40 -0
- package/dist/cjs/src/stories/badge.stories.d.ts +26 -0
- package/dist/cjs/src/stories/button.stories.d.ts +48 -0
- package/dist/cjs/src/stories/checkbox.stories.d.ts +46 -0
- package/dist/cjs/src/stories/container.stories.d.ts +36 -0
- package/dist/cjs/src/stories/dialog.stories.d.ts +20 -0
- package/dist/cjs/src/stories/grid.stories.d.ts +42 -0
- package/dist/cjs/src/stories/heading.stories.d.ts +82 -0
- package/dist/cjs/src/stories/input-number.stories.d.ts +51 -0
- package/dist/cjs/src/stories/input.stories.d.ts +35 -0
- package/dist/cjs/src/stories/picture.stories.d.ts +18 -0
- package/dist/cjs/src/stories/popover.stories.d.ts +17 -0
- package/dist/cjs/src/stories/radio.stories.d.ts +39 -0
- package/dist/cjs/src/stories/skeleton.stories.d.ts +20 -0
- package/dist/cjs/src/stories/text.stories.d.ts +94 -0
- package/dist/cjs/stories/creativeModule.stories.d.ts +2 -1
- package/dist/cjs/stories/creativeModule.stories.js +1 -1
- package/dist/cjs/stories/creativeModule.stories.js.map +2 -2
- package/dist/cjs/stories/shelf.stories.d.ts +17 -0
- package/dist/cjs/tailwind.config.d.ts +253 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/apps/playground/utils/classnames.d.ts +1 -0
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js.map +2 -2
- package/dist/esm/biz-components/AccordionCards/useDebounce.d.ts +6 -0
- package/dist/esm/biz-components/CreativeModule/index.d.ts +2 -2
- package/dist/esm/biz-components/CreativeModule/index.js +1 -1
- package/dist/esm/biz-components/CreativeModule/index.js.map +3 -3
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js.map +2 -2
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.d.ts +8 -0
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +2 -0
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js.map +7 -0
- package/dist/esm/biz-components/GraphicOverlay/index.d.ts +2 -0
- package/dist/esm/biz-components/GraphicOverlay/index.js +2 -0
- package/dist/esm/biz-components/GraphicOverlay/index.js.map +7 -0
- package/dist/esm/biz-components/GraphicOverlay/types.d.ts +33 -0
- package/dist/esm/biz-components/GraphicOverlay/types.js +1 -0
- package/dist/esm/biz-components/GraphicOverlay/types.js.map +7 -0
- package/dist/esm/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +3 -0
- package/dist/esm/biz-components/SectionHeading/SectionHeading.d.ts +4 -0
- package/dist/esm/biz-components/SectionHeading/types.d.ts +6 -0
- package/dist/esm/biz-components/Shelf/Shelf.d.ts +8 -0
- package/dist/esm/biz-components/Shelf/index.d.ts +1 -0
- package/dist/esm/biz-components/Shelf/types.d.ts +6 -0
- package/dist/esm/biz-components/ShelfDisplay/index.js +3 -3
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/tab.d.ts +7 -0
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/biz-components/Title/index.js.map +3 -3
- package/dist/esm/biz-components/Title/types.d.ts +3 -2
- package/dist/esm/biz-components/index.d.ts +1 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/dist/esm/components/col.d.ts +29 -0
- package/dist/esm/components/dropdown.d.ts +27 -0
- package/dist/esm/components/row.d.ts +18 -0
- package/dist/esm/helpers/get-subtree.d.ts +12 -0
- package/dist/esm/packages/ui/src/components/avatar.d.ts +26 -0
- package/dist/esm/packages/ui/src/components/index.d.ts +20 -0
- package/dist/esm/packages/ui/src/index.d.ts +1 -0
- package/dist/esm/packages/ui/src/stories/avatar.stories.d.ts +40 -0
- package/dist/esm/packages/ui/src/stories/badge.stories.d.ts +26 -0
- package/dist/esm/packages/ui/src/stories/button.stories.d.ts +48 -0
- package/dist/esm/packages/ui/src/stories/checkbox.stories.d.ts +46 -0
- package/dist/esm/packages/ui/src/stories/container.stories.d.ts +36 -0
- package/dist/esm/packages/ui/src/stories/dialog.stories.d.ts +20 -0
- package/dist/esm/packages/ui/src/stories/grid.stories.d.ts +42 -0
- package/dist/esm/packages/ui/src/stories/heading.stories.d.ts +82 -0
- package/dist/esm/packages/ui/src/stories/input.stories.d.ts +35 -0
- package/dist/esm/packages/ui/src/stories/picture.stories.d.ts +18 -0
- package/dist/esm/packages/ui/src/stories/popover.stories.d.ts +17 -0
- package/dist/esm/packages/ui/src/stories/radio.stories.d.ts +39 -0
- package/dist/esm/packages/ui/src/stories/skeleton.stories.d.ts +20 -0
- package/dist/esm/packages/ui/src/stories/text.stories.d.ts +94 -0
- package/dist/esm/src/components/index.d.ts +21 -0
- package/dist/esm/src/components/input-number.d.ts +47 -0
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/stories/avatar.stories.d.ts +40 -0
- package/dist/esm/src/stories/badge.stories.d.ts +26 -0
- package/dist/esm/src/stories/button.stories.d.ts +48 -0
- package/dist/esm/src/stories/checkbox.stories.d.ts +46 -0
- package/dist/esm/src/stories/container.stories.d.ts +36 -0
- package/dist/esm/src/stories/dialog.stories.d.ts +20 -0
- package/dist/esm/src/stories/grid.stories.d.ts +42 -0
- package/dist/esm/src/stories/heading.stories.d.ts +82 -0
- package/dist/esm/src/stories/input-number.stories.d.ts +51 -0
- package/dist/esm/src/stories/input.stories.d.ts +35 -0
- package/dist/esm/src/stories/picture.stories.d.ts +18 -0
- package/dist/esm/src/stories/popover.stories.d.ts +17 -0
- package/dist/esm/src/stories/radio.stories.d.ts +39 -0
- package/dist/esm/src/stories/skeleton.stories.d.ts +20 -0
- package/dist/esm/src/stories/text.stories.d.ts +94 -0
- package/dist/esm/stories/creativeModule.stories.d.ts +2 -1
- package/dist/esm/stories/creativeModule.stories.js +1 -1
- package/dist/esm/stories/creativeModule.stories.js.map +2 -2
- package/dist/esm/stories/shelf.stories.d.ts +17 -0
- package/dist/esm/tailwind.config.d.ts +253 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/biz-components/WhyChooses/WhyChoose.d.ts +0 -14
- package/dist/cjs/biz-components/WhyChooses/index.d.ts +0 -2
- package/dist/cjs/biz-components/WhyChooses/types.d.ts +0 -11
- package/dist/esm/biz-components/WhyChooses/WhyChoose.d.ts +0 -14
- package/dist/esm/biz-components/WhyChooses/index.d.ts +0 -2
- package/dist/esm/biz-components/WhyChooses/types.d.ts +0 -11
- /package/dist/cjs/biz-components/{Faq/type.d.ts → SectionHeading/index.d.ts} +0 -0
- /package/dist/cjs/{biz-components/WhyChoose/type.d.ts → components/inputnumber.d.ts} +0 -0
- /package/dist/cjs/hooks/{useExposure.d.ts → useEXposure.d.ts} +0 -0
- /package/dist/cjs/stories/{WhyChoose.stories.d.ts → whychoose.stories.d.ts} +0 -0
- /package/dist/esm/biz-components/{Faq/type.d.ts → SectionHeading/index.d.ts} +0 -0
- /package/dist/esm/{biz-components/WhyChoose/type.d.ts → components/inputnumber.d.ts} +0 -0
- /package/dist/esm/hooks/{useExposure.d.ts → useEXposure.d.ts} +0 -0
- /package/dist/esm/stories/{WhyChoose.stories.d.ts → whychoose.stories.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Shelf.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as pe,jsx as n,jsxs as T}from"react/jsx-runtime";import z,{useState as I,useEffect as R,useRef as k,useImperativeHandle as W}from"react";import{cn as _}from"../../helpers/utils.js";import G from"../../components/picture.js";import J from"./tabSwitch.js";import L from"../../components/button.js";import K from"../Title/index.js";import Q from"../SwiperBox/index.js";import{withLayout as X}from"../../shared/Styles.js";import{formatVariantPrice as Y}from"./shelfDisplay.js";import{useExposure as Z}from"../../hooks/useExposure.js";import{gaTrack as E}from"../../shared/track.js";import{useAiuiContext as ee}from"../AiuiProvider/index.js";import te from"../../components/badge.js";import{Heading as ne}from"../../components/heading.js";import{Text as re}from"../../components/text.js";import{trackUrlRef as se}from"../../shared/trackUrlRef.js";const V="image",H="product_shelf",ie=999999999e-2;function ae(e){const t=k(null),[l,f]=I(!1);return R(()=>{if(l)return;const d=t.current;if(!d||typeof IntersectionObserver>"u")return;const o=new IntersectionObserver(([s])=>{s.isIntersecting&&(f(!0),o.disconnect())},e);return o.observe(d),()=>o.disconnect()},[l,e]),[t,l]}const oe=({data:e,configuration:t})=>{const{locale:l="us",copyWriting:f}=ee(),d=(r,a,u)=>t?.event?.primaryButton?.(r,a+1,u),o=(r,a,u)=>t?.event?.secondaryButton?.(r,a+1,u),s=e?.variants?.find(r=>r?.sku===e?.sku)||e?.variants?.[0]||{},B=!s?.availableForSale&&s?.price?.amount===ie,h=t?.isShowTag,y=t?.isShowOriginalPrice,v=s?.coupons?.[0],{price:b,basePrice:D}=Y({locale:l,amount:y&&v?v.variant_price4wscode:s.price,baseAmount:y&&v?s.price:0,currencyCode:e?.price?.currencyCode||"USD"}),w=()=>{const r=e?.sku,a=e?.variants;return a?.find(x=>x?.sku===r)?.image?.url||a?.[0]?.image?.url||""},p=e?.custom_name||e?.title,g=e?.custom_description||e?.description;return n("div",{className:_("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",t?.itemShape==="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:T("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[n("div",{className:_("lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:n("a",{"aria-label":p,target:t?.target,href:se(`${l==="us"||!l?"":`/${l}`}/products/${e?.handle}`,`${V}_${H}`),onClick:()=>{E({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||s?.sku,item_name:e?.name,item_variant:s?.name,price:s?.price,index:t?.index+1}]}})},children:n(G,{source:w(),alt:"",className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),h?n("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:e?.tags?.filter?.(r=>r?.startsWith?.("CLtag"))?.map?.(r=>r?.replace?.("CLtag:",""))?.slice?.(0,2)?.map?.((r,a)=>n(te,{children:r},a))}):null,p?n(ne,{as:"h3",title:p||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start",html:p||""}):null,g?n(re,{size:2,className:"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]",html:g||""}):null,n("div",{className:"mb-2 mt-[20px] flex items-center",children:B?n("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:f?.soldOutText}):T(pe,{children:[n("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:s?.availableForSale&&b||""}),n("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:s?.availableForSale&&D||""})]})}),T("div",{className:_("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?n(L,{variant:"secondary",onClick:()=>o(e,t?.index,t),className:`
|
|
2
2
|
${t.direction==="vertical"?"w-full":""}
|
|
3
|
-
`,children:t?.secondaryButton||""}):null,t?.primaryButton?n(
|
|
3
|
+
`,children:t?.secondaryButton||""}):null,t?.primaryButton?n(L,{variant:"primary",onClick:()=>d(e,t?.index,t),className:`
|
|
4
4
|
${t.direction==="vertical"?"w-full":""}
|
|
5
|
-
`,children:t?.primaryButton||""}):null]})]})},e?.id||e?.handle)},
|
|
5
|
+
`,children:t?.primaryButton||""}):null]})]})},e?.id||e?.handle)},le=z.forwardRef(({data:e,buildData:t,className:l="",key:f,event:d,recommendedData:o,target:s="_self"},B)=>{const[h,y]=I(""),[v,b]=I([]),[D,w]=ae({threshold:0}),p=k(!1),g=k(!1),r=k(null);W(B,()=>r.current),Z(r,{componentType:V,componentName:H,componentTitle:e?.title,navigation:h});const{productsTab:a=[],productsCard:u=[],title:x,isShowTab:P=!0,tabShape:$="square",isShowTag:A=!1,isShowOriginalPrice:F=!0,isShowRecommendedCard:j=!1,...q}=e,M=()=>{E({event:"ga4Event",event_name:"view_item_list",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:o?.map((i,C)=>{const c=i?.variants?.find(m=>m?.sku===i?.sku)||i?.variants?.[0];return{item_id:i?.sku||c?.sku,item_name:i?.name,item_variant:c?.name,price:c?.price,index:C+1}})}})},N=(i,C)=>{if(C){const S=o?.map?.(c=>({...c,isShowRecommended:!0}));b(S?.length?S||[]:[])}else if(Array.isArray(i)){const c=i?.map?.(m=>{const O=t?.products?.find(U=>U?.handle===m?.handle);if(O)return{sku:m.sku,isShowRecommended:!1,custom_name:m.custom_name,custom_description:m.custom_description,...O}})?.filter(m=>m);b(c?.length?c||[]:[])}else b([])};return R(()=>{w&&o?.length&&!g.current&&(g.current=!0,M())},[w,o]),R(()=>{if(!p.current){if(!p.current&&o?.length&&(p.current=!0),P){y(a?.[0]?.tab||""),N(a?.[0]?.data||[],a?.[0]?.isShowRecommendedTab);return}N(u,j)}},[o]),T("div",{ref:r,className:_("shelf-display-wrap w-full",l,{"aiui-dark":e?.theme==="dark"}),children:[x&&n(K,{data:{title:x}}),P&&n("div",{className:"md-tablet:w-full md-tablet:overflow-hidden",children:n(J,{value:h,tabs:a,tabShape:$,onTabClick:i=>{if(y(i?.tab),N(i?.data||[],i?.isShowRecommendedTab),!i?.isShowRecommendedTab){E({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:V,component_name:H,component_title:e?.title,component_position:1,navigation:i?.tab}});return}M()}})}),n("div",{ref:D,className:"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]",children:n(Q,{className:`${P?"mt-6":""} !overflow-visible`,id:`ShelfDisplay${f}${h}`,data:{list:v,configuration:{...q,event:d,isShowTag:A,isShowOriginalPrice:F,target:s}},Slide:oe,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 Be=X(le);export{Be as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ShelfDisplay/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport TabSwitch from './tabSwitch.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { gaTrack } from '../../shared/track.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport Badge from '../../components/badge.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps } from '../../types/props.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n custom_name?: string\n custom_description?: string\n}\n\ntype EventType = {\n primaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n secondaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n}\n\ntype ShelfDisplayType = {\n title?: string\n isShowTab?: boolean\n isShowTag?: boolean\n isShowRecommendedCard?: boolean\n isShowOriginalPrice?: boolean\n direction?: 'horizontal' | 'vertical'\n align?: 'left' | 'center' | 'right'\n productsTab?: any[]\n productsCard?: any[]\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n primaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n secondaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n theme?: 'light' | 'dark'\n containerProps?: ContainerProps\n}\n\nexport interface ShelfDisplayProps {\n data: ShelfDisplayType\n buildData?: {\n categories: any[]\n products: any[]\n }\n recommendedData?: any[]\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: EventType\n className?: string\n key?: string\n target?: '_self' | '_blank'\n}\n\nfunction useOnceInView<T extends Element>(options: any) {\n const ref = useRef<T>(null)\n const [inView, setInView] = useState(false)\n\n useEffect(() => {\n if (inView) return // \u5DF2\u8FDB\u5165\u8FC7\uFF0C\u5219\u4E0D\u518D\u89C2\u5BDF\n const el = ref.current\n if (!el || typeof IntersectionObserver === 'undefined') return\n\n const observer = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) {\n setInView(true)\n observer.disconnect() // \u505C\u6B62\u89C2\u5BDF\n }\n }, options)\n\n observer.observe(el)\n return () => observer.disconnect()\n }, [inView, options])\n\n return [ref, inView]\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n const onPrimaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.primaryButton?.(params, index + 1, data)\n\n const onSecondaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.secondaryButton?.(params, index + 1, data)\n\n const variant = data?.variants?.find((item: any) => item?.sku === data?.sku) || data?.variants?.[0] || {}\n\n const isSoldOut = !variant?.availableForSale && variant?.price?.amount === SOLD_OUT_PRICE\n const isShowTag = configuration?.isShowTag\n const isShowOriginalPrice = configuration?.isShowOriginalPrice\n\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: isShowOriginalPrice && coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: isShowOriginalPrice && coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n const displayTitle = data?.custom_name || data?.title\n const displayDescription = data?.custom_description || data?.description\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4\">\n <div\n className={cn(\n 'lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden'\n )}\n >\n <a\n aria-label={displayTitle}\n target={configuration?.target}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'select_item',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: [\n {\n item_id: data?.sku || variant?.sku,\n item_name: data?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: configuration?.index + 1,\n },\n ],\n },\n })\n }}\n >\n <Picture source={handleUrl()} alt=\"\" className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </a>\n </div>\n {isShowTag ? (\n <div className=\"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden\">\n {data?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n ?.map?.((item: any, index: number) => <Badge key={index}>{item}</Badge>)}\n </div>\n ) : null}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle || ''}\n size={2}\n className=\"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start\"\n html={displayTitle || ''}\n />\n ) : null}\n {displayDescription ? (\n <Text\n size={2}\n className=\"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]\"\n html={displayDescription || ''}\n />\n ) : null}\n <div className=\"mb-2 mt-[20px] flex items-center\">\n {isSoldOut ? (\n <div className=\"tablet:text-2xl text-info-primary text-xl font-bold\">{copyWriting?.soldOutText}</div>\n ) : (\n <>\n <div className=\"final-price tablet:text-2xl text-info-primary text-xl font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn(\n 'lg-desktop:gap-3 flex items-center gap-2',\n configuration.direction === 'vertical' ? 'flex-col' : ''\n )}\n >\n {configuration?.secondaryButton ? (\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n ) : null}\n {configuration?.primaryButton ? (\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay = React.forwardRef<HTMLDivElement, ShelfDisplayProps>(\n ({ data, buildData, className = '', key, event, recommendedData, target = '_self' }, ref) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const [viewRef, inView] = useOnceInView<HTMLDivElement>({ threshold: 0 })\n const isRecommend = useRef<boolean>(false)\n const isView = useRef<boolean>(false)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType: componentType,\n componentName: componentName,\n componentTitle: data?.title,\n navigation: tabId,\n })\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n isShowTab = true,\n tabShape = 'square',\n isShowTag = false,\n isShowOriginalPrice = true,\n isShowRecommendedCard = false,\n ...other\n } = data\n\n const gackViewEvent = () => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'view_item_list',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: recommendedData?.map((item, index) => {\n const findData = item?.variants?.find((v: any) => v?.sku === item?.sku)\n const variant = findData || item?.variants?.[0]\n return {\n item_id: item?.sku || variant?.sku,\n item_name: item?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: index + 1,\n }\n }),\n },\n })\n }\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[], flag: boolean) => {\n if (flag) {\n const newCurrentData = recommendedData?.map(item => {\n return {\n ...item,\n isShowRecommended: true,\n }\n })\n setCurrentItems(newCurrentData || [])\n } else {\n const newCurrentData = currentData\n ?.map(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n isShowRecommended: false,\n custom_name: item.custom_name,\n custom_description: item.custom_description,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n setCurrentItems(newCurrentData || [])\n }\n }\n\n useEffect(() => {\n if (inView && recommendedData?.length && !isView.current) {\n isView.current = true\n gackViewEvent()\n }\n }, [inView, recommendedData])\n\n // \u7B97\u6CD5\u6570\u636E\u4F1A\u7A0D\u5FAE\u5EF6\u8FDF\uFF0C\u6240\u4EE5\u9700\u76D1\u542CrecommendedData\uFF0C\u4E3A\u4E86\u9632\u6B62\u5728\u6709\u7B97\u6CD5\u6570\u636E\u4E14\u5BF9\u9ED8\u8BA4\u6E32\u67D3\u7B2C\u4E00\u4E2A\u540E\u53CD\u590D\u89E6\u53D1\uFF0C\u7528isRecommend\u5173\u95ED\n useEffect(() => {\n if (isRecommend.current) return\n if (!isRecommend.current && recommendedData?.length) {\n isRecommend.current = true\n }\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [], productsTab?.[0]?.isShowRecommendedTab)\n return\n }\n handleCurrentTab(productsCard, isShowRecommendedCard)\n }, [recommendedData])\n\n return (\n <div\n ref={innerRef}\n className={cn('shelf-display-wrap w-full', className, { 'aiui-dark': data?.theme === 'dark' })}\n >\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <div className=\"md-tablet:w-full md-tablet:overflow-hidden\">\n <TabSwitch\n value={tabId}\n tabs={productsTab}\n tabShape={tabShape}\n onTabClick={v => {\n setTabId(v?.tab)\n handleCurrentTab(v?.data || [], v?.isShowRecommendedTab)\n if (!v?.isShowRecommendedTab) {\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?.title,\n component_position: 1,\n navigation: v?.tab,\n },\n })\n return\n }\n gackViewEvent()\n }}\n />\n </div>\n )}\n <div\n ref={viewRef as any}\n className=\"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]\"\n >\n <SwiperBox\n className={`${isShowTab ? 'mt-6' : ''} !overflow-visible`}\n id={`ShelfDisplay${key}${tabId}`}\n data={{\n list: currentItems,\n configuration: { ...other, event: event, isShowTag, isShowOriginalPrice, target: target },\n }}\n Slide={ShelfDisplayItem}\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 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nexport default withLayout(ShelfDisplay)\n"],
|
|
5
|
-
"mappings": "aAiMY,OAgCA,YAAAA,GAhCA,OAAAC,EAgCA,QAAAC,MAhCA,oBAhMZ,OAAOC,GAAS,YAAAC,EAAU,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QACxE,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAOC,MAAe,iBACtB,OAAOC,MAAY,6BACnB,OAAOC,MAAW,oBAClB,OAAOC,MAAe,wBACtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,sBAAAC,MAA0B,oBACnC,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,WAAAC,MAAe,wBACxB,OAAS,kBAAAC,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport TabSwitch from './tabSwitch.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { gaTrack } from '../../shared/track.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport Badge from '../../components/badge.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps } from '../../types/props.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n custom_name?: string\n custom_description?: string\n}\n\ntype EventType = {\n primaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n secondaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n}\n\ntype ShelfDisplayType = {\n title?: string\n isShowTab?: boolean\n isShowTag?: boolean\n isShowRecommendedCard?: boolean\n isShowOriginalPrice?: boolean\n direction?: 'horizontal' | 'vertical'\n align?: 'left' | 'center' | 'right'\n productsTab?: any[]\n productsCard?: any[]\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n primaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n secondaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n theme?: 'light' | 'dark'\n containerProps?: ContainerProps\n}\n\nexport interface ShelfDisplayProps {\n data: ShelfDisplayType\n buildData?: {\n categories: any[]\n products: any[]\n }\n recommendedData?: any[]\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: EventType\n className?: string\n key?: string\n target?: '_self' | '_blank'\n}\n\nfunction useOnceInView<T extends Element>(options: any) {\n const ref = useRef<T>(null)\n const [inView, setInView] = useState(false)\n\n useEffect(() => {\n if (inView) return // \u5DF2\u8FDB\u5165\u8FC7\uFF0C\u5219\u4E0D\u518D\u89C2\u5BDF\n const el = ref.current\n if (!el || typeof IntersectionObserver === 'undefined') return\n\n const observer = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) {\n setInView(true)\n observer.disconnect() // \u505C\u6B62\u89C2\u5BDF\n }\n }, options)\n\n observer.observe(el)\n return () => observer.disconnect()\n }, [inView, options])\n\n return [ref, inView]\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n const onPrimaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.primaryButton?.(params, index + 1, data)\n\n const onSecondaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.secondaryButton?.(params, index + 1, data)\n\n const variant = data?.variants?.find((item: any) => item?.sku === data?.sku) || data?.variants?.[0] || {}\n\n const isSoldOut = !variant?.availableForSale && variant?.price?.amount === SOLD_OUT_PRICE\n const isShowTag = configuration?.isShowTag\n const isShowOriginalPrice = configuration?.isShowOriginalPrice\n\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: isShowOriginalPrice && coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: isShowOriginalPrice && coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n const displayTitle = data?.custom_name || data?.title\n const displayDescription = data?.custom_description || data?.description\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4\">\n <div\n className={cn(\n 'lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden'\n )}\n >\n <a\n aria-label={displayTitle}\n target={configuration?.target}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'select_item',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: [\n {\n item_id: data?.sku || variant?.sku,\n item_name: data?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: configuration?.index + 1,\n },\n ],\n },\n })\n }}\n >\n <Picture source={handleUrl()} alt=\"\" className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </a>\n </div>\n {isShowTag ? (\n <div className=\"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden\">\n {data?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n ?.map?.((item: any, index: number) => <Badge key={index}>{item}</Badge>)}\n </div>\n ) : null}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle || ''}\n size={2}\n className=\"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start\"\n html={displayTitle || ''}\n />\n ) : null}\n {displayDescription ? (\n <Text\n size={2}\n className=\"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]\"\n html={displayDescription || ''}\n />\n ) : null}\n <div className=\"mb-2 mt-[20px] flex items-center\">\n {isSoldOut ? (\n <div className=\"tablet:text-2xl text-info-primary text-xl font-bold\">{copyWriting?.soldOutText}</div>\n ) : (\n <>\n <div className=\"final-price tablet:text-2xl text-info-primary text-xl font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn(\n 'shelf-flex-button-group',\n 'lg-desktop:gap-3 flex items-center gap-2',\n configuration.direction === 'vertical' ? 'flex-col' : ''\n )}\n >\n {configuration?.secondaryButton ? (\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n ) : null}\n {configuration?.primaryButton ? (\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay = React.forwardRef<HTMLDivElement, ShelfDisplayProps>(\n ({ data, buildData, className = '', key, event, recommendedData, target = '_self' }, ref) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const [viewRef, inView] = useOnceInView<HTMLDivElement>({ threshold: 0 })\n const isRecommend = useRef<boolean>(false)\n const isView = useRef<boolean>(false)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType: componentType,\n componentName: componentName,\n componentTitle: data?.title,\n navigation: tabId,\n })\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n isShowTab = true,\n tabShape = 'square',\n isShowTag = false,\n isShowOriginalPrice = true,\n isShowRecommendedCard = false,\n ...other\n } = data\n\n const gackViewEvent = () => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'view_item_list',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: recommendedData?.map((item, index) => {\n const findData = item?.variants?.find((v: any) => v?.sku === item?.sku)\n const variant = findData || item?.variants?.[0]\n return {\n item_id: item?.sku || variant?.sku,\n item_name: item?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: index + 1,\n }\n }),\n },\n })\n }\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[], flag: boolean) => {\n if (flag) {\n const newCurrentData = recommendedData?.map?.(item => {\n return {\n ...item,\n isShowRecommended: true,\n }\n })\n setCurrentItems(newCurrentData?.length ? newCurrentData || [] : [])\n } else {\n const isArray = Array.isArray(currentData)\n if (isArray) {\n const newCurrentData = currentData\n ?.map?.(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n isShowRecommended: false,\n custom_name: item.custom_name,\n custom_description: item.custom_description,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n setCurrentItems(newCurrentData?.length ? newCurrentData || [] : [])\n } else {\n setCurrentItems([])\n }\n }\n }\n\n useEffect(() => {\n if (inView && recommendedData?.length && !isView.current) {\n isView.current = true\n gackViewEvent()\n }\n }, [inView, recommendedData])\n\n // \u7B97\u6CD5\u6570\u636E\u4F1A\u7A0D\u5FAE\u5EF6\u8FDF\uFF0C\u6240\u4EE5\u9700\u76D1\u542CrecommendedData\uFF0C\u4E3A\u4E86\u9632\u6B62\u5728\u6709\u7B97\u6CD5\u6570\u636E\u4E14\u5BF9\u9ED8\u8BA4\u6E32\u67D3\u7B2C\u4E00\u4E2A\u540E\u53CD\u590D\u89E6\u53D1\uFF0C\u7528isRecommend\u5173\u95ED\n useEffect(() => {\n if (isRecommend.current) return\n if (!isRecommend.current && recommendedData?.length) {\n isRecommend.current = true\n }\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [], productsTab?.[0]?.isShowRecommendedTab)\n return\n }\n handleCurrentTab(productsCard, isShowRecommendedCard)\n }, [recommendedData])\n\n return (\n <div\n ref={innerRef}\n className={cn('shelf-display-wrap w-full', className, { 'aiui-dark': data?.theme === 'dark' })}\n >\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <div className=\"md-tablet:w-full md-tablet:overflow-hidden\">\n <TabSwitch\n value={tabId}\n tabs={productsTab}\n tabShape={tabShape}\n onTabClick={v => {\n setTabId(v?.tab)\n handleCurrentTab(v?.data || [], v?.isShowRecommendedTab)\n if (!v?.isShowRecommendedTab) {\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?.title,\n component_position: 1,\n navigation: v?.tab,\n },\n })\n return\n }\n gackViewEvent()\n }}\n />\n </div>\n )}\n <div\n ref={viewRef as any}\n className=\"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]\"\n >\n <SwiperBox\n className={`${isShowTab ? 'mt-6' : ''} !overflow-visible`}\n id={`ShelfDisplay${key}${tabId}`}\n data={{\n list: currentItems,\n configuration: { ...other, event: event, isShowTag, isShowOriginalPrice, target: target },\n }}\n Slide={ShelfDisplayItem}\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 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nexport default withLayout(ShelfDisplay)\n"],
|
|
5
|
+
"mappings": "aAiMY,OAgCA,YAAAA,GAhCA,OAAAC,EAgCA,QAAAC,MAhCA,oBAhMZ,OAAOC,GAAS,YAAAC,EAAU,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QACxE,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAOC,MAAe,iBACtB,OAAOC,MAAY,6BACnB,OAAOC,MAAW,oBAClB,OAAOC,MAA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F,UAAAsC,GAASxE,EAACW,EAAA,CAAM,KAAM,CAAE,MAAO6D,CAAM,EAAG,EACxCC,GACCzE,EAAC,OAAI,UAAU,6CACb,SAAAA,EAACS,EAAA,CACC,MAAOqD,EACP,KAAMQ,EACN,SAAUI,EACV,WAAYI,GAAK,CAGf,GAFAf,EAASe,GAAG,GAAG,EACfC,EAAiBD,GAAG,MAAQ,CAAC,EAAGA,GAAG,oBAAoB,EACnD,CAACA,GAAG,qBAAsB,CAC5B9D,EAAQ,CACN,MAAO,WACP,WAAY,kBACZ,iBAAkB,CAChB,WAAY,YACZ,eAAgBM,EAChB,eAAgBC,EAChB,gBAAiBW,GAAM,MACvB,mBAAoB,EACpB,WAAY4C,GAAG,GACjB,CACF,CAAC,EACD,MACF,CACAD,EAAc,CAChB,EACF,EACF,EAEF7E,EAAC,OACC,IAAKkE,EACL,UAAU,2FAEV,SAAAlE,EAACY,EAAA,CACC,UAAW,GAAG6D,EAAY,OAAS,EAAE,qBACrC,GAAI,eAAef,CAAG,GAAGI,CAAK,GAC9B,KAAM,CACJ,KAAME,EACN,cAAe,CAAE,GAAGY,EAAO,MAAOjB,EAAO,UAAAd,EAAW,oBAAAC,EAAqB,OAAQe,CAAO,CAC1F,EACA,MAAO5B,GACP,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,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EACF,EACF,GACF,CAEJ,CACF,EAEA,IAAOmD,GAAQvE,EAAW0C,EAAY",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "React", "useState", "useEffect", "useRef", "useImperativeHandle", "cn", "Picture", "TabSwitch", "Button", "Title", "SwiperBox", "withLayout", "formatVariantPrice", "useExposure", "gaTrack", "useAiuiContext", "Badge", "Heading", "Text", "trackUrlRef", "componentType", "componentName", "SOLD_OUT_PRICE", "useOnceInView", "options", "ref", "inView", "setInView", "el", "observer", "entry", "ShelfDisplayItem", "data", "configuration", "locale", "copyWriting", "onPrimaryButton", "params", "index", "onSecondaryButton", "variant", "item", "isSoldOut", "isShowTag", "isShowOriginalPrice", "coupon", "price", "basePrice", "handleUrl", "sku", "skuArray", "displayTitle", "displayDescription", "ShelfDisplay", "buildData", "className", "key", "event", "recommendedData", "target", "tabId", "setTabId", "currentItems", "setCurrentItems", "viewRef", "isRecommend", "isView", "innerRef", "productsTab", "productsCard", "title", "isShowTab", "tabShape", "isShowRecommendedCard", "other", "gackViewEvent", "v", "handleCurrentTab", "currentData", "flag", "newCurrentData", "findData", "ShelfDisplay_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as
|
|
1
|
+
"use client";import{jsx as a,jsxs as A}from"react/jsx-runtime";import $,{useEffect as z,useRef as r,useImperativeHandle as U}from"react";import{gsap as c}from"gsap";import{SplitText as h}from"gsap/dist/SplitText";import{ScrollTrigger as w}from"gsap/dist/ScrollTrigger";import{cn as v}from"../../helpers/utils.js";import{Heading as j}from"../../components/index.js";import{withLayout as C}from"../../shared/Styles.js";import{useExposure as F}from"../../hooks/useExposure.js";import{trackUrlRef as _}from"../../shared/trackUrlRef.js";import{useInView as q}from"react-intersection-observer";const x="link",y="title",k=$.forwardRef(({data:m,className:b},R)=>{const{title:p,caption:u,theme:f,extensions:n}=m,o=r(null),t=r(null),e=r(null),i=r(null),{ref:H,inView:d}=q();return U(R,()=>o.current),F(o,{componentType:x,componentName:y,componentTitle:m?.title}),z(()=>{c.registerPlugin(h,w);function E(){if(!t.current)return;const L=t.current?.clientHeight||80;e.current=new h(t.current,{type:"words",wordsClass:"word"});const s=e.current.words;c.set(s,{opacity:0}),i.current=w.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${L*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:M=>{const D=M.progress,g=s.length,N=1/g,T=.5;s.forEach((S,I)=>{const P=I/g*(1-T),V=N*(1+T);let l=(D-P)/V;l=Math.max(0,Math.min(l,1)),c.set(S,{opacity:l})})}})}return d&&E(),()=>{e.current&&e.current.revert(),i.current&&i.current.kill()}},[d]),(p||u)&&A("div",{className:"mb-6 flex items-end justify-between overflow-hidden",ref:o,children:[a("div",{ref:H,className:v("space-y-4",b,{"aiui-dark":f==="dark"}),children:a(j,{ref:t,as:"h2",size:4,html:u||p})}),n?.textLink&&a("a",{className:v({"aiui-dark":f==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:_(n?.link,`${x}_${y}`),children:n?.textLink})]})});k.displayName="Title";var tt=C(k);export{tt as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Title/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title, theme,
|
|
5
|
-
"mappings": "aA8EM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBA7EN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QAC9D,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,cAAAC,MAAkB,yBAE3B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,aAAAC,MAAiB,8BAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAEhBC,EAAQf,EAAM,WAAuC,CAAC,CAAE,KAAAgB,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACvF,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useExposure", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "ref", "title", "theme", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title, caption, theme, extensions } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n (title || caption) && (\n <div className=\"mb-6 flex items-end justify-between overflow-hidden\" ref={innerRef}>\n <div ref={inViewRef} className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={caption || title} />\n </div>\n {extensions?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extensions?.link, `${componentType}_${componentName}`)}\n >\n {extensions?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
+
"mappings": "aA8EM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,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EAAE,gBACjC,MAAO,GACP,SAAWE,GAAc,CACvB,MAAMC,EAAWD,EAAK,SAChBE,EAAQH,EAAM,OACdI,EAAW,EAAID,EACfE,EAAU,GAChBL,EAAM,QAAQ,CAACM,EAAWC,IAAc,CACtC,MAAMC,EAASD,EAAIJ,GAAU,EAAIE,GAC3BI,EAAQL,GAAY,EAAIC,GAC9B,IAAIK,GAAWR,EAAWM,GAASC,EACnCC,EAAU,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAS,CAAC,CAAC,EAC1CrC,EAAK,IAAIiC,EAAM,CAAE,QAAAI,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,CACH,CAEA,OAAIb,GACFC,EAAW,EAGN,IAAM,CACXJ,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACE,CAAM,CAAC,GAGRT,GAASC,IACRrB,EAAC,OAAI,UAAU,sDAAsD,IAAKwB,EACxE,UAAAzB,EAAC,OAAI,IAAK6B,EAAW,UAAWpB,EAAG,YAAaU,EAAW,CAAE,YAAaI,IAAU,MAAO,CAAC,EAC1F,SAAAvB,EAACU,EAAA,CAAQ,IAAKgB,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMJ,GAAWD,EAAO,EACnE,EACCG,GAAY,UACXxB,EAAC,KACC,UAAWS,EACT,CAAE,YAAac,IAAU,MAAO,EAChC,oGACF,EACA,KAAMV,EAAYW,GAAY,KAAM,GAAGT,CAAa,IAAIC,CAAa,EAAE,EAEtE,SAAAQ,GAAY,SACf,GAEJ,CAGN,CAAC,EAEDP,EAAM,YAAc,QAEpB,IAAO2B,GAAQjC,EAAWM,CAAK",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useExposure", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "ref", "title", "caption", "theme", "extensions", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
|
|
7
7
|
}
|
|
@@ -10,7 +10,8 @@ export interface TitleProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* 主标题
|
|
12
12
|
*/
|
|
13
|
-
title
|
|
13
|
+
title?: string;
|
|
14
|
+
caption?: string;
|
|
14
15
|
/**
|
|
15
16
|
* 特性列表,最多支持3个
|
|
16
17
|
*/
|
|
@@ -22,7 +23,7 @@ export interface TitleProps {
|
|
|
22
23
|
/**
|
|
23
24
|
* 扩展数据
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
extensions?: any;
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
29
|
* 自定义类名
|
|
@@ -24,3 +24,4 @@ export { withLayout } from '../shared/Styles.js';
|
|
|
24
24
|
export { default as AiuiProvider } from './AiuiProvider/index.js';
|
|
25
25
|
export { default as Tabs } from './Tabs/index.js';
|
|
26
26
|
export { default as CreativeModule } from './CreativeModule/index.js';
|
|
27
|
+
export { default as GraphicOverlay } from './GraphicOverlay/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as r}from"./BrandEquity/index.js";import{default as o}from"./MemberEquity/index.js";import{default as l}from"./Slogan/index.js";import{default as u}from"./Title/index.js";import{default as s}from"./Spacer/index.js";import{default as m}from"./ShelfDisplay/index.js";import{default as c}from"./Evaluate/index.js";import{default as n}from"./Category/index.js";import{default as h}from"./HeroBanner/index.js";import{default as
|
|
1
|
+
import{default as r}from"./BrandEquity/index.js";import{default as o}from"./MemberEquity/index.js";import{default as l}from"./Slogan/index.js";import{default as u}from"./Title/index.js";import{default as s}from"./Spacer/index.js";import{default as m}from"./ShelfDisplay/index.js";import{default as c}from"./Evaluate/index.js";import{default as n}from"./Category/index.js";import{default as h}from"./HeroBanner/index.js";import{default as G}from"./AccordionCards/index.js";import{default as q}from"./Graphic/index.js";import{default as P}from"./MediaPlayerBase/index.js";import{default as v}from"./MediaPlayerSticky/index.js";import{default as S}from"./MediaPlayerMulti/index.js";import{default as E}from"./Marquee/index.js";import{default as b}from"./WhyChoose/index.js";import{default as I}from"./Faq/index.js";import{MarqueeItem as D,MarqueeImageContent as F,MarqueeTextContent as H}from"./Marquee/index.js";import{default as W}from"./MultiLayoutGraphicBlock/index.js";import{default as J}from"./GraphicAttractionBlock/index.js";import{withLayout as N}from"../shared/Styles.js";import{default as R}from"./AiuiProvider/index.js";import{default as V}from"./Tabs/index.js";import{default as Y}from"./CreativeModule/index.js";import{default as _}from"./GraphicOverlay/index.js";export{G as AccordionCards,R as AiuiProvider,r as BrandEquity,n as Category,Y as CreativeModule,c as Evaluate,I as Faq,q as Graphic,J as GraphicAttractionBlock,_ as GraphicOverlay,h as HeroBanner,E as Marquee,F as MarqueeImageContent,D as MarqueeItem,H as MarqueeTextContent,P as MediaPlayerBase,S as MediaPlayerMulti,v as MediaPlayerSticky,o as MemberEquity,W as MultiLayoutGraphicBlock,m as ShelfDisplay,l as Slogan,s as Spacer,V as Tabs,u as Title,b as WhyChoose,N as withLayout};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/biz-components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\n"],
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAAwB,mBACjC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA6B,wBACtC,OAAoB,WAAXA,MAAiC,4BAC1C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAAkC,6BAC3C,OAAoB,WAAXA,MAAoC,+BAC7C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA4B,uBACrC,OAAoB,WAAXA,MAAsB,iBAC/B,OAAS,eAAAC,EAAa,uBAAAC,EAAqB,sBAAAC,MAA0B,qBACrE,OAAoB,WAAXH,MAA0C,qCAEnD,OAAoB,WAAXA,MAAyC,oCAElD,OAAS,cAAAI,MAAkB,sBAC3B,OAAoB,WAAXJ,MAA+B,0BACxC,OAAoB,WAAXA,MAAuB,kBAChC,OAAoB,WAAXA,MAAiC",
|
|
4
|
+
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\nexport { default as GraphicOverlay } from './GraphicOverlay/index.js'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAAwB,mBACjC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA6B,wBACtC,OAAoB,WAAXA,MAAiC,4BAC1C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAAkC,6BAC3C,OAAoB,WAAXA,MAAoC,+BAC7C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA4B,uBACrC,OAAoB,WAAXA,MAAsB,iBAC/B,OAAS,eAAAC,EAAa,uBAAAC,EAAqB,sBAAAC,MAA0B,qBACrE,OAAoB,WAAXH,MAA0C,qCAEnD,OAAoB,WAAXA,MAAyC,oCAElD,OAAS,cAAAI,MAAkB,sBAC3B,OAAoB,WAAXJ,MAA+B,0BACxC,OAAoB,WAAXA,MAAuB,kBAChC,OAAoB,WAAXA,MAAiC,4BAC1C,OAAoB,WAAXA,MAAiC",
|
|
6
6
|
"names": ["default", "MarqueeItem", "MarqueeImageContent", "MarqueeTextContent", "withLayout"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
interface mediaProps {
|
|
4
|
+
span?: number;
|
|
5
|
+
pull?: number;
|
|
6
|
+
push?: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
order?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ColProps {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
span?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
offset?: number;
|
|
16
|
+
order?: number;
|
|
17
|
+
push?: number;
|
|
18
|
+
pull?: number;
|
|
19
|
+
flex?: number;
|
|
20
|
+
allFlex?: number;
|
|
21
|
+
md?: number | mediaProps;
|
|
22
|
+
lxl?: number | mediaProps;
|
|
23
|
+
mdl?: number | mediaProps;
|
|
24
|
+
xlxxl?: number | mediaProps;
|
|
25
|
+
minxxl?: number | mediaProps;
|
|
26
|
+
}
|
|
27
|
+
declare const Col: React.ForwardRefExoticComponent<ColProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export { Col };
|
|
29
|
+
export type { ColProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
7
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
8
|
+
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
inset?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
|
+
inset?: boolean;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const DropdownMenuShortcut: {
|
|
24
|
+
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
interface RowProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
align?: 'start' | 'center' | 'end' | 'stretch' | {
|
|
7
|
+
[key in 'md' | 'mdl' | 'xlxxl' | 'minxxl']: 'start' | 'center' | 'end' | 'stretch';
|
|
8
|
+
};
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
gutter?: number | object | Array<object | number>;
|
|
11
|
+
wrap?: boolean;
|
|
12
|
+
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between' | 'space-evenly' | {
|
|
13
|
+
[key in 'md' | 'mdl' | 'xlxxl' | 'minxxl']: 'start' | 'end' | 'center' | 'space-around' | 'space-between' | 'space-evenly';
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const Row: React.ForwardRefExoticComponent<RowProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export { Row };
|
|
18
|
+
export type { RowProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* This is a helper function that is used when a component supports `asChild`
|
|
4
|
+
* using the `Slot` component but its implementation contains nested DOM elements.
|
|
5
|
+
*
|
|
6
|
+
* Using it ensures if a consumer uses the `asChild` prop, the elements are in
|
|
7
|
+
* correct order in the DOM, adopting the intended consumer `children`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSubtree(options: {
|
|
10
|
+
asChild: boolean | undefined;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}, content: React.ReactNode | ((children: React.ReactNode) => React.ReactNode)): React.ReactNode;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const Avatar: React.ForwardRefExoticComponent<{
|
|
5
|
+
/** 定义子组件作为父组件的类型,详细使用方式请参考radix-ui */
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
/** 类名*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/** 样式*/
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
/** 点击事件*/
|
|
12
|
+
onClick?: Function;
|
|
13
|
+
/** 文本自适应*/
|
|
14
|
+
isAdaptation?: boolean;
|
|
15
|
+
/** 文本自适应最小字体, 开启时生效*/
|
|
16
|
+
minSize?: number;
|
|
17
|
+
/** 文本自适应最大字体, 开启时生效*/
|
|
18
|
+
maxSize?: number;
|
|
19
|
+
/** 文本自适应类*/
|
|
20
|
+
textClassName?: string;
|
|
21
|
+
} & VariantProps<(props?: ({
|
|
22
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
23
|
+
} & import("class-variance-authority/dist/types.js").ClassProp) | undefined) => string> & Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
24
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
25
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default as Button } from './button.js';
|
|
2
|
+
export { default as Badge } from './badge.js';
|
|
3
|
+
export * from './input.js';
|
|
4
|
+
export { default as Checkbox } from './checkbox.js';
|
|
5
|
+
export { default as Skeleton } from './skeleton.js';
|
|
6
|
+
export * from './dialog.js';
|
|
7
|
+
export * from './popover.js';
|
|
8
|
+
export * from './radio.js';
|
|
9
|
+
export * from './dialog.js';
|
|
10
|
+
export * from './text.js';
|
|
11
|
+
export * from './gird.js';
|
|
12
|
+
export * from './col.js';
|
|
13
|
+
export * from './row.js';
|
|
14
|
+
export * from './heading.js';
|
|
15
|
+
export * from './container.js';
|
|
16
|
+
export * from './color.js';
|
|
17
|
+
export * from './link.js';
|
|
18
|
+
export * from './avatar.js';
|
|
19
|
+
export { default as Picture } from './picture.js';
|
|
20
|
+
export { default as Theme } from './theme.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/index.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const meta: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
onClick?: Function;
|
|
8
|
+
isAdaptation?: boolean;
|
|
9
|
+
minSize?: number;
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
textClassName?: string;
|
|
12
|
+
} & import("class-variance-authority").VariantProps<(props?: ({
|
|
13
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/dist/types.js").ClassProp) | undefined) => string> & Omit<import("@radix-ui/react-avatar").AvatarProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
tags: string[];
|
|
16
|
+
subcomponents: any;
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: string;
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
argTypes: {
|
|
26
|
+
size: {
|
|
27
|
+
description: string;
|
|
28
|
+
table: {
|
|
29
|
+
defaultValue: {
|
|
30
|
+
summary: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export default meta;
|
|
37
|
+
export declare const Default: () => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare const AvatarType: () => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const AvatarTextAdaptation: () => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare const AvatarSize: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { Badge } from '../components/index.js';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Badge;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: {
|
|
13
|
+
type: "select";
|
|
14
|
+
};
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
args: {
|
|
19
|
+
variant: "default";
|
|
20
|
+
children: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
export declare const Default: Story;
|
|
26
|
+
export declare const Examples: Story;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../components/button.js").ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: {
|
|
13
|
+
type: "select";
|
|
14
|
+
};
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
size: {
|
|
18
|
+
control: {
|
|
19
|
+
type: "select";
|
|
20
|
+
};
|
|
21
|
+
options: string[];
|
|
22
|
+
};
|
|
23
|
+
hoverEffect: {
|
|
24
|
+
description: string;
|
|
25
|
+
control: {
|
|
26
|
+
type: "select";
|
|
27
|
+
};
|
|
28
|
+
options: string[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
args: {
|
|
32
|
+
variant: "primary";
|
|
33
|
+
size: "base";
|
|
34
|
+
children: string;
|
|
35
|
+
asChild: false;
|
|
36
|
+
disabled: false;
|
|
37
|
+
loading: false;
|
|
38
|
+
hoverEffect: "none";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
export declare const Primary: Story;
|
|
44
|
+
export declare const Secondary: Story;
|
|
45
|
+
export declare const Link: Story;
|
|
46
|
+
export declare const WithIcon: Story;
|
|
47
|
+
export declare const Aschild: Story;
|
|
48
|
+
export declare const Spinner: Story;
|