@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,t,l)=>{let o={[`--top${e}`]:"auto",[`--${l+e}`]:"0",[`--pos${e}`]:"fixed"};return"after-first-cart-button"===t&&(o[`--d${e}`]="none"),o},displayConditionStyle=(e,t)=>({...getDisplayStyle("",e?.desktop,t?.desktop),...getDisplayStyle("-tablet",e?.tablet??e?.desktop,t?.tablet??t?.desktop),...getDisplayStyle("-mobile",e?.mobile??e?.desktop,t?.mobile??t?.desktop)}),getContainerStyles=e=>{let{style:t,position:l,display:o}=e;return{margin:"0 auto",...getStylePadding(t),...displayConditionStyle(o,l),"z-index":_const.ELEMENT_Z_INDEX.STICKY}},getContentStyles=e=>{let{style:t,width:l,background:o}=e;return{...core.makeStyle({m:"0 auto"}),...core.makeStyleResponsive("w",l),...filterStyles(t),...core.getStyleBackgroundByDevice(o),...core.getGradientBgrStyleByDevice(o)}},getStylePadding=e=>{let t=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"],l={};return t.forEach(t=>{e?.[t]&&(l[t]=e[t])}),l},filterStyles=e=>{let t={...e},l=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"];return l.forEach(e=>{delete t?.[e]}),t};exports.displayConditionStyle=displayConditionStyle,exports.filterStyles=filterStyles,exports.getContainerStyles=getContainerStyles,exports.getContentStyles=getContentStyles,exports.getDisplayStyle=getDisplayStyle,exports.getStylePadding=getStylePadding;
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),i=core.usePageStore(e=>"interaction"===e.sidebarMode),l=core.useCurrentDevice(),r=(e,t)=>({[`--left${t}`]:"top"==e?"0":"50%",[`--t${t}`]:"top"==e?"unset":"translateX(-50%)"}),p=React.useMemo(()=>({...r(o?.desktop,""),...r(o?.tablet??o?.desktop,"-tablet"),...r(o?.mobile??o?.desktop,"-mobile")}),[o?.desktop,o?.mobile,o?.tablet]),b=React.useMemo(()=>{if(i&&o?.[l]==="top")return"40px"},[l,i,o]),c=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]),d=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=React.useMemo(()=>({"--pos":"fixed","--pos-tablet":"fixed","--pos-mobile":"fixed"}),[]);return{w:a,displayStyle:d,positionStyle:u,getCSSAlign:p,makeDisplaySettingStyles:c}};exports.default=useSticky;
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 p}from"../../../common/const.js";let getDisplayStyle=(t,e,l)=>{let o={[`--top${t}`]:"auto",[`--${l+t}`]:"0",[`--pos${t}`]:"fixed"};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":p.STICKY}},getContentStyles=p=>{let{style:i,width:r,background:a}=p;return{...t({m:"0 auto"}),...e("w",r),...filterStyles(i),...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
+ 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 i}from"react";let useSticky=a=>{let{width:p,position:s}=a??{},b=t(t=>t.isStickyVisible),d=e("w",p),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=i(()=>({...m(s?.desktop,""),...m(s?.tablet??s?.desktop,"-tablet"),...m(s?.mobile??s?.desktop,"-mobile")}),[s?.desktop,s?.mobile,s?.tablet]),f=i(()=>{if(r&&s?.[k]==="top")return"40px"},[k,r,s]),c=i(()=>({"--d":a?.display?.desktop!=="after-first-cart-button"||b?"block":"none","--d-tablet":a?.display?.tablet!=="after-first-cart-button"||b?"block":"none","--d-mobile":a?.display?.mobile!=="after-first-cart-button"||b?"block":"none"}),[b,a?.display?.desktop,a?.display?.mobile,a?.display?.tablet]),u=i(()=>({"--top":f??"auto","--top-tablet":f??"auto","--top-mobile":f??"auto",[`--${s?.desktop}`]:f??"0px",[`--${s?.tablet??s?.desktop}-tablet`]:f??"0px",[`--${s?.mobile??s?.desktop}-mobile`]:f??"0px"}),[f,s?.desktop,s?.mobile,s?.tablet]),y=i(()=>({"--pos":"fixed","--pos-tablet":"fixed","--pos-mobile":"fixed"}),[]);return{w:d,displayStyle:u,positionStyle:y,getCSSAlign:n,makeDisplaySettingStyles:c}};export{useSticky as default};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.744",
3
+ "version": "2.0.0-staging.745",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",