efficient-storefront-blocks 0.133.6 → 0.133.7

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 client";import{jsx as l,jsxs as f}from"react/jsx-runtime";import{createContext as h,useContext as k,useEffect as w,useRef as L}from"react";import N from"next/link";import x from"./HeaderNavItem.js";import C from"./MenuPlaceholderLabel.js";import{useCardRow as _}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as i}from"efficient-web-builder/render/components/goldPhrases";import{scrollBehavior as g}from"efficient-web-builder/render/components/useReducedMotion";import{useTakeViewHide as T,withViewHide as u}from"efficient-web-builder/render/components/ViewHideRoot";import{isLabelOnlyMenuUrl as E,menuDropdownAside as M,menuLinkKind as R}from"../lib/menu-link.js";import{CURRENT_LINE as p,TAB_CELLS as d,showCurrentTab as v}from"../lib/content/tab-strip.js";import{blockParts as y}from"../lib/block-parts.js";import{MENU_BLOCK_TYPE as I}from"../lib/document/document-nodes.js";const m=y(I)("menu-link"),P=h(null),b="opacity-80 transition-opacity hover:opacity-100";function s({item:r,label:t,link:n,onNavigate:a,current:c=!1,children:o}){const e=T();return E(r.url)?e.scope(l("span",{className:u(t,e.className),...e.attrs,...m,children:i(r.label)})):e.scope(R(r.url)==="off-site"?f("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:u(n,e.className),onClick:a,...e.attrs,...m,children:[i(r.label),o]}):f(N,{href:r.url,className:u(n,e.className),onClick:a,"aria-current":c?"page":void 0,...e.attrs,...m,children:[i(r.label),o]}))}function j(){const r=L(null);return w(()=>{v(r.current?.closest("[data-menu-tabs] > ul")??null,g())},[]),l("span",{ref:r,className:d.underline})}function A(){const r=_(),t=k(P);if(!r||!t)return null;if(t.placeholder)return l(C,{});const n={label:r.row.label??"",url:r.row.href??""},a=!!t.current&&t.current.index===r.index&&t.current.href===n.url;if(t.place==="tab"){const e=d.tab(a);return l(s,{item:n,label:e,link:e,current:a,children:a?l(j,{}):null})}if(t.place==="column")return l(s,{item:n,label:"text-fg",link:"text-fg transition-colors hover:text-accent",current:a});if(t.place==="panel")return l(s,{item:n,label:"",link:` ${b}`,onNavigate:t.onNavigate,current:a});const c=r.item,o=c?.dropdown_items??[];return o.length?l(x,{item:{href:n.url,label:i(n.label),plainLabel:n.label,dropdownItems:o.map(e=>({href:e.url,label:i(e.label),plainLabel:e.label,description:e.description,image:e.image,badge:e.badge})),dropdownAside:M(c?.dropdown_aside)}}):a?l(s,{item:n,label:"",link:p.rowLink,current:!0,children:l("span",{"aria-hidden":"true",className:p.row})}):l(s,{item:n,label:"",link:` ${b}`})}export{P as MenuPlaceContext,A as default};
1
+ "use client";import{jsx as l,jsxs as f}from"react/jsx-runtime";import{createContext as L,useContext as k,useEffect as w,useRef as N}from"react";import x from"next/link";import C from"./HeaderNavItem.js";import _ from"./MenuPlaceholderLabel.js";import{useCardRow as g}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as i}from"efficient-web-builder/render/components/goldPhrases";import{scrollBehavior as I}from"efficient-web-builder/render/components/useReducedMotion";import{useTakeViewHide as R,withViewHide as u}from"efficient-web-builder/render/components/ViewHideRoot";import{isLabelOnlyMenuUrl as T,menuDropdownAside as E,menuLinkKind as M}from"../lib/menu-link.js";import{CURRENT_LINE as d,TAB_CELLS as p,showCurrentTab as v}from"../lib/content/tab-strip.js";import{blockParts as y}from"../lib/block-parts.js";import{MENU_BLOCK_TYPE as P}from"../lib/document/document-nodes.js";const m=y(P)("menu-link"),j=L(null),b="opacity-80 transition-opacity hover:opacity-100";function s({item:r,label:t,link:n,onNavigate:a,current:c=!1,children:o}){const e=R();return T(r.url)?e.scope(l("span",{className:u(t,e.className),...e.attrs,...m,children:i(r.label)})):e.scope(M(r.url)==="off-site"?f("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:u(n,e.className),onClick:a,...e.attrs,...m,children:[i(r.label),o]}):f(x,{href:r.url,className:u(n,e.className),onClick:a,"aria-current":c?"page":void 0,...e.attrs,...m,children:[i(r.label),o]}))}const A="[data-menu-tabs] > ul, [data-menu-row] > ul";function h({className:r,hidden:t=!1}){const n=N(null);return w(()=>{v(n.current?.closest(A)??null,I())},[]),l("span",{ref:n,"aria-hidden":t?"true":void 0,className:r})}function B(){const r=g(),t=k(j);if(!r||!t)return null;if(t.placeholder)return l(_,{});const n={label:r.row.label??"",url:r.row.href??""},a=!!t.current&&t.current.index===r.index&&t.current.href===n.url;if(t.place==="tab"){const e=p.tab(a);return l(s,{item:n,label:e,link:e,current:a,children:a?l(h,{className:p.underline}):null})}if(t.place==="column")return l(s,{item:n,label:"text-fg",link:"text-fg transition-colors hover:text-accent",current:a});if(t.place==="panel")return l(s,{item:n,label:"",link:` ${b}`,onNavigate:t.onNavigate,current:a});const c=r.item,o=c?.dropdown_items??[];return o.length?l(C,{item:{href:n.url,label:i(n.label),plainLabel:n.label,dropdownItems:o.map(e=>({href:e.url,label:i(e.label),plainLabel:e.label,description:e.description,image:e.image,badge:e.badge})),dropdownAside:E(c?.dropdown_aside)}}):a?l(s,{item:n,label:"",link:d.rowLink,current:!0,children:l(h,{className:d.row,hidden:!0})}):l(s,{item:n,label:"",link:` ${b}`})}export{j as MenuPlaceContext,B as default};