@gem-sdk/components 2.0.0-staging.744 → 2.0.0-staging.745
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");require("react/jsx-runtime"),require("react");var _const=require("../../../common/const.js");const getDisplayStyle=(e,
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");require("react/jsx-runtime"),require("react");var _const=require("../../../common/const.js");const getCSSPosition=t=>"top"==t?"sticky":"fixed",getDisplayStyle=(t,e,l)=>{let o={[`--top${t}`]:"auto",[`--${l+t}`]:"0",[`--pos${t}`]:getCSSPosition(l)};return"after-first-cart-button"===e&&(o[`--d${t}`]="none"),o},displayConditionStyle=(t,e)=>({...getDisplayStyle("",t?.desktop,e?.desktop),...getDisplayStyle("-tablet",t?.tablet??t?.desktop,e?.tablet??e?.desktop),...getDisplayStyle("-mobile",t?.mobile??t?.desktop,e?.mobile??e?.desktop)}),getContainerStyles=t=>{let{style:e,position:l,display:o}=t;return{margin:"0 auto",...getStylePadding(e),...displayConditionStyle(o,l),"z-index":_const.ELEMENT_Z_INDEX.STICKY}},getContentStyles=t=>{let{style:e,width:l,background:o}=t;return{...core.makeStyle({m:"0 auto"}),...core.makeStyleResponsive("w",l),...filterStyles(e),...core.getStyleBackgroundByDevice(o),...core.getGradientBgrStyleByDevice(o)}},getStylePadding=t=>{let e=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"],l={};return e.forEach(e=>{t?.[e]&&(l[e]=t[e])}),l},filterStyles=t=>{let e={...t},l=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"];return l.forEach(t=>{delete e?.[t]}),e};exports.displayConditionStyle=displayConditionStyle,exports.filterStyles=filterStyles,exports.getContainerStyles=getContainerStyles,exports.getContentStyles=getContentStyles,exports.getDisplayStyle=getDisplayStyle,exports.getStylePadding=getStylePadding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),React=require("react");const useSticky=e=>{let{width:t,position:o}=e??{},s=core.useStickyStore(e=>e.isStickyVisible),a=core.makeStyleResponsive("w",t),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),React=require("react");const useSticky=e=>{let{width:t,position:o}=e??{},s=core.useStickyStore(e=>e.isStickyVisible),a=core.makeStyleResponsive("w",t),l=core.usePageStore(e=>"interaction"===e.sidebarMode),i=core.useCurrentDevice(),p=(e,t)=>({[`--left${t}`]:"top"==e?"0":"50%",[`--t${t}`]:"top"==e?"unset":"translateX(-50%)"}),r=React.useMemo(()=>({...p(o?.desktop,""),...p(o?.tablet??o?.desktop,"-tablet"),...p(o?.mobile??o?.desktop,"-mobile")}),[o?.desktop,o?.mobile,o?.tablet]),b=React.useMemo(()=>{if(l&&o?.[i]==="top")return"40px"},[i,l,o]),d=React.useMemo(()=>({"--d":e?.display?.desktop!=="after-first-cart-button"||s?"block":"none","--d-tablet":e?.display?.tablet!=="after-first-cart-button"||s?"block":"none","--d-mobile":e?.display?.mobile!=="after-first-cart-button"||s?"block":"none"}),[s,e?.display?.desktop,e?.display?.mobile,e?.display?.tablet]),c=React.useMemo(()=>({"--top":b??"auto","--top-tablet":b??"auto","--top-mobile":b??"auto",[`--${o?.desktop}`]:b??"0px",[`--${o?.tablet??o?.desktop}-tablet`]:b??"0px",[`--${o?.mobile??o?.desktop}-mobile`]:b??"0px"}),[b,o?.desktop,o?.mobile,o?.tablet]),u=e=>"top"==e?"sticky":"fixed",k=()=>({"--pos":u(o?.desktop),"--pos-tablet":u(o?.tablet??o?.desktop),"--pos-mobile":u(o?.mobile??o?.desktop)});return{w:a,displayStyle:c,positionStyle:k,getCSSAlign:r,makeDisplaySettingStyles:d}};exports.default=useSticky;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeStyle as t,makeStyleResponsive as e,getStyleBackgroundByDevice as l,getGradientBgrStyleByDevice as o}from"@gem-sdk/core";import"react/jsx-runtime";import"react";import{ELEMENT_Z_INDEX as
|
|
1
|
+
import{makeStyle as t,makeStyleResponsive as e,getStyleBackgroundByDevice as l,getGradientBgrStyleByDevice as o}from"@gem-sdk/core";import"react/jsx-runtime";import"react";import{ELEMENT_Z_INDEX as i}from"../../../common/const.js";let getCSSPosition=t=>"top"==t?"sticky":"fixed",getDisplayStyle=(t,e,l)=>{let o={[`--top${t}`]:"auto",[`--${l+t}`]:"0",[`--pos${t}`]:getCSSPosition(l)};return"after-first-cart-button"===e&&(o[`--d${t}`]="none"),o},displayConditionStyle=(t,e)=>({...getDisplayStyle("",t?.desktop,e?.desktop),...getDisplayStyle("-tablet",t?.tablet??t?.desktop,e?.tablet??e?.desktop),...getDisplayStyle("-mobile",t?.mobile??t?.desktop,e?.mobile??e?.desktop)}),getContainerStyles=t=>{let{style:e,position:l,display:o}=t;return{margin:"0 auto",...getStylePadding(e),...displayConditionStyle(o,l),"z-index":i.STICKY}},getContentStyles=i=>{let{style:p,width:r,background:a}=i;return{...t({m:"0 auto"}),...e("w",r),...filterStyles(p),...l(a),...o(a)}},getStylePadding=t=>{let e=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"],l={};return e.forEach(e=>{t?.[e]&&(l[e]=t[e])}),l},filterStyles=t=>{let e={...t},l=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"];return l.forEach(t=>{delete e?.[t]}),e};export{displayConditionStyle,filterStyles,getContainerStyles,getContentStyles,getDisplayStyle,getStylePadding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useStickyStore as t,makeStyleResponsive as e,usePageStore as o,useCurrentDevice as l}from"@gem-sdk/core";import{useMemo as
|
|
1
|
+
import{useStickyStore as t,makeStyleResponsive as e,usePageStore as o,useCurrentDevice as l}from"@gem-sdk/core";import{useMemo as p}from"react";let useSticky=i=>{let{width:s,position:a}=i??{},b=t(t=>t.isStickyVisible),d=e("w",s),r=o(t=>"interaction"===t.sidebarMode),k=l(),m=(t,e)=>({[`--left${e}`]:"top"==t?"0":"50%",[`--t${e}`]:"top"==t?"unset":"translateX(-50%)"}),n=p(()=>({...m(a?.desktop,""),...m(a?.tablet??a?.desktop,"-tablet"),...m(a?.mobile??a?.desktop,"-mobile")}),[a?.desktop,a?.mobile,a?.tablet]),c=p(()=>{if(r&&a?.[k]==="top")return"40px"},[k,r,a]),f=p(()=>({"--d":i?.display?.desktop!=="after-first-cart-button"||b?"block":"none","--d-tablet":i?.display?.tablet!=="after-first-cart-button"||b?"block":"none","--d-mobile":i?.display?.mobile!=="after-first-cart-button"||b?"block":"none"}),[b,i?.display?.desktop,i?.display?.mobile,i?.display?.tablet]),u=p(()=>({"--top":c??"auto","--top-tablet":c??"auto","--top-mobile":c??"auto",[`--${a?.desktop}`]:c??"0px",[`--${a?.tablet??a?.desktop}-tablet`]:c??"0px",[`--${a?.mobile??a?.desktop}-mobile`]:c??"0px"}),[c,a?.desktop,a?.mobile,a?.tablet]),y=t=>"top"==t?"sticky":"fixed",x=()=>({"--pos":y(a?.desktop),"--pos-tablet":y(a?.tablet??a?.desktop),"--pos-mobile":y(a?.mobile??a?.desktop)});return{w:d,displayStyle:u,positionStyle:x,getCSSAlign:n,makeDisplaySettingStyles:f}};export{useSticky as default};
|