@c-rex/components 0.1.37 → 0.1.39
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/README.md +73 -73
- package/package.json +250 -235
- package/src/article/article-action-bar.tsx +110 -110
- package/src/article/article-content.tsx +18 -46
- package/src/autocomplete.tsx +201 -201
- package/src/breadcrumb.tsx +124 -124
- package/src/carousel/carousel.tsx +353 -352
- package/src/check-article-lang.tsx +47 -43
- package/src/directoryNodes/directory-tree-context.tsx +388 -0
- package/src/directoryNodes/tree-of-content.tsx +68 -67
- package/src/documents/result-list.tsx +124 -127
- package/src/favorites/bookmark-button.tsx +97 -79
- package/src/favorites/favorite-button.tsx +137 -74
- package/src/footer/footer-shell.tsx +52 -0
- package/src/footer/footer.tsx +7 -0
- package/src/footer/legal-links-block.tsx +25 -0
- package/src/footer/organization-contact-block.tsx +94 -0
- package/src/footer/social-links-block.tsx +38 -0
- package/src/footer/types.ts +10 -0
- package/src/footer/vcard-footer.tsx +72 -0
- package/src/generated/client-components.tsx +1366 -1350
- package/src/generated/create-client-request.tsx +116 -113
- package/src/generated/create-server-request.tsx +70 -61
- package/src/generated/create-suggestions-request.tsx +55 -55
- package/src/generated/server-components.tsx +1056 -1056
- package/src/generated/suggestions.tsx +302 -299
- package/src/icons/file-icon.tsx +8 -8
- package/src/icons/flag-icon.tsx +15 -15
- package/src/icons/loading.tsx +11 -11
- package/src/icons/social-icon.tsx +24 -0
- package/src/info/info-card.tsx +43 -0
- package/src/info/{info-table.tsx → information-unit-metadata-grid.tsx} +157 -146
- package/src/info/shared.tsx +49 -25
- package/src/navbar/language-switcher/content-language-switch.tsx +92 -92
- package/src/navbar/language-switcher/shared.tsx +33 -33
- package/src/navbar/language-switcher/ui-language-switch.tsx +37 -38
- package/src/navbar/navbar.tsx +157 -148
- package/src/navbar/settings.tsx +62 -62
- package/src/navbar/sign-in-out-btns.tsx +35 -35
- package/src/navbar/user-menu.tsx +60 -60
- package/src/page-wrapper.tsx +54 -31
- package/src/render-article.module.css +155 -0
- package/src/render-article.tsx +75 -68
- package/src/renditions/file-download.tsx +83 -83
- package/src/renditions/html.tsx +64 -64
- package/src/renditions/image/container.tsx +54 -54
- package/src/renditions/image/rendition.tsx +55 -55
- package/src/restriction-menu/restriction-menu-container.tsx +117 -53
- package/src/restriction-menu/restriction-menu-item.tsx +155 -147
- package/src/restriction-menu/restriction-menu.tsx +341 -157
- package/src/results/dialog-filter.tsx +166 -166
- package/src/results/empty.tsx +15 -15
- package/src/results/filter-navbar.tsx +294 -261
- package/src/results/filter-sidebar/__tests__/utils.test.ts +129 -0
- package/src/results/filter-sidebar/index.tsx +270 -126
- package/src/results/filter-sidebar/utils.ts +196 -164
- package/src/results/generic/table-result-list.tsx +97 -99
- package/src/results/{table-with-images.tsx → information-unit-search-results-card-list.tsx} +125 -127
- package/src/results/{cards.tsx → information-unit-search-results-cards.tsx} +99 -99
- package/src/results/{table.tsx → information-unit-search-results-table.tsx} +104 -104
- package/src/results/pagination.tsx +81 -81
- package/src/results/summary.ts +30 -0
- package/src/results/utils.ts +54 -47
- package/src/search-input.tsx +70 -70
- package/src/share-button.tsx +49 -49
- package/src/stores/favorites-store.ts +88 -88
- package/src/stores/highlight-store.ts +15 -15
- package/src/stores/language-store.ts +14 -43
- package/src/stores/restriction-store.ts +11 -11
- package/src/stores/search-settings-store.ts +68 -64
- package/src/article/article-action-bar.analysis.md +0 -15
- package/src/article/article-action-bar.stories.tsx +0 -15
- package/src/article/article-content.analysis.md +0 -15
- package/src/article/article-content.stories.tsx +0 -21
- package/src/autocomplete.analysis.md +0 -17
- package/src/breadcrumb.analysis.md +0 -15
- package/src/carousel/carousel.analysis.md +0 -17
- package/src/check-article-lang.analysis.md +0 -15
- package/src/directoryNodes/tree-of-content.analysis.md +0 -14
- package/src/directoryNodes/tree-of-content.stories.tsx +0 -22
- package/src/documents/result-list.analysis.md +0 -14
- package/src/documents/result-list.stories.tsx +0 -19
- package/src/favorites/bookmark-button.analysis.md +0 -17
- package/src/favorites/bookmark-button.stories.tsx +0 -19
- package/src/favorites/favorite-button.analysis.md +0 -18
- package/src/favorites/favorite-button.stories.tsx +0 -22
- package/src/icons/file-icon.analysis.md +0 -14
- package/src/icons/file-icon.stories.tsx +0 -19
- package/src/icons/flag-icon.analysis.md +0 -14
- package/src/icons/flag-icon.stories.tsx +0 -25
- package/src/icons/loading.analysis.md +0 -14
- package/src/icons/loading.stories.tsx +0 -21
- package/src/info/info-table.analysis.md +0 -15
- package/src/info/shared.analysis.md +0 -14
- package/src/info/stories/info-table.stories.tsx +0 -31
- package/src/info/stories/shared.stories.tsx +0 -24
- package/src/navbar/language-switcher/content-language-switch.analysis.md +0 -15
- package/src/navbar/language-switcher/shared.analysis.md +0 -14
- package/src/navbar/language-switcher/ui-language-switch.analysis.md +0 -15
- package/src/navbar/navbar.analysis.md +0 -14
- package/src/navbar/settings.analysis.md +0 -14
- package/src/navbar/sign-in-out-btns.analysis.md +0 -14
- package/src/navbar/stories/navbar.stories.tsx +0 -31
- package/src/navbar/stories/settings.stories.tsx +0 -15
- package/src/navbar/stories/sign-in-out-btns.stories.tsx +0 -15
- package/src/navbar/stories/user-menu.stories.tsx +0 -20
- package/src/navbar/user-menu.analysis.md +0 -14
- package/src/page-wrapper.analysis.md +0 -14
- package/src/render-article.analysis.md +0 -15
- package/src/renditions/file-download.analysis.md +0 -14
- package/src/renditions/file-download.stories.tsx +0 -19
- package/src/renditions/html.analysis.md +0 -17
- package/src/renditions/html.stories.tsx +0 -19
- package/src/renditions/image/container.analysis.md +0 -15
- package/src/renditions/image/container.stories.tsx +0 -19
- package/src/renditions/image/rendition.analysis.md +0 -14
- package/src/renditions/image/rendition.stories.tsx +0 -19
- package/src/restriction-menu/restriction-menu-container.analysis.md +0 -14
- package/src/restriction-menu/restriction-menu-item.analysis.md +0 -14
- package/src/restriction-menu/restriction-menu.analysis.md +0 -17
- package/src/results/analysis/cards.analysis.md +0 -14
- package/src/results/analysis/dialog-filter.analysis.md +0 -17
- package/src/results/analysis/empty.analysis.md +0 -14
- package/src/results/analysis/filter-navbar.analysis.md +0 -16
- package/src/results/analysis/pagination.analysis.md +0 -14
- package/src/results/analysis/table-with-images.analysis.md +0 -15
- package/src/results/analysis/table.analysis.md +0 -15
- package/src/results/filter-sidebar/index.analysis.md +0 -14
- package/src/results/generic/table-result-list.analysis.md +0 -15
- package/src/results/generic/table-result-list.stories.tsx +0 -21
- package/src/results/stories/cards.stories.tsx +0 -66
- package/src/results/stories/dialog-filter.stories.tsx +0 -20
- package/src/results/stories/empty.stories.tsx +0 -25
- package/src/results/stories/filter-navbar.stories.tsx +0 -19
- package/src/results/stories/filter-sidebar.stories.tsx +0 -20
- package/src/results/stories/pagination.stories.tsx +0 -24
- package/src/results/stories/table-with-images.stories.tsx +0 -19
- package/src/results/stories/table.stories.tsx +0 -78
- package/src/search-input.analysis.md +0 -15
- package/src/share-button.analysis.md +0 -19
- package/src/stories/autocomplete.stories.tsx +0 -20
- package/src/stories/breadcrumb.stories.tsx +0 -93
- package/src/stories/check-article-lang.stories.tsx +0 -22
- package/src/stories/render-article.stories.tsx +0 -19
- package/src/stories/search-input.stories.tsx +0 -21
- package/src/stories/share-button.stories.tsx +0 -15
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { FC, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useHighlightStore } from "../stores/highlight-store";
|
|
4
|
-
import { Button } from "@c-rex/ui/button";
|
|
5
|
-
import { ArrowBigLeft, ArrowBigRight, FileSearchIcon, PanelRight, Search, X } from "lucide-react";
|
|
6
|
-
import { useQueryState } from "nuqs";
|
|
7
|
-
import { useHighlight } from "@c-rex/contexts/highlight-provider";
|
|
8
|
-
import { useMultiSidebar } from "@c-rex/ui/sidebar";
|
|
9
|
-
import { cn } from "@c-rex/utils";
|
|
10
|
-
import { useTranslations } from "next-intl";
|
|
11
|
-
|
|
12
|
-
export const ArticleActionBar: FC = () => {
|
|
13
|
-
const t = useTranslations();
|
|
14
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
15
|
-
const { next, prev } = useHighlight();
|
|
16
|
-
const [open, setOpen] = useState(false);
|
|
17
|
-
const enableHighlight = useHighlightStore((state) => state.enable);
|
|
18
|
-
const toggleHighlight = useHighlightStore((state) => state.toggleHighlight);
|
|
19
|
-
const { rightSidebar } = useMultiSidebar()
|
|
20
|
-
const [query, setQuery] = useQueryState("q");
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (open && inputRef.current) {
|
|
24
|
-
inputRef.current.focus();
|
|
25
|
-
}
|
|
26
|
-
}, [open]);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<div className="w-auto justify-between bg-primary text-primary-foreground rounded-full shadow-lg flex
|
|
31
|
-
{enableHighlight && (
|
|
32
|
-
|
|
33
|
-
<>
|
|
34
|
-
<div className="flex items-center">
|
|
35
|
-
<input
|
|
36
|
-
type="text"
|
|
37
|
-
value={query as string || ""}
|
|
38
|
-
ref={inputRef}
|
|
39
|
-
onKeyDown={(e) => {
|
|
40
|
-
if (e.key === "Enter") {
|
|
41
|
-
next();
|
|
42
|
-
}
|
|
43
|
-
if (e.key === "Escape") {
|
|
44
|
-
setOpen(false);
|
|
45
|
-
}
|
|
46
|
-
}}
|
|
47
|
-
onChange={(e) => setQuery(e.target.value || null)}
|
|
48
|
-
placeholder={t("search")}
|
|
49
|
-
className={cn(
|
|
50
|
-
"border border-gray-300 left-12 transition-all duration-300 rounded-full h-9 bg-secondary text-secondary-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
51
|
-
open ? "flex flex-1 opacity-100 px-2 mr-2" : "w-0 opacity-0 px-0"
|
|
52
|
-
)}
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<Button variant="ghost" size="icon" rounded="full" onClick={() => setOpen(!open)}>
|
|
56
|
-
{open ? <X className="w-5 h-5" /> : <Search className="w-5 h-5" />}
|
|
57
|
-
</Button>
|
|
58
|
-
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<Button
|
|
62
|
-
variant="ghost"
|
|
63
|
-
size="icon"
|
|
64
|
-
rounded="full"
|
|
65
|
-
onClick={prev}
|
|
66
|
-
className={cn(open && "hidden sm:inline-flex")}
|
|
67
|
-
>
|
|
68
|
-
<ArrowBigLeft />
|
|
69
|
-
</Button>
|
|
70
|
-
|
|
71
|
-
<Button
|
|
72
|
-
variant="ghost"
|
|
73
|
-
size="icon"
|
|
74
|
-
rounded="full"
|
|
75
|
-
onClick={next}
|
|
76
|
-
className={cn(open && "hidden sm:inline-flex")}
|
|
77
|
-
>
|
|
78
|
-
<ArrowBigRight />
|
|
79
|
-
</Button>
|
|
80
|
-
</>
|
|
81
|
-
)}
|
|
82
|
-
|
|
83
|
-
<Button
|
|
84
|
-
variant="ghost"
|
|
85
|
-
size="icon"
|
|
86
|
-
rounded="full"
|
|
87
|
-
onClick={() => toggleHighlight(!enableHighlight)}
|
|
88
|
-
className={cn("group", open && "hidden sm:inline-flex")}
|
|
89
|
-
>
|
|
90
|
-
{enableHighlight ?
|
|
91
|
-
<FileSearchIcon /> :
|
|
92
|
-
<div className="relative inline-block">
|
|
93
|
-
<FileSearchIcon />
|
|
94
|
-
<span className="absolute inset-0 w-[2px] bg-primary-foreground rotate-45 translate-x-2 group-hover:bg-accent-foreground" />
|
|
95
|
-
</div>
|
|
96
|
-
}
|
|
97
|
-
</Button>
|
|
98
|
-
|
|
99
|
-
<Button
|
|
100
|
-
variant="ghost"
|
|
101
|
-
size="icon"
|
|
102
|
-
rounded="full"
|
|
103
|
-
onClick={rightSidebar.toggleSidebar}
|
|
104
|
-
className={cn(open && "hidden sm:inline-flex")}
|
|
105
|
-
>
|
|
106
|
-
<PanelRight />
|
|
107
|
-
</Button>
|
|
108
|
-
</div>
|
|
109
|
-
</>
|
|
110
|
-
)
|
|
1
|
+
"use client";
|
|
2
|
+
import { FC, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useHighlightStore } from "../stores/highlight-store";
|
|
4
|
+
import { Button } from "@c-rex/ui/button";
|
|
5
|
+
import { ArrowBigLeft, ArrowBigRight, FileSearchIcon, PanelRight, Search, X } from "lucide-react";
|
|
6
|
+
import { useQueryState } from "nuqs";
|
|
7
|
+
import { useHighlight } from "@c-rex/contexts/highlight-provider";
|
|
8
|
+
import { useMultiSidebar } from "@c-rex/ui/sidebar";
|
|
9
|
+
import { cn } from "@c-rex/utils";
|
|
10
|
+
import { useTranslations } from "next-intl";
|
|
11
|
+
|
|
12
|
+
export const ArticleActionBar: FC = () => {
|
|
13
|
+
const t = useTranslations();
|
|
14
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
15
|
+
const { next, prev } = useHighlight();
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const enableHighlight = useHighlightStore((state) => state.enable);
|
|
18
|
+
const toggleHighlight = useHighlightStore((state) => state.toggleHighlight);
|
|
19
|
+
const { rightSidebar } = useMultiSidebar()
|
|
20
|
+
const [query, setQuery] = useQueryState("q");
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (open && inputRef.current) {
|
|
24
|
+
inputRef.current.focus();
|
|
25
|
+
}
|
|
26
|
+
}, [open]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<div className="w-auto justify-between bg-primary text-primary-foreground rounded-full shadow-lg flex bottom-4 p-2 float-right gap-2 transition-all duration-300 absolute right-4">
|
|
31
|
+
{enableHighlight && (
|
|
32
|
+
|
|
33
|
+
<>
|
|
34
|
+
<div className="flex items-center">
|
|
35
|
+
<input
|
|
36
|
+
type="text"
|
|
37
|
+
value={query as string || ""}
|
|
38
|
+
ref={inputRef}
|
|
39
|
+
onKeyDown={(e) => {
|
|
40
|
+
if (e.key === "Enter") {
|
|
41
|
+
next();
|
|
42
|
+
}
|
|
43
|
+
if (e.key === "Escape") {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
}
|
|
46
|
+
}}
|
|
47
|
+
onChange={(e) => setQuery(e.target.value || null)}
|
|
48
|
+
placeholder={t("search")}
|
|
49
|
+
className={cn(
|
|
50
|
+
"border border-gray-300 left-12 transition-all duration-300 rounded-full h-9 bg-secondary text-secondary-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
51
|
+
open ? "flex flex-1 opacity-100 px-2 mr-2" : "w-0 opacity-0 px-0"
|
|
52
|
+
)}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<Button variant="ghost" size="icon" rounded="full" onClick={() => setOpen(!open)}>
|
|
56
|
+
{open ? <X className="w-5 h-5" /> : <Search className="w-5 h-5" />}
|
|
57
|
+
</Button>
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<Button
|
|
62
|
+
variant="ghost"
|
|
63
|
+
size="icon"
|
|
64
|
+
rounded="full"
|
|
65
|
+
onClick={prev}
|
|
66
|
+
className={cn(open && "hidden sm:inline-flex")}
|
|
67
|
+
>
|
|
68
|
+
<ArrowBigLeft />
|
|
69
|
+
</Button>
|
|
70
|
+
|
|
71
|
+
<Button
|
|
72
|
+
variant="ghost"
|
|
73
|
+
size="icon"
|
|
74
|
+
rounded="full"
|
|
75
|
+
onClick={next}
|
|
76
|
+
className={cn(open && "hidden sm:inline-flex")}
|
|
77
|
+
>
|
|
78
|
+
<ArrowBigRight />
|
|
79
|
+
</Button>
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
<Button
|
|
84
|
+
variant="ghost"
|
|
85
|
+
size="icon"
|
|
86
|
+
rounded="full"
|
|
87
|
+
onClick={() => toggleHighlight(!enableHighlight)}
|
|
88
|
+
className={cn("group", open && "hidden sm:inline-flex")}
|
|
89
|
+
>
|
|
90
|
+
{enableHighlight ?
|
|
91
|
+
<FileSearchIcon /> :
|
|
92
|
+
<div className="relative inline-block">
|
|
93
|
+
<FileSearchIcon />
|
|
94
|
+
<span className="absolute inset-0 w-[2px] bg-primary-foreground rotate-45 translate-x-2 group-hover:bg-accent-foreground" />
|
|
95
|
+
</div>
|
|
96
|
+
}
|
|
97
|
+
</Button>
|
|
98
|
+
|
|
99
|
+
<Button
|
|
100
|
+
variant="ghost"
|
|
101
|
+
size="icon"
|
|
102
|
+
rounded="full"
|
|
103
|
+
onClick={rightSidebar.toggleSidebar}
|
|
104
|
+
className={cn(open && "hidden sm:inline-flex")}
|
|
105
|
+
>
|
|
106
|
+
<PanelRight />
|
|
107
|
+
</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</>
|
|
110
|
+
)
|
|
111
111
|
}
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const name = $(el).attr("name")
|
|
20
|
-
const content = $(el).attr("content")
|
|
21
|
-
return name && content ? { name, content } : null
|
|
22
|
-
}).get().filter(Boolean)
|
|
23
|
-
|
|
24
|
-
const articleHtml = $("main").html() || ""
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
{metaTags.map((tag) => (
|
|
29
|
-
<meta key={`${tag.name}-${tag.content}`} name={tag.name} content={tag.content} />
|
|
30
|
-
))}
|
|
31
|
-
<div className="pr-4 relative">
|
|
32
|
-
<RenderArticle htmlContent={articleHtml} contentLang="" />
|
|
33
|
-
</div>
|
|
34
|
-
<ArticleActionBar />
|
|
35
|
-
</>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<HtmlRendition
|
|
41
|
-
renditions={renditions}
|
|
42
|
-
render={articleRender}
|
|
43
|
-
shortId=""
|
|
44
|
-
/>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { RenderArticle } from "../render-article";
|
|
3
|
+
import { ArticleActionBar } from "./article-action-bar";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
articleHtml: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ArticleContent: FC<Props> = async ({ articleHtml }) => {
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<div className="pr-4 relative">
|
|
13
|
+
<RenderArticle htmlContent={articleHtml} contentLang="" />
|
|
14
|
+
</div>
|
|
15
|
+
<ArticleActionBar />
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|