@curvenote/theme-ui 1.0.1
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/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/components/layout/app-layout.d.ts +8 -0
- package/dist/components/layout/app-layout.d.ts.map +1 -0
- package/dist/components/layout/app-layout.js +24 -0
- package/dist/components/layout/app-sidebar.d.ts +2 -0
- package/dist/components/layout/app-sidebar.d.ts.map +1 -0
- package/dist/components/layout/app-sidebar.js +125 -0
- package/dist/components/layout/article-layout.d.ts +8 -0
- package/dist/components/layout/article-layout.d.ts.map +1 -0
- package/dist/components/layout/article-layout.js +20 -0
- package/dist/components/layout/grid.d.ts +2 -0
- package/dist/components/layout/grid.d.ts.map +1 -0
- package/dist/components/layout/grid.js +4 -0
- package/dist/components/layout/header.d.ts +5 -0
- package/dist/components/layout/header.d.ts.map +1 -0
- package/dist/components/layout/header.js +5 -0
- package/dist/components/layout/index.d.ts +7 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/index.js +7 -0
- package/dist/components/layout/loading-bar.d.ts +12 -0
- package/dist/components/layout/loading-bar.d.ts.map +1 -0
- package/dist/components/layout/loading-bar.js +53 -0
- package/dist/components/layout/site-header.d.ts +8 -0
- package/dist/components/layout/site-header.d.ts.map +1 -0
- package/dist/components/layout/site-header.js +55 -0
- package/dist/components/layout/types.d.ts +6 -0
- package/dist/components/layout/types.d.ts.map +1 -0
- package/dist/components/layout/types.js +1 -0
- package/dist/components/providers/compute.d.ts +5 -0
- package/dist/components/providers/compute.d.ts.map +1 -0
- package/dist/components/providers/compute.js +6 -0
- package/dist/components/providers/connect.d.ts +24 -0
- package/dist/components/providers/connect.d.ts.map +1 -0
- package/dist/components/providers/connect.js +208 -0
- package/dist/components/providers/curvenote-providers.d.ts +52 -0
- package/dist/components/providers/curvenote-providers.d.ts.map +1 -0
- package/dist/components/providers/curvenote-providers.js +199 -0
- package/dist/components/providers/design.d.ts +39 -0
- package/dist/components/providers/design.d.ts.map +1 -0
- package/dist/components/providers/design.js +50 -0
- package/dist/components/providers/index.d.ts +10 -0
- package/dist/components/providers/index.d.ts.map +1 -0
- package/dist/components/providers/index.js +12 -0
- package/dist/components/providers/lightbox-provider.d.ts +31 -0
- package/dist/components/providers/lightbox-provider.d.ts.map +1 -0
- package/dist/components/providers/lightbox-provider.js +109 -0
- package/dist/components/providers/myst-providers.d.ts +6 -0
- package/dist/components/providers/myst-providers.d.ts.map +1 -0
- package/dist/components/providers/myst-providers.js +29 -0
- package/dist/components/providers/page-providers.d.ts +15 -0
- package/dist/components/providers/page-providers.d.ts.map +1 -0
- package/dist/components/providers/page-providers.js +28 -0
- package/dist/components/providers/ping-boundary.d.ts +40 -0
- package/dist/components/providers/ping-boundary.d.ts.map +1 -0
- package/dist/components/providers/ping-boundary.js +115 -0
- package/dist/components/providers/platform-providers.d.ts +18 -0
- package/dist/components/providers/platform-providers.d.ts.map +1 -0
- package/dist/components/providers/platform-providers.js +29 -0
- package/dist/components/providers/types.d.ts +30 -0
- package/dist/components/providers/types.d.ts.map +1 -0
- package/dist/components/providers/types.js +1 -0
- package/dist/components/ui/Callout.d.ts +10 -0
- package/dist/components/ui/Callout.d.ts.map +1 -0
- package/dist/components/ui/Callout.js +7 -0
- package/dist/components/ui/PageCards.d.ts +2 -0
- package/dist/components/ui/PageCards.d.ts.map +1 -0
- package/dist/components/ui/PageCards.js +11 -0
- package/dist/components/ui/abbreviations.d.ts +5 -0
- package/dist/components/ui/abbreviations.d.ts.map +1 -0
- package/dist/components/ui/abbreviations.js +31 -0
- package/dist/components/ui/abstract.d.ts +8 -0
- package/dist/components/ui/abstract.d.ts.map +1 -0
- package/dist/components/ui/abstract.js +9 -0
- package/dist/components/ui/accessibility-skip-to.d.ts +15 -0
- package/dist/components/ui/accessibility-skip-to.d.ts.map +1 -0
- package/dist/components/ui/accessibility-skip-to.js +31 -0
- package/dist/components/ui/acknowledgements.d.ts +4 -0
- package/dist/components/ui/acknowledgements.d.ts.map +1 -0
- package/dist/components/ui/acknowledgements.js +20 -0
- package/dist/components/ui/article-actions-downloads.d.ts +26 -0
- package/dist/components/ui/article-actions-downloads.d.ts.map +1 -0
- package/dist/components/ui/article-actions-downloads.js +143 -0
- package/dist/components/ui/article-actions-dropdown.d.ts +5 -0
- package/dist/components/ui/article-actions-dropdown.d.ts.map +1 -0
- package/dist/components/ui/article-actions-dropdown.js +68 -0
- package/dist/components/ui/article-actions-share.d.ts +5 -0
- package/dist/components/ui/article-actions-share.d.ts.map +1 -0
- package/dist/components/ui/article-actions-share.js +52 -0
- package/dist/components/ui/article-actions.d.ts +2 -0
- package/dist/components/ui/article-actions.d.ts.map +1 -0
- package/dist/components/ui/article-actions.js +20 -0
- package/dist/components/ui/article-bar.d.ts +8 -0
- package/dist/components/ui/article-bar.d.ts.map +1 -0
- package/dist/components/ui/article-bar.js +32 -0
- package/dist/components/ui/article-card.d.ts +12 -0
- package/dist/components/ui/article-card.d.ts.map +1 -0
- package/dist/components/ui/article-card.js +22 -0
- package/dist/components/ui/article-footer.d.ts +2 -0
- package/dist/components/ui/article-footer.d.ts.map +1 -0
- package/dist/components/ui/article-footer.js +7 -0
- package/dist/components/ui/author-popover.d.ts +7 -0
- package/dist/components/ui/author-popover.d.ts.map +1 -0
- package/dist/components/ui/author-popover.js +36 -0
- package/dist/components/ui/backmatter.d.ts +9 -0
- package/dist/components/ui/backmatter.d.ts.map +1 -0
- package/dist/components/ui/backmatter.js +49 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/banner.d.ts +7 -0
- package/dist/components/ui/banner.d.ts.map +1 -0
- package/dist/components/ui/banner.js +44 -0
- package/dist/components/ui/bibliography.d.ts +6 -0
- package/dist/components/ui/bibliography.d.ts.map +1 -0
- package/dist/components/ui/bibliography.js +20 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +28 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/citation.d.ts +7 -0
- package/dist/components/ui/citation.d.ts.map +1 -0
- package/dist/components/ui/citation.js +99 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/cookie-banner.d.ts +8 -0
- package/dist/components/ui/cookie-banner.d.ts.map +1 -0
- package/dist/components/ui/cookie-banner.js +31 -0
- package/dist/components/ui/data-availability.d.ts +4 -0
- package/dist/components/ui/data-availability.d.ts.map +1 -0
- package/dist/components/ui/data-availability.js +20 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +36 -0
- package/dist/components/ui/document-outline.d.ts +8 -0
- package/dist/components/ui/document-outline.d.ts.map +1 -0
- package/dist/components/ui/document-outline.js +168 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/error-page.d.ts +9 -0
- package/dist/components/ui/error-page.d.ts.map +1 -0
- package/dist/components/ui/error-page.js +21 -0
- package/dist/components/ui/footer-links.d.ts +14 -0
- package/dist/components/ui/footer-links.d.ts.map +1 -0
- package/dist/components/ui/footer-links.js +18 -0
- package/dist/components/ui/footnotes.d.ts +4 -0
- package/dist/components/ui/footnotes.d.ts.map +1 -0
- package/dist/components/ui/footnotes.js +30 -0
- package/dist/components/ui/frontmatter-badges.d.ts +27 -0
- package/dist/components/ui/frontmatter-badges.d.ts.map +1 -0
- package/dist/components/ui/frontmatter-badges.js +60 -0
- package/dist/components/ui/frontmatter.d.ts +7 -0
- package/dist/components/ui/frontmatter.d.ts.map +1 -0
- package/dist/components/ui/frontmatter.js +6 -0
- package/dist/components/ui/image.d.ts +34 -0
- package/dist/components/ui/image.d.ts.map +1 -0
- package/dist/components/ui/image.js +83 -0
- package/dist/components/ui/index.d.ts +50 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +56 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/license-description.d.ts +4 -0
- package/dist/components/ui/license-description.d.ts.map +1 -0
- package/dist/components/ui/license-description.js +63 -0
- package/dist/components/ui/license-frontmatter.d.ts +22 -0
- package/dist/components/ui/license-frontmatter.d.ts.map +1 -0
- package/dist/components/ui/license-frontmatter.js +37 -0
- package/dist/components/ui/lightbox-container.d.ts +11 -0
- package/dist/components/ui/lightbox-container.d.ts.map +1 -0
- package/dist/components/ui/lightbox-container.js +13 -0
- package/dist/components/ui/lightbox.d.ts +17 -0
- package/dist/components/ui/lightbox.d.ts.map +1 -0
- package/dist/components/ui/lightbox.js +129 -0
- package/dist/components/ui/link-card.d.ts +15 -0
- package/dist/components/ui/link-card.d.ts.map +1 -0
- package/dist/components/ui/link-card.js +28 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +17 -0
- package/dist/components/ui/search.d.ts +9 -0
- package/dist/components/ui/search.d.ts.map +1 -0
- package/dist/components/ui/search.js +290 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +40 -0
- package/dist/components/ui/sidebar.d.ts +67 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +202 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +13 -0
- package/dist/components/ui/theme-button.d.ts +2 -0
- package/dist/components/ui/theme-button.d.ts.map +1 -0
- package/dist/components/ui/theme-button.js +9 -0
- package/dist/components/ui/tooltip.d.ts +13 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +20 -0
- package/dist/components/ui/types.d.ts +11 -0
- package/dist/components/ui/types.d.ts.map +1 -0
- package/dist/components/ui/types.js +10 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-hydrated.d.ts +2 -0
- package/dist/hooks/use-hydrated.d.ts.map +1 -0
- package/dist/hooks/use-hydrated.js +6 -0
- package/dist/hooks/use-image-load.d.ts +14 -0
- package/dist/hooks/use-image-load.d.ts.map +1 -0
- package/dist/hooks/use-image-load.js +41 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/hooks/use-theme.d.ts +6 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +23 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/lib/checkMecaExport.d.ts +5 -0
- package/dist/lib/checkMecaExport.d.ts.map +1 -0
- package/dist/lib/checkMecaExport.js +4 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/knownParts.d.ts +12 -0
- package/dist/lib/knownParts.d.ts.map +1 -0
- package/dist/lib/knownParts.js +14 -0
- package/dist/lib/links.d.ts +3 -0
- package/dist/lib/links.d.ts.map +1 -0
- package/dist/lib/links.js +7 -0
- package/dist/lib/parse-date.d.ts +2 -0
- package/dist/lib/parse-date.d.ts.map +1 -0
- package/dist/lib/parse-date.js +7 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +5 -0
- package/package.json +67 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
const badgeVariants = cva('inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden', {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
10
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
|
11
|
+
destructive: 'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
12
|
+
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: 'default',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
function Badge({ className, variant, asChild = false, ...props }) {
|
|
20
|
+
const Comp = asChild ? Slot : 'span';
|
|
21
|
+
return (_jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/banner.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,eAAe,EACf,KAAa,EACb,IAAY,GACb,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,2CAiEA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useImageLoad } from '../../hooks';
|
|
4
|
+
import { cn } from '@curvenote/react-utils';
|
|
5
|
+
function useParallaxEffect() {
|
|
6
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const handleScroll = () => {
|
|
9
|
+
const scrollY = window.scrollY;
|
|
10
|
+
// Limit the parallax effect to a reasonable range
|
|
11
|
+
const maxOffset = 300; // Maximum movement
|
|
12
|
+
const offset = Math.min(scrollY * 0.5, maxOffset); // 0.5 speed factor
|
|
13
|
+
setScrollOffset(offset);
|
|
14
|
+
};
|
|
15
|
+
window.addEventListener('scroll', handleScroll);
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener('scroll', handleScroll);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return scrollOffset;
|
|
21
|
+
}
|
|
22
|
+
export function Banner({ banner, bannerOptimized, inset = false, thin = false, }) {
|
|
23
|
+
const scrollOffset = useParallaxEffect();
|
|
24
|
+
const { imageLoaded, imgRef, handleImageLoad } = useImageLoad({
|
|
25
|
+
src: bannerOptimized ?? banner ?? '',
|
|
26
|
+
showPlaceholder: false,
|
|
27
|
+
minDelay: 100,
|
|
28
|
+
});
|
|
29
|
+
const duration = 'duration-500';
|
|
30
|
+
return (_jsxs(_Fragment, { children: [banner && (_jsx("div", { className: cn('col-screen z-[-1] overflow-hidden', {
|
|
31
|
+
'h-[300px]': !thin,
|
|
32
|
+
'mb-[-200px]': inset && !thin,
|
|
33
|
+
'h-[100px]': thin,
|
|
34
|
+
'mb-[-50px]': inset && thin,
|
|
35
|
+
'mb-8': !inset,
|
|
36
|
+
}), children: _jsx("img", { ref: imgRef, src: bannerOptimized ?? banner, className: cn('mt-0 mb-0 object-cover object-center w-full h-full transition-[opacity,filter]', duration, {
|
|
37
|
+
'opacity-0 grayscale': !imageLoaded,
|
|
38
|
+
'opacity-100 grayscale-0': imageLoaded,
|
|
39
|
+
}), style: {
|
|
40
|
+
transform: `translateY(${scrollOffset}px)`,
|
|
41
|
+
}, onLoad: handleImageLoad }) })), banner && inset && (_jsxs("div", { className: "col-body-outset h-0 mb-8", children: [_jsx("div", { className: cn('overflow-hidden transition-shadow pointer-events-none h-[200px] mb-[-200px] dark:shadow-accent-foreground lg:rounded-t', duration, {
|
|
42
|
+
'shadow-2xl': imageLoaded,
|
|
43
|
+
}) }), _jsx("div", { className: cn('overflow-hidden bg-background pointer-events-none h-[300px] lg:rounded-t') })] }))] }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function Bibliography({ className, innerClassName, hideLongBibliography, }: {
|
|
2
|
+
className?: string;
|
|
3
|
+
innerClassName?: string;
|
|
4
|
+
hideLongBibliography?: false | number;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
//# sourceMappingURL=bibliography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bibliography.d.ts","sourceRoot":"","sources":["../../../src/components/ui/bibliography.tsx"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,cAAc,EACd,oBAAyB,GAC1B,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACvC,kDAgDA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useReferences } from '@myst-theme/providers';
|
|
3
|
+
import { cn } from '@curvenote/react-utils';
|
|
4
|
+
import { HashLink } from 'myst-to-react';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { Button } from './button';
|
|
7
|
+
import { PART_IDS } from './types';
|
|
8
|
+
export function Bibliography({ className, innerClassName, hideLongBibliography = 15, }) {
|
|
9
|
+
const references = useReferences();
|
|
10
|
+
const { order, data } = references?.cite ?? {};
|
|
11
|
+
const filtered = order?.filter((l) => l);
|
|
12
|
+
const [hidden, setHidden] = useState(true);
|
|
13
|
+
if (!filtered || !data || filtered.length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
const refs = hidden && hideLongBibliography ? filtered.slice(0, hideLongBibliography) : filtered;
|
|
16
|
+
return (_jsxs("section", { id: PART_IDS.bibliography, className: cn(className), children: [_jsxs("div", { className: innerClassName, children: [!!hideLongBibliography && filtered.length > hideLongBibliography && (_jsx(Button, { variant: "outline", onClick: () => setHidden(!hidden), className: "float-right text-xs", children: hidden ? 'Show All' : 'Collapse' })), _jsxs("header", { className: "text-lg font-semibold text-stone-900 dark:text-white group", children: ["References", _jsx(HashLink, { id: PART_IDS.bibliography, title: "Link to References", hover: true, className: "ml-2" })] })] }), _jsx("div", { className: cn('pl-3 mb-8 text-xs text-stone-500 dark:text-stone-300', innerClassName), children: _jsxs("ol", { children: [refs.map((label) => {
|
|
17
|
+
const { html } = data[label];
|
|
18
|
+
return (_jsx("li", { className: "break-words", id: `cite-${label}`, dangerouslySetInnerHTML: { __html: html || '' } }, label));
|
|
19
|
+
}), !!hideLongBibliography && filtered.length > hideLongBibliography && (_jsx("li", { className: "list-none text-center", children: _jsx(Button, { variant: "outline", onClick: () => setHidden(!hidden), className: "text-xs", children: hidden ? `Show all ${filtered.length} references` : 'Collapse references' }) }))] }) })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Breadcrumb({ ...props }: React.ComponentProps<'nav'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function BreadcrumbLink({ asChild, className, ...props }: React.ComponentProps<'a'> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
12
|
+
//# sourceMappingURL=breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/ui/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAE5D;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,2CAW1E;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,2CAQ1E;AAED,iBAAS,cAAc,CAAC,EACtB,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,2CAUA;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAW5E;AAED,iBAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,2CAYzF;AAED,iBAAS,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAahF;AAED,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
function Breadcrumb({ ...props }) {
|
|
7
|
+
return _jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
8
|
+
}
|
|
9
|
+
function BreadcrumbList({ className, ...props }) {
|
|
10
|
+
return (_jsx("ol", { "data-slot": "breadcrumb-list", className: cn('text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5', className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
13
|
+
return (_jsx("li", { "data-slot": "breadcrumb-item", className: cn('inline-flex items-center gap-1.5', className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
16
|
+
const Comp = asChild ? Slot : 'a';
|
|
17
|
+
return (_jsx(Comp, { "data-slot": "breadcrumb-link", className: cn('hover:text-foreground transition-colors', className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
20
|
+
return (_jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn('text-foreground font-normal', className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
23
|
+
return (_jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn('[&>svg]:size-3.5', className), ...props, children: children ?? _jsx(ChevronRight, {}) }));
|
|
24
|
+
}
|
|
25
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
26
|
+
return (_jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn('flex size-9 items-center justify-center', className), ...props, children: [_jsx(MoreHorizontal, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "More" })] }));
|
|
27
|
+
}
|
|
28
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
5
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
11
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EA2BnB,CAAC;AAEF,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAC/B,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,2CAUF;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
10
|
+
destructive: 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
11
|
+
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
12
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
13
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
14
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
18
|
+
xs: 'h-6 rounded-sm gap-1.5 px-1 has-[>svg]:px-1.5',
|
|
19
|
+
sm: 'h-8 rounded-sm gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
20
|
+
lg: 'h-10 rounded-sm px-6 has-[>svg]:px-4',
|
|
21
|
+
icon: 'size-9',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: 'default',
|
|
26
|
+
size: 'default',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
30
|
+
const Comp = asChild ? Slot : 'button';
|
|
31
|
+
return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
32
|
+
}
|
|
33
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useShowCitation(): boolean;
|
|
2
|
+
export declare function BibTeXCitationMenuItem(): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare function Citation({ className, children, }: {
|
|
4
|
+
className?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=citation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation.d.ts","sourceRoot":"","sources":["../../../src/components/ui/citation.tsx"],"names":[],"mappings":"AAyDA,wBAAgB,eAAe,YAI9B;AAeD,wBAAgB,sBAAsB,mDAYrC;AAED,wBAAgB,QAAQ,CAAC,EACvB,SAAS,EACT,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,kDAoGA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DropdownMenuItem, } from '.';
|
|
3
|
+
import { useProjectManifest } from '@myst-theme/providers';
|
|
4
|
+
import { getYear } from '../../lib/parse-date';
|
|
5
|
+
import { doi } from 'doi-utils';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { triggerBlobDownload } from './article-actions-downloads';
|
|
8
|
+
import { DownloadIcon, Copy, FileHeart } from 'lucide-react';
|
|
9
|
+
import { Button } from './button';
|
|
10
|
+
import { toast } from 'sonner';
|
|
11
|
+
function generateBibTeX(project) {
|
|
12
|
+
const year = getYear(project.date);
|
|
13
|
+
// Generate citation key from first author's family name and year
|
|
14
|
+
let citeKey = 'unknown';
|
|
15
|
+
if (project.authors && project.authors.length > 0) {
|
|
16
|
+
const firstAuthor = project.authors[0];
|
|
17
|
+
const familyName = firstAuthor.nameParsed?.family ??
|
|
18
|
+
(firstAuthor.name ? (firstAuthor.name.split(' ').pop() ?? 'unknown') : 'unknown');
|
|
19
|
+
citeKey = `${familyName.toLowerCase()}${year ?? ''}`;
|
|
20
|
+
}
|
|
21
|
+
// Format authors for BibTeX: "Family, Given and Family, Given"
|
|
22
|
+
let authors = '';
|
|
23
|
+
if (project.authors && project.authors.length > 0) {
|
|
24
|
+
authors = project.authors
|
|
25
|
+
.map((author) => {
|
|
26
|
+
const family = author.nameParsed?.family ?? (author.name ? (author.name.split(' ').pop() ?? '') : '');
|
|
27
|
+
const given = author.nameParsed?.given ??
|
|
28
|
+
(author.name ? author.name.split(' ').slice(0, -1).join(' ') : '');
|
|
29
|
+
return given ? `${family}, ${given}` : family;
|
|
30
|
+
})
|
|
31
|
+
.join(' and ');
|
|
32
|
+
}
|
|
33
|
+
const bibtex = `@article{${citeKey},
|
|
34
|
+
author = {${authors}},
|
|
35
|
+
title = {${project.title || ''}},
|
|
36
|
+
journal = {${project.venue?.title || ''}},
|
|
37
|
+
year = {${year ?? ''}},
|
|
38
|
+
doi = {${project.doi || ''}},
|
|
39
|
+
url = {${project.doi ? doi.buildUrl(project.doi) : ''}}
|
|
40
|
+
}`;
|
|
41
|
+
return bibtex;
|
|
42
|
+
}
|
|
43
|
+
export function useShowCitation() {
|
|
44
|
+
const project = useProjectManifest();
|
|
45
|
+
const doiUrl = doi.buildUrl(project?.doi);
|
|
46
|
+
return !!doiUrl;
|
|
47
|
+
}
|
|
48
|
+
function handleDownloadBibTeX(project) {
|
|
49
|
+
const bibtex = generateBibTeX(project);
|
|
50
|
+
const blob = new Blob([bibtex], { type: 'text/plain' });
|
|
51
|
+
const filename = `citation.bib`;
|
|
52
|
+
toast.success(_jsxs(_Fragment, { children: ["Download starting... ", _jsx("br", {}), _jsx("code", { children: filename })] }));
|
|
53
|
+
triggerBlobDownload(blob, filename);
|
|
54
|
+
}
|
|
55
|
+
export function BibTeXCitationMenuItem() {
|
|
56
|
+
const project = useProjectManifest();
|
|
57
|
+
const showCitation = useShowCitation();
|
|
58
|
+
if (!showCitation || !project)
|
|
59
|
+
return null;
|
|
60
|
+
return (_jsxs(DropdownMenuItem, { onClick: () => handleDownloadBibTeX(project), children: [_jsx(FileHeart, { className: "mr-2 h-4 w-4" }), "BibTeX Citation"] }));
|
|
61
|
+
}
|
|
62
|
+
export function Citation({ className, children, }) {
|
|
63
|
+
const project = useProjectManifest();
|
|
64
|
+
const doiUrl = doi.buildUrl(project?.doi);
|
|
65
|
+
if (!doiUrl)
|
|
66
|
+
return null;
|
|
67
|
+
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx("div", { className: cn('cursor-pointer', className), children: children }) }), _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { className: "mb-2 text-2xl font-semibold", children: "Cite Article" }) }), _jsx("div", { className: "space-y-4", children: _jsx("div", { children: _jsxs("p", { className: "p-3 text-sm rounded text-muted-foreground bg-muted", children: [project?.authors
|
|
68
|
+
?.map((author, idx, arr) => {
|
|
69
|
+
const family = author.nameParsed
|
|
70
|
+
? (author.nameParsed?.family ?? '')
|
|
71
|
+
: author.name;
|
|
72
|
+
const given = author.nameParsed?.given ?? '';
|
|
73
|
+
// Get initials from given names
|
|
74
|
+
const initials = given
|
|
75
|
+
.split(/\s+/)
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.map((n) => n[0]?.toUpperCase() + '.')
|
|
78
|
+
.join(' ');
|
|
79
|
+
// Determine separator: nothing for first, ', ' for middle, ' & ' for last (if more than one)
|
|
80
|
+
let sep = '';
|
|
81
|
+
if (arr.length > 1) {
|
|
82
|
+
if (idx === arr.length - 1) {
|
|
83
|
+
sep = ' & ';
|
|
84
|
+
}
|
|
85
|
+
else if (idx > 0) {
|
|
86
|
+
sep = ', ';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return `${idx === 0 ? '' : sep}${family}${initials ? ', ' + initials : ''}`;
|
|
90
|
+
})
|
|
91
|
+
.join(''), ' ', "(", getYear(project?.date), "). ", project?.title, ".", project?.venue?.title ? ` ${project.venue.title},` : '', project?.doi && (_jsxs(_Fragment, { children: [' ', _jsx("a", { href: doiUrl, target: "_blank", rel: "noopener noreferrer", className: "underline", children: doiUrl })] }))] }) }) }), _jsxs("div", { className: "mb-4 prose prose-sm dark:prose-invert", children: [_jsxs("div", { className: "mb-4 flex gap-2 justify-end", children: [doiUrl && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
92
|
+
navigator.clipboard.writeText(doiUrl);
|
|
93
|
+
toast.success(_jsxs("div", { children: ["DOI copied to clipboard: ", _jsx("br", {}), _jsx("a", { href: doiUrl, children: doiUrl })] }));
|
|
94
|
+
}, className: "gap-2", children: [_jsx(Copy, { className: "w-4 h-4" }), "Copy DOI"] })), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
95
|
+
if (!project)
|
|
96
|
+
return;
|
|
97
|
+
handleDownloadBibTeX(project);
|
|
98
|
+
}, className: "gap-2", children: [_jsx(DownloadIcon, { className: "w-4 h-4" }), "Download BibTeX"] })] }), doiUrl && (_jsxs("div", { className: "mb-2", children: [_jsx("div", { className: "font-medium", children: "DOI" }), _jsx("a", { href: doiUrl, className: "break-all", target: "_blank", rel: "noopener noreferrer", children: doiUrl })] }))] })] })] }));
|
|
99
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
2
|
+
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
6
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/components/ui/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExF;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAEtE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAEtE;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
|
+
function Collapsible({ ...props }) {
|
|
4
|
+
return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
5
|
+
}
|
|
6
|
+
function CollapsibleTrigger({ ...props }) {
|
|
7
|
+
return _jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props });
|
|
8
|
+
}
|
|
9
|
+
function CollapsibleContent({ ...props }) {
|
|
10
|
+
return _jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
|
|
11
|
+
}
|
|
12
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface CookieBannerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
message?: string;
|
|
4
|
+
privacyLink?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function CookieBanner({ className, message, privacyLink, }: CookieBannerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=cookie-banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-banner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/cookie-banner.tsx"],"names":[],"mappings":"AAIA,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,OAAwI,EACxI,WAA2C,GAC5C,EAAE,iBAAiB,kDA8DnB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button } from '.';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
export function CookieBanner({ className, message = 'We use cookies to enhance your experience on our website. By continuing to use this site, you consent to our use of cookies.', privacyLink = 'https://curvenote.com/legal', }) {
|
|
6
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
7
|
+
const [hasConsented, setHasConsented] = React.useState(false);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
// Check if user has already made a choice
|
|
10
|
+
const consent = localStorage.getItem('cookie-consent');
|
|
11
|
+
if (!consent) {
|
|
12
|
+
setIsVisible(true);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
setHasConsented(consent === 'accepted');
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
const handleAccept = () => {
|
|
19
|
+
localStorage.setItem('cookie-consent', 'accepted');
|
|
20
|
+
setHasConsented(true);
|
|
21
|
+
setIsVisible(false);
|
|
22
|
+
};
|
|
23
|
+
// const handleDecline = () => {
|
|
24
|
+
// localStorage.setItem('cookie-consent', 'declined');
|
|
25
|
+
// setHasConsented(false);
|
|
26
|
+
// setIsVisible(false);
|
|
27
|
+
// };
|
|
28
|
+
if (!isVisible)
|
|
29
|
+
return null;
|
|
30
|
+
return (_jsx("div", { className: cn('fixed bottom-0 left-0 right-0 z-50 bg-background/60 dark:bg-background/50 backdrop-blur-md border-t border-border/50 dark:border-border/30 shadow-lg', className), role: "banner", "aria-label": "Cookie consent", children: _jsx("div", { className: "container mx-auto px-4 py-4", children: _jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4", children: [_jsx("div", { className: "flex-1", children: _jsxs("p", { className: "text-sm text-muted-foreground", children: [message, ' ', _jsx("a", { href: privacyLink, className: "text-primary hover:underline underline-offset-4", children: "Learn more" }), "."] }) }), _jsx("div", { className: "flex flex-col sm:flex-row gap-2 shrink-0", children: _jsx(Button, { size: "sm", variant: "secondary", onClick: handleAccept, className: "whitespace-nowrap cursor-pointer", children: "Accept Cookies" }) })] }) }) }));
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-availability.d.ts","sourceRoot":"","sources":["../../../src/components/ui/data-availability.tsx"],"names":[],"mappings":"AAeA,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAuBrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useFrontmatter, useReferences } from '@myst-theme/providers';
|
|
3
|
+
import { copyNode } from 'myst-common';
|
|
4
|
+
import { MyST, HashLink } from 'myst-to-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { extractKnownParts } from '../../lib/knownParts';
|
|
7
|
+
import { PART_IDS } from './types';
|
|
8
|
+
function useDataAvailability() {
|
|
9
|
+
const frontmatter = useFrontmatter();
|
|
10
|
+
const references = useReferences();
|
|
11
|
+
const tree = copyNode(references?.article ?? { type: 'root', children: [] });
|
|
12
|
+
const knownParts = extractKnownParts(tree, frontmatter?.parts);
|
|
13
|
+
return knownParts.data_availability;
|
|
14
|
+
}
|
|
15
|
+
export function DataAvailability({ className }) {
|
|
16
|
+
const dataAvailability = useDataAvailability();
|
|
17
|
+
if (!dataAvailability)
|
|
18
|
+
return null;
|
|
19
|
+
return (_jsxs("section", { id: PART_IDS.data_availability, className: cn('min-w-full prose dark:prose-invert prose-sm', className), children: [_jsxs("header", { className: "text-lg font-semibold text-stone-900 dark:text-white group", children: ["Data Availability", _jsx(HashLink, { id: PART_IDS.data_availability, title: "Link to Data Availability", hover: true, className: "ml-2" })] }), _jsx("div", { className: cn('pl-3 mb-8 text-sm text-stone-500 dark:text-stone-300'), children: _jsx(MyST, { ast: dataAvailability }) })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
16
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAE9E;AAED,iBAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAExF;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAEtF;AAED,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAEpF;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAWtD;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,2CAyBA;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQzE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQzE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQ/F;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
import { XIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
function Dialog({ ...props }) {
|
|
7
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DialogTrigger({ ...props }) {
|
|
10
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DialogPortal({ ...props }) {
|
|
13
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
14
|
+
}
|
|
15
|
+
function DialogClose({ ...props }) {
|
|
16
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
17
|
+
}
|
|
18
|
+
function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
22
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-sm border p-6 shadow-lg duration-200 sm:max-w-lg', className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
23
|
+
}
|
|
24
|
+
function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-none', className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-sm text-muted-foreground', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface DocumentOutlineProps {
|
|
2
|
+
mdast: any;
|
|
3
|
+
maxdepth?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function DocumentOutline({ mdast, maxdepth, className }: DocumentOutlineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=document-outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-outline.d.ts","sourceRoot":"","sources":["../../../src/components/ui/document-outline.tsx"],"names":[],"mappings":"AAcA,UAAU,oBAAoB;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAqBD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,QAAY,EAAE,SAAS,EAAE,EAAE,oBAAoB,kDAoMvF"}
|