@gem-sdk/components 2.0.0-staging.934 → 2.0.0-staging.936

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");const filterStyles=e=>{let t=["--mb","--mb-mobile","--mb-tablet"];return t.forEach(t=>{delete e?.[t]}),e},getStyleContainerIconlistMain=({styles:e,style:t,type:o})=>{let{background:l,align:r}=e??{};return{...t="react"===o?filterStyles(t):t,...core.getStyleBackgroundByDevice(l),...core.makeStyleResponsive("jc",r),...core.makeStyleResponsive("d",{desktop:"flex",tablet:"flex",mobile:"flex"}),...core.getGradientBgrStyleByDevice(l,{desktop:!0,tablet:!0,mobile:!0})}},getStyleWraplistIcon=({styles:e})=>{let{panelAlign:t,contentBoxPadding:o,contentBoxWidth:l}=e??{};return{...core.getResponsiveStylePadding(o),...core.makeStyleResponsive("w",l),...core.makeStyleResponsive("jc",t)}},getStyleColListIcon=({styles:e})=>{let{verticalSpacing:t}=e??{};return{...core.makeStyleResponsive("rg",t)}},getStyleWrapItemIcon=({styles:e})=>{let{horizontalSpacing:t,position:o}=e??{};return{...core.makeStyleResponsive("cg",t),...core.makeStyleResponsive("ai",o)}},getStyleWrapIcon=({styles:e,setting:t})=>{let{iconBorder:o,backgroundColor:l,iconRounded:r}=e??{},{globalSize:i}=t??{},s=core.makeGlobalSize(i);return{...s.padding,...core.makeStyle({bs:o?.border,bw:o?.width,bc:core.getSingleColorVariable(o?.color),bg:l,bblr:r?.bblr,bbrr:r?.bbrr,btlr:r?.btlr,btrr:r?.btrr}),...core.makeStyleResponsive("pos",{desktop:"relative",tablet:"relative",mobile:"relative"}),...core.makeStyleResponsive("top",{desktop:"inherit",tablet:"inherit",mobile:"inherit"})}},getStyleIcon=({styles:e,setting:t})=>{let{iconColor:o}=e||{},{iconWidth:l}=t??{};return{"--c":core.getSingleColorVariable(o),"--w":"100%","--h":"100%","--size-desktop":`${l?.desktop}px`,"--size-tablet":`${l?.tablet||l?.desktop}px`,"--size-mobile":`${l?.mobile||l?.tablet||l?.desktop}px`}},getStyleTypoText=({setting:e})=>({typo:e?.textTypo});exports.getStyleColListIcon=getStyleColListIcon,exports.getStyleContainerIconlistMain=getStyleContainerIconlistMain,exports.getStyleIcon=getStyleIcon,exports.getStyleTypoText=getStyleTypoText,exports.getStyleWrapIcon=getStyleWrapIcon,exports.getStyleWrapItemIcon=getStyleWrapItemIcon,exports.getStyleWraplistIcon=getStyleWraplistIcon;
1
+ "use strict";var core=require("@gem-sdk/core");const filterStyles=e=>{let t=["--mb","--mb-mobile","--mb-tablet"];return t.forEach(t=>{delete e?.[t]}),e},getStyleContainerIconlistMain=({styles:e,style:t,type:o})=>{let{align:l}=e??{};return{...t="react"===o?filterStyles(t):t,...core.makeStyleResponsive("jc",l),...core.makeStyleResponsive("d",{desktop:"flex",tablet:"flex",mobile:"flex"})}},getStyleWraplistIcon=({styles:e})=>{let{panelAlign:t,contentBoxPadding:o,contentBoxWidth:l,background:r}=e??{};return{...core.getStyleBackgroundByDevice(r),...core.getResponsiveStylePadding(o),...core.makeStyleResponsive("w",l),...core.makeStyleResponsive("jc",t),...core.getGradientBgrStyleByDevice(r,{desktop:!0,tablet:!0,mobile:!0})}},getStyleColListIcon=({styles:e})=>{let{verticalSpacing:t}=e??{};return{...core.makeStyleResponsive("rg",t)}},getStyleWrapItemIcon=({styles:e})=>{let{horizontalSpacing:t,position:o}=e??{};return{...core.makeStyleResponsive("cg",t),...core.makeStyleResponsive("ai",o)}},getStyleWrapIcon=({styles:e,setting:t})=>{let{iconBorder:o,backgroundColor:l,iconRounded:r}=e??{},{globalSize:i}=t??{},s=core.makeGlobalSize(i);return{...s.padding,...core.makeStyle({bs:o?.border,bw:o?.width,bc:core.getSingleColorVariable(o?.color),bg:l,bblr:r?.bblr,bbrr:r?.bbrr,btlr:r?.btlr,btrr:r?.btrr}),...core.makeStyleResponsive("pos",{desktop:"relative",tablet:"relative",mobile:"relative"}),...core.makeStyleResponsive("top",{desktop:"inherit",tablet:"inherit",mobile:"inherit"})}},getStyleIcon=({styles:e,setting:t})=>{let{iconColor:o}=e||{},{iconWidth:l}=t??{};return{"--c":core.getSingleColorVariable(o),"--w":"100%","--h":"100%","--size-desktop":`${l?.desktop}px`,"--size-tablet":`${l?.tablet||l?.desktop}px`,"--size-mobile":`${l?.mobile||l?.tablet||l?.desktop}px`}},getStyleTypoText=({setting:e})=>({typo:e?.textTypo});exports.getStyleColListIcon=getStyleColListIcon,exports.getStyleContainerIconlistMain=getStyleContainerIconlistMain,exports.getStyleIcon=getStyleIcon,exports.getStyleTypoText=getStyleTypoText,exports.getStyleWrapIcon=getStyleWrapIcon,exports.getStyleWrapItemIcon=getStyleWrapItemIcon,exports.getStyleWraplistIcon=getStyleWraplistIcon;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core"),React=require("react");const useDropdownSwatches=e=>{let{option:t,variantGroup:n,variants:r,initValue:a,hasPreSelected:c,presetConfiguration:o}=e,{setSelectedOption:s,forceSelectedOption:i,selectedOptions:l}=core.useSelectedOption(),u=core.useProduct(),d=React.useMemo(()=>{if(!o)return;let{presets:e,optionType:t}=o;return e?.[t||"rectangle_list"]},[o]),[p,f]=React.useState(c?a:"blank");React.useEffect(()=>{f(l?.[t?.name??"blank"])},[l,t]),React.useEffect(()=>{c||f("blank")},[c]);let v=e=>!!e&&(e?.inventoryQuantity&&e.inventoryQuantity>0||!e?.manageInventory||"CONTINUE"===e.inventoryPolicy),y=e=>{let t=r?.find(t=>t?.id===e);if(t&&t.selectedOptions){let e=core.parseSelectedOption(t.selectedOptions);console.log("\uD83D\uDE80 ~ handleSelectVariant ~ selectedOption:",e),e&&i(e,u?.id)}},S=e=>{n?y(e.target?.value):s(t?.name,e.target?.value,u?.id)};return{value:p,preset:d,handleOnChangeSelect:S,checkVariantInStock:v}};exports.useDropdownSwatches=useDropdownSwatches;
1
+ "use strict";var core=require("@gem-sdk/core"),React=require("react");const useDropdownSwatches=e=>{let{option:t,variantGroup:r,variants:n,initValue:a,hasPreSelected:c,presetConfiguration:o}=e,{setSelectedOption:s,forceSelectedOption:i,selectedOptions:u}=core.useSelectedOption(),l=core.useProduct(),d=React.useMemo(()=>{if(!o)return;let{presets:e,optionType:t}=o;return e?.[t||"rectangle_list"]},[o]),[p,f]=React.useState(c?a:"blank");React.useEffect(()=>{f(u?.[t?.name??"blank"])},[u,t]),React.useEffect(()=>{c||f("blank")},[c]);let v=e=>!!e&&(e?.inventoryQuantity&&e.inventoryQuantity>0||!e?.manageInventory||"CONTINUE"===e.inventoryPolicy),y=e=>{let t=n?.find(t=>t?.id===e);if(t&&t.selectedOptions){let e=core.parseSelectedOption(t.selectedOptions);e&&i(e,l?.id,!1,!0)}},w=e=>{r?y(e.target?.value):s(t?.name,e.target?.value,l?.id)};return{value:p,preset:d,handleOnChangeSelect:w,checkVariantInStock:v}};exports.useDropdownSwatches=useDropdownSwatches;
@@ -1 +1 @@
1
- import{getStyleBackgroundByDevice as t,makeStyleResponsive as e,getGradientBgrStyleByDevice as l,getResponsiveStylePadding as r,makeGlobalSize as o,makeStyle as b,getSingleColorVariable as i}from"@gem-sdk/core";let filterStyles=t=>{let e=["--mb","--mb-mobile","--mb-tablet"];return e.forEach(e=>{delete t?.[e]}),t},getStyleContainerIconlistMain=({styles:r,style:o,type:b})=>{let{background:i,align:n}=r??{};return{...o="react"===b?filterStyles(o):o,...t(i),...e("jc",n),...e("d",{desktop:"flex",tablet:"flex",mobile:"flex"}),...l(i,{desktop:!0,tablet:!0,mobile:!0})}},getStyleWraplistIcon=({styles:t})=>{let{panelAlign:l,contentBoxPadding:o,contentBoxWidth:b}=t??{};return{...r(o),...e("w",b),...e("jc",l)}},getStyleColListIcon=({styles:t})=>{let{verticalSpacing:l}=t??{};return{...e("rg",l)}},getStyleWrapItemIcon=({styles:t})=>{let{horizontalSpacing:l,position:r}=t??{};return{...e("cg",l),...e("ai",r)}},getStyleWrapIcon=({styles:t,setting:l})=>{let{iconBorder:r,backgroundColor:n,iconRounded:p}=t??{},{globalSize:a}=l??{},s=o(a);return{...s.padding,...b({bs:r?.border,bw:r?.width,bc:i(r?.color),bg:n,bblr:p?.bblr,bbrr:p?.bbrr,btlr:p?.btlr,btrr:p?.btrr}),...e("pos",{desktop:"relative",tablet:"relative",mobile:"relative"}),...e("top",{desktop:"inherit",tablet:"inherit",mobile:"inherit"})}},getStyleIcon=({styles:t,setting:e})=>{let{iconColor:l}=t||{},{iconWidth:r}=e??{};return{"--c":i(l),"--w":"100%","--h":"100%","--size-desktop":`${r?.desktop}px`,"--size-tablet":`${r?.tablet||r?.desktop}px`,"--size-mobile":`${r?.mobile||r?.tablet||r?.desktop}px`}},getStyleTypoText=({setting:t})=>({typo:t?.textTypo});export{getStyleColListIcon,getStyleContainerIconlistMain,getStyleIcon,getStyleTypoText,getStyleWrapIcon,getStyleWrapItemIcon,getStyleWraplistIcon};
1
+ import{makeStyleResponsive as t,getStyleBackgroundByDevice as e,getResponsiveStylePadding as l,getGradientBgrStyleByDevice as r,makeGlobalSize as o,makeStyle as b,getSingleColorVariable as i}from"@gem-sdk/core";let filterStyles=t=>{let e=["--mb","--mb-mobile","--mb-tablet"];return e.forEach(e=>{delete t?.[e]}),t},getStyleContainerIconlistMain=({styles:e,style:l,type:r})=>{let{align:o}=e??{};return{...l="react"===r?filterStyles(l):l,...t("jc",o),...t("d",{desktop:"flex",tablet:"flex",mobile:"flex"})}},getStyleWraplistIcon=({styles:o})=>{let{panelAlign:b,contentBoxPadding:i,contentBoxWidth:n,background:p}=o??{};return{...e(p),...l(i),...t("w",n),...t("jc",b),...r(p,{desktop:!0,tablet:!0,mobile:!0})}},getStyleColListIcon=({styles:e})=>{let{verticalSpacing:l}=e??{};return{...t("rg",l)}},getStyleWrapItemIcon=({styles:e})=>{let{horizontalSpacing:l,position:r}=e??{};return{...t("cg",l),...t("ai",r)}},getStyleWrapIcon=({styles:e,setting:l})=>{let{iconBorder:r,backgroundColor:n,iconRounded:p}=e??{},{globalSize:a}=l??{},s=o(a);return{...s.padding,...b({bs:r?.border,bw:r?.width,bc:i(r?.color),bg:n,bblr:p?.bblr,bbrr:p?.bbrr,btlr:p?.btlr,btrr:p?.btrr}),...t("pos",{desktop:"relative",tablet:"relative",mobile:"relative"}),...t("top",{desktop:"inherit",tablet:"inherit",mobile:"inherit"})}},getStyleIcon=({styles:t,setting:e})=>{let{iconColor:l}=t||{},{iconWidth:r}=e??{};return{"--c":i(l),"--w":"100%","--h":"100%","--size-desktop":`${r?.desktop}px`,"--size-tablet":`${r?.tablet||r?.desktop}px`,"--size-mobile":`${r?.mobile||r?.tablet||r?.desktop}px`}},getStyleTypoText=({setting:t})=>({typo:t?.textTypo});export{getStyleColListIcon,getStyleContainerIconlistMain,getStyleIcon,getStyleTypoText,getStyleWrapIcon,getStyleWrapItemIcon,getStyleWraplistIcon};
@@ -1 +1 @@
1
- import{useSelectedOption as e,useProduct as t,parseSelectedOption as n}from"@gem-sdk/core";import{useMemo as r,useState as l,useEffect as o}from"react";let useDropdownSwatches=a=>{let{option:i,variantGroup:s,variants:c,initValue:d,hasPreSelected:u,presetConfiguration:m}=a,{setSelectedOption:p,forceSelectedOption:y,selectedOptions:g}=e(),v=t(),f=r(()=>{if(!m)return;let{presets:e,optionType:t}=m;return e?.[t||"rectangle_list"]},[m]),[k,w]=l(u?d:"blank");o(()=>{w(g?.[i?.name??"blank"])},[g,i]),o(()=>{u||w("blank")},[u]);let O=e=>!!e&&(e?.inventoryQuantity&&e.inventoryQuantity>0||!e?.manageInventory||"CONTINUE"===e.inventoryPolicy),b=e=>{let t=c?.find(t=>t?.id===e);if(t&&t.selectedOptions){let e=n(t.selectedOptions);console.log("\uD83D\uDE80 ~ handleSelectVariant ~ selectedOption:",e),e&&y(e,v?.id)}},h=e=>{s?b(e.target?.value):p(i?.name,e.target?.value,v?.id)};return{value:k,preset:f,handleOnChangeSelect:h,checkVariantInStock:O}};export{useDropdownSwatches};
1
+ import{useSelectedOption as e,useProduct as t,parseSelectedOption as n}from"@gem-sdk/core";import{useMemo as r,useState as a,useEffect as i}from"react";let useDropdownSwatches=o=>{let{option:l,variantGroup:s,variants:d,initValue:u,hasPreSelected:c,presetConfiguration:m}=o,{setSelectedOption:p,forceSelectedOption:y,selectedOptions:v}=e(),f=t(),g=r(()=>{if(!m)return;let{presets:e,optionType:t}=m;return e?.[t||"rectangle_list"]},[m]),[k,w]=a(c?u:"blank");i(()=>{w(v?.[l?.name??"blank"])},[v,l]),i(()=>{c||w("blank")},[c]);let b=e=>!!e&&(e?.inventoryQuantity&&e.inventoryQuantity>0||!e?.manageInventory||"CONTINUE"===e.inventoryPolicy),O=e=>{let t=d?.find(t=>t?.id===e);if(t&&t.selectedOptions){let e=n(t.selectedOptions);e&&y(e,f?.id,!1,!0)}},h=e=>{s?O(e.target?.value):p(l?.name,e.target?.value,f?.id)};return{value:k,preset:g,handleOnChangeSelect:h,checkVariantInStock:b}};export{useDropdownSwatches};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.934",
3
+ "version": "2.0.0-staging.936",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "2.0.0-staging.930",
28
+ "@gem-sdk/core": "2.0.0-staging.936",
29
29
  "@gem-sdk/styles": "2.0.0-staging.886",
30
30
  "@gem-sdk/system": "2.0.0-staging.711",
31
31
  "tsup": "^8.5.0",