@c-rex/components 0.1.26 → 0.1.29

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.
Files changed (60) hide show
  1. package/package.json +9 -1
  2. package/src/article/article-action-bar.stories.tsx +15 -0
  3. package/src/article/article-content.stories.tsx +21 -0
  4. package/src/autocomplete.tsx +8 -5
  5. package/src/carousel/carousel.tsx +344 -0
  6. package/src/check-article-lang.tsx +5 -5
  7. package/src/directoryNodes/tree-of-content.stories.tsx +22 -0
  8. package/src/directoryNodes/tree-of-content.tsx +2 -2
  9. package/src/documents/result-list.stories.tsx +19 -0
  10. package/src/documents/result-list.tsx +24 -33
  11. package/src/favorites/bookmark-button.stories.tsx +19 -0
  12. package/src/favorites/favorite-button.stories.tsx +22 -0
  13. package/src/generated/create-server-request.tsx +2 -2
  14. package/src/icons/file-icon.stories.tsx +19 -0
  15. package/src/icons/flag-icon.stories.tsx +25 -0
  16. package/src/icons/loading.stories.tsx +21 -0
  17. package/src/info/info-table.tsx +2 -69
  18. package/src/info/stories/info-table.stories.tsx +31 -0
  19. package/src/info/stories/shared.stories.tsx +24 -0
  20. package/src/navbar/language-switcher/content-language-switch.tsx +3 -7
  21. package/src/navbar/language-switcher/ui-language-switch.tsx +2 -2
  22. package/src/navbar/navbar.tsx +76 -35
  23. package/src/navbar/stories/navbar.stories.tsx +21 -6
  24. package/src/navbar/stories/settings.stories.tsx +15 -0
  25. package/src/navbar/stories/sign-in-out-btns.stories.tsx +15 -0
  26. package/src/navbar/stories/user-menu.stories.tsx +20 -0
  27. package/src/page-wrapper.tsx +10 -14
  28. package/src/renditions/file-download.stories.tsx +19 -0
  29. package/src/renditions/html.stories.tsx +19 -0
  30. package/src/renditions/html.tsx +12 -9
  31. package/src/renditions/image/container.stories.tsx +19 -0
  32. package/src/renditions/image/container.tsx +6 -3
  33. package/src/renditions/image/rendition.stories.tsx +19 -0
  34. package/src/renditions/image/rendition.tsx +9 -14
  35. package/src/restriction-menu/restriction-menu-item.tsx +89 -0
  36. package/src/restriction-menu/restriction-menu.tsx +157 -0
  37. package/src/results/cards.tsx +1 -1
  38. package/src/results/dialog-filter.tsx +30 -67
  39. package/src/results/filter-navbar.tsx +12 -15
  40. package/src/results/generic/table-result-list.stories.tsx +21 -0
  41. package/src/results/generic/table-result-list.tsx +31 -28
  42. package/src/results/stories/cards.stories.tsx +16 -8
  43. package/src/results/stories/dialog-filter.stories.tsx +20 -0
  44. package/src/results/stories/empty.stories.tsx +12 -1
  45. package/src/results/stories/filter-navbar.stories.tsx +19 -0
  46. package/src/results/stories/filter-sidebar.stories.tsx +20 -0
  47. package/src/results/stories/pagination.stories.tsx +24 -0
  48. package/src/results/stories/table-with-images.stories.tsx +19 -0
  49. package/src/results/stories/table.stories.tsx +32 -9
  50. package/src/results/table-with-images.tsx +2 -16
  51. package/src/search-input.tsx +33 -12
  52. package/src/stores/language-store.ts +33 -16
  53. package/src/stores/search-settings-store.ts +49 -8
  54. package/src/stories/autocomplete.stories.tsx +20 -0
  55. package/src/stories/breadcrumb.stories.tsx +72 -31
  56. package/src/stories/check-article-lang.stories.tsx +22 -0
  57. package/src/stories/render-article.stories.tsx +19 -0
  58. package/src/stories/search-input.stories.tsx +21 -0
  59. package/src/stories/share-button.stories.tsx +15 -0
  60. 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
- } satisfies Meta;
12
-
9
+ },
10
+ tags: ['autodocs'],
11
+ };
13
12
  export default meta;
14
- type Story = StoryObj<typeof meta>;
13
+ type Story = StoryObj<typeof Breadcrumb>;
15
14
 
16
- const mockItems = [
15
+ const tree = [
17
16
  {
18
- id: 'docs',
19
- label: 'Documentation',
20
- link: '/docs',
17
+ id: 'home',
18
+ label: 'Home',
19
+ linkId: 'home',
21
20
  active: false,
22
- children: [],
23
- },
24
- {
25
- id: 'components',
26
- label: 'Components',
27
- link: '/docs/components',
28
- active: false,
29
- children: [],
30
- },
31
- {
32
- id: 'breadcrumb',
33
- label: 'Breadcrumb',
34
- link: '/docs/components/breadcrumb',
35
- active: true,
36
- children: [],
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 Default: Story = {
41
+ export const Basic: Story = {
41
42
  args: {
42
- items: mockItems,
43
- loading: false,
43
+ tree,
44
+ lang: 'en',
44
45
  },
45
46
  };
46
47
 
47
- export const Loading: Story = {
48
+ export const WithLongTree: Story = {
48
49
  args: {
49
- items: [],
50
- loading: true,
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
- };