@c-rex/components 0.1.28 → 0.1.30
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/package.json +9 -1
- package/src/article/article-action-bar.stories.tsx +15 -0
- package/src/article/article-content.stories.tsx +21 -0
- package/src/autocomplete.tsx +8 -5
- package/src/carousel/carousel.tsx +344 -0
- package/src/check-article-lang.tsx +5 -5
- package/src/directoryNodes/tree-of-content.stories.tsx +22 -0
- package/src/directoryNodes/tree-of-content.tsx +2 -2
- package/src/documents/result-list.stories.tsx +19 -0
- package/src/documents/result-list.tsx +23 -33
- package/src/favorites/bookmark-button.stories.tsx +19 -0
- package/src/favorites/favorite-button.stories.tsx +22 -0
- package/src/icons/file-icon.stories.tsx +19 -0
- package/src/icons/flag-icon.stories.tsx +25 -0
- package/src/icons/loading.stories.tsx +21 -0
- package/src/info/info-table.tsx +2 -69
- package/src/info/stories/info-table.stories.tsx +31 -0
- package/src/info/stories/shared.stories.tsx +24 -0
- package/src/navbar/language-switcher/content-language-switch.tsx +3 -7
- package/src/navbar/language-switcher/ui-language-switch.tsx +2 -2
- package/src/navbar/navbar.tsx +76 -35
- package/src/navbar/stories/navbar.stories.tsx +21 -6
- package/src/navbar/stories/settings.stories.tsx +15 -0
- package/src/navbar/stories/sign-in-out-btns.stories.tsx +15 -0
- package/src/navbar/stories/user-menu.stories.tsx +20 -0
- package/src/page-wrapper.tsx +10 -14
- package/src/renditions/file-download.stories.tsx +19 -0
- package/src/renditions/html.stories.tsx +19 -0
- package/src/renditions/html.tsx +12 -9
- package/src/renditions/image/container.stories.tsx +19 -0
- package/src/renditions/image/container.tsx +6 -3
- package/src/renditions/image/rendition.stories.tsx +19 -0
- package/src/renditions/image/rendition.tsx +9 -14
- package/src/restriction-menu/restriction-menu-item.tsx +89 -0
- package/src/restriction-menu/restriction-menu.tsx +157 -0
- package/src/results/cards.tsx +1 -1
- package/src/results/dialog-filter.tsx +30 -67
- package/src/results/filter-navbar.tsx +12 -15
- package/src/results/generic/table-result-list.stories.tsx +21 -0
- package/src/results/generic/table-result-list.tsx +31 -28
- package/src/results/stories/cards.stories.tsx +16 -8
- package/src/results/stories/dialog-filter.stories.tsx +20 -0
- package/src/results/stories/empty.stories.tsx +12 -1
- package/src/results/stories/filter-navbar.stories.tsx +19 -0
- package/src/results/stories/filter-sidebar.stories.tsx +20 -0
- package/src/results/stories/pagination.stories.tsx +24 -0
- package/src/results/stories/table-with-images.stories.tsx +19 -0
- package/src/results/stories/table.stories.tsx +32 -9
- package/src/results/table-with-images.tsx +2 -16
- package/src/search-input.tsx +33 -12
- package/src/stores/language-store.ts +33 -16
- package/src/stores/search-settings-store.ts +49 -8
- package/src/stories/autocomplete.stories.tsx +20 -0
- package/src/stories/breadcrumb.stories.tsx +72 -31
- package/src/stories/check-article-lang.stories.tsx +22 -0
- package/src/stories/render-article.stories.tsx +19 -0
- package/src/stories/search-input.stories.tsx +21 -0
- package/src/stories/share-button.stories.tsx +15 -0
- package/src/results/result-container.tsx +0 -70
|
@@ -1,52 +1,93 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { Breadcrumb } from '../breadcrumb';
|
|
3
3
|
|
|
4
|
-
const meta: Meta = {
|
|
4
|
+
const meta: Meta<typeof Breadcrumb> = {
|
|
5
5
|
title: 'Components/Breadcrumb',
|
|
6
6
|
component: Breadcrumb,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
7
|
parameters: {
|
|
9
8
|
layout: 'centered',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
13
12
|
export default meta;
|
|
14
|
-
type Story = StoryObj<typeof
|
|
13
|
+
type Story = StoryObj<typeof Breadcrumb>;
|
|
15
14
|
|
|
16
|
-
const
|
|
15
|
+
const tree = [
|
|
17
16
|
{
|
|
18
|
-
id: '
|
|
19
|
-
label: '
|
|
20
|
-
|
|
17
|
+
id: 'home',
|
|
18
|
+
label: 'Home',
|
|
19
|
+
linkId: 'home',
|
|
21
20
|
active: false,
|
|
22
|
-
children: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
children: [
|
|
22
|
+
{
|
|
23
|
+
id: 'docs',
|
|
24
|
+
label: 'Docs',
|
|
25
|
+
linkId: 'docs',
|
|
26
|
+
active: false,
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
id: 'breadcrumb',
|
|
30
|
+
label: 'Breadcrumb',
|
|
31
|
+
linkId: 'breadcrumb',
|
|
32
|
+
active: true,
|
|
33
|
+
children: [],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
37
38
|
},
|
|
38
39
|
];
|
|
39
40
|
|
|
40
|
-
export const
|
|
41
|
+
export const Basic: Story = {
|
|
41
42
|
args: {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
tree,
|
|
44
|
+
lang: 'en',
|
|
44
45
|
},
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
export const
|
|
48
|
+
export const WithLongTree: Story = {
|
|
48
49
|
args: {
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
tree: [
|
|
51
|
+
{
|
|
52
|
+
id: 'home',
|
|
53
|
+
label: 'Home',
|
|
54
|
+
linkId: 'home',
|
|
55
|
+
active: false,
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
id: 'section',
|
|
59
|
+
label: 'Section',
|
|
60
|
+
linkId: 'section',
|
|
61
|
+
active: false,
|
|
62
|
+
children: [
|
|
63
|
+
{
|
|
64
|
+
id: 'docs',
|
|
65
|
+
label: 'Docs',
|
|
66
|
+
linkId: 'docs',
|
|
67
|
+
active: false,
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
id: 'components',
|
|
71
|
+
label: 'Components',
|
|
72
|
+
linkId: 'components',
|
|
73
|
+
active: false,
|
|
74
|
+
children: [
|
|
75
|
+
{
|
|
76
|
+
id: 'breadcrumb',
|
|
77
|
+
label: 'Breadcrumb',
|
|
78
|
+
linkId: 'breadcrumb',
|
|
79
|
+
active: true,
|
|
80
|
+
children: [],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
lang: 'en',
|
|
51
92
|
},
|
|
52
93
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CheckArticleLangToast } from '../check-article-lang';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof CheckArticleLangToast> = {
|
|
5
|
+
title: 'Components/CheckArticleLangToast',
|
|
6
|
+
component: CheckArticleLangToast,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof CheckArticleLangToast>;
|
|
14
|
+
|
|
15
|
+
export const Basic: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
availableVersions: [
|
|
18
|
+
{ shortId: '1', active: true, lang: 'en', country: 'US', link: '/en' },
|
|
19
|
+
{ shortId: '2', active: false, lang: 'pt', country: 'BR', link: '/pt' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { RenderArticle } from '../render-article';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof RenderArticle> = {
|
|
5
|
+
title: 'Components/RenderArticle',
|
|
6
|
+
component: RenderArticle,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof RenderArticle>;
|
|
14
|
+
|
|
15
|
+
export const Basic: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
htmlContent: '<h1>Hello World</h1><p>This is a test article.</p>',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SearchInput } from '../search-input';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SearchInput> = {
|
|
5
|
+
title: 'Components/SearchInput',
|
|
6
|
+
component: SearchInput,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof SearchInput>;
|
|
14
|
+
|
|
15
|
+
export const Basic: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
showPkgFilter: false,
|
|
18
|
+
autocompleteType: 'default', // ajuste conforme opções reais
|
|
19
|
+
onSelectPath: '/',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ShareButton } from '../share-button';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ShareButton> = {
|
|
5
|
+
title: 'Components/ShareButton',
|
|
6
|
+
component: ShareButton,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof ShareButton>;
|
|
14
|
+
|
|
15
|
+
export const Basic: Story = {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
2
|
-
import {
|
|
3
|
-
DocumentModel,
|
|
4
|
-
ResultContainerModel,
|
|
5
|
-
ExternalProductGraphicModel,
|
|
6
|
-
FragmentModel,
|
|
7
|
-
InformationUnitModel,
|
|
8
|
-
PackageModel,
|
|
9
|
-
TopicModel
|
|
10
|
-
} from "@c-rex/interfaces";
|
|
11
|
-
import { Empty } from "./empty";
|
|
12
|
-
|
|
13
|
-
type ResultData = ResultContainerModel<
|
|
14
|
-
DocumentModel |
|
|
15
|
-
ExternalProductGraphicModel |
|
|
16
|
-
FragmentModel |
|
|
17
|
-
InformationUnitModel |
|
|
18
|
-
PackageModel |
|
|
19
|
-
TopicModel
|
|
20
|
-
>;
|
|
21
|
-
|
|
22
|
-
const vertical = "vertical";
|
|
23
|
-
const horizontal = "horizontal";
|
|
24
|
-
|
|
25
|
-
interface ResultContainerProps {
|
|
26
|
-
data?: ResultData;
|
|
27
|
-
error?: { message: string; name: string };
|
|
28
|
-
layout?: typeof vertical | typeof horizontal;
|
|
29
|
-
|
|
30
|
-
FilterComponent?: FC<any>;
|
|
31
|
-
ResultsComponent: FC<any>;
|
|
32
|
-
PaginationComponent: FC<any>;
|
|
33
|
-
[key: string]: unknown;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const ResultContainer: FC<ResultContainerProps> = ({
|
|
37
|
-
data,
|
|
38
|
-
error,
|
|
39
|
-
layout = horizontal,
|
|
40
|
-
FilterComponent,
|
|
41
|
-
ResultsComponent,
|
|
42
|
-
PaginationComponent,
|
|
43
|
-
...props
|
|
44
|
-
}) => {
|
|
45
|
-
if (error) {
|
|
46
|
-
return <div>Error: {error.message}</div>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!data || data.items.length === 0) {
|
|
50
|
-
return <Empty />;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div className="flex flex-row gap-6 pb-6">
|
|
55
|
-
|
|
56
|
-
{(data.tags && FilterComponent) && (
|
|
57
|
-
<FilterComponent
|
|
58
|
-
tags={data.tags}
|
|
59
|
-
totalItemCount={data.pageInfo.totalItemCount!}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
<div className="flex-1">
|
|
64
|
-
<ResultsComponent items={data.items} {...props} />
|
|
65
|
-
|
|
66
|
-
<PaginationComponent pageInfo={data.pageInfo} {...props} />
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
};
|