@anker-in/headless-ui 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +11 -2
  2. package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
  3. package/dist/cjs/biz-components/Listing/BizProductProvider.js.map +3 -3
  4. package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js +1 -1
  5. package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js.map +3 -3
  6. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  7. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +3 -3
  8. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +1 -1
  9. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +3 -3
  10. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
  11. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  12. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +6 -6
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +2 -1
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  16. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +3 -3
  17. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  18. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  19. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  20. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +2 -2
  21. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  22. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  23. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -2
  24. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
  25. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
  26. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
  27. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
  28. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +2 -2
  29. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
  30. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +3 -3
  31. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +1 -1
  32. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +2 -2
  33. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  34. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  35. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  36. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +2 -2
  37. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  38. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  39. package/dist/cjs/biz-components/Listing/components/ProductCard/index.js +1 -1
  40. package/dist/cjs/biz-components/Listing/components/ProductCard/index.js.map +2 -2
  41. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  42. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  43. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
  44. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
  45. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.d.ts +2 -0
  46. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.js +2 -0
  47. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.js.map +7 -0
  48. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  49. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  50. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
  51. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  52. package/dist/cjs/biz-components/Listing/index.d.ts +0 -3
  53. package/dist/cjs/biz-components/Listing/index.js +1 -1
  54. package/dist/cjs/biz-components/Listing/index.js.map +4 -4
  55. package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
  56. package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +3 -3
  57. package/dist/cjs/biz-components/MediaPlayerSticky/index.js +1 -1
  58. package/dist/cjs/biz-components/MediaPlayerSticky/index.js.map +2 -2
  59. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +4 -0
  60. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
  61. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  62. package/dist/cjs/biz-components/index.d.ts +0 -1
  63. package/dist/cjs/biz-components/index.js +1 -1
  64. package/dist/cjs/biz-components/index.js.map +3 -3
  65. package/dist/cjs/components/ExposureDetector.js +1 -1
  66. package/dist/cjs/components/ExposureDetector.js.map +2 -2
  67. package/dist/cjs/components/avatar.js +1 -1
  68. package/dist/cjs/components/avatar.js.map +2 -2
  69. package/dist/cjs/components/link.d.ts +2 -2
  70. package/dist/cjs/components/link.js +1 -1
  71. package/dist/cjs/components/link.js.map +2 -2
  72. package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
  73. package/dist/cjs/helpers/ScrollLoadVideo.js.map +2 -2
  74. package/dist/cjs/stories/link.stories.d.ts +1 -1
  75. package/dist/cjs/stories/link.stories.js +1 -1
  76. package/dist/cjs/stories/link.stories.js.map +1 -1
  77. package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +11 -2
  78. package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
  79. package/dist/esm/biz-components/Listing/BizProductProvider.js.map +3 -3
  80. package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js +1 -1
  81. package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js.map +3 -3
  82. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  83. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +3 -3
  84. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +1 -1
  85. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +3 -3
  86. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
  87. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  88. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +6 -6
  89. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  90. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +2 -1
  91. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  92. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +3 -3
  93. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  94. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  95. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  96. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +2 -2
  97. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  98. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  99. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +3 -3
  100. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
  101. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
  102. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
  103. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
  104. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +2 -2
  105. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
  106. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +3 -3
  107. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +1 -1
  108. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +2 -2
  109. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  110. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  111. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  112. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +2 -2
  113. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  114. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  115. package/dist/esm/biz-components/Listing/components/ProductCard/index.js +1 -1
  116. package/dist/esm/biz-components/Listing/components/ProductCard/index.js.map +2 -2
  117. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  118. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  119. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
  120. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
  121. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.d.ts +2 -0
  122. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.js +2 -0
  123. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/useScrollSpy.js.map +7 -0
  124. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  125. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  126. package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
  127. package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  128. package/dist/esm/biz-components/Listing/index.d.ts +0 -3
  129. package/dist/esm/biz-components/Listing/index.js +1 -1
  130. package/dist/esm/biz-components/Listing/index.js.map +3 -3
  131. package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
  132. package/dist/esm/biz-components/MediaPlayerBase/index.js.map +3 -3
  133. package/dist/esm/biz-components/MediaPlayerSticky/index.js +1 -1
  134. package/dist/esm/biz-components/MediaPlayerSticky/index.js.map +2 -2
  135. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +4 -0
  136. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
  137. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  138. package/dist/esm/biz-components/index.d.ts +0 -1
  139. package/dist/esm/biz-components/index.js +1 -1
  140. package/dist/esm/biz-components/index.js.map +2 -2
  141. package/dist/esm/components/ExposureDetector.js +1 -1
  142. package/dist/esm/components/ExposureDetector.js.map +2 -2
  143. package/dist/esm/components/avatar.js +1 -1
  144. package/dist/esm/components/avatar.js.map +2 -2
  145. package/dist/esm/components/link.d.ts +2 -2
  146. package/dist/esm/components/link.js +1 -1
  147. package/dist/esm/components/link.js.map +2 -2
  148. package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
  149. package/dist/esm/helpers/ScrollLoadVideo.js.map +2 -2
  150. package/dist/esm/stories/link.stories.d.ts +1 -1
  151. package/dist/esm/stories/link.stories.js +1 -1
  152. package/dist/esm/stories/link.stories.js.map +1 -1
  153. package/package.json +2 -2
  154. package/tailwind.config.js +1 -1
@@ -1,2 +1,2 @@
1
- import{jsx as l,jsxs as j}from"react/jsx-runtime";import{useEffect as m,useState as g,useRef as v,useCallback as V}from"react";import{cn as n}from"../helpers/utils.js";import{debounce as M}from"lodash";const c=new Set,T=({src:r,poster:u,alt:E="Scroll Loaded Video",className:h="",videoWrapperClassName:p="",videoClassName:y="",autoplay:N=!1,muted:S=!0,loop:k=!0,controls:z=!1,playsInline:I=!0,videoRef:a=null,...U})=>{const[s,L]=g(!1),[t,d]=g(!1),b=v(null),f=v(null),o=v("");m(()=>{c.has(r)&&(L(!0),d(!0),o.current=r)},[r]),m(()=>{if(t&&s){const e=a?.current||f.current;e&&(e.muted=!0,e.play().catch(i=>{console.warn("\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:",i)}))}},[t,s,a]);const w=V(()=>{const e=r;if(!e||o.current===e&&t)return;if(c.has(e)){d(!0),o.current=e;return}o.current=e;const i=document.createElement("video");i.preload="metadata",i.onloadedmetadata=()=>{d(!0),c.add(e)},i.src=e},[t,r]);m(()=>{if(!b.current||t)return;const e=M(()=>{if(window.scrollY>10)return L(!0),w(),window.removeEventListener("scroll",e)},100);return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[w,t]);const H=V(()=>{d(!0),o.current&&c.add(o.current);const e=a?.current||f.current;e&&(e.muted=!0,e.play())},[]);return j("div",{ref:b,className:n("relative size-full",h),children:[u&&l("div",{className:n("absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out",p,{"opacity-100":!t,"overflow-visible opacity-0":t}),children:l("img",{src:u,alt:E,style:{width:"100%",height:"100%",objectFit:"cover"},className:n(y)})}),l("div",{className:n("size-full transition-opacity duration-500 ease-in-out",{"opacity-100":t,"opacity-0":!t}),style:{visibility:s?"visible":"hidden"},children:s&&l("div",{className:n("relative size-full",p),children:l("video",{ref:a||f,src:o.current||r,poster:u,className:n("size-full object-cover",y),onLoadedMetadata:H,autoPlay:N,muted:S,loop:k,controls:z,playsInline:I,...U},o.current)})})]})};var R=T;export{R as default};
1
+ import{jsx as l,jsxs as j}from"react/jsx-runtime";import{useEffect as m,useState as g,useRef as v,useCallback as V}from"react";import{cn as n}from"../helpers/utils.js";import{debounce as M}from"lodash";const c=new Set,T=({src:r,poster:u,alt:E="Scroll Loaded Video",className:h="",videoWrapperClassName:y="",videoClassName:p="",autoplay:N=!1,muted:z=!0,loop:S=!0,controls:k=!1,playsInline:I=!0,videoRef:a=null,...U})=>{const[s,L]=g(!1),[t,d]=g(!1),b=v(null),f=v(null),o=v("");m(()=>{c.has(r)&&(L(!0),d(!0),o.current=r)},[r]),m(()=>{if(t&&s){const e=a?.current||f.current;e&&(e.muted=!0,e.play().catch(i=>{console.warn("\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:",i)}))}},[t,s,a]);const w=V(()=>{const e=r;if(!e||o.current===e&&t)return;if(c.has(e)){d(!0),o.current=e;return}o.current=e;const i=document.createElement("video");i.preload="metadata",i.onloadedmetadata=()=>{d(!0),c.add(e)},i.src=e},[t,r]);m(()=>{if(!b.current||t)return;const e=M(()=>{if(window.scrollY>10)return L(!0),w(),window.removeEventListener("scroll",e)},100);return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[w,t]);const H=V(()=>{d(!0),o.current&&c.add(o.current);const e=a?.current||f.current;e&&(e.muted=!0,e.play())},[]);return j("div",{ref:b,className:n("relative size-full",h),children:[u&&l("div",{className:n("absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out",y,{"opacity-100":!t,"overflow-visible opacity-0":t}),children:l("img",{src:u,alt:E,style:{width:"100%",height:"100%",objectFit:"cover"},className:n(p),loading:"lazy"})}),l("div",{className:n("size-full transition-opacity duration-500 ease-in-out",{"opacity-100":t,"opacity-0":!t}),style:{visibility:s?"visible":"hidden"},children:s&&l("div",{className:n("relative size-full",y),children:l("video",{ref:a||f,src:o.current||r,poster:u,className:n("size-full object-cover",p),onLoadedMetadata:H,autoPlay:N,muted:z,loop:S,controls:k,playsInline:I,...U},o.current)})})]})};var R=T;export{R as default};
2
2
  //# sourceMappingURL=ScrollLoadVideo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/ScrollLoadVideo.tsx"],
4
- "sourcesContent": ["import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { debounce } from 'lodash'\n\n// \u521B\u5EFA\u4E00\u4E2A\u5168\u5C40\u7F13\u5B58\u6765\u5B58\u50A8\u5DF2\u52A0\u8F7D\u7684\u89C6\u9891URL\nconst globalLoadedVideoUrls = new Set<string>()\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n alt = 'Scroll Loaded Video',\n className = '',\n videoWrapperClassName = '',\n videoClassName = '',\n autoplay = false,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef = null,\n ...attr\n}: {\n src: string\n poster?: string\n alt?: string\n className?: string\n videoWrapperClassName?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n [key: string]: any\n}) => {\n const [isVideoStartLoad, setIsVideoStartLoad] = useState(false)\n const [isVideoLoaded, setIsVideoLoaded] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n // \u5185\u90E8\u89C6\u9891\u5F15\u7528\uFF0C\u5982\u679C\u5916\u90E8\u6CA1\u6709\u4F20\u5165 videoRef\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n // \u4FDD\u5B58\u5F53\u524D\u52A0\u8F7D\u7684\u89C6\u9891URL\n const currentVideoUrl = useRef<string>('')\n\n // \u5728\u7EC4\u4EF6\u6302\u8F7D\u65F6\u68C0\u67E5\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u88AB\u52A0\u8F7D\u8FC7\n useEffect(() => {\n // \u5982\u679C\u89C6\u9891\u5DF2\u7ECF\u88AB\u5168\u5C40\u7F13\u5B58\u8FC7\uFF0C\u76F4\u63A5\u8BBE\u7F6E\u4E3A\u5DF2\u52A0\u8F7D\u72B6\u6001\n if (globalLoadedVideoUrls.has(src)) {\n setIsVideoStartLoad(true)\n setIsVideoLoaded(true)\n currentVideoUrl.current = src\n }\n }, [src])\n\n // \u5F53\u89C6\u9891\u5DF2\u52A0\u8F7D\u4E14\u5DF2\u5F00\u59CB\u52A0\u8F7D\u65F6\uFF0C\u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n useEffect(() => {\n if (isVideoLoaded && isVideoStartLoad) {\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n // \u786E\u4FDD\u9759\u97F3\u4EE5\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\n videoElement.muted = true\n // \u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n videoElement.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n }\n }, [isVideoLoaded, isVideoStartLoad, videoRef])\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const preloadVideo = useCallback(() => {\n const videoUrl = src\n\n if (!videoUrl) return\n\n // \u5982\u679C\u5F53\u524DURL\u5DF2\u7ECF\u662F\u89C6\u9891\u7248\u672C\uFF0C\u65E0\u9700\u91CD\u590D\u52A0\u8F7D\n if (currentVideoUrl.current === videoUrl && isVideoLoaded) {\n return\n }\n\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\u8FD9\u4E2AURL\u7684\u89C6\u9891\u7248\u672C\n if (globalLoadedVideoUrls.has(videoUrl)) {\n setIsVideoLoaded(true)\n currentVideoUrl.current = videoUrl\n return\n }\n\n // \u66F4\u65B0\u5F53\u524D\u89C6\u9891URL\n currentVideoUrl.current = videoUrl\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const videoElement = document.createElement('video')\n videoElement.preload = 'metadata'\n videoElement.onloadedmetadata = () => {\n setIsVideoLoaded(true)\n globalLoadedVideoUrls.add(videoUrl)\n }\n videoElement.src = videoUrl\n }, [isVideoLoaded, src])\n\n useEffect(() => {\n if (!ref.current || isVideoLoaded) return\n const scrollHandler = debounce(() => {\n if (window.scrollY > 10) {\n setIsVideoStartLoad(true)\n preloadVideo()\n return window.removeEventListener('scroll', scrollHandler)\n }\n }, 100)\n window.addEventListener('scroll', scrollHandler)\n return () => {\n window.removeEventListener('scroll', scrollHandler)\n }\n }, [preloadVideo, isVideoLoaded])\n\n const handleVideoLoad = useCallback(() => {\n setIsVideoLoaded(true)\n // \u8BB0\u5F55\u5F53\u524DURL\u5DF2\u52A0\u8F7D\u89C6\u9891\u7248\u672C\n if (currentVideoUrl.current) {\n globalLoadedVideoUrls.add(currentVideoUrl.current)\n }\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n videoElement.muted = true\n videoElement.play()\n }\n }, [])\n\n return (\n <div ref={ref} className={cn('relative size-full', className)}>\n {poster && (\n <div\n className={cn(\n 'absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out',\n videoWrapperClassName,\n {\n 'opacity-100': !isVideoLoaded,\n 'overflow-visible opacity-0': isVideoLoaded,\n }\n )}\n >\n <img\n src={poster}\n alt={alt}\n style={{ width: '100%', height: '100%', objectFit: 'cover' }}\n className={cn(videoClassName)}\n />\n </div>\n )}\n <div\n className={cn('size-full transition-opacity duration-500 ease-in-out', {\n 'opacity-100': isVideoLoaded,\n 'opacity-0': !isVideoLoaded,\n })}\n style={{ visibility: isVideoStartLoad ? 'visible' : 'hidden' }}\n >\n {isVideoStartLoad && (\n <div className={cn('relative size-full', videoWrapperClassName)}>\n <video\n ref={videoRef || internalVideoRef}\n key={currentVideoUrl.current} // \u6DFB\u52A0key\u786E\u4FDDURL\u53D8\u5316\u65F6\u91CD\u65B0\u6E32\u67D3\n src={currentVideoUrl.current || src}\n poster={poster}\n className={cn('size-full object-cover', videoClassName)}\n onLoadedMetadata={handleVideoLoad}\n autoPlay={autoplay}\n muted={muted}\n loop={loop}\n controls={controls}\n playsInline={playsInline}\n {...attr}\n />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nexport default ScrollLoadVideo\n"],
5
- "mappings": "AAgII,OAYM,OAAAA,EAZN,QAAAC,MAAA,oBAhIJ,OAAgB,aAAAC,EAAW,YAAAC,EAAU,UAAAC,EAAQ,eAAAC,MAAmB,QAChE,OAAS,MAAAC,MAAU,sBACnB,OAAS,YAAAC,MAAgB,SAGzB,MAAMC,EAAwB,IAAI,IAE5BC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,IAAAC,EAAM,sBACN,UAAAC,EAAY,GACZ,sBAAAC,EAAwB,GACxB,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,SAAAC,EAAW,GACX,YAAAC,EAAc,GACd,SAAAC,EAAW,KACX,GAAGC,CACL,IAaM,CACJ,KAAM,CAACC,EAAkBC,CAAmB,EAAIrB,EAAS,EAAK,EACxD,CAACsB,EAAeC,CAAgB,EAAIvB,EAAS,E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,EAAG,CAACF,EAAcP,CAAa,CAAC,EAEhC,MAAMU,EAAkB9B,EAAY,IAAM,CACxCqB,EAAiB,EAAI,EAEjBG,EAAgB,SAClBrB,EAAsB,IAAIqB,EAAgB,OAAO,EAEnD,MAAMC,EAAeT,GAAU,SAAWO,EAAiB,QACvDE,IACFA,EAAa,MAAQ,GACrBA,EAAa,KAAK,EAEtB,EAAG,CAAC,CAAC,EAEL,OACE7B,EAAC,OAAI,IAAK0B,EAAK,UAAWrB,EAAG,qBAAsBO,CAAS,EACzD,UAAAF,GACCX,EAAC,OACC,UAAWM,EACT,yFACAQ,EACA,CACE,cAAe,CAACW,EAChB,6BAA8BA,CAChC,CACF,EAEA,SAAAzB,EAAC,OACC,IAAKW,EACL,IAAKC,EACL,MAAO,CAAE,MAAO,OAAQ,OAAQ,OAAQ,UAAW,OAAQ,EAC3D,UAAWN,EAAGS,CAAc,EAC9B,EACF,EAEFf,EAAC,OACC,UAAWM,EAAG,wDAAyD,CACrE,cAAemB,EACf,YAAa,CAACA,CAChB,CAAC,EACD,MAAO,CAAE,WAAYF,EAAmB,UAAY,QAAS,EAE5D,SAAAA,GACCvB,EAAC,OAAI,UAAWM,EAAG,qBAAsBQ,CAAqB,EAC5D,SAAAd,EAAC,SACC,IAAKqB,GAAYO,EAEjB,IAAKC,EAAgB,SAAWnB,EAChC,OAAQC,EACR,UAAWL,EAAG,yBAA0BS,CAAc,EACtD,iBAAkBoB,EAClB,SAAUnB,EACV,MAAOC,EACP,KAAMC,EACN,SAAUC,EACV,YAAaC,EACZ,GAAGE,GAVCO,EAAgB,OAWvB,EACF,EAEJ,GACF,CAEJ,EAEA,IAAOO,EAAQ3B",
4
+ "sourcesContent": ["import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { debounce } from 'lodash'\n\n// \u521B\u5EFA\u4E00\u4E2A\u5168\u5C40\u7F13\u5B58\u6765\u5B58\u50A8\u5DF2\u52A0\u8F7D\u7684\u89C6\u9891URL\nconst globalLoadedVideoUrls = new Set<string>()\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n alt = 'Scroll Loaded Video',\n className = '',\n videoWrapperClassName = '',\n videoClassName = '',\n autoplay = false,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef = null,\n ...attr\n}: {\n src: string\n poster?: string\n alt?: string\n className?: string\n videoWrapperClassName?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n [key: string]: any\n}) => {\n const [isVideoStartLoad, setIsVideoStartLoad] = useState(false)\n const [isVideoLoaded, setIsVideoLoaded] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n // \u5185\u90E8\u89C6\u9891\u5F15\u7528\uFF0C\u5982\u679C\u5916\u90E8\u6CA1\u6709\u4F20\u5165 videoRef\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n // \u4FDD\u5B58\u5F53\u524D\u52A0\u8F7D\u7684\u89C6\u9891URL\n const currentVideoUrl = useRef<string>('')\n\n // \u5728\u7EC4\u4EF6\u6302\u8F7D\u65F6\u68C0\u67E5\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u88AB\u52A0\u8F7D\u8FC7\n useEffect(() => {\n // \u5982\u679C\u89C6\u9891\u5DF2\u7ECF\u88AB\u5168\u5C40\u7F13\u5B58\u8FC7\uFF0C\u76F4\u63A5\u8BBE\u7F6E\u4E3A\u5DF2\u52A0\u8F7D\u72B6\u6001\n if (globalLoadedVideoUrls.has(src)) {\n setIsVideoStartLoad(true)\n setIsVideoLoaded(true)\n currentVideoUrl.current = src\n }\n }, [src])\n\n // \u5F53\u89C6\u9891\u5DF2\u52A0\u8F7D\u4E14\u5DF2\u5F00\u59CB\u52A0\u8F7D\u65F6\uFF0C\u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n useEffect(() => {\n if (isVideoLoaded && isVideoStartLoad) {\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n // \u786E\u4FDD\u9759\u97F3\u4EE5\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\n videoElement.muted = true\n // \u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n videoElement.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n }\n }, [isVideoLoaded, isVideoStartLoad, videoRef])\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const preloadVideo = useCallback(() => {\n const videoUrl = src\n\n if (!videoUrl) return\n\n // \u5982\u679C\u5F53\u524DURL\u5DF2\u7ECF\u662F\u89C6\u9891\u7248\u672C\uFF0C\u65E0\u9700\u91CD\u590D\u52A0\u8F7D\n if (currentVideoUrl.current === videoUrl && isVideoLoaded) {\n return\n }\n\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\u8FD9\u4E2AURL\u7684\u89C6\u9891\u7248\u672C\n if (globalLoadedVideoUrls.has(videoUrl)) {\n setIsVideoLoaded(true)\n currentVideoUrl.current = videoUrl\n return\n }\n\n // \u66F4\u65B0\u5F53\u524D\u89C6\u9891URL\n currentVideoUrl.current = videoUrl\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const videoElement = document.createElement('video')\n videoElement.preload = 'metadata'\n videoElement.onloadedmetadata = () => {\n setIsVideoLoaded(true)\n globalLoadedVideoUrls.add(videoUrl)\n }\n videoElement.src = videoUrl\n }, [isVideoLoaded, src])\n\n useEffect(() => {\n if (!ref.current || isVideoLoaded) return\n const scrollHandler = debounce(() => {\n if (window.scrollY > 10) {\n setIsVideoStartLoad(true)\n preloadVideo()\n return window.removeEventListener('scroll', scrollHandler)\n }\n }, 100)\n window.addEventListener('scroll', scrollHandler)\n return () => {\n window.removeEventListener('scroll', scrollHandler)\n }\n }, [preloadVideo, isVideoLoaded])\n\n const handleVideoLoad = useCallback(() => {\n setIsVideoLoaded(true)\n // \u8BB0\u5F55\u5F53\u524DURL\u5DF2\u52A0\u8F7D\u89C6\u9891\u7248\u672C\n if (currentVideoUrl.current) {\n globalLoadedVideoUrls.add(currentVideoUrl.current)\n }\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n videoElement.muted = true\n videoElement.play()\n }\n }, [])\n\n return (\n <div ref={ref} className={cn('relative size-full', className)}>\n {poster && (\n <div\n className={cn(\n 'absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out',\n videoWrapperClassName,\n {\n 'opacity-100': !isVideoLoaded,\n 'overflow-visible opacity-0': isVideoLoaded,\n }\n )}\n >\n <img\n src={poster}\n alt={alt}\n style={{ width: '100%', height: '100%', objectFit: 'cover' }}\n className={cn(videoClassName)}\n loading=\"lazy\"\n />\n </div>\n )}\n <div\n className={cn('size-full transition-opacity duration-500 ease-in-out', {\n 'opacity-100': isVideoLoaded,\n 'opacity-0': !isVideoLoaded,\n })}\n style={{ visibility: isVideoStartLoad ? 'visible' : 'hidden' }}\n >\n {isVideoStartLoad && (\n <div className={cn('relative size-full', videoWrapperClassName)}>\n <video\n ref={videoRef || internalVideoRef}\n key={currentVideoUrl.current} // \u6DFB\u52A0key\u786E\u4FDDURL\u53D8\u5316\u65F6\u91CD\u65B0\u6E32\u67D3\n src={currentVideoUrl.current || src}\n poster={poster}\n className={cn('size-full object-cover', videoClassName)}\n onLoadedMetadata={handleVideoLoad}\n autoPlay={autoplay}\n muted={muted}\n loop={loop}\n controls={controls}\n playsInline={playsInline}\n {...attr}\n />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nexport default ScrollLoadVideo\n"],
5
+ "mappings": "AAgII,OAYM,OAAAA,EAZN,QAAAC,MAAA,oBAhIJ,OAAgB,aAAAC,EAAW,YAAAC,EAAU,UAAAC,EAAQ,eAAAC,MAAmB,QAChE,OAAS,MAAAC,MAAU,sBACnB,OAAS,YAAAC,MAAgB,SAGzB,MAAMC,EAAwB,IAAI,IAE5BC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,IAA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EACP,KAAMC,EACN,SAAUC,EACV,YAAaC,EACZ,GAAGE,GAVCO,EAAgB,OAWvB,EACF,EAEJ,GACF,CAEJ,EAEA,IAAOO,EAAQ3B",
6
6
  "names": ["jsx", "jsxs", "useEffect", "useState", "useRef", "useCallback", "cn", "debounce", "globalLoadedVideoUrls", "ScrollLoadVideo", "src", "poster", "alt", "className", "videoWrapperClassName", "videoClassName", "autoplay", "muted", "loop", "controls", "playsInline", "videoRef", "attr", "isVideoStartLoad", "setIsVideoStartLoad", "isVideoLoaded", "setIsVideoLoaded", "ref", "internalVideoRef", "currentVideoUrl", "videoElement", "error", "preloadVideo", "videoUrl", "scrollHandler", "handleVideoLoad", "ScrollLoadVideo_default"]
7
7
  }
@@ -11,7 +11,7 @@ declare const meta: {
11
11
  onClick?: Function;
12
12
  } & import("class-variance-authority").VariantProps<(props?: ({
13
13
  size?: "base" | "lg" | null | undefined;
14
- variant?: "primary" | "secoundry" | null | undefined;
14
+ variant?: "primary" | "secondary" | null | undefined;
15
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & import("../helpers/component-props.js").ComponentPropsWithout<"a", import("../helpers/component-props.js").RemovedProps> & import("react").RefAttributes<HTMLAnchorElement>>;
16
16
  parameters: {
17
17
  layout: string;
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import"@storybook/icons";import i from"../components/link.js";const n={title:"Components/Link",component:i,parameters:{layout:"centered"},tags:["autodocs"],argTypes:{size:{description:"\u5C3A\u5BF8",control:{type:"select"},options:["base","lg"],table:{defaultValue:{summary:"base"}}},variant:{description:"\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F",control:{type:"select"},options:["primary","secoundry"],table:{defaultValue:{summary:"primary"}}},onClick:{control:!1},suffixIcon:{control:!1},style:{control:!1},className:{control:!1},children:{control:!1}},args:{onClick:void 0}};var t=n;const r={args:{children:"Link"}},d=()=>a("div",{className:"inline-flex flex-col gap-4",children:[e("div",{className:"inline-flex gap-4",children:e(i,{size:"base",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"lg",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"base",variant:"secoundry",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"lg",variant:"secoundry",children:"Link"})})]}),c=()=>a("div",{className:"inline-flex flex-col gap-4",children:[a("div",{className:"inline-flex gap-4",children:[e(i,{size:"base",disabled:!0,children:"Link"}),e(i,{size:"base",disabled:!0,children:"Link"})]}),a("div",{className:"inline-flex gap-4",children:[e(i,{size:"lg",disabled:!0,children:"Link"}),e(i,{size:"lg",disabled:!0,children:"Link"})]})]});export{r as Default,c as Disabled,d as LinkSize,t as default};
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import"@storybook/icons";import i from"../components/link.js";const n={title:"Components/Link",component:i,parameters:{layout:"centered"},tags:["autodocs"],argTypes:{size:{description:"\u5C3A\u5BF8",control:{type:"select"},options:["base","lg"],table:{defaultValue:{summary:"base"}}},variant:{description:"\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F",control:{type:"select"},options:["primary","secondary"],table:{defaultValue:{summary:"primary"}}},onClick:{control:!1},suffixIcon:{control:!1},style:{control:!1},className:{control:!1},children:{control:!1}},args:{onClick:void 0}};var t=n;const r={args:{children:"Link"}},d=()=>a("div",{className:"inline-flex flex-col gap-4",children:[e("div",{className:"inline-flex gap-4",children:e(i,{size:"base",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"lg",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"base",variant:"secondary",children:"Link"})}),e("div",{className:"inline-flex gap-4",children:e(i,{size:"lg",variant:"secondary",children:"Link"})})]}),c=()=>a("div",{className:"inline-flex flex-col gap-4",children:[a("div",{className:"inline-flex gap-4",children:[e(i,{size:"base",disabled:!0,children:"Link"}),e(i,{size:"base",disabled:!0,children:"Link"})]}),a("div",{className:"inline-flex gap-4",children:[e(i,{size:"lg",disabled:!0,children:"Link"}),e(i,{size:"lg",disabled:!0,children:"Link"})]})]});export{r as Default,c as Disabled,d as LinkSize,t as default};
2
2
  //# sourceMappingURL=link.stories.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/stories/link.stories.tsx"],
4
- "sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { ChevronRightIcon } from '@storybook/icons'\nimport Link from '../components/link.js'\n\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Link',\n component: Link,\n parameters: {\n layout: 'centered',\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n size: {\n description: '\u5C3A\u5BF8',\n control: {\n type: 'select',\n },\n options: ['base', 'lg'],\n table: {\n defaultValue: { summary: 'base' },\n },\n },\n variant: {\n description: '\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F',\n control: {\n type: 'select',\n },\n options: ['primary', 'secoundry'],\n table: {\n defaultValue: { summary: 'primary' },\n },\n },\n onClick: {\n control: false,\n },\n suffixIcon: {\n control: false,\n },\n style: {\n control: false,\n },\n className: {\n control: false,\n },\n children: {\n control: false,\n },\n },\n args: {\n onClick: undefined,\n },\n} satisfies Meta<typeof Link>\n\nexport default meta\n\ntype Story = StoryObj<typeof meta>\n\nexport const Default: Story = {\n args: {\n children: 'Link',\n },\n}\n\nexport const LinkSize = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" variant=\"secoundry\">\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" variant=\"secoundry\">\n Link\n </Link>\n </div>\n </div>\n)\n\nexport const Disabled = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" disabled>\n Link\n </Link>\n <Link size=\"base\" disabled>\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" disabled>\n Link\n </Link>\n <Link size=\"lg\" disabled>\n Link\n </Link>\n </div>\n </div>\n)\n"],
4
+ "sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { ChevronRightIcon } from '@storybook/icons'\nimport Link from '../components/link.js'\n\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Link',\n component: Link,\n parameters: {\n layout: 'centered',\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n size: {\n description: '\u5C3A\u5BF8',\n control: {\n type: 'select',\n },\n options: ['base', 'lg'],\n table: {\n defaultValue: { summary: 'base' },\n },\n },\n variant: {\n description: '\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F',\n control: {\n type: 'select',\n },\n options: ['primary', 'secondary'],\n table: {\n defaultValue: { summary: 'primary' },\n },\n },\n onClick: {\n control: false,\n },\n suffixIcon: {\n control: false,\n },\n style: {\n control: false,\n },\n className: {\n control: false,\n },\n children: {\n control: false,\n },\n },\n args: {\n onClick: undefined,\n },\n} satisfies Meta<typeof Link>\n\nexport default meta\n\ntype Story = StoryObj<typeof meta>\n\nexport const Default: Story = {\n args: {\n children: 'Link',\n },\n}\n\nexport const LinkSize = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" variant=\"secondary\">\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" variant=\"secondary\">\n Link\n </Link>\n </div>\n </div>\n)\n\nexport const Disabled = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" disabled>\n Link\n </Link>\n <Link size=\"base\" disabled>\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" disabled>\n Link\n </Link>\n <Link size=\"lg\" disabled>\n Link\n </Link>\n </div>\n </div>\n)\n"],
5
5
  "mappings": "AAmEE,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBAlEF,MAAiC,mBACjC,OAAOC,MAAU,wBAEjB,MAAMC,EAAO,CAEX,MAAO,kBACP,UAAWD,EACX,WAAY,CACV,OAAQ,UACV,EAEA,KAAM,CAAC,UAAU,EAEjB,SAAU,CACR,KAAM,CACJ,YAAa,eACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,IAAI,EACtB,MAAO,CACL,aAAc,CAAE,QAAS,MAAO,CAClC,CACF,EACA,QAAS,CACP,YAAa,mDACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,UAAW,WAAW,EAChC,MAAO,CACL,aAAc,CAAE,QAAS,SAAU,CACrC,CACF,EACA,QAAS,CACP,QAAS,EACX,EACA,WAAY,CACV,QAAS,EACX,EACA,MAAO,CACL,QAAS,EACX,EACA,UAAW,CACT,QAAS,EACX,EACA,SAAU,CACR,QAAS,EACX,CACF,EACA,KAAM,CACJ,QAAS,MACX,CACF,EAEA,IAAOE,EAAQD,EAIR,MAAME,EAAiB,CAC5B,KAAM,CACJ,SAAU,MACZ,CACF,EAEaC,EAAW,IACtBL,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,oBACb,SAAAA,EAACE,EAAA,CAAK,KAAK,OAAO,gBAAI,EACxB,EACAF,EAAC,OAAI,UAAU,oBACb,SAAAA,EAACE,EAAA,CAAK,KAAK,KAAK,gBAAI,EACtB,EACAF,EAAC,OAAI,UAAU,oBACb,SAAAA,EAACE,EAAA,CAAK,KAAK,OAAO,QAAQ,YAAY,gBAEtC,EACF,EACAF,EAAC,OAAI,UAAU,oBACb,SAAAA,EAACE,EAAA,CAAK,KAAK,KAAK,QAAQ,YAAY,gBAEpC,EACF,GACF,EAGWK,EAAW,IACtBN,EAAC,OAAI,UAAU,6BACb,UAAAA,EAAC,OAAI,UAAU,oBACb,UAAAD,EAACE,EAAA,CAAK,KAAK,OAAO,SAAQ,GAAC,gBAE3B,EACAF,EAACE,EAAA,CAAK,KAAK,OAAO,SAAQ,GAAC,gBAE3B,GACF,EACAD,EAAC,OAAI,UAAU,oBACb,UAAAD,EAACE,EAAA,CAAK,KAAK,KAAK,SAAQ,GAAC,gBAEzB,EACAF,EAACE,EAAA,CAAK,KAAK,KAAK,SAAQ,GAAC,gBAEzB,GACF,GACF",
6
6
  "names": ["jsx", "jsxs", "Link", "meta", "link_stories_default", "Default", "LinkSize", "Disabled"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -154,6 +154,6 @@
154
154
  "test": "jest",
155
155
  "test:snapshots:update": "jest -u",
156
156
  "test:coverage": "jest --coverage && jest-coverage-badges output \"./badges\"",
157
- "clean": "rm -rf .turbo node_modules dist style.css"
157
+ "clean": "rm -rf .turbo nodqe_modules dist style.css"
158
158
  }
159
159
  }
@@ -13,7 +13,7 @@ module.exports = {
13
13
  'm-tablet': { max: '1440px' },
14
14
  tablet: '768px', // ≥768px 平板
15
15
  laptop: '1025px', // ≥1025px 小桌面
16
- 'mid-desktop': '1280px', // ≥1280px 中桌面
16
+ 'laptop-md': '1280px', // ≥1280px 中桌面
17
17
  desktop: '1440px', // ≥1440px 大桌面
18
18
  'lg-desktop': '1920px', // ≥1920px 超大屏
19
19
  },