efficient-storefront-blocks 0.125.15 → 0.125.16
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/CHANGELOG.md +4 -0
- package/dist/editor/components/CountryShowAsTiles.d.ts +3 -2
- package/dist/editor/components/CountryShowAsTiles.js +1 -1
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +24 -24
- package/dist/render/components/CountrySelect.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +1 -0
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/lib/content/country-show-as.d.ts +6 -3
- package/dist/render/lib/content/country-show-as.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as
|
|
1
|
+
"use client";import{jsx as n,Fragment as p,jsxs as d}from"react/jsx-runtime";import{ThemedSelectList as N,useThemedSelect as _}from"./ThemedSelect.js";import{useCurrency as x}from"./CurrencyContext.js";import{countryName as O}from"../lib/countries.js";import{regionSwitchHref as k}from"../lib/menu-link.js";import{FlagAuIcon as v,FlagCaIcon as T,FlagEuIcon as R,FlagGbIcon as A,FlagNzIcon as E,FlagUsIcon as U,GlobeIcon as j}from"efficient-shell/icons/efficient";import{GlobeAltIcon as G}from"efficient-shell/icons/efficient-looks";import{TOOL_ICON_BUTTON_CLASS as L}from"./HeaderTools.js";import{COUNTRY_SHOW_AS_DEFAULT as z,countryShowAsHasFlag as B}from"../lib/content/country-show-as.js";const g={US:U,CA:T,AU:v,NZ:E,GB:A,EU:R};function w({code:r,width:e}){const c=Object.hasOwn(g,r)?g[r]:void 0;return c?n("span",{"aria-hidden":!0,className:"inline-flex shrink-0 border border-line",children:n(c,{size:e})}):null}function H(r,e){const c=n(w,{code:e.code,width:18});switch(r){case"code_currency":return e.currency?d(p,{children:[n("span",{children:e.code}),n("span",{"aria-hidden":!0,className:"opacity-50",children:"·"}),n("span",{children:e.currency})]}):n("span",{children:e.code});case"globe_code":return d(p,{children:[n(j,{size:14,className:"shrink-0"}),n("span",{children:e.code})]});case"currency":return n("span",{children:e.currency??e.code});case"flag_code":return d(p,{children:[c,n("span",{children:e.code})]});case"flag":return Object.hasOwn(g,e.code)?c:n("span",{children:e.code});default:return n("span",{children:e.name})}}function F(r,e,c){const s=new Map(r.map(a=>[a.code,a]));return(e?.length?e:r.map(a=>a.code)).map(a=>{const i=s.get(a);return{code:a,name:i?.name||O(a),currency:i?.currency,url:i?.url||c?.[a]||""}})}const I=2;function Q(r){const{countries:e}=x();return F(e,r).length>=I}function W({urls:r,countries:e,showAs:c=z}={}){const{country:s,setCountry:a,countries:i}=x(),l=F(i,e,r),m=l.find(t=>t.code===s)??l[0];function C(t){const b=r?k(l.find(f=>f.code===t)?.url,window.location.href):null;if(b){window.location.href=b;return}i.some(f=>f.code===t)&&a(t)}const S=B(c),h=l.map(t=>({value:t.code,label:t.name,meta:t.currency,...S?{lead:n(w,{code:t.code,width:21})}:{}})),o=_({items:h,value:s,onPick:C});if(!m||l.length<I)return null;const u=o.open,y=c==="globe";return d("div",{ref:o.wrapRef,className:"relative",children:[n("button",{ref:t=>{o.triggerRef.current=t},type:"button","aria-haspopup":"listbox","aria-expanded":u,"aria-controls":u?o.listId:void 0,"aria-activedescendant":o.activeId,"aria-label":`Region: ${m.name}. Click to change.`,onClick:o.toggle,onKeyDown:o.onTriggerKeyDown,suppressHydrationWarning:!0,...y?{className:L}:{className:"inline-flex items-center gap-2 whitespace-nowrap border border-fg-dim px-3 py-2 font-mono text-[13px] uppercase tracking-[0.18em] transition-colors hover:border-fg",style:{color:"color-mix(in oklab, currentColor 80%, transparent)"}},children:y?n(G,{size:18,strokeWidth:"1.6","aria-hidden":"true"}):d(p,{children:[H(c,m),n("span",{"aria-hidden":!0,className:`text-[11px] opacity-70 transition-transform ${u?"rotate-180":""}`,children:"▾"})]})}),u&&n(N,{id:o.listId,tone:"region",ariaLabel:"Choose region",items:h,value:s,focusIdx:o.focusIdx,onFocus:o.setFocusIdx,onPick:o.pick,listRef:o.listRef})]})}export{W as default,Q as useCountrySelectShows};
|
|
@@ -8,6 +8,7 @@ export declare const UTIL_WORDS: {
|
|
|
8
8
|
readonly close: "Close";
|
|
9
9
|
};
|
|
10
10
|
export declare const UTIL_WORD_CLASS = "whitespace-nowrap";
|
|
11
|
+
export declare const TOOL_ICON_BUTTON_CLASS = "mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";
|
|
11
12
|
export declare function cartLabel(count: number): string;
|
|
12
13
|
export declare function CartButton({ onClick, count, asText, className, takesViewHide, }: {
|
|
13
14
|
onClick: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as o,Fragment as y}from"react/jsx-runtime";import N from"next/link";import{useEffect as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o,Fragment as y}from"react/jsx-runtime";import N from"next/link";import{useEffect as _,useRef as w}from"react";import{CartAltIcon as k}from"efficient-shell/icons/efficient-looks";import h from"efficient-easel/screen/components/UiIcon";import{prefersReducedMotion as v}from"efficient-web-builder/render/components/useReducedMotion";import{HideTaker as $,NO_HIDE as S,useTakeViewHide as C,withViewHide as O}from"efficient-web-builder/render/components/ViewHideRoot";const l={search:"Search",account:"Account",cart:"Bag",menu:"Menu",close:"Close"},d="whitespace-nowrap",B="mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";function L(n){return n>99?"99+":String(n)}function j({count:n,ref:t}){return e("span",{ref:t,"data-cart-badge":"","aria-hidden":"true",className:"pointer-events-none absolute -top-[7px] -right-[9px] inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-current px-1 text-[10px] leading-none font-semibold tabular-nums",style:{letterSpacing:0},children:e("span",{style:{color:"var(--sf-header-ground, var(--bg))"},children:L(n)})})}function A(n){return`Open cart, ${n} item${n===1?"":"s"}`}function M({onClick:n,count:t,asText:s,className:r,takesViewHide:a=!1}){const c=w(null),i=w(t);return _(()=>{i.current!==t&&(i.current=t,!v()&&c.current?.animate([{transform:"scale(0.6)"},{transform:"scale(1)"}],{duration:180,easing:"ease-out"}))},[t]),e($,{as:"button",takes:a,type:"button",onClick:n,"aria-label":A(t),className:`mono-eyebrow-ctl inline-flex items-center gap-2 opacity-80 transition-opacity hover:opacity-100 ${r??""}`,children:s?o("span",{className:d,children:[l.cart,t>0?` ${t}`:""]}):o("span",{className:"relative inline-flex",children:[e(k,{size:18,strokeWidth:"1.6","aria-hidden":"true"}),t>0?e(j,{count:t,ref:c}):null]})})}function D({asText:n,className:t,takesViewHide:s=!1}){const r=C(),a=s?r:S;return a.scope(e(N,{href:"/account","aria-label":"Account",className:O(`${B} ${t??""}`,a.className),...a.attrs,children:n?e("span",{className:d,children:l.account}):o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e("circle",{cx:"12",cy:"8",r:"3.4"}),e("path",{d:"M5 20a7 7 0 0 1 14 0"})]})}))}function E({onClick:n,asText:t,withWord:s,phoneLook:r,className:a}){let c=!1,i;if(r){const u=t?"text":s?"icon_text":"icon",p=(b,g)=>b&&g?"":b?"max-view-tablet:hidden":g?"view-tablet:hidden":null,m=p(u!=="text",r!=="text"),f=p(u!=="icon",r!=="icon"),x=u==="icon_text"||r==="icon_text";c=!0,i=o(y,{children:[m===null?null:e("span",{className:`inline-flex ${m}`,children:e(h,{name:"search",size:x?20:18,strokeWidth:x?1.5:1.6,rounded:!0})}),f===null?null:e("span",{className:`${d} ${f}`,children:l.search})]})}else s?(c=!0,i=o(y,{children:[e(h,{name:"search",size:20,strokeWidth:1.5,rounded:!0}),e("span",{className:`${d} max-view-tablet:hidden`,children:l.search})]})):i=t?e("span",{className:d,children:l.search}):e(h,{name:"search",size:18,strokeWidth:1.6,rounded:!0});return e("button",{type:"button",onClick:n,"aria-label":"Search",title:"Search (⌘K)",className:`mono-eyebrow-ctl inline-flex items-center ${c?"gap-2 ":""}opacity-80 transition-opacity hover:opacity-100 ${a??""}`,children:i})}export{D as AccountButton,M as CartButton,E as SearchButton,B as TOOL_ICON_BUTTON_CLASS,l as UTIL_WORDS,d as UTIL_WORD_CLASS,A as cartLabel};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export type CountryShowAs = "name" | "code_currency" | "globe_code" | "currency" | "flag_code" | "flag";
|
|
2
|
-
|
|
1
|
+
export type CountryShowAs = "name" | "code_currency" | "globe_code" | "currency" | "flag_code" | "flag" | "globe";
|
|
2
|
+
type ShowAsChoice = {
|
|
3
3
|
value: CountryShowAs;
|
|
4
4
|
label: string;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export declare const COUNTRY_SHOW_AS: readonly ShowAsChoice[];
|
|
7
|
+
export declare const HEADER_ROW_SHOW_AS: readonly ShowAsChoice[];
|
|
6
8
|
export declare const COUNTRY_SHOW_AS_LABEL = "Show as";
|
|
7
9
|
export declare const COUNTRY_SHOW_AS_DEFAULT: CountryShowAs;
|
|
8
10
|
export declare function resolveCountryShowAs(v: unknown): CountryShowAs;
|
|
9
11
|
export declare const countryShowAsHasFlag: (v: CountryShowAs) => boolean;
|
|
12
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=[{value:"name",label:"Country name"},{value:"code_currency",label:"Code and currency"},{value:"globe_code",label:"Globe and code"},{value:"currency",label:"Currency"},{value:"flag_code",label:"Flag and code"},{value:"flag",label:"Flag"},{value:"globe",label:"Globe"}],n=l.filter(e=>e.value!=="globe"),r="Show as",a="name";function c(e){return l.some(o=>o.value===e)?e:a}const u=e=>e==="flag_code"||e==="flag";export{l as COUNTRY_SHOW_AS,a as COUNTRY_SHOW_AS_DEFAULT,r as COUNTRY_SHOW_AS_LABEL,n as HEADER_ROW_SHOW_AS,u as countryShowAsHasFlag,c as resolveCountryShowAs};
|