@machinerd/js-module 0.4.1 → 0.5.1
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/README.md +36 -4
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +2 -3
- package/dist/hooks/index.d.mts +2 -3
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks-DBo6LQrH.mjs +1 -0
- package/dist/hooks-DqgWx1Fa.cjs +1 -0
- package/dist/{index-CWgr7lXX.d.cts → index-ByfkW7VU.d.mts} +186 -192
- package/dist/{index-CfKO4Lbp.d.mts → index-ComhjQ-q.d.cts} +186 -192
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/providers/index.cjs +1 -0
- package/dist/providers/index.d.cts +14 -0
- package/dist/providers/index.d.mts +14 -0
- package/dist/providers/index.mjs +1 -0
- package/dist/providers-5JCPezAS.mjs +1 -0
- package/dist/providers-BNK8Fisc.cjs +1 -0
- package/dist/{skeleton-NTpsm0XR.mjs → skeleton-S6S1ZnCy.mjs} +1 -1
- package/dist/{skeleton-B1Jzl0cz.cjs → skeleton-g6yXh6D9.cjs} +1 -1
- package/dist/src-C_FmOyer.mjs +1 -0
- package/dist/src-CjpmdVyv.cjs +1 -0
- package/dist/styles/index.css +206 -1
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +10 -10
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.mjs +1 -1
- package/dist/ui-client/index.cjs +1 -1
- package/dist/ui-client/index.d.cts +37 -23
- package/dist/ui-client/index.d.mts +38 -24
- package/dist/ui-client/index.mjs +1 -1
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.mjs +1 -1
- package/package.json +5 -1
- package/dist/hooks-BDwkyixK.mjs +0 -1
- package/dist/hooks-D1JcFVTH.cjs +0 -1
- /package/dist/{index-DiZ4xS_f.d.mts → index-CH1uVFqx.d.cts} +0 -0
- /package/dist/{index-OjfbEYpE.d.cts → index-D6Jzsxc-.d.mts} +0 -0
- /package/dist/{util-1BLWEgZB.cjs → util-o7fjt7iK.cjs} +0 -0
- /package/dist/{util-Dtb82Us1.mjs → util-zXJA6Gnc.mjs} +0 -0
package/dist/ui-client/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../util-1BLWEgZB.cjs`),n=require(`../skeleton-B1Jzl0cz.cjs`),r=require(`../hooks-D1JcFVTH.cjs`);let i=require(`lodash-es`),a=require(`clsx`);a=e.t(a);let o=require(`react`);o=e.t(o);let s=require(`react/jsx-runtime`),c=require(`class-variance-authority`),l=require(`embla-carousel-react`);l=e.t(l);let u=require(`react-dom`);const d=o.default.createContext(null);function f(){let e=o.default.useContext(d);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function p({orientation:e=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:c,...u}){let[f,p]=(0,l.default)({...n,axis:e===`horizontal`?`x`:`y`},i),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),v=(0,o.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()))},[]),y=(0,o.useCallback)(()=>{p?.scrollPrev()},[p]),b=(0,o.useCallback)(()=>{p?.scrollNext()},[p]),x=(0,o.useCallback)(t=>{e===`horizontal`?t.key===`ArrowLeft`?(t.preventDefault(),y()):t.key===`ArrowRight`&&(t.preventDefault(),b()):t.key===`ArrowUp`?(t.preventDefault(),y()):t.key===`ArrowDown`&&(t.preventDefault(),b())},[y,b,e]);return(0,o.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,o.useEffect)(()=>{if(p)return v(p),p.on(`reInit`,v),p.on(`select`,v),()=>{p?.off(`select`,v)}},[p,v]),(0,s.jsx)(d.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:y,scrollNext:b,canScrollPrev:m,canScrollNext:g},children:(0,s.jsx)(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:x,className:t.y(`komc:relative`,a),...u,children:c})})}function m({className:e,...n}){let{carouselRef:r,orientation:i}=f();return(0,s.jsx)(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:(0,s.jsx)(`div`,{className:t.y(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,e),...n})})}function h({className:e,...n}){let{orientation:r}=f();return(0,s.jsx)(`div`,{"data-komc":!0,className:t.y(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,e),...n})}function g({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:i}=f();return(0,s.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`previous slide`,className:(0,a.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function _({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:i}=f();return(0,s.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`next slide`,className:(0,a.default)(`komc:w-full`,t),onClick:r,...n,children:e})}const v=(0,c.cva)(`komc:relative komc:z-10 komc:w-full komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function y({closeOnBackdropClick:e=!0,isOpen:t,zIndex:n=1e4,padding:i,maxWidth:a,className:c,onClose:l,children:u,...d}){let f=r.c(t,300),[p,m]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(t&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else t||m(!1)},[t,f]);let h=(0,o.useCallback)(e=>{e.key===`Escape`&&l()},[l]),g=(0,o.useCallback)(()=>{e&&l()},[e,l]);return(0,o.useEffect)(()=>(t?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[t,h]),f?(0,s.jsxs)(`div`,{"data-komc":!0,className:`komc:flex komc:justify-center komc:items-center komc:fixed komc:inset-0`,style:{zIndex:n},children:[(0,s.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:`komc:w-full komc:h-full komc:bg-black/50 komc:absolute komc:inset-0 komc:cursor-default komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:g,"aria-label":`close dialog`}),(0,s.jsx)(`div`,{"data-state":p?`open`:`closed`,className:`${v({padding:i,maxWidth:a,className:c})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]}):null}const b=(0,c.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),x=(0,o.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,s.jsx)(`img`,{ref:n,...i})}),S=(0,o.forwardRef)(({skeleton:e=!0,layout:t=`stretch`,fallbackSrc:i,className:o,emptyNode:c,emptyNodeClassName:l,skeletonClassName:u,...d},f)=>{let{ref:p,isLoad:m,isError:h,imageProps:g}=r.r({ref:f,fallbackSrc:i,forceLoad:!e,...d}),_=!d.fill&&t===`intrinsic`?{width:`${d.width}px`,height:`${d.height}px`}:void 0,v=(0,a.default)(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!d.fill&&t===`stretch`&&`komc:w-full komc:h-full`);return!i&&h&&c?d.fill?(0,s.jsx)(C,{className:l,children:c}):(0,s.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,s.jsx)(C,{className:l,children:c})}):d.fill?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`img`,{ref:p,...g,className:(0,a.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:invisible`:`komc:visible`,o)}),(0,s.jsx)(`div`,{"data-komc":!0,className:(0,a.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,s.jsx)(n.t,{size:`full`,className:u})})]}):(0,s.jsxs)(`div`,{"data-komc":!0,style:_,className:v,children:[(0,s.jsx)(`img`,{ref:p,...g,className:(0,a.default)(b({fill:d.fill,className:o}),e&&!m?`komc:invisible`:`komc:visible`)}),(0,s.jsx)(`div`,{className:(0,a.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,s.jsx)(n.t,{size:`full`,className:u})})]})}),C=({children:e,className:t})=>(0,s.jsx)(`div`,{"data-komc":!0,role:`alert`,className:(0,a.default)(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var w=S;function T({children:e,setOpen:t}){return(0,s.jsx)(`div`,{"data-komc":!0,className:(0,a.default)(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const E=(0,c.cva)(t.y(`komc:absolute komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:``,false:``},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}}),D=(0,o.forwardRef)(({portal:e,children:t,className:n,placement:r,...i},a)=>(0,s.jsx)(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:E({portal:e,placement:r,className:n}),...i,children:t}));var O=D;const k=(0,c.cva)(t.y(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.y(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.y(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":t.y(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.y(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.y(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.y(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}}),A=({placement:e,className:t,offset:n,style:r,...i})=>{let a=(0,o.useMemo)(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return(0,s.jsx)(`div`,{className:k({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};var j=A;const M=24,N=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function P({placement:e,className:t,content:n,open:r,hiddenRef:c,containerRef:l}){let[d,f]=(0,o.useState)(!1),p=(0,o.useRef)(null),[m,h]=(0,o.useState)(e),[g,_]=(0,o.useState)({top:0,left:0}),[v,y]=(0,o.useState)({x:0,y:0}),b=(0,o.useCallback)((0,i.debounce)(()=>{let e=l?.current,t=c.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.scrollY||document.documentElement.scrollTop,a=window.scrollX||document.documentElement.scrollLeft,[o,s]=m.split(`-`),u=i+n.top,d=a+n.left+n.width/2-r.width/2;switch(o){case`top`:u-=r.height;break;case`bottom`:u+=n.height;break}switch(s){case`start`:d+=r.width/2-24;break;case`end`:d-=r.width/2-24;break}let f=d,p=window.innerWidth;f+r.width>p-4&&(f=p-r.width-4),f<4&&(f=4),_({top:u,left:f}),y({x:d-f,y:0})},50),[m]),x=(0,o.useCallback)((0,i.debounce)(()=>{if(!c.current)return;let{top:t,height:n}=c.current.getBoundingClientRect();h(r=>{let i=e;return t+n>=window.innerHeight?i=N(r,`top`):t<0&&(i=N(r,`bottom`)),i})},50),[e]);return(0,o.useEffect)(()=>(f(!0),x(),window.addEventListener(`scroll`,b,{passive:!0}),window.addEventListener(`resize`,b),window.addEventListener(`scroll`,x,{passive:!0}),window.addEventListener(`resize`,x),()=>{window.removeEventListener(`scroll`,b),window.removeEventListener(`resize`,b),window.removeEventListener(`scroll`,x),window.removeEventListener(`resize`,x)}),[b,x]),(0,o.useEffect)(()=>{d&&b()},[d,b]),d?(0,u.createPortal)((0,s.jsxs)(O,{ref:p,portal:!0,"data-komc":!0,placement:m,className:(0,a.default)(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...g},children:[(0,s.jsx)(`span`,{children:n}),(0,s.jsx)(j,{placement:m,offset:v})]}),document.body):null}const F=(0,o.forwardRef)(({children:e,content:t,defaultOpen:n=!1,className:i,placement:c=`top`},l)=>{let[u,d]=(0,o.useState)(n),f=(0,o.useRef)(null),p=(0,o.useRef)(null);return r.o({ref:f,setOpen:d}),(0,s.jsxs)(`div`,{ref:f,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[(0,s.jsx)(T,{setOpen:d,children:e}),(0,s.jsx)(P,{placement:c,className:i,open:u,content:t,hiddenRef:p,containerRef:f}),(0,s.jsx)(O,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:c,className:(0,a.default)(`komc:opacity-0 komc:invisible`,i),children:(0,s.jsx)(`span`,{children:t})})]})});var I=F;exports.BaseImage=x,exports.Carousel=p,exports.CarouselItem=h,exports.CarouselNext=_,exports.CarouselPrevious=g,exports.CarouselWrapper=m,exports.Dialog=y,exports.EmptyNode=C,exports.Image=w,exports.Tooltip=I;
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);require(`../src-CjpmdVyv.cjs`);const t=require(`../util-o7fjt7iK.cjs`),n=require(`../skeleton-g6yXh6D9.cjs`),r=require(`../hooks-DqgWx1Fa.cjs`);require(`../providers-BNK8Fisc.cjs`);let i=require(`clsx`);i=e.t(i);let a=require(`react`);a=e.t(a);let o=require(`react/jsx-runtime`),s=require(`class-variance-authority`),c=require(`embla-carousel-react`);c=e.t(c);let l=require(`react-dom`);const u=a.default.createContext(null);function d(){let e=a.default.useContext(u);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function f({orientation:e=`horizontal`,options:n,setApi:r,plugins:i,className:s,children:l,...d}){let[f,p]=(0,c.default)({...n,axis:e===`horizontal`?`x`:`y`},i),[m,h]=(0,a.useState)(!1),[g,_]=(0,a.useState)(!1),v=(0,a.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()))},[]),y=(0,a.useCallback)(()=>{p?.scrollPrev()},[p]),b=(0,a.useCallback)(()=>{p?.scrollNext()},[p]),x=(0,a.useCallback)(t=>{e===`horizontal`?t.key===`ArrowLeft`?(t.preventDefault(),y()):t.key===`ArrowRight`&&(t.preventDefault(),b()):t.key===`ArrowUp`?(t.preventDefault(),y()):t.key===`ArrowDown`&&(t.preventDefault(),b())},[y,b,e]);return(0,a.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,a.useEffect)(()=>{if(p)return v(p),p.on(`reInit`,v),p.on(`select`,v),()=>{p?.off(`select`,v)}},[p,v]),(0,o.jsx)(u.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:y,scrollNext:b,canScrollPrev:m,canScrollNext:g},children:(0,o.jsx)(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:x,className:t.y(`komc:relative`,s),...d,children:l})})}function p({className:e,...n}){let{carouselRef:r,orientation:i}=d();return(0,o.jsx)(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:(0,o.jsx)(`div`,{className:t.y(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,e),...n})})}function m({className:e,...n}){let{orientation:r}=d();return(0,o.jsx)(`div`,{"data-komc":!0,className:t.y(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,e),...n})}function h({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`previous slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function g({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`next slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}const _=(0,s.cva)(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function v({closeOnBackdropClick:e=!0,isOpen:t,zIndex:n=1e4,padding:i,maxWidth:s,className:c,onClose:l,children:u,...d}){let f=r.c(t,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(t&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else t||m(!1)},[t,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&l()},[l]),g=(0,a.useCallback)(()=>{e&&l()},[e,l]);return(0,a.useEffect)(()=>(t?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[t,h]),f?(0,o.jsx)(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:n},children:(0,o.jsxs)(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:g,"aria-label":`close dialog`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:`${_({padding:i,maxWidth:s,className:c})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const y=(0,s.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),b=(0,a.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,o.jsx)(`img`,{ref:n,...i})}),x=(0,a.forwardRef)(({skeleton:e=!0,layout:t=`stretch`,fallbackSrc:a,className:s,emptyNode:c,emptyNodeClassName:l,skeletonClassName:u,...d},f)=>{let{ref:p,isLoad:m,isError:h,imageProps:g}=r.r({ref:f,fallbackSrc:a,forceLoad:!e,...d}),_=!d.fill&&t===`intrinsic`?{width:`${d.width}px`,height:`${d.height}px`}:void 0,v=(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!d.fill&&t===`stretch`&&`komc:w-full komc:h-full`);return!a&&h&&c?d.fill?(0,o.jsx)(S,{className:l,children:c}):(0,o.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,o.jsx)(S,{className:l,children:c})}):d.fill?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:invisible`:`komc:visible`,s)}),(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]}):(0,o.jsxs)(`div`,{"data-komc":!0,style:_,className:v,children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(y({fill:d.fill,className:s}),e&&!m?`komc:invisible`:`komc:visible`)}),(0,o.jsx)(`div`,{className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]})}),S=({children:e,className:t})=>(0,o.jsx)(`div`,{"data-komc":!0,role:`alert`,className:(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var C=x;const w=(0,s.cva)((0,i.default)(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),T=(0,s.cva)(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function E({isOpen:e,onClose:t,direction:n=`bottom`,size:s=`full`,children:c,className:l,closeOnBackdropClick:u=!0,zIndex:d=1001}){let f=r.c(e,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else e||m(!1)},[e,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&t()},[t]),g=(0,a.useCallback)(()=>{u&&t()},[u,t]);return(0,a.useEffect)(()=>(e?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[e,h]),f?(0,o.jsxs)(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:(0,i.default)(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:g,"aria-label":`close sheet`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:(0,i.default)(w({direction:n,className:l}),T({direction:n,size:s})),role:`dialog`,"aria-modal":`true`,children:c})]}):null}function D({children:e,setOpen:t}){return(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const O=(0,s.cva)(t.y(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}}),k=(0,a.forwardRef)(({portal:e,children:t,className:n,placement:r,...i},a)=>(0,o.jsx)(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:O({portal:e,placement:r,className:n}),...i,children:t}));var A=k;const j=(0,s.cva)(t.y(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.y(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.y(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":t.y(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.y(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.y(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.y(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}}),M=({placement:e,className:t,offset:n,style:r,...i})=>{let s=(0,a.useMemo)(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return(0,o.jsx)(`div`,{className:j({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var N=M;const P=24,F=2,I=180,L=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function R({placement:e,className:t,content:n,open:r,hiddenRef:s,containerRef:c}){let[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(e),[m,h]=(0,a.useState)({top:0,left:0}),[g,_]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{d(!0)},[]);let v=(0,a.useCallback)(()=>{let t=c.current,n=s.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=e,[o]=a.split(`-`),l=r.top,u=window.innerHeight-r.bottom;o===`bottom`&&u<i.height&&l>=i.height?a=L(a,`top`):o===`top`&&l<i.height&&u>=i.height&&(a=L(a,`bottom`)),p(a);let[d,f]=a.split(`-`),m=r.top,g=r.left+r.width/2-i.width/2;switch(d){case`top`:m-=i.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:g+=i.width/2-24;break;case`end`:g-=i.width/2-24;break}let v=g,y=window.innerWidth;v+i.width>y-4&&(v=y-i.width-4),v<4&&(v=4),h({top:m,left:v}),_({x:g-v,y:0})},[e,c,s]);return(0,a.useEffect)(()=>{if(!u||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;v();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||v(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let o=0,s=0,l=``,d=()=>{if(e||o>=180)return;let t=c.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===l?s+=1:(s=0,l=n,v())}s<2&&(o+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[u,r,v,c]),u?(0,l.createPortal)((0,o.jsxs)(A,{portal:!0,"data-komc":!0,placement:f,className:(0,i.default)(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...m},children:[(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(N,{placement:f,offset:g})]}),document.body):null}const z=(0,a.forwardRef)(({children:e,content:t,defaultOpen:n=!1,className:s,placement:c=`top`},l)=>{let[u,d]=(0,a.useState)(n),f=(0,a.useRef)(null),p=(0,a.useRef)(null);return r.o({ref:f,setOpen:d}),(0,o.jsxs)(`div`,{ref:f,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[(0,o.jsx)(D,{setOpen:d,children:e}),(0,o.jsx)(R,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(A,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:c,className:(0,i.default)(`komc:opacity-0 komc:invisible`,s),children:(0,o.jsx)(`span`,{children:t})})]})});var B=z;exports.BaseImage=b,exports.Carousel=f,exports.CarouselItem=m,exports.CarouselNext=g,exports.CarouselPrevious=h,exports.CarouselWrapper=p,exports.Dialog=v,exports.EmptyNode=S,exports.Image=C,exports.Sheet=E,exports.Tooltip=B;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as UseSubsetImageProps, n as BaseProps
|
|
2
|
-
import
|
|
3
|
-
import * as react14 from "react";
|
|
1
|
+
import { a as UseSubsetImageProps, n as BaseProps } from "../index-ComhjQ-q.cjs";
|
|
2
|
+
import * as react3 from "react";
|
|
4
3
|
import React$1, { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
4
|
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
7
|
-
import
|
|
5
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
8
7
|
import { VariantProps } from "class-variance-authority";
|
|
9
8
|
|
|
10
9
|
//#region src/ui-client/carousel/carousel-context.d.ts
|
|
@@ -74,7 +73,7 @@ declare function CarouselNext({
|
|
|
74
73
|
declare const classes: (props?: ({
|
|
75
74
|
padding?: "none" | "sm" | "md" | "lg" | null | undefined;
|
|
76
75
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
77
|
-
} &
|
|
76
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
78
77
|
interface DialogProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
79
78
|
closeOnBackdropClick?: boolean;
|
|
80
79
|
isOpen: boolean;
|
|
@@ -103,37 +102,28 @@ type ImageSubsetProps = {
|
|
|
103
102
|
skeletonClassName?: string;
|
|
104
103
|
};
|
|
105
104
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
106
|
-
|
|
107
|
-
declare const BaseImage: react14.ForwardRefExoticComponent<(Omit<Omit<BaseProps, "apiClient"> & {
|
|
105
|
+
declare const BaseImage: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
108
106
|
fill: true;
|
|
109
107
|
sizes: string;
|
|
110
108
|
width?: never;
|
|
111
109
|
height?: never;
|
|
112
|
-
} & {
|
|
113
|
-
apiClient: ApiClient;
|
|
114
|
-
}, "ref"> | Omit<Omit<BaseProps, "apiClient"> & {
|
|
110
|
+
}, "ref"> | Omit<BaseProps & {
|
|
115
111
|
fill?: false;
|
|
116
112
|
sizes?: never;
|
|
117
113
|
width: number;
|
|
118
114
|
height: number;
|
|
119
|
-
} &
|
|
120
|
-
|
|
121
|
-
}, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
122
|
-
declare const Image: react14.ForwardRefExoticComponent<(Omit<Omit<BaseProps, "apiClient"> & {
|
|
115
|
+
}, "ref">) & react3.RefAttributes<HTMLImageElement>>;
|
|
116
|
+
declare const Image: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
123
117
|
fill: true;
|
|
124
118
|
sizes: string;
|
|
125
119
|
width?: never;
|
|
126
120
|
height?: never;
|
|
127
|
-
} & {
|
|
128
|
-
apiClient: ApiClient;
|
|
129
|
-
} & ImageSubsetProps, "ref"> | Omit<Omit<BaseProps, "apiClient"> & {
|
|
121
|
+
} & ImageSubsetProps, "ref"> | Omit<BaseProps & {
|
|
130
122
|
fill?: false;
|
|
131
123
|
sizes?: never;
|
|
132
124
|
width: number;
|
|
133
125
|
height: number;
|
|
134
|
-
} &
|
|
135
|
-
apiClient: ApiClient;
|
|
136
|
-
} & ImageSubsetProps, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
126
|
+
} & ImageSubsetProps, "ref">) & react3.RefAttributes<HTMLImageElement>>;
|
|
137
127
|
interface EmptyNodeProps {
|
|
138
128
|
children: React.ReactNode;
|
|
139
129
|
className?: string;
|
|
@@ -143,6 +133,30 @@ declare const EmptyNode: ({
|
|
|
143
133
|
className
|
|
144
134
|
}: EmptyNodeProps) => react_jsx_runtime2.JSX.Element;
|
|
145
135
|
//#endregion
|
|
136
|
+
//#region src/ui-client/sheet/sheet.d.ts
|
|
137
|
+
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
138
|
+
type Size = 'full' | 'half' | 'auto';
|
|
139
|
+
interface SheetProps {
|
|
140
|
+
isOpen: boolean;
|
|
141
|
+
onClose: () => void;
|
|
142
|
+
direction?: Direction;
|
|
143
|
+
size?: Size;
|
|
144
|
+
children: React$1.ReactNode;
|
|
145
|
+
className?: string;
|
|
146
|
+
closeOnBackdropClick?: boolean;
|
|
147
|
+
zIndex?: number;
|
|
148
|
+
}
|
|
149
|
+
declare function Sheet({
|
|
150
|
+
isOpen,
|
|
151
|
+
onClose,
|
|
152
|
+
direction,
|
|
153
|
+
size,
|
|
154
|
+
children,
|
|
155
|
+
className,
|
|
156
|
+
closeOnBackdropClick,
|
|
157
|
+
zIndex
|
|
158
|
+
}: SheetProps): react_jsx_runtime2.JSX.Element | null;
|
|
159
|
+
//#endregion
|
|
146
160
|
//#region src/ui-client/tooltip/tooltip-container.d.ts
|
|
147
161
|
type SubPlacement = 'start' | 'end';
|
|
148
162
|
type MainPlacement = 'top' | 'bottom';
|
|
@@ -153,6 +167,6 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
153
167
|
placement?: TooltipPlacement;
|
|
154
168
|
defaultOpen?: boolean;
|
|
155
169
|
}
|
|
156
|
-
declare const TooltipContainer:
|
|
170
|
+
declare const TooltipContainer: react3.ForwardRefExoticComponent<TooltipContainerProps & react3.RefAttributes<HTMLDivElement>>;
|
|
157
171
|
//#endregion
|
|
158
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type
|
|
172
|
+
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as UseSubsetImageProps, n as BaseProps
|
|
2
|
-
import { t as ApiClient } from "../index-DiZ4xS_f.mjs";
|
|
1
|
+
import { a as UseSubsetImageProps, n as BaseProps } from "../index-ByfkW7VU.mjs";
|
|
3
2
|
import * as react3 from "react";
|
|
4
3
|
import React$1, { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
6
5
|
import { VariantProps } from "class-variance-authority";
|
|
7
6
|
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
8
7
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
@@ -42,33 +41,33 @@ declare function Carousel({
|
|
|
42
41
|
className,
|
|
43
42
|
children,
|
|
44
43
|
...props
|
|
45
|
-
}: CarouselProps$1):
|
|
44
|
+
}: CarouselProps$1): react_jsx_runtime3.JSX.Element;
|
|
46
45
|
//#endregion
|
|
47
46
|
//#region src/ui-client/carousel/carousel-wrapper.d.ts
|
|
48
47
|
declare function CarouselWrapper({
|
|
49
48
|
className,
|
|
50
49
|
...props
|
|
51
|
-
}: React$1.ComponentProps<'div'>):
|
|
50
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime3.JSX.Element;
|
|
52
51
|
//#endregion
|
|
53
52
|
//#region src/ui-client/carousel/carousel-item.d.ts
|
|
54
53
|
declare function CarouselItem({
|
|
55
54
|
className,
|
|
56
55
|
...props
|
|
57
|
-
}: React$1.ComponentProps<'div'>):
|
|
56
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime3.JSX.Element;
|
|
58
57
|
//#endregion
|
|
59
58
|
//#region src/ui-client/carousel/carousel-previous.d.ts
|
|
60
59
|
declare function CarouselPrevious({
|
|
61
60
|
children,
|
|
62
61
|
className,
|
|
63
62
|
...props
|
|
64
|
-
}: React$1.ComponentProps<'button'>):
|
|
63
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime3.JSX.Element;
|
|
65
64
|
//#endregion
|
|
66
65
|
//#region src/ui-client/carousel/carousel-next.d.ts
|
|
67
66
|
declare function CarouselNext({
|
|
68
67
|
children,
|
|
69
68
|
className,
|
|
70
69
|
...props
|
|
71
|
-
}: React$1.ComponentProps<'button'>):
|
|
70
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime3.JSX.Element;
|
|
72
71
|
//#endregion
|
|
73
72
|
//#region src/ui-client/dialog/dialog.d.ts
|
|
74
73
|
declare const classes: (props?: ({
|
|
@@ -92,7 +91,7 @@ declare function Dialog({
|
|
|
92
91
|
onClose,
|
|
93
92
|
children,
|
|
94
93
|
...rest
|
|
95
|
-
}: DialogProps):
|
|
94
|
+
}: DialogProps): react_jsx_runtime3.JSX.Element | null;
|
|
96
95
|
//#endregion
|
|
97
96
|
//#region src/ui-client/image/image.d.ts
|
|
98
97
|
type ImageSubsetProps = {
|
|
@@ -103,36 +102,27 @@ type ImageSubsetProps = {
|
|
|
103
102
|
skeletonClassName?: string;
|
|
104
103
|
};
|
|
105
104
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
106
|
-
|
|
107
|
-
declare const BaseImage: react3.ForwardRefExoticComponent<(Omit<Omit<BaseProps, "apiClient"> & {
|
|
105
|
+
declare const BaseImage: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
108
106
|
fill: true;
|
|
109
107
|
sizes: string;
|
|
110
108
|
width?: never;
|
|
111
109
|
height?: never;
|
|
112
|
-
} & {
|
|
113
|
-
apiClient: ApiClient;
|
|
114
|
-
}, "ref"> | Omit<Omit<BaseProps, "apiClient"> & {
|
|
110
|
+
}, "ref"> | Omit<BaseProps & {
|
|
115
111
|
fill?: false;
|
|
116
112
|
sizes?: never;
|
|
117
113
|
width: number;
|
|
118
114
|
height: number;
|
|
119
|
-
} & {
|
|
120
|
-
apiClient: ApiClient;
|
|
121
115
|
}, "ref">) & react3.RefAttributes<HTMLImageElement>>;
|
|
122
|
-
declare const Image: react3.ForwardRefExoticComponent<(Omit<
|
|
116
|
+
declare const Image: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
123
117
|
fill: true;
|
|
124
118
|
sizes: string;
|
|
125
119
|
width?: never;
|
|
126
120
|
height?: never;
|
|
127
|
-
} & {
|
|
128
|
-
apiClient: ApiClient;
|
|
129
|
-
} & ImageSubsetProps, "ref"> | Omit<Omit<BaseProps, "apiClient"> & {
|
|
121
|
+
} & ImageSubsetProps, "ref"> | Omit<BaseProps & {
|
|
130
122
|
fill?: false;
|
|
131
123
|
sizes?: never;
|
|
132
124
|
width: number;
|
|
133
125
|
height: number;
|
|
134
|
-
} & {
|
|
135
|
-
apiClient: ApiClient;
|
|
136
126
|
} & ImageSubsetProps, "ref">) & react3.RefAttributes<HTMLImageElement>>;
|
|
137
127
|
interface EmptyNodeProps {
|
|
138
128
|
children: React.ReactNode;
|
|
@@ -141,7 +131,31 @@ interface EmptyNodeProps {
|
|
|
141
131
|
declare const EmptyNode: ({
|
|
142
132
|
children,
|
|
143
133
|
className
|
|
144
|
-
}: EmptyNodeProps) =>
|
|
134
|
+
}: EmptyNodeProps) => react_jsx_runtime3.JSX.Element;
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/ui-client/sheet/sheet.d.ts
|
|
137
|
+
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
138
|
+
type Size = 'full' | 'half' | 'auto';
|
|
139
|
+
interface SheetProps {
|
|
140
|
+
isOpen: boolean;
|
|
141
|
+
onClose: () => void;
|
|
142
|
+
direction?: Direction;
|
|
143
|
+
size?: Size;
|
|
144
|
+
children: React$1.ReactNode;
|
|
145
|
+
className?: string;
|
|
146
|
+
closeOnBackdropClick?: boolean;
|
|
147
|
+
zIndex?: number;
|
|
148
|
+
}
|
|
149
|
+
declare function Sheet({
|
|
150
|
+
isOpen,
|
|
151
|
+
onClose,
|
|
152
|
+
direction,
|
|
153
|
+
size,
|
|
154
|
+
children,
|
|
155
|
+
className,
|
|
156
|
+
closeOnBackdropClick,
|
|
157
|
+
zIndex
|
|
158
|
+
}: SheetProps): react_jsx_runtime3.JSX.Element | null;
|
|
145
159
|
//#endregion
|
|
146
160
|
//#region src/ui-client/tooltip/tooltip-container.d.ts
|
|
147
161
|
type SubPlacement = 'start' | 'end';
|
|
@@ -155,4 +169,4 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
155
169
|
}
|
|
156
170
|
declare const TooltipContainer: react3.ForwardRefExoticComponent<TooltipContainerProps & react3.RefAttributes<HTMLDivElement>>;
|
|
157
171
|
//#endregion
|
|
158
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type
|
|
172
|
+
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
package/dist/ui-client/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e}from"../util-Dtb82Us1.mjs";import{t}from"../skeleton-NTpsm0XR.mjs";import{c as n,o as r,r as i}from"../hooks-BDwkyixK.mjs";import{debounce as a}from"lodash-es";import o from"clsx";import s,{forwardRef as c,useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{cva as _}from"class-variance-authority";import v from"embla-carousel-react";import{createPortal as y}from"react-dom";const b=s.createContext(null);function x(){let e=s.useContext(b);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function S({orientation:t=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:o,...s}){let[c,d]=v({...n,axis:t===`horizontal`?`x`:`y`},i),[f,m]=p(!1),[g,_]=p(!1),y=l(e=>{e&&(m(e.canScrollPrev()),_(e.canScrollNext()))},[]),x=l(()=>{d?.scrollPrev()},[d]),S=l(()=>{d?.scrollNext()},[d]),C=l(e=>{t===`horizontal`?e.key===`ArrowLeft`?(e.preventDefault(),x()):e.key===`ArrowRight`&&(e.preventDefault(),S()):e.key===`ArrowUp`?(e.preventDefault(),x()):e.key===`ArrowDown`&&(e.preventDefault(),S())},[x,S,t]);return u(()=>{!d||!r||r(d)},[d,r]),u(()=>{if(d)return y(d),d.on(`reInit`,y),d.on(`select`,y),()=>{d?.off(`select`,y)}},[d,y]),h(b.Provider,{value:{carouselRef:c,api:d,options:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:x,scrollNext:S,canScrollPrev:f,canScrollNext:g},children:h(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:C,className:e(`komc:relative`,a),...s,children:o})})}function C({className:t,...n}){let{carouselRef:r,orientation:i}=x();return h(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:h(`div`,{className:e(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,t),...n})})}function w({className:t,...n}){let{orientation:r}=x();return h(`div`,{"data-komc":!0,className:e(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,t),...n})}function T({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:i}=x();return h(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`previous slide`,className:o(`komc:w-full`,t),onClick:r,...n,children:e})}function E({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:i}=x();return h(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`next slide`,className:o(`komc:w-full`,t),onClick:r,...n,children:e})}const D=_(`komc:relative komc:z-10 komc:w-full komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function O({closeOnBackdropClick:e=!0,isOpen:t,zIndex:r=1e4,padding:i,maxWidth:a,className:o,onClose:s,children:c,...d}){let f=n(t,300),[m,_]=p(!1);u(()=>{if(t&&f){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else t||_(!1)},[t,f]);let v=l(e=>{e.key===`Escape`&&s()},[s]),y=l(()=>{e&&s()},[e,s]);return u(()=>(t?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[t,v]),f?g(`div`,{"data-komc":!0,className:`komc:flex komc:justify-center komc:items-center komc:fixed komc:inset-0`,style:{zIndex:r},children:[h(`button`,{type:`button`,"data-state":m?`open`:`closed`,className:`komc:w-full komc:h-full komc:bg-black/50 komc:absolute komc:inset-0 komc:cursor-default komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:y,"aria-label":`close dialog`}),h(`div`,{"data-state":m?`open`:`closed`,className:`${D({padding:i,maxWidth:a,className:o})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:c})]}):null}const k=_(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),A=c(({...e},t)=>{let{ref:n,imageProps:r}=i({ref:t,...e});return h(`img`,{ref:n,...r})}),j=c(({skeleton:e=!0,layout:n=`stretch`,fallbackSrc:r,className:a,emptyNode:s,emptyNodeClassName:c,skeletonClassName:l,...u},d)=>{let{ref:f,isLoad:p,isError:_,imageProps:v}=i({ref:d,fallbackSrc:r,forceLoad:!e,...u}),y=!u.fill&&n===`intrinsic`?{width:`${u.width}px`,height:`${u.height}px`}:void 0,b=o(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!u.fill&&n===`stretch`&&`komc:w-full komc:h-full`);return!r&&_&&s?u.fill?h(M,{className:c,children:s}):h(`div`,{"data-komc":!0,style:y,className:b,children:h(M,{className:c,children:s})}):u.fill?g(m,{children:[h(`img`,{ref:f,...v,className:o(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!p?`komc:invisible`:`komc:visible`,a)}),h(`div`,{"data-komc":!0,className:o(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!p?`komc:block`:`komc:hidden`),children:h(t,{size:`full`,className:l})})]}):g(`div`,{"data-komc":!0,style:y,className:b,children:[h(`img`,{ref:f,...v,className:o(k({fill:u.fill,className:a}),e&&!p?`komc:invisible`:`komc:visible`)}),h(`div`,{className:o(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!p?`komc:block`:`komc:hidden`),children:h(t,{size:`full`,className:l})})]})}),M=({children:e,className:t})=>h(`div`,{"data-komc":!0,role:`alert`,className:o(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var N=j;function P({children:e,setOpen:t}){return h(`div`,{"data-komc":!0,className:o(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const F=_(e(`komc:absolute komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:``,false:``},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}});var I=c(({portal:e,children:t,className:n,placement:r,...i},a)=>h(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:F({portal:e,placement:r,className:n}),...i,children:t}));const L=_(e(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:e(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:e(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":e(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":e(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":e(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":e(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}});var R=({placement:e,className:t,offset:n,style:r,...i})=>{let a=d(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return h(`div`,{className:L({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const z=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function B({placement:e,className:t,content:n,open:r,hiddenRef:i,containerRef:s}){let[c,d]=p(!1),m=f(null),[_,v]=p(e),[b,x]=p({top:0,left:0}),[S,C]=p({x:0,y:0}),w=l(a(()=>{let e=s?.current,t=i.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft,[c,l]=_.split(`-`),u=a+n.top,d=o+n.left+n.width/2-r.width/2;switch(c){case`top`:u-=r.height;break;case`bottom`:u+=n.height;break}switch(l){case`start`:d+=r.width/2-24;break;case`end`:d-=r.width/2-24;break}let f=d,p=window.innerWidth;f+r.width>p-4&&(f=p-r.width-4),f<4&&(f=4),x({top:u,left:f}),C({x:d-f,y:0})},50),[_]),T=l(a(()=>{if(!i.current)return;let{top:t,height:n}=i.current.getBoundingClientRect();v(r=>{let i=e;return t+n>=window.innerHeight?i=z(r,`top`):t<0&&(i=z(r,`bottom`)),i})},50),[e]);return u(()=>(d(!0),T(),window.addEventListener(`scroll`,w,{passive:!0}),window.addEventListener(`resize`,w),window.addEventListener(`scroll`,T,{passive:!0}),window.addEventListener(`resize`,T),()=>{window.removeEventListener(`scroll`,w),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,T),window.removeEventListener(`resize`,T)}),[w,T]),u(()=>{c&&w()},[c,w]),c?y(g(I,{ref:m,portal:!0,"data-komc":!0,placement:_,className:o(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...b},children:[h(`span`,{children:n}),h(R,{placement:_,offset:S})]}),document.body):null}var V=c(({children:e,content:t,defaultOpen:n=!1,className:i,placement:a=`top`},s)=>{let[c,l]=p(n),u=f(null),d=f(null);return r({ref:u,setOpen:l}),g(`div`,{ref:u,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[h(P,{setOpen:l,children:e}),h(B,{placement:a,className:i,open:c,content:t,hiddenRef:d,containerRef:u}),h(I,{ref:d,role:`presentation`,"aria-hidden":`true`,placement:a,className:o(`komc:opacity-0 komc:invisible`,i),children:h(`span`,{children:t})})]})});export{A as BaseImage,S as Carousel,w as CarouselItem,E as CarouselNext,T as CarouselPrevious,C as CarouselWrapper,O as Dialog,M as EmptyNode,N as Image,V as Tooltip};
|
|
1
|
+
import"../src-C_FmOyer.mjs";import{y as e}from"../util-zXJA6Gnc.mjs";import{t}from"../skeleton-S6S1ZnCy.mjs";import{c as n,o as r,r as i}from"../hooks-DBo6LQrH.mjs";import"../providers-5JCPezAS.mjs";import a from"clsx";import o,{forwardRef as s,useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{cva as g}from"class-variance-authority";import _ from"embla-carousel-react";import{createPortal as v}from"react-dom";const y=o.createContext(null);function b(){let e=o.useContext(y);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function x({orientation:t=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:o,...s}){let[u,d]=_({...n,axis:t===`horizontal`?`x`:`y`},i),[p,h]=f(!1),[g,v]=f(!1),b=c(e=>{e&&(h(e.canScrollPrev()),v(e.canScrollNext()))},[]),x=c(()=>{d?.scrollPrev()},[d]),S=c(()=>{d?.scrollNext()},[d]),C=c(e=>{t===`horizontal`?e.key===`ArrowLeft`?(e.preventDefault(),x()):e.key===`ArrowRight`&&(e.preventDefault(),S()):e.key===`ArrowUp`?(e.preventDefault(),x()):e.key===`ArrowDown`&&(e.preventDefault(),S())},[x,S,t]);return l(()=>{!d||!r||r(d)},[d,r]),l(()=>{if(d)return b(d),d.on(`reInit`,b),d.on(`select`,b),()=>{d?.off(`select`,b)}},[d,b]),m(y.Provider,{value:{carouselRef:u,api:d,options:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:x,scrollNext:S,canScrollPrev:p,canScrollNext:g},children:m(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:C,className:e(`komc:relative`,a),...s,children:o})})}function S({className:t,...n}){let{carouselRef:r,orientation:i}=b();return m(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:m(`div`,{className:e(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,t),...n})})}function C({className:t,...n}){let{orientation:r}=b();return m(`div`,{"data-komc":!0,className:e(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,t),...n})}function w({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`previous slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}function T({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`next slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}const E=g(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function D({closeOnBackdropClick:e=!0,isOpen:t,zIndex:r=1e4,padding:i,maxWidth:a,className:o,onClose:s,children:u,...d}){let p=n(t,300),[g,_]=f(!1);l(()=>{if(t&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else t||_(!1)},[t,p]);let v=c(e=>{e.key===`Escape`&&s()},[s]),y=c(()=>{e&&s()},[e,s]);return l(()=>(t?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[t,v]),p?m(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:r},children:h(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:y,"aria-label":`close dialog`}),m(`div`,{"data-state":g?`open`:`closed`,className:`${E({padding:i,maxWidth:a,className:o})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const O=g(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),k=s(({...e},t)=>{let{ref:n,imageProps:r}=i({ref:t,...e});return m(`img`,{ref:n,...r})}),A=s(({skeleton:e=!0,layout:n=`stretch`,fallbackSrc:r,className:o,emptyNode:s,emptyNodeClassName:c,skeletonClassName:l,...u},d)=>{let{ref:f,isLoad:g,isError:_,imageProps:v}=i({ref:d,fallbackSrc:r,forceLoad:!e,...u}),y=!u.fill&&n===`intrinsic`?{width:`${u.width}px`,height:`${u.height}px`}:void 0,b=a(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!u.fill&&n===`stretch`&&`komc:w-full komc:h-full`);return!r&&_&&s?u.fill?m(j,{className:c,children:s}):m(`div`,{"data-komc":!0,style:y,className:b,children:m(j,{className:c,children:s})}):u.fill?h(p,{children:[m(`img`,{ref:f,...v,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:invisible`:`komc:visible`,o)}),m(`div`,{"data-komc":!0,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]}):h(`div`,{"data-komc":!0,style:y,className:b,children:[m(`img`,{ref:f,...v,className:a(O({fill:u.fill,className:o}),e&&!g?`komc:invisible`:`komc:visible`)}),m(`div`,{className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]})}),j=({children:e,className:t})=>m(`div`,{"data-komc":!0,role:`alert`,className:a(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var M=A;const N=g(a(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),P=g(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function F({isOpen:e,onClose:t,direction:r=`bottom`,size:i=`full`,children:o,className:s,closeOnBackdropClick:u=!0,zIndex:d=1001}){let p=n(e,300),[g,_]=f(!1);l(()=>{if(e&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else e||_(!1)},[e,p]);let v=c(e=>{e.key===`Escape`&&t()},[t]),y=c(()=>{u&&t()},[u,t]);return l(()=>(e?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[e,v]),p?h(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:a(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:y,"aria-label":`close sheet`}),m(`div`,{"data-state":g?`open`:`closed`,className:a(N({direction:r,className:s}),P({direction:r,size:i})),role:`dialog`,"aria-modal":`true`,children:o})]}):null}function I({children:e,setOpen:t}){return m(`div`,{"data-komc":!0,className:a(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const L=g(e(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}});var R=s(({portal:e,children:t,className:n,placement:r,...i},a)=>m(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:L({portal:e,placement:r,className:n}),...i,children:t}));const z=g(e(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:e(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:e(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":e(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":e(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":e(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":e(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}});var B=({placement:e,className:t,offset:n,style:r,...i})=>{let a=u(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return m(`div`,{className:z({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const V=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function H({placement:e,className:t,content:n,open:r,hiddenRef:i,containerRef:o}){let[s,u]=f(!1),[d,p]=f(e),[g,_]=f({top:0,left:0}),[y,b]=f({x:0,y:0});l(()=>{u(!0)},[]);let x=c(()=>{let t=o.current,n=i.current;if(!t||!n)return;let r=t.getBoundingClientRect(),a=n.getBoundingClientRect(),s=e,[c]=s.split(`-`),l=r.top,u=window.innerHeight-r.bottom;c===`bottom`&&u<a.height&&l>=a.height?s=V(s,`top`):c===`top`&&l<a.height&&u>=a.height&&(s=V(s,`bottom`)),p(s);let[d,f]=s.split(`-`),m=r.top,h=r.left+r.width/2-a.width/2;switch(d){case`top`:m-=a.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:h+=a.width/2-24;break;case`end`:h-=a.width/2-24;break}let g=h,v=window.innerWidth;g+a.width>v-4&&(g=v-a.width-4),g<4&&(g=4),_({top:m,left:g}),b({x:h-g,y:0})},[e,o,i]);return l(()=>{if(!s||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;x();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||x(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let c=0,l=0,u=``,d=()=>{if(e||c>=180)return;let t=o.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===u?l+=1:(l=0,u=n,x())}l<2&&(c+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[s,r,x,o]),s?v(h(R,{portal:!0,"data-komc":!0,placement:d,className:a(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...g},children:[m(`span`,{children:n}),m(B,{placement:d,offset:y})]}),document.body):null}var U=s(({children:e,content:t,defaultOpen:n=!1,className:i,placement:o=`top`},s)=>{let[c,l]=f(n),u=d(null),p=d(null);return r({ref:u,setOpen:l}),h(`div`,{ref:u,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[m(I,{setOpen:l,children:e}),m(H,{placement:o,className:i,open:c,content:t,hiddenRef:p,containerRef:u}),m(R,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:o,className:a(`komc:opacity-0 komc:invisible`,i),children:m(`span`,{children:t})})]})});export{k as BaseImage,x as Carousel,C as CarouselItem,T as CarouselNext,w as CarouselPrevious,S as CarouselWrapper,D as Dialog,j as EmptyNode,M as Image,F as Sheet,U as Tooltip};
|
package/dist/util/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../util-
|
|
1
|
+
const e=require(`../util-o7fjt7iK.cjs`);exports.appendSearchPath=e.z,exports.calcPageCount=e.v,exports.clearQueryByKey=e.B,exports.clearSearchPath=e.V,exports.cn=e.y,exports.comparePriorityAsc=e.b,exports.composeKey=e.x,exports.deleteAllSearchHistory=e.H,exports.deleteSearchHistory=e.U,exports.displayDatetime=e._,exports.existLeastOne=e.S,exports.formatBytes=e.d,exports.formatCompactNumber=e.o,exports.formatExceedNumber=e.s,exports.formatI18nNumber=e.c,exports.formatKoNumber=e.l,exports.genNanoID=e.t,exports.generatePage=e.n,exports.generatePageGroup=e.r,exports.getCookie=e.W,exports.getFileExtension=e.f,exports.getFilename=e.p,exports.getFirstLocationAddress=e.C,exports.getFullAddress=e.w,exports.getI18nKey=e.T,exports.getI18nValue=e.E,exports.getI18nValues=e.D,exports.getModelName=e.O,exports.getSearchHistory=e.G,exports.getYoutubeVideoId=e.K,exports.insertSearchHistory=e.q,exports.isExternalSrc=e.m,exports.isSearchPage=e.J,exports.isSrcSetCompatible=e.h,exports.link=e.k,exports.loadExLib=e.A,exports.parsePath=e.g,exports.parseQuery=e.j,exports.printNanoID=e.i,exports.productSlugify=e.M,exports.randomNum=e.a,exports.recomposeI18nNumber=e.u,exports.selectItemByWeight=e.N,exports.setCookies=e.Y,exports.shuffle=e.P,exports.sleep=e.F,exports.slugify=e.I,exports.withoutProperties=e.L,exports.withoutProperty=e.R;
|
package/dist/util/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,Y as S,_ as C,a as w,b as T,c as E,d as D,f as O,g as k,h as A,i as j,j as M,k as N,l as P,m as F,n as I,o as L,p as R,q as z,r as B,s as V,t as H,u as U,v as W,w as G,x as K,y as q,z as J}from"../util-
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,Y as S,_ as C,a as w,b as T,c as E,d as D,f as O,g as k,h as A,i as j,j as M,k as N,l as P,m as F,n as I,o as L,p as R,q as z,r as B,s as V,t as H,u as U,v as W,w as G,x as K,y as q,z as J}from"../util-zXJA6Gnc.mjs";export{J as appendSearchPath,W as calcPageCount,t as clearQueryByKey,b as clearSearchPath,q as cn,T as comparePriorityAsc,K as composeKey,s as deleteAllSearchHistory,y as deleteSearchHistory,C as displayDatetime,_ as existLeastOne,D as formatBytes,L as formatCompactNumber,V as formatExceedNumber,E as formatI18nNumber,P as formatKoNumber,H as genNanoID,I as generatePage,B as generatePageGroup,x as getCookie,O as getFileExtension,R as getFilename,n as getFirstLocationAddress,G as getFullAddress,v as getI18nKey,i as getI18nValue,r as getI18nValues,m as getModelName,o as getSearchHistory,u as getYoutubeVideoId,z as insertSearchHistory,F as isExternalSrc,l as isSearchPage,A as isSrcSetCompatible,N as link,e as loadExLib,k as parsePath,M as parseQuery,j as printNanoID,f as productSlugify,w as randomNum,U as recomposeI18nNumber,p as selectItemByWeight,S as setCookies,h as shuffle,a as sleep,c as slugify,d as withoutProperties,g as withoutProperty};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@machinerd/js-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"import": "./dist/hooks/index.mjs",
|
|
29
29
|
"require": "./dist/hooks/index.cjs"
|
|
30
30
|
},
|
|
31
|
+
"./providers": {
|
|
32
|
+
"import": "./dist/providers/index.mjs",
|
|
33
|
+
"require": "./dist/providers/index.cjs"
|
|
34
|
+
},
|
|
31
35
|
"./styles/index.css": "./dist/styles/index.css"
|
|
32
36
|
},
|
|
33
37
|
"keywords": [],
|
package/dist/hooks-BDwkyixK.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,h as t,m as n}from"./util-Dtb82Us1.mjs";import{throttle as r}from"lodash-es";import{useCallback as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";function l(e,t){let[n,r]=c(!1);return a(()=>{let i;return e&&!n?r(!0):!e&&n&&(i=setTimeout(()=>r(!1),t)),()=>clearTimeout(i)},[e,t,n]),n}function u(e=1){let t=s(null),[n,r]=c(!1),[i,a]=c(0),[o,l]=c(0),u=s(!1);return{ref:t,onMouseDown:e=>{t.current&&(r(!0),u.current=!1,a(e.pageX-t.current.offsetLeft),l(t.current.scrollLeft))},onMouseLeave:()=>r(!1),onMouseUp:()=>r(!1),onMouseMove:r=>{if(!n||!t.current)return;r.preventDefault();let a=(r.pageX-t.current.offsetLeft-i)*e;Math.abs(a)>10&&(u.current=!0),t.current.scrollLeft=o-a},onClickCapture:e=>{u.current&&(e.stopPropagation(),e.preventDefault())}}}function d({ref:e,setOpen:t}){let n=i(n=>{e.current?.contains(n.target)||t(!1)},[e,t]);a(()=>(document.addEventListener(`mousedown`,n),document.addEventListener(`touchstart`,n),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`touchstart`,n)}),[n])}const f=[`mouse`,`touch`];function p({open:e,type:t=f}){let n=i(e=>{e.preventDefault()},[]),r=i(e=>{e.preventDefault()},[]);a(()=>{let i=e&&t.includes(`mouse`),a=e&&t.includes(`touch`);return i?(document.body.classList.add(`overflow-hidden`),document.addEventListener(`wheel`,r,{passive:!1})):(document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`wheel`,r)),a?document.addEventListener(`touchmove`,n,{passive:!1}):document.removeEventListener(`touchmove`,n),()=>{document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`touchmove`,n),document.removeEventListener(`wheel`,r)}},[e,t,n,r])}function m({enabled:e=!0,behavior:t=`smooth`}={}){let[n,r]=c(!1),o=s(null),l=i(()=>{window.scrollTo({top:0,behavior:t})},[t]);return a(()=>{let t=o.current;if(!t||!e){r(!1);return}let n=new IntersectionObserver(e=>{let t=e[0];t&&r(!t.isIntersecting)},{root:null,rootMargin:`0px`,threshold:0});return n.observe(t),()=>n.disconnect()},[e]),{isVisible:n,handleScrolToTop:l,ref:o}}const h=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function g({ref:r,src:l,forceLoad:u=!1,folder:d=`media`,fallbackSrc:f,origin:p,originalWidth:m,loading:g=`lazy`,apiClient:_,...v}){let[y,b]=c(0),[x,S]=c(u||!l),[C,w]=c(!l),T=s(null),E=s(null),D=i(e=>{T.current=e,typeof r==`function`?r(e):r&&(r.current=e)},[r]),O=i((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?_.cdnStatic(n):_.cdnMedia(n)},[_]),k=o(()=>h.filter(e=>e<=m),[m]),A=o(()=>n(l)?l:O(l,d),[O,l,d]),j=o(()=>{if(p||!t(l)||k.length===0)return;let{filenameWithoutExtension:n,directory:r}=e(l,d);if(v.width){let e=k.find(e=>e>=v.width)??k[k.length-1],t=e*2,i=k.find(e=>e>=t)??k[k.length-1];return`${O(`${r}/subsets/w${e}/${n}.webp`,d)} 1x,${O(`${r}/subsets/w${i}/${n}.webp`,d)} 2x`}let i=``;for(let e of k)i+=`${O(`${r}/subsets/w${e}/${n}.webp`,d)} ${e}w, `;return i.trim()},[k,O,d,p,l,v.width]),M=i((t,n)=>{let{filenameWithoutExtension:r,directory:i}=e(t,n);return`${O(`${i}/subsets/origin/${r}.webp`,n)}`},[O]),N=o(()=>{if(l)return`${M(l,d)} 1x`},[l,d,M]),P=i(e=>{b(t=>t>=2?(e&&(E.current=e),3):t+1)},[]),F=(()=>{if(y===0)return j;if(y===1)return N}),I=y>=3?f:A,L=y===0?v.sizes:void 0,R=y>0?`eager`:g;a(()=>{y<3||w(!0)},[y]),a(()=>{let e=T.current;if(!e||C)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){P();return}if(e.complete&&e.naturalWidth>0){S(!0);return}let t=()=>{e.naturalWidth>0&&S(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[C,y,P]);let{fill:z,...B}=v;return{ref:D,isLoad:x,isError:C,imageProps:{...B,src:I,srcSet:F(),sizes:L,loading:R,onError:C?void 0:P}}}function _(e=1280){let[t,n]=c(e);return a(()=>{let e=r(()=>{let e=window.innerWidth;n(e)},200);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),{windowSize:t}}export{p as a,l as c,m as i,h as n,d as o,g as r,u as s,_ as t};
|
package/dist/hooks-D1JcFVTH.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./util-1BLWEgZB.cjs`);let n=require(`lodash-es`),r=require(`react`);function i(e,t){let[n,i]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let r;return e&&!n?i(!0):!e&&n&&(r=setTimeout(()=>i(!1),t)),()=>clearTimeout(r)},[e,t,n]),n}function a(e=1){let t=(0,r.useRef)(null),[n,i]=(0,r.useState)(!1),[a,o]=(0,r.useState)(0),[s,c]=(0,r.useState)(0),l=(0,r.useRef)(!1);return{ref:t,onMouseDown:e=>{t.current&&(i(!0),l.current=!1,o(e.pageX-t.current.offsetLeft),c(t.current.scrollLeft))},onMouseLeave:()=>i(!1),onMouseUp:()=>i(!1),onMouseMove:r=>{if(!n||!t.current)return;r.preventDefault();let i=(r.pageX-t.current.offsetLeft-a)*e;Math.abs(i)>10&&(l.current=!0),t.current.scrollLeft=s-i},onClickCapture:e=>{l.current&&(e.stopPropagation(),e.preventDefault())}}}function o({ref:e,setOpen:t}){let n=(0,r.useCallback)(n=>{e.current?.contains(n.target)||t(!1)},[e,t]);(0,r.useEffect)(()=>(document.addEventListener(`mousedown`,n),document.addEventListener(`touchstart`,n),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`touchstart`,n)}),[n])}const s=[`mouse`,`touch`];function c({open:e,type:t=s}){let n=(0,r.useCallback)(e=>{e.preventDefault()},[]),i=(0,r.useCallback)(e=>{e.preventDefault()},[]);(0,r.useEffect)(()=>{let r=e&&t.includes(`mouse`),a=e&&t.includes(`touch`);return r?(document.body.classList.add(`overflow-hidden`),document.addEventListener(`wheel`,i,{passive:!1})):(document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`wheel`,i)),a?document.addEventListener(`touchmove`,n,{passive:!1}):document.removeEventListener(`touchmove`,n),()=>{document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`touchmove`,n),document.removeEventListener(`wheel`,i)}},[e,t,n,i])}function l({enabled:e=!0,behavior:t=`smooth`}={}){let[n,i]=(0,r.useState)(!1),a=(0,r.useRef)(null),o=(0,r.useCallback)(()=>{window.scrollTo({top:0,behavior:t})},[t]);return(0,r.useEffect)(()=>{let t=a.current;if(!t||!e){i(!1);return}let n=new IntersectionObserver(e=>{let t=e[0];t&&i(!t.isIntersecting)},{root:null,rootMargin:`0px`,threshold:0});return n.observe(t),()=>n.disconnect()},[e]),{isVisible:n,handleScrolToTop:o,ref:a}}const u=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function d({ref:e,src:n,forceLoad:i=!1,folder:a=`media`,fallbackSrc:o,origin:s,originalWidth:c,loading:l=`lazy`,apiClient:d,...f}){let[p,m]=(0,r.useState)(0),[h,g]=(0,r.useState)(i||!n),[_,v]=(0,r.useState)(!n),y=(0,r.useRef)(null),b=(0,r.useRef)(null),x=(0,r.useCallback)(t=>{y.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),S=(0,r.useCallback)((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?d.cdnStatic(n):d.cdnMedia(n)},[d]),C=(0,r.useMemo)(()=>u.filter(e=>e<=c),[c]),w=(0,r.useMemo)(()=>t.m(n)?n:S(n,a),[S,n,a]),T=(0,r.useMemo)(()=>{if(s||!t.h(n)||C.length===0)return;let{filenameWithoutExtension:e,directory:r}=t.g(n,a);if(f.width){let t=C.find(e=>e>=f.width)??C[C.length-1],n=t*2,i=C.find(e=>e>=n)??C[C.length-1];return`${S(`${r}/subsets/w${t}/${e}.webp`,a)} 1x,${S(`${r}/subsets/w${i}/${e}.webp`,a)} 2x`}let i=``;for(let t of C)i+=`${S(`${r}/subsets/w${t}/${e}.webp`,a)} ${t}w, `;return i.trim()},[C,S,a,s,n,f.width]),E=(0,r.useCallback)((e,n)=>{let{filenameWithoutExtension:r,directory:i}=t.g(e,n);return`${S(`${i}/subsets/origin/${r}.webp`,n)}`},[S]),D=(0,r.useMemo)(()=>{if(n)return`${E(n,a)} 1x`},[n,a,E]),O=(0,r.useCallback)(e=>{m(t=>t>=2?(e&&(b.current=e),3):t+1)},[]),k=(()=>{if(p===0)return T;if(p===1)return D}),A=p>=3?o:w,j=p===0?f.sizes:void 0,M=p>0?`eager`:l;(0,r.useEffect)(()=>{p<3||v(!0)},[p]),(0,r.useEffect)(()=>{let e=y.current;if(!e||_)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){O();return}if(e.complete&&e.naturalWidth>0){g(!0);return}let t=()=>{e.naturalWidth>0&&g(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[_,p,O]);let{fill:N,...P}=f;return{ref:x,isLoad:h,isError:_,imageProps:{...P,src:A,srcSet:k(),sizes:j,loading:M,onError:_?void 0:O}}}function f(e=1280){let[t,i]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let e=(0,n.throttle)(()=>{let e=window.innerWidth;i(e)},200);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),{windowSize:t}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|