quirk-ui 0.0.426 → 0.0.428
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/colors.css');require('../../../assets/index.css');const s=require("react/jsx-runtime"),i=require("react"),e=require("../../../NavLink-BCSzEhr3.cjs");;/* empty css */require("react-dom");require("../Tabs/index.cjs");;/* empty css */const te=require("../../../next/ui/PortableTextRenderer/index.cjs");require("../../../link-DJmAF1Kb.cjs");require("../../../next/contexts/LocaleBridge.cjs");require("next/image");require("@fortawesome/fontawesome-free/css/all.min.css");require("../../../next/blocks/HeroBlock/HeroContext.cjs");const le=require("../../../chevron-down-DfK1XBl3.cjs"),ae=require("../../../external-link-DDShu-48.cjs"),ie={standard:e.styles.standard,transparent:e.styles.transparent},re={left:e.styles.left,center:e.styles.center,right:e.styles.right};function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/colors.css');require('../../../assets/index.css');const s=require("react/jsx-runtime"),i=require("react"),e=require("../../../NavLink-BCSzEhr3.cjs");;/* empty css */require("react-dom");require("../Tabs/index.cjs");;/* empty css */const te=require("../../../next/ui/PortableTextRenderer/index.cjs");require("../../../link-DJmAF1Kb.cjs");require("../../../next/contexts/LocaleBridge.cjs");require("next/image");require("@fortawesome/fontawesome-free/css/all.min.css");require("../../../next/blocks/HeroBlock/HeroContext.cjs");const le=require("../../../chevron-down-DfK1XBl3.cjs"),ae=require("../../../external-link-DDShu-48.cjs"),ie={standard:e.styles.standard,transparent:e.styles.transparent},re={left:e.styles.left,center:e.styles.center,right:e.styles.right};function oe({title:F,logo:p,items:h,groups:u,utilityItems:w,isSticky:X=!1,showSearch:g=!0,showLocaleSelect:C=!0,alignment:x="right",variant:V="standard",navigationType:R="default",className:A}){const[H,U]=i.useState(0),[q,c]=i.useState(null),[$,J]=i.useState(!1),[E,K]=i.useState(!1),[Q,Y]=i.useState(!1),[Z,P]=i.useState(null),[f,m]=i.useState(0),[ee,L]=i.useState(null),j=i.useRef(null),y=i.useRef(null),N=i.useRef(new Map),M=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} ${e.styles.searchWrapper}`,children:s.jsx("div",{className:e.styles.linkItem})}),_=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem})}),k=l=>{const n=N.current.get(l);if(n&&y.current){const r=n.getBoundingClientRect(),o=y.current.getBoundingClientRect(),t=r.left-o.left+r.width/2;P(t)}};console.log(k);const se=l=>{c(n=>n===l?null:l)},ne=l=>l.map((n,r)=>{var B,O,T,I,D;console.log("GROUP",n);const o=`group-${r}`,b=ee===r,t=(B=n.primaryItems)==null?void 0:B[f??0];return console.log(t),s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{L(r),c(o),k(o)},onMouseLeave:()=>{L(null),m(0),c(null)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:a=>{N.current.set(o,a)},role:"menuitem","aria-haspopup":"true","aria-expanded":b,"aria-controls":`submenu-${r}`,className:`${e.styles.sublinkToggle} ${b?e.styles.open:""} `,children:[n.title,s.jsx(le.ChevronDown,{size:18,className:e.styles.chevron})]})}),s.jsx("div",{id:`submenu-${r}`,className:`${e.styles.sublinks} ${b?e.styles.show:""}`,role:"menu","aria-label":`${n.title} submenu`,children:s.jsx("div",{children:s.jsxs("div",{className:`${e.styles.sublinksInner} ${n.spotlight?e.styles.withSpotlight:e.styles.withoutSpotlight}`,children:[s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.primaryColumn}`,children:[s.jsx("div",{className:e.styles.linkItem}),(O=n.primaryItems)==null?void 0:O.map((a,d)=>a.href?s.jsxs("a",{href:a.href,className:`${e.styles.link} ${f===d?e.styles.open:""}`,target:a.isExternal?"_blank":"_self",rel:a.isExternal?"noopener noreferrer":void 0,onClick:()=>{var G;c(null),(G=a.onClick)==null||G.call(a)},onMouseEnter:()=>a.sublinks?m(d):null,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[a.label,a.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:a.subtitle})]}),a.isExternal&&s.jsx(ae.ExternalLink,{className:e.styles.newTabIcon,size:16})]},a._key??d):s.jsx("button",{className:`${e.styles.sublinkToggle} ${f===d?e.styles.open:""}`,onMouseEnter:()=>m(d),children:s.jsxs("span",{className:e.styles.linkContent,children:[a.label,a.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:a.subtitle})]})},a._key??d))]}),(t==null?void 0:t.sublinks)&&((T=t==null?void 0:t.sublinks)==null?void 0:T.length)>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[(t==null?void 0:t.description)&&s.jsx("div",{className:e.styles.sublinksDescription,children:s.jsx(te.RichText,{blocks:t==null?void 0:t.description})}),v(t.sublinks,`${o}-${f}`)]},`${t.label}-${(I=t==null?void 0:t.sublinks)==null?void 0:I.length}`),(n==null?void 0:n.secondaryItems)&&((D=n==null?void 0:n.secondaryItems)==null?void 0:D.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:v(n.secondaryItems,`${o}-secondary`)})]})})})]},n._key??`group-${r}`)}),v=(l,n="")=>l.map(r=>{const o=`${n}/${r.label}`;return s.jsx(e.NavLink,{link:r,path:o,parentPath:n,openPath:q,togglePath:se,updateTriangleIndicator:k,setOpenPath:c,renderLinks:v,buttonRefs:N},r._key??o)}),S=i.useCallback(l=>{j.current&&!j.current.contains(l.target)&&c(null)},[]),W=i.useCallback(()=>{z(),typeof window<"u"&&window.innerWidth>768&&(J(!1),c(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),z=i.useCallback(()=>{if(y.current){const l=y.current.getBoundingClientRect().width;U(l),Y(!0)}},[]);return i.useEffect(()=>{const l=typeof window<"u",n=typeof document<"u";return l&&window.addEventListener("resize",W),n&&document.addEventListener("click",S),z(),()=>{l&&window.removeEventListener("resize",W),n&&document.removeEventListener("click",S)}},[]),i.useEffect(()=>{if(typeof window<"u"){const l=()=>{const n=window.innerWidth<768;K(n)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}},[]),i.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=$?"hidden":"",()=>{document.body.style.overflow=""}},[$]),s.jsx("header",{ref:j,className:`${A??""} ${re[x]} ${ie[V]} ${e.styles.navbar} ${X?e.styles.sticky:""} ${u&&u.length?e.styles.advanced:e.styles.default}`,role:"navigation","aria-label":"Main navigation",children:s.jsxs("div",{className:`${e.styles.container} ${(!w||w.length===0)&&x!=="center"?e.styles.twoColumn:""}`,children:[p?s.jsx("div",{className:e.styles.logo,children:p}):s.jsx("div",{className:e.styles.title,children:F}),s.jsx("nav",{ref:y,style:{left:x==="center"?`calc(50% - ${H/2}px)`:"0"},className:`${e.styles.nav} ${$?e.styles.open:""} ${Q?e.styles.visible:e.styles.hidden}`,id:"main-menu",role:"menubar","aria-label":"Main navigation",children:s.jsxs("div",{className:e.styles.navInner,children:[s.jsx("svg",{style:{left:`${Z}px`},className:`${e.styles.triangle} ${q?e.styles.show:""}`,width:16,height:12,viewBox:"0 0 100 75",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("polygon",{points:"50,5 95,70 5,70",strokeLinejoin:"round",fill:"white",stroke:"white"})}),R==="default"&&h&&s.jsxs("div",{className:e.styles.grid,children:[h&&h.length>0&&v(h),g&&!E&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(M,{})]}),C&&s.jsx(_,{})]}),!E&&R==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&ne(u),g&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(M,{})]}),C&&s.jsx(_,{})]})]})})]})})}exports.Navbar=oe;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as n, jsxs as i, Fragment as
|
|
1
|
+
import { jsx as n, jsxs as i, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { useState as c, useRef as C, useCallback as E, useEffect as L } from "react";
|
|
3
3
|
import { s as e, N as re } from "../../../NavLink-DgPiB7YX.js";
|
|
4
4
|
import '../../../assets/colors.css';import '../../../assets/index.css';/* empty css */
|
|
@@ -21,25 +21,25 @@ const he = {
|
|
|
21
21
|
center: e.center,
|
|
22
22
|
right: e.right
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
title:
|
|
26
|
-
logo:
|
|
24
|
+
function Me({
|
|
25
|
+
title: q,
|
|
26
|
+
logo: R,
|
|
27
27
|
items: m,
|
|
28
28
|
groups: h,
|
|
29
|
-
utilityItems:
|
|
30
|
-
isSticky:
|
|
31
|
-
showSearch:
|
|
29
|
+
utilityItems: x,
|
|
30
|
+
isSticky: J = !1,
|
|
31
|
+
showSearch: M = !0,
|
|
32
32
|
showLocaleSelect: W = !0,
|
|
33
33
|
alignment: $ = "right",
|
|
34
|
-
variant:
|
|
34
|
+
variant: K = "standard",
|
|
35
35
|
navigationType: z = "default",
|
|
36
36
|
// searchComponent,
|
|
37
37
|
// localeSelectComponent,
|
|
38
|
-
className:
|
|
38
|
+
className: Q
|
|
39
39
|
}) {
|
|
40
40
|
const [Y, Z] = c(0), [B, d] = c(null), [N, P] = c(!1), [I, ee] = c(!1), [ne, se] = c(!1), [te, le] = c(null), [v, w] = c(
|
|
41
41
|
0
|
|
42
|
-
), [ae,
|
|
42
|
+
), [ae, O] = c(null), k = C(null), f = C(null), y = C(/* @__PURE__ */ new Map()), _ = () => /* @__PURE__ */ n(
|
|
43
43
|
"div",
|
|
44
44
|
{
|
|
45
45
|
className: `${e.linkWrapper} ${e.parent} ${e.searchWrapper}`,
|
|
@@ -57,16 +57,17 @@ function Re({
|
|
|
57
57
|
d((s) => s === l ? null : l);
|
|
58
58
|
}, oe = (l) => l.map((s, o) => {
|
|
59
59
|
var X, F, S, V, A;
|
|
60
|
+
console.log("GROUP", s);
|
|
60
61
|
const r = `group-${o}`, b = ae === o, t = (X = s.primaryItems) == null ? void 0 : X[v ?? 0];
|
|
61
62
|
return console.log(t), /* @__PURE__ */ i(
|
|
62
63
|
"div",
|
|
63
64
|
{
|
|
64
65
|
className: `${e.linkWrapper} ${e.parent}`,
|
|
65
66
|
onMouseEnter: () => {
|
|
66
|
-
|
|
67
|
+
O(o), d(r), g(r);
|
|
67
68
|
},
|
|
68
69
|
onMouseLeave: () => {
|
|
69
|
-
|
|
70
|
+
O(null), w(0), d(null);
|
|
70
71
|
},
|
|
71
72
|
children: [
|
|
72
73
|
/* @__PURE__ */ n("div", { className: e.linkItem, children: /* @__PURE__ */ i(
|
|
@@ -196,11 +197,11 @@ function Re({
|
|
|
196
197
|
},
|
|
197
198
|
o._key ?? r
|
|
198
199
|
);
|
|
199
|
-
}),
|
|
200
|
+
}), G = E((l) => {
|
|
200
201
|
k.current && !k.current.contains(l.target) && d(null);
|
|
202
|
+
}, []), j = E(() => {
|
|
203
|
+
D(), typeof window < "u" && window.innerWidth > 768 && (P(!1), d(null), typeof document < "u" && (document.body.style.overflow = ""));
|
|
201
204
|
}, []), D = E(() => {
|
|
202
|
-
G(), typeof window < "u" && window.innerWidth > 768 && (P(!1), d(null), typeof document < "u" && (document.body.style.overflow = ""));
|
|
203
|
-
}, []), G = E(() => {
|
|
204
205
|
if (f.current) {
|
|
205
206
|
const l = f.current.getBoundingClientRect().width;
|
|
206
207
|
Z(l), se(!0);
|
|
@@ -208,8 +209,8 @@ function Re({
|
|
|
208
209
|
}, []);
|
|
209
210
|
return L(() => {
|
|
210
211
|
const l = typeof window < "u", s = typeof document < "u";
|
|
211
|
-
return l && window.addEventListener("resize",
|
|
212
|
-
l && window.removeEventListener("resize",
|
|
212
|
+
return l && window.addEventListener("resize", j), s && document.addEventListener("click", G), D(), () => {
|
|
213
|
+
l && window.removeEventListener("resize", j), s && document.removeEventListener("click", G);
|
|
213
214
|
};
|
|
214
215
|
}, []), L(() => {
|
|
215
216
|
if (typeof window < "u") {
|
|
@@ -228,15 +229,15 @@ function Re({
|
|
|
228
229
|
"header",
|
|
229
230
|
{
|
|
230
231
|
ref: k,
|
|
231
|
-
className: `${
|
|
232
|
+
className: `${Q ?? ""} ${fe[$]} ${he[K]} ${e.navbar} ${J ? e.sticky : ""} ${h && h.length ? e.advanced : e.default}`,
|
|
232
233
|
role: "navigation",
|
|
233
234
|
"aria-label": "Main navigation",
|
|
234
235
|
children: /* @__PURE__ */ i(
|
|
235
236
|
"div",
|
|
236
237
|
{
|
|
237
|
-
className: `${e.container} ${(!
|
|
238
|
+
className: `${e.container} ${(!x || x.length === 0) && $ !== "center" ? e.twoColumn : ""}`,
|
|
238
239
|
children: [
|
|
239
|
-
|
|
240
|
+
R ? /* @__PURE__ */ n("div", { className: e.logo, children: R }) : /* @__PURE__ */ n("div", { className: e.title, children: q }),
|
|
240
241
|
/* @__PURE__ */ n(
|
|
241
242
|
"nav",
|
|
242
243
|
{
|
|
@@ -271,17 +272,17 @@ function Re({
|
|
|
271
272
|
),
|
|
272
273
|
z === "default" && m && /* @__PURE__ */ i("div", { className: e.grid, children: [
|
|
273
274
|
m && m.length > 0 && p(m),
|
|
274
|
-
|
|
275
|
+
M && !I && /* @__PURE__ */ i(U, { children: [
|
|
275
276
|
/* @__PURE__ */ n("span", { className: e.separator }),
|
|
276
|
-
/* @__PURE__ */ n(
|
|
277
|
+
/* @__PURE__ */ n(_, {})
|
|
277
278
|
] }),
|
|
278
279
|
W && /* @__PURE__ */ n(T, {})
|
|
279
280
|
] }),
|
|
280
281
|
!I && z === "advanced" && h && /* @__PURE__ */ i("div", { className: e.grid, children: [
|
|
281
282
|
h.length > 0 && oe(h),
|
|
282
|
-
|
|
283
|
+
M && /* @__PURE__ */ i(U, { children: [
|
|
283
284
|
/* @__PURE__ */ n("span", { className: e.separator }),
|
|
284
|
-
/* @__PURE__ */ n(
|
|
285
|
+
/* @__PURE__ */ n(_, {})
|
|
285
286
|
] }),
|
|
286
287
|
W && /* @__PURE__ */ n(T, {})
|
|
287
288
|
] })
|
|
@@ -295,5 +296,5 @@ function Re({
|
|
|
295
296
|
);
|
|
296
297
|
}
|
|
297
298
|
export {
|
|
298
|
-
|
|
299
|
+
Me as Navbar
|
|
299
300
|
};
|
package/dist/core.d.ts
CHANGED
|
@@ -880,7 +880,7 @@ export declare type NavGroup = {
|
|
|
880
880
|
title: string;
|
|
881
881
|
primaryItems?: NavItem[];
|
|
882
882
|
secondaryItems?: NavItem[];
|
|
883
|
-
spotlight?:
|
|
883
|
+
spotlight?: Spotlight;
|
|
884
884
|
};
|
|
885
885
|
|
|
886
886
|
export declare type NavItem = {
|
|
@@ -1111,6 +1111,13 @@ declare type SpinnerProps = {
|
|
|
1111
1111
|
className?: string;
|
|
1112
1112
|
};
|
|
1113
1113
|
|
|
1114
|
+
declare type Spotlight = {
|
|
1115
|
+
title?: any[];
|
|
1116
|
+
description?: any[];
|
|
1117
|
+
imageUrl?: string;
|
|
1118
|
+
callToAction: any;
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1114
1121
|
export declare function Stack({ direction, gap, align, justify, wrap, as, className, children, ...restProps }: StackProps): JSX.Element;
|
|
1115
1122
|
|
|
1116
1123
|
declare type StackProps = {
|
package/dist/main.d.ts
CHANGED
|
@@ -1275,7 +1275,7 @@ export declare type NavGroup = {
|
|
|
1275
1275
|
title: string;
|
|
1276
1276
|
primaryItems?: NavItem[];
|
|
1277
1277
|
secondaryItems?: NavItem[];
|
|
1278
|
-
spotlight?:
|
|
1278
|
+
spotlight?: Spotlight;
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
1281
|
export declare interface NavigationData {
|
|
@@ -1655,6 +1655,13 @@ declare type SpinnerProps = {
|
|
|
1655
1655
|
className?: string;
|
|
1656
1656
|
};
|
|
1657
1657
|
|
|
1658
|
+
declare type Spotlight = {
|
|
1659
|
+
title?: any[];
|
|
1660
|
+
description?: any[];
|
|
1661
|
+
imageUrl?: string;
|
|
1662
|
+
callToAction: any;
|
|
1663
|
+
};
|
|
1664
|
+
|
|
1658
1665
|
export declare function SpotlightCard({ spotlight }: SpotlightCardProps): JSX.Element;
|
|
1659
1666
|
|
|
1660
1667
|
declare interface SpotlightCardProps {
|
package/dist/next.d.ts
CHANGED
|
@@ -401,7 +401,7 @@ declare type NavGroup = {
|
|
|
401
401
|
title: string;
|
|
402
402
|
primaryItems?: NavItem[];
|
|
403
403
|
secondaryItems?: NavItem[];
|
|
404
|
-
spotlight?:
|
|
404
|
+
spotlight?: Spotlight;
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
export declare interface NavigationData {
|
|
@@ -566,6 +566,13 @@ export declare interface SiteSettings {
|
|
|
566
566
|
defaultFooter?: NavigationData;
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
+
declare type Spotlight = {
|
|
570
|
+
title?: any[];
|
|
571
|
+
description?: any[];
|
|
572
|
+
imageUrl?: string;
|
|
573
|
+
callToAction: any;
|
|
574
|
+
};
|
|
575
|
+
|
|
569
576
|
export declare function SpotlightCard({ spotlight }: SpotlightCardProps): JSX.Element;
|
|
570
577
|
|
|
571
578
|
declare interface SpotlightCardProps {
|