@cruk/chakra-components 4.0.0-dev.32 → 4.0.0-dev.33
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,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),n=require("@chakra-ui/react"),t=require("react"),i=require("../Button/index.js"),r=require("../Button/IconButton.js");require("../Flex/index.js");var s=require("../Heading/index.js");require("../Icon/index.js");var o=require("../List/index.js"),a=require("@chakra-ui/icons");const d=n.forwardRef((d,l)=>{const{children:c,...x}=d,[u,h]=t.useState(!1),[g,j]=t.useState(!1),[p,m]=t.useState(!1),b=t.Children.toArray(c),f=n.useBreakpointValue({base:5,lg:8},{fallback:"md"}),v=b.slice(0,u?b.length:f),w="OnThisPage-container";return t.useEffect(()=>{const e=()=>{const e=document.getElementById(w);e&&j(window.scrollY>e.offsetTop+e.offsetHeight)};e(),window.addEventListener("scroll",e);const n=()=>{const e=document.querySelector('[data-testid="survey-root"]');m(!!e)};n();const t=new MutationObserver(n);return t.observe(document.body,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",e),t.disconnect()}},[]),c?e.jsx(n.Box,{paddingTop:{base:4,md:8,lg:10},ref:l,"data-testid":w,id:w,children:e.jsxs(n.Box,{backgroundColor:"onThisPagePrimaryBg",padding:{base:4,md:6,lg:8},...x,children:[e.jsxs("nav",{children:[e.jsx(s.Heading,{fontSize:{base:"headings.sm",lg:"headings.lg"},lineHeight:{base:"headings.sm",lg:"headings.lg"},display:"flex",pb:4,children:"On this page"}),e.jsx(n.UnorderedList,{marginInlineStart:0,paddingInlineStart:0,sx:{li:{display:"flex",paddingBottom:2,alignItems:"center"}},styleType:"none",children:v.map((n,t)=>e.jsx(o.ArrowDownListItem,{children:n},t))})]}),f&&b.length>f&&e.jsx(n.Flex,{justifyContent:"flex-end",children:e.jsx(i.Button,{mt:4,variant:"linkNoDecoration",rightIcon:u?e.jsx(a.ChevronUpIcon,{boxSize:6}):e.jsx(a.ChevronDownIcon,{boxSize:6}),onClick:()=>h(!u),children:u?"Show less":"Show all"})}),g&&e.jsx(n.Portal,{children:e.jsx(n.Flex,{justifyContent:"center",pointerEvents:"none",children:e.jsx(n.Container,{position:"fixed",bottom:{base:p?
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),n=require("@chakra-ui/react"),t=require("react"),i=require("../Button/index.js"),r=require("../Button/IconButton.js");require("../Flex/index.js");var s=require("../Heading/index.js");require("../Icon/index.js");var o=require("../List/index.js"),a=require("@chakra-ui/icons");const d=n.forwardRef((d,l)=>{const{children:c,...x}=d,[u,h]=t.useState(!1),[g,j]=t.useState(!1),[p,m]=t.useState(!1),b=t.Children.toArray(c),f=n.useBreakpointValue({base:5,lg:8},{fallback:"md"}),v=b.slice(0,u?b.length:f),w="OnThisPage-container";return t.useEffect(()=>{const e=()=>{const e=document.getElementById(w);e&&j(window.scrollY>e.offsetTop+e.offsetHeight)};e(),window.addEventListener("scroll",e);const n=()=>{const e=document.querySelector('[data-testid="survey-root"]');m(!!e)};n();const t=new MutationObserver(n);return t.observe(document.body,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",e),t.disconnect()}},[]),c?e.jsx(n.Box,{paddingTop:{base:4,md:8,lg:10},ref:l,"data-testid":w,id:w,children:e.jsxs(n.Box,{backgroundColor:"onThisPagePrimaryBg",padding:{base:4,md:6,lg:8},...x,children:[e.jsxs("nav",{children:[e.jsx(s.Heading,{fontSize:{base:"headings.sm",lg:"headings.lg"},lineHeight:{base:"headings.sm",lg:"headings.lg"},display:"flex",pb:4,children:"On this page"}),e.jsx(n.UnorderedList,{marginInlineStart:0,paddingInlineStart:0,sx:{li:{display:"flex",paddingBottom:2,alignItems:"center"}},styleType:"none",children:v.map((n,t)=>e.jsx(o.ArrowDownListItem,{children:n},t))})]}),f&&b.length>f&&e.jsx(n.Flex,{justifyContent:"flex-end",children:e.jsx(i.Button,{mt:4,variant:"linkNoDecoration",rightIcon:u?e.jsx(a.ChevronUpIcon,{boxSize:6}):e.jsx(a.ChevronDownIcon,{boxSize:6}),onClick:()=>h(!u),children:u?"Show less":"Show all"})}),g&&e.jsx(n.Portal,{children:e.jsx(n.Flex,{justifyContent:"center",pointerEvents:"none",children:e.jsx(n.Container,{position:"fixed",bottom:{base:p?16:4,md:20},children:e.jsx(n.Flex,{justifyContent:"end",paddingRight:{base:4,md:8},children:e.jsx(n.Box,{pointerEvents:"auto",zIndex:"sticky",position:"relative",children:e.jsx(n.Link,{href:`#${w}`,children:e.jsx(r.IconButton,{icon:e.jsx(a.ArrowUpIcon,{}),variant:"backToTop","aria-label":"Back to top"})})})})})})})]})}):e.jsx(e.Fragment,{})});exports.OnThisPageHeadings=d;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as i,useBreakpointValue as o,Box as r,UnorderedList as s,Flex as d,Portal as a,Container as l,Link as c}from"@chakra-ui/react";import m,{useEffect as h}from"react";import{Button as g}from"../Button/index.js";import{IconButton as p}from"../Button/IconButton.js";import"../Flex/index.js";import{Heading as f}from"../Heading/index.js";import"../Icon/index.js";import{ArrowDownListItem as u}from"../List/index.js";import{ChevronUpIcon as b,ChevronDownIcon as x,ArrowUpIcon as y}from"@chakra-ui/icons";const v=i((i,v)=>{const{children:j,...S}=i,[k,w]=m.useState(!1),[I,B]=m.useState(!1),[T,C]=m.useState(!1),E=m.Children.toArray(j),L=o({base:5,lg:8},{fallback:"md"}),z=E.slice(0,k?E.length:L),H="OnThisPage-container";return h(()=>{const e=()=>{const e=document.getElementById(H);e&&B(window.scrollY>e.offsetTop+e.offsetHeight)};e(),window.addEventListener("scroll",e);const n=()=>{const e=document.querySelector('[data-testid="survey-root"]');C(!!e)};n();const t=new MutationObserver(n);return t.observe(document.body,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",e),t.disconnect()}},[]),j?e(r,{paddingTop:{base:4,md:8,lg:10},ref:v,"data-testid":H,id:H,children:t(r,{backgroundColor:"onThisPagePrimaryBg",padding:{base:4,md:6,lg:8},...S,children:[t("nav",{children:[e(f,{fontSize:{base:"headings.sm",lg:"headings.lg"},lineHeight:{base:"headings.sm",lg:"headings.lg"},display:"flex",pb:4,children:"On this page"}),e(s,{marginInlineStart:0,paddingInlineStart:0,sx:{li:{display:"flex",paddingBottom:2,alignItems:"center"}},styleType:"none",children:z.map((n,t)=>e(u,{children:n},t))})]}),L&&E.length>L&&e(d,{justifyContent:"flex-end",children:e(g,{mt:4,variant:"linkNoDecoration",rightIcon:e(k?b:x,{boxSize:6}),onClick:()=>w(!k),children:k?"Show less":"Show all"})}),I&&e(a,{children:e(d,{justifyContent:"center",pointerEvents:"none",children:e(l,{position:"fixed",bottom:{base:T?
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as i,useBreakpointValue as o,Box as r,UnorderedList as s,Flex as d,Portal as a,Container as l,Link as c}from"@chakra-ui/react";import m,{useEffect as h}from"react";import{Button as g}from"../Button/index.js";import{IconButton as p}from"../Button/IconButton.js";import"../Flex/index.js";import{Heading as f}from"../Heading/index.js";import"../Icon/index.js";import{ArrowDownListItem as u}from"../List/index.js";import{ChevronUpIcon as b,ChevronDownIcon as x,ArrowUpIcon as y}from"@chakra-ui/icons";const v=i((i,v)=>{const{children:j,...S}=i,[k,w]=m.useState(!1),[I,B]=m.useState(!1),[T,C]=m.useState(!1),E=m.Children.toArray(j),L=o({base:5,lg:8},{fallback:"md"}),z=E.slice(0,k?E.length:L),H="OnThisPage-container";return h(()=>{const e=()=>{const e=document.getElementById(H);e&&B(window.scrollY>e.offsetTop+e.offsetHeight)};e(),window.addEventListener("scroll",e);const n=()=>{const e=document.querySelector('[data-testid="survey-root"]');C(!!e)};n();const t=new MutationObserver(n);return t.observe(document.body,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",e),t.disconnect()}},[]),j?e(r,{paddingTop:{base:4,md:8,lg:10},ref:v,"data-testid":H,id:H,children:t(r,{backgroundColor:"onThisPagePrimaryBg",padding:{base:4,md:6,lg:8},...S,children:[t("nav",{children:[e(f,{fontSize:{base:"headings.sm",lg:"headings.lg"},lineHeight:{base:"headings.sm",lg:"headings.lg"},display:"flex",pb:4,children:"On this page"}),e(s,{marginInlineStart:0,paddingInlineStart:0,sx:{li:{display:"flex",paddingBottom:2,alignItems:"center"}},styleType:"none",children:z.map((n,t)=>e(u,{children:n},t))})]}),L&&E.length>L&&e(d,{justifyContent:"flex-end",children:e(g,{mt:4,variant:"linkNoDecoration",rightIcon:e(k?b:x,{boxSize:6}),onClick:()=>w(!k),children:k?"Show less":"Show all"})}),I&&e(a,{children:e(d,{justifyContent:"center",pointerEvents:"none",children:e(l,{position:"fixed",bottom:{base:T?16:4,md:20},children:e(d,{justifyContent:"end",paddingRight:{base:4,md:8},children:e(r,{pointerEvents:"auto",zIndex:"sticky",position:"relative",children:e(c,{href:`#${H}`,children:e(p,{icon:e(y,{}),variant:"backToTop","aria-label":"Back to top"})})})})})})})]})}):e(n,{})});export{v as OnThisPageHeadings};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|