@scm-manager/ui-components 4.0.0-REACT18-20250701-125025 → 4.0.0-REACT19

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 (124) hide show
  1. package/package.json +46 -51
  2. package/src/BranchSelector.stories.tsx +60 -11
  3. package/src/Breadcrumb.stories.tsx +131 -57
  4. package/src/Breadcrumb.tsx +3 -3
  5. package/src/CardColumn.stories.tsx +94 -27
  6. package/src/CardColumnSmall.stories.tsx +102 -27
  7. package/src/CommaSeparatedList.tsx +2 -2
  8. package/src/Date.stories.tsx +64 -17
  9. package/src/Duration.stories.tsx +92 -45
  10. package/src/ErrorBoundary.tsx +38 -58
  11. package/src/ErrorNotification.tsx +1 -1
  12. package/src/Help.stories.tsx +61 -17
  13. package/src/Help.tsx +5 -11
  14. package/src/Icon.stories.tsx +93 -13
  15. package/src/LinkPaginator.tsx +9 -6
  16. package/src/Loading.stories.tsx +26 -6
  17. package/src/Logo.stories.tsx +44 -13
  18. package/src/Notification.stories.tsx +111 -23
  19. package/src/OverviewPageActions.tsx +5 -5
  20. package/src/Paginator.test.tsx +115 -94
  21. package/src/PdfViewer.stories.tsx +83 -5
  22. package/src/PreformattedCodeBlock.stories.tsx +97 -26
  23. package/src/ProtectedRoute.tsx +14 -39
  24. package/src/SmallLoadingSpinner.stories.tsx +26 -6
  25. package/src/SyntaxHighlighter.stories.tsx +122 -40
  26. package/src/SyntaxHighlighterRenderer.tsx +7 -7
  27. package/src/Tag.stories.tsx +135 -18
  28. package/src/Tag.tsx +2 -1
  29. package/src/Tooltip.stories.tsx +147 -34
  30. package/src/__snapshots__/storyshots.test.ts.snap +6 -112
  31. package/src/avatar/Avatar.ts +1 -1
  32. package/src/avatar/AvatarImage.tsx +1 -1
  33. package/src/avatar/AvatarWrapper.tsx +2 -2
  34. package/src/buttons/Button.stories.tsx +159 -0
  35. package/src/buttons/Button.tsx +5 -5
  36. package/src/config/ConfigurationBinder.tsx +39 -39
  37. package/src/config/ConfigurationForm.tsx +2 -1
  38. package/src/config/TitledSettings.tsx +4 -1
  39. package/src/forms/AddKeyValueEntryToTableField.stories.tsx +60 -25
  40. package/src/forms/Checkbox.stories.tsx +165 -27
  41. package/src/forms/Checkbox.tsx +1 -0
  42. package/src/forms/DropDown.stories.tsx +81 -35
  43. package/src/forms/FileInput.stories.tsx +85 -10
  44. package/src/forms/InputField.stories.tsx +210 -37
  45. package/src/forms/InputField.tsx +1 -0
  46. package/src/forms/Radio.stories.tsx +181 -34
  47. package/src/forms/Radio.tsx +1 -0
  48. package/src/forms/Select.stories.tsx +266 -46
  49. package/src/forms/Select.tsx +1 -0
  50. package/src/forms/Textarea.stories.tsx +99 -53
  51. package/src/forms/Textarea.tsx +1 -0
  52. package/src/forms/index.ts +3 -1
  53. package/src/index.ts +5 -5
  54. package/src/jest-dom.d.ts +17 -0
  55. package/src/layout/Footer.stories.tsx +114 -22
  56. package/src/layout/FooterSection.tsx +1 -0
  57. package/src/layout/Header.tsx +2 -1
  58. package/src/layout/Page.tsx +1 -3
  59. package/src/layout/PrimaryContentColumn.tsx +2 -2
  60. package/src/layout/SecondaryNavigationColumn.tsx +3 -3
  61. package/src/layout/SubSubtitle.tsx +2 -1
  62. package/src/layout/Subtitle.tsx +2 -1
  63. package/src/layout/Title.tsx +2 -5
  64. package/src/markdown/LazyMarkdownView.tsx +16 -5
  65. package/src/markdown/MarkdownHeadingRenderer.test.ts +9 -1
  66. package/src/markdown/MarkdownHeadingRenderer.tsx +3 -3
  67. package/src/markdown/MarkdownImageRenderer.test.ts +8 -1
  68. package/src/markdown/MarkdownImageRenderer.tsx +2 -1
  69. package/src/markdown/MarkdownLinkRenderer.test.tsx +9 -0
  70. package/src/markdown/MarkdownLinkRenderer.tsx +6 -4
  71. package/src/markdown/MarkdownView.stories.tsx +224 -72
  72. package/src/markdown/markdownExtensions.ts +6 -4
  73. package/src/modals/ConfirmAlert.stories.tsx +133 -44
  74. package/src/modals/ConfirmAlert.tsx +5 -4
  75. package/src/modals/Modal.stories.tsx +461 -252
  76. package/src/modals/Modal.tsx +12 -11
  77. package/src/modals/useRegisterModal.test.tsx +5 -4
  78. package/src/navigation/MenuContext.tsx +2 -2
  79. package/src/navigation/NavLink.tsx +4 -7
  80. package/src/navigation/PrimaryNavigation.tsx +2 -2
  81. package/src/navigation/PrimaryNavigationLink.tsx +6 -5
  82. package/src/navigation/RoutingProps.ts +1 -3
  83. package/src/navigation/SecondaryNavigation.stories.tsx +157 -45
  84. package/src/navigation/SecondaryNavigation.tsx +17 -16
  85. package/src/navigation/SecondaryNavigationItem.tsx +2 -1
  86. package/src/navigation/SubNavigation.tsx +4 -8
  87. package/src/navigation/useActiveMatch.ts +20 -22
  88. package/src/navigation/useNavigationLock.ts +1 -0
  89. package/src/popover/Popover.stories.tsx +111 -41
  90. package/src/popover/Popover.tsx +2 -5
  91. package/src/repos/Diff.stories.tsx +418 -223
  92. package/src/repos/Diff.tsx +1 -5
  93. package/src/repos/HunkExpandDivider.tsx +2 -2
  94. package/src/repos/LoadingDiff.tsx +11 -6
  95. package/src/repos/RepositoryEntry.stories.tsx +217 -53
  96. package/src/repos/RepositoryFlag.tsx +2 -1
  97. package/src/repos/TokenizedDiffView.tsx +4 -2
  98. package/src/repos/annotate/Annotate.stories.tsx +225 -111
  99. package/src/repos/annotate/AnnotateLine.tsx +2 -1
  100. package/src/repos/changesets/ChangesetAuthor.tsx +2 -2
  101. package/src/repos/changesets/ChangesetButtonGroup.test.tsx +9 -5
  102. package/src/repos/changesets/ChangesetDiff.test.ts +10 -2
  103. package/src/repos/changesets/Changesets.stories.tsx +388 -197
  104. package/src/repos/changesets/ContributorRow.tsx +2 -2
  105. package/src/repos/changesets/SignatureIcon.tsx +1 -0
  106. package/src/repos/diff/DiffFileTree.tsx +1 -1
  107. package/src/repos/diff/styledElements.tsx +4 -3
  108. package/src/repos/index.ts +15 -15
  109. package/src/search/Hit.tsx +3 -2
  110. package/src/search/TextHitField.stories.tsx +131 -43
  111. package/src/search/TextHitField.tsx +3 -2
  112. package/src/search/index.ts +1 -1
  113. package/src/storyshots.test.ts +66 -60
  114. package/src/table/Table.stories.tsx +146 -48
  115. package/src/table/Table.tsx +7 -8
  116. package/src/table/TextColumn.tsx +0 -9
  117. package/src/toast/Toast.tsx +2 -1
  118. package/src/toast/ToastArea.tsx +2 -2
  119. package/src/toast/ToastButton.tsx +2 -1
  120. package/src/toast/ToastButtons.tsx +4 -2
  121. package/src/toast/ToastNotification.tsx +2 -1
  122. package/src/toast/index.stories.tsx +144 -39
  123. package/src/toast/index.ts +1 -1
  124. package/src/buttons/index.stories.tsx +0 -85
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-components",
3
- "version": "4.0.0-REACT18-20250701-125025",
3
+ "version": "4.0.0-REACT19",
4
4
  "description": "UI Components for SCM-Manager and its plugins",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -13,75 +13,70 @@
13
13
  "scripts": {
14
14
  "test": "jest",
15
15
  "typecheck": "tsc",
16
- "build-storybook": "build-storybook",
17
- "storybook": "start-storybook -s ../ui-webapp/public",
16
+ "storybook": "storybook dev -p 6006",
17
+ "build-storybook": "storybook build",
18
18
  "storyshots": "jest --testPathPattern=\"storyshots.test.ts\" --collectCoverage=false",
19
19
  "update-storyshots": "jest --testPathPattern=\"storyshots.test.ts\" --collectCoverage=false -u",
20
20
  "depcheck": "depcheck"
21
21
  },
22
22
  "peerDependencies": {
23
- "@headlessui/react": "^1.7.17",
23
+ "@headlessui/react": "^2.2.7",
24
24
  "classnames": "^2.3.1",
25
25
  "date-fns": "^2.4.1",
26
- "react": "^18.3.1",
27
- "react-dom": "^18.3.1",
28
- "react-i18next": "11",
29
- "react-router-dom": "^5.3.3",
30
- "styled-components": "^5.3.5",
31
26
  "i18next": "21",
32
- "react-query": "^3.39.2"
27
+ "react": "^19.1.1",
28
+ "react-dom": "^19.1.1",
29
+ "react-i18next": "11",
30
+ "react-query": "^3.39.2",
31
+ "react-router-dom": "^7.9.1",
32
+ "styled-components": "^6.1.19"
33
33
  },
34
34
  "devDependencies": {
35
- "@scm-manager/ui-tests": "4.0.0-REACT18-20250701-125025",
36
- "@scm-manager/ui-types": "4.0.0-REACT18-20250701-125025",
35
+ "@scm-manager/babel-preset": "^2.13.1",
36
+ "@scm-manager/eslint-config": "^2.17.0",
37
+ "@scm-manager/jest-preset": "^2.15.0-alpha1",
38
+ "@scm-manager/prettier-config": "^2.12.0",
39
+ "@scm-manager/tsconfig": "^2.13.0",
40
+ "@scm-manager/ui-shortcuts": "4.0.0-REACT19",
41
+ "@scm-manager/ui-syntaxhighlighting": "4.0.0-REACT19",
42
+ "@scm-manager/ui-text": "4.0.0-REACT19",
43
+ "@scm-manager/ui-types": "4.0.0-REACT19",
44
+ "@storybook/addon-actions": "^9.0.8",
45
+ "@storybook/addon-docs": "^9.1.5",
46
+ "@storybook/addon-essentials": "^9.0.0-alpha.12",
47
+ "@storybook/addon-interactions": "^9.0.0-alpha.10",
48
+ "@storybook/addon-links": "^9.1.5",
49
+ "@storybook/react": "^9.1.5",
50
+ "@storybook/react-vite": "^9.1.5",
51
+ "@tanstack/react-query": "4.40.1",
52
+ "@tanstack/react-query-devtools": "4.40.1",
53
+ "@testing-library/react": "16.3.0",
54
+ "@types/classnames": "^2.3.1",
37
55
  "@types/fetch-mock": "^7.3.1",
56
+ "@types/react": "^19.1.1",
38
57
  "@types/react-select": "^2.0.19",
39
58
  "@types/unist": "^2.0.3",
40
- "gitdiff-parser": "^0.2.2",
41
- "i18next-fetch-backend": "4",
42
- "webpack": "^5.76.0",
43
- "@storybook/addon-actions": "^6.5.10",
44
- "@storybook/addon-essentials": "^6.5.10",
45
- "@storybook/addon-interactions": "^6.5.10",
46
- "@storybook/addon-storyshots": "^6.5.10",
47
- "@storybook/builder-webpack5": "^6.5.10",
48
- "@storybook/manager-webpack5": "^6.5.10",
49
- "@storybook/react": "^6.5.10",
50
- "@testing-library/react": "^12.1.5",
51
- "storybook-addon-i18next": "^1.3.0",
52
- "storybook-addon-themes": "^6.1.0",
53
- "@types/classnames": "^2.3.1",
54
- "@types/react": "^18.3.1",
55
- "@types/react-dom": "^17.0.1",
56
- "@types/react-router-dom": "^5.3.3",
57
- "@types/styled-components": "^5.1.25",
58
- "@testing-library/react-hooks": "8.0.1",
59
+ "decode-named-character-reference": "^1.0.1",
59
60
  "fetch-mock": "^7.5.1",
60
- "html-webpack-plugin": "^5.5.0",
61
- "mini-css-extract-plugin": "^2.4.3",
62
- "react-test-renderer": "^18.2.0",
61
+ "gitdiff-parser": "^0.2.2",
62
+ "minimatch": "^10.0.3",
63
+ "react-test-renderer": "^19.1.1",
64
+ "react-router-dom": "^7.9.1",
63
65
  "sass-loader": "^12.3.0",
64
- "@types/react-test-renderer": "^18.2.0",
65
- "decode-named-character-reference": "^1.0.1",
66
- "@scm-manager/babel-preset": "^2.13.1",
67
- "@scm-manager/eslint-config": "^2.17.0",
68
- "@scm-manager/jest-preset": "^2.14.1",
69
- "@scm-manager/prettier-config": "^2.12.0",
70
- "@scm-manager/tsconfig": "^2.13.0",
71
- "@scm-manager/ui-syntaxhighlighting": "4.0.0-REACT18-20250701-125025",
72
- "@scm-manager/ui-shortcuts": "4.0.0-REACT18-20250701-125025",
73
- "@scm-manager/ui-text": "4.0.0-REACT18-20250701-125025"
66
+ "storybook-addon-i18next": "^1.3.0",
67
+ "storybook-addon-themes": "^6.1.0"
74
68
  },
75
69
  "dependencies": {
76
- "@scm-manager/ui-core": "4.0.0-REACT18-20250701-125025",
77
- "@scm-manager/ui-overlays": "4.0.0-REACT18-20250701-125025",
78
- "@scm-manager/ui-layout": "4.0.0-REACT18-20250701-125025",
79
- "@scm-manager/ui-buttons": "4.0.0-REACT18-20250701-125025",
80
- "@scm-manager/ui-api": "4.0.0-REACT18-20250701-125025",
81
- "@scm-manager/ui-extensions": "4.0.0-REACT18-20250701-125025",
70
+ "@scm-manager/ui-api": "4.0.0-REACT19",
71
+ "@scm-manager/ui-buttons": "4.0.0-REACT19",
72
+ "@scm-manager/ui-core": "4.0.0-REACT19",
73
+ "@scm-manager/ui-extensions": "4.0.0-REACT19",
74
+ "@scm-manager/ui-layout": "4.0.0-REACT19",
75
+ "@scm-manager/ui-overlays": "4.0.0-REACT19",
82
76
  "deepmerge": "^4.2.2",
83
77
  "hast-util-sanitize": "^3.0.2",
84
78
  "react-diff-view": "^2.4.10",
79
+ "react-error-boundary": "^6.0.0",
85
80
  "react-hook-form": "^7.33.1",
86
81
  "react-select": "^2.1.2",
87
82
  "rehype-raw": "^5.1.0",
@@ -109,4 +104,4 @@
109
104
  "publishConfig": {
110
105
  "access": "public"
111
106
  }
112
- }
107
+ }
@@ -14,24 +14,73 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import { storiesOf } from "@storybook/react";
17
+ // import { storiesOf } from "@storybook/react";
18
+ // import { BranchSelector } from "./index";
19
+ // import { Branch } from "@scm-manager/ui-types";
20
+ // import * as React from "react";
21
+ // import styled from "styled-components";
22
+ //
23
+ // const master = { name: "master", revision: "1", defaultBranch: true, _links: {} };
24
+ // const develop = { name: "develop", revision: "2", defaultBranch: false, _links: {} };
25
+ //
26
+ // const branchSelected = (branch?: Branch) => null;
27
+ //
28
+ // const branches = [master, develop];
29
+ //
30
+ // const Wrapper = styled.div`
31
+ // margin: 2rem;
32
+ // max-width: 400px;
33
+ // `;
34
+ //
35
+ // storiesOf("BranchSelector", module)
36
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
37
+ // .add("Default", () => <BranchSelector branches={branches} onSelectBranch={branchSelected} label="Select Branch" />);
38
+
18
39
  import { BranchSelector } from "./index";
19
40
  import { Branch } from "@scm-manager/ui-types";
20
41
  import * as React from "react";
42
+ import type { Meta, StoryObj } from "@storybook/react";
21
43
  import styled from "styled-components";
22
44
 
23
- const master = { name: "master", revision: "1", defaultBranch: true, _links: {} };
24
- const develop = { name: "develop", revision: "2", defaultBranch: false, _links: {} };
25
-
26
- const branchSelected = (branch?: Branch) => null;
27
-
28
- const branches = [master, develop];
29
-
30
45
  const Wrapper = styled.div`
31
46
  margin: 2rem;
32
47
  max-width: 400px;
33
48
  `;
34
49
 
35
- storiesOf("BranchSelector", module)
36
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
37
- .add("Default", () => <BranchSelector branches={branches} onSelectBranch={branchSelected} label="Select Branch" />);
50
+ // This is the metadata for your component, replacing `storiesOf("BranchSelector", module)`
51
+ const meta: Meta<typeof BranchSelector> = {
52
+ title: "Components/BranchSelector",
53
+ component: BranchSelector,
54
+ decorators: [
55
+ // The decorator is now an array in the meta object
56
+ (Story) => (
57
+ <Wrapper>
58
+ <Story />
59
+ </Wrapper>
60
+ ),
61
+ ],
62
+ argTypes: {
63
+ // This tells Storybook to automatically create an "action" for the onSelectBranch prop
64
+ // so you can see when it's called in the Actions panel.
65
+ onSelectBranch: { action: "branchSelected" },
66
+ },
67
+ tags: ["autodocs"], // This enables the automatic documentation page
68
+ };
69
+
70
+ export default meta;
71
+
72
+ // Define the story type for better TypeScript support
73
+ type Story = StoryObj<typeof meta>;
74
+
75
+ // Mock data for the story
76
+ const master: Branch = { name: "master", revision: "1", defaultBranch: true, _links: {} };
77
+ const develop: Branch = { name: "develop", revision: "2", defaultBranch: false, _links: {} };
78
+
79
+ // This is your "Default" story, replacing `.add("Default", ...)`
80
+ export const Default: Story = {
81
+ args: {
82
+ // Props for the component go into the `args` object
83
+ branches: [master, develop],
84
+ label: "Select Branch",
85
+ },
86
+ };
@@ -14,15 +14,97 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import { storiesOf } from "@storybook/react";
18
- import * as React from "react";
17
+ // import { storiesOf } from "@storybook/react";
18
+ // import * as React from "react";
19
+ // import styled from "styled-components";
20
+ // import Breadcrumb from "./Breadcrumb";
21
+ // import repository from "./__resources__/repository";
22
+ // // @ts-ignore ignore unknown png
23
+ // import Git from "./__resources__/git-logo.png";
24
+ // import { MemoryRouter } from "react-router-dom";
25
+ // import Icon from "./Icon";
26
+ //
27
+ // const Wrapper = styled.div`
28
+ // margin: 2rem;
29
+ // max-width: 800px;
30
+ // `;
31
+ //
32
+ // const master = { name: "master", revision: "1", defaultBranch: true, _links: {} };
33
+ // const path = "src/main/java/com/cloudogu";
34
+ // const longPath =
35
+ // "dream-path/src/main/scm-plugins/javaUtilityHomeHousingLinkReferrer/sonia/scm/repositoryUndergroundSupportManager/spi/SvnRepositoryServiceResolver.java";
36
+ // const baseUrl = "scm-manager.org/scm/repo/hitchhiker/heartOfGold/sources";
37
+ // const sources = Git;
38
+ // const prefix = (
39
+ // <a href="#link">
40
+ // <Icon name="heart" color="danger" alt="heart icon" />
41
+ // </a>
42
+ // );
43
+ //
44
+ // storiesOf("BreadCrumb", module)
45
+ // .addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
46
+ // .addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
47
+ // .add("Default", () => (
48
+ // <Breadcrumb
49
+ // repository={repository}
50
+ // defaultBranch={master}
51
+ // branch={master}
52
+ // path={path}
53
+ // baseUrl={baseUrl}
54
+ // sources={sources}
55
+ // revision={"1"}
56
+ // permalink={"/" + path}
57
+ // />
58
+ // ))
59
+ // .add("Long path", () => (
60
+ // <Breadcrumb
61
+ // repository={repository}
62
+ // defaultBranch={master}
63
+ // branch={master}
64
+ // path={longPath}
65
+ // baseUrl={baseUrl}
66
+ // sources={sources}
67
+ // revision={"1"}
68
+ // permalink={"/" + longPath}
69
+ // />
70
+ // ))
71
+ // .add("With prefix button", () => (
72
+ // <Breadcrumb
73
+ // repository={repository}
74
+ // defaultBranch={master}
75
+ // branch={master}
76
+ // path={path}
77
+ // baseUrl={baseUrl}
78
+ // sources={sources}
79
+ // revision={"1"}
80
+ // permalink={"/" + path}
81
+ // preButtons={prefix}
82
+ // />
83
+ // ))
84
+ // .add("Not clickable", () => (
85
+ // <Breadcrumb
86
+ // repository={repository}
87
+ // defaultBranch={master}
88
+ // branch={master}
89
+ // path={path}
90
+ // baseUrl={baseUrl}
91
+ // sources={sources}
92
+ // revision={"1"}
93
+ // permalink={"/" + path}
94
+ // clickable={false}
95
+ // />
96
+ // ));
97
+
98
+ import React from "react";
19
99
  import styled from "styled-components";
100
+ import { MemoryRouter } from "react-router-dom";
101
+ import type { Meta, StoryObj } from "@storybook/react";
102
+
20
103
  import Breadcrumb from "./Breadcrumb";
104
+ import Icon from "./Icon";
21
105
  import repository from "./__resources__/repository";
22
106
  // @ts-ignore ignore unknown png
23
107
  import Git from "./__resources__/git-logo.png";
24
- import { MemoryRouter } from "react-router-dom";
25
- import Icon from "./Icon";
26
108
 
27
109
  const Wrapper = styled.div`
28
110
  margin: 2rem;
@@ -41,56 +123,48 @@ const prefix = (
41
123
  </a>
42
124
  );
43
125
 
44
- storiesOf("BreadCrumb", module)
45
- .addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
46
- .addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
47
- .add("Default", () => (
48
- <Breadcrumb
49
- repository={repository}
50
- defaultBranch={master}
51
- branch={master}
52
- path={path}
53
- baseUrl={baseUrl}
54
- sources={sources}
55
- revision={"1"}
56
- permalink={"/" + path}
57
- />
58
- ))
59
- .add("Long path", () => (
60
- <Breadcrumb
61
- repository={repository}
62
- defaultBranch={master}
63
- branch={master}
64
- path={longPath}
65
- baseUrl={baseUrl}
66
- sources={sources}
67
- revision={"1"}
68
- permalink={"/" + longPath}
69
- />
70
- ))
71
- .add("With prefix button", () => (
72
- <Breadcrumb
73
- repository={repository}
74
- defaultBranch={master}
75
- branch={master}
76
- path={path}
77
- baseUrl={baseUrl}
78
- sources={sources}
79
- revision={"1"}
80
- permalink={"/" + path}
81
- preButtons={prefix}
82
- />
83
- ))
84
- .add("Not clickable", () => (
85
- <Breadcrumb
86
- repository={repository}
87
- defaultBranch={master}
88
- branch={master}
89
- path={path}
90
- baseUrl={baseUrl}
91
- sources={sources}
92
- revision={"1"}
93
- permalink={"/" + path}
94
- clickable={false}
95
- />
96
- ));
126
+ const meta: Meta<typeof Breadcrumb> = {
127
+ title: "Components/Breadcrumb",
128
+ component: Breadcrumb,
129
+ decorators: [(Story) => <MemoryRouter><Story /></MemoryRouter>, (Story) => <Wrapper>{Story()}</Wrapper>],
130
+ tags: ["autodocs"],
131
+ };
132
+
133
+ export default meta;
134
+
135
+ type Story = StoryObj<typeof meta>;
136
+
137
+ export const Default: Story = {
138
+ args: {
139
+ repository: repository,
140
+ defaultBranch: master,
141
+ branch: master,
142
+ path: path,
143
+ baseUrl: baseUrl,
144
+ sources: sources,
145
+ revision: "1",
146
+ permalink: "/" + path,
147
+ },
148
+ };
149
+
150
+ export const LongPath: Story = {
151
+ args: {
152
+ ...Default.args,
153
+ path: longPath,
154
+ permalink: "/" + longPath,
155
+ },
156
+ };
157
+
158
+ export const WithPrefixButton: Story = {
159
+ args: {
160
+ ...Default.args,
161
+ preButtons: prefix,
162
+ },
163
+ };
164
+
165
+ export const NotClickable: Story = {
166
+ args: {
167
+ ...Default.args,
168
+ clickable: false,
169
+ },
170
+ };
@@ -16,7 +16,7 @@
16
16
 
17
17
  import React, { FC, useState } from "react";
18
18
  import { useTranslation } from "react-i18next";
19
- import { Link, useHistory, useLocation } from "react-router-dom";
19
+ import { Link, useNavigate, useLocation } from "react-router-dom";
20
20
  import classNames from "classnames";
21
21
  import styled from "styled-components";
22
22
  import { urls } from "@scm-manager/ui-api";
@@ -139,7 +139,7 @@ const Breadcrumb: FC<Props> = ({
139
139
  clickable = true,
140
140
  }) => {
141
141
  const location = useLocation();
142
- const history = useHistory();
142
+ const navigate = useNavigate();
143
143
  const [copying, setCopying] = useState(false);
144
144
  const [t] = useTranslation("commons");
145
145
 
@@ -177,7 +177,7 @@ const Breadcrumb: FC<Props> = ({
177
177
  };
178
178
 
179
179
  const copySource = () => {
180
- history.push(location.pathname);
180
+ navigate(location.pathname);
181
181
  setCopying(true);
182
182
  copyToClipboard(
183
183
  window.location.protocol + "//" + window.location.host + urls.withContextPath(permalink || location.pathname)
@@ -14,12 +14,60 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
+ // import React from "react";
18
+ // import { MemoryRouter } from "react-router-dom";
19
+ // import { storiesOf } from "@storybook/react";
20
+ // import CardColumn from "./CardColumn";
21
+ // import Icon from "./Icon";
22
+ // import styled from "styled-components";
23
+ // import { DateFromNow } from ".";
24
+ // import repository from "./__resources__/repository";
25
+ //
26
+ // const Wrapper = styled.div`
27
+ // margin: 2rem;
28
+ // max-width: 400px;
29
+ // `;
30
+ //
31
+ // const link = "/foo/bar";
32
+ // const avatar = <Icon name="icons fa-2x fa-fw" alt="avatar" />;
33
+ // const title = <strong>title</strong>;
34
+ // const footerLeft = <small>left footer</small>;
35
+ // const footerRight = <small>right footer</small>;
36
+ // const baseDate = "2020-03-26T12:13:42+02:00";
37
+ //
38
+ // storiesOf("CardColumn", module)
39
+ // .addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
40
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
41
+ // .add("Default", () => (
42
+ // <CardColumn
43
+ // link={link}
44
+ // avatar={avatar}
45
+ // title={title}
46
+ // description="A description can be added here."
47
+ // footerLeft={footerLeft}
48
+ // footerRight={footerRight}
49
+ // />
50
+ // ))
51
+ // .add("Minimal", () => <CardColumn title={title} footerLeft={footerLeft} footerRight={footerRight} />)
52
+ // .add("With hoverable date", () => (
53
+ // <CardColumn
54
+ // title={title}
55
+ // footerLeft={footerLeft}
56
+ // footerRight={
57
+ // <small className="level-item">
58
+ // <DateFromNow baseDate={baseDate} date={repository.creationDate} />
59
+ // </small>
60
+ // }
61
+ // />
62
+ // ));
63
+
17
64
  import React from "react";
18
65
  import { MemoryRouter } from "react-router-dom";
19
- import { storiesOf } from "@storybook/react";
66
+ import styled from "styled-components";
67
+ import type { Meta, StoryObj } from "@storybook/react";
68
+
20
69
  import CardColumn from "./CardColumn";
21
70
  import Icon from "./Icon";
22
- import styled from "styled-components";
23
71
  import { DateFromNow } from ".";
24
72
  import repository from "./__resources__/repository";
25
73
 
@@ -35,28 +83,47 @@ const footerLeft = <small>left footer</small>;
35
83
  const footerRight = <small>right footer</small>;
36
84
  const baseDate = "2020-03-26T12:13:42+02:00";
37
85
 
38
- storiesOf("CardColumn", module)
39
- .addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
40
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
41
- .add("Default", () => (
42
- <CardColumn
43
- link={link}
44
- avatar={avatar}
45
- title={title}
46
- description="A description can be added here."
47
- footerLeft={footerLeft}
48
- footerRight={footerRight}
49
- />
50
- ))
51
- .add("Minimal", () => <CardColumn title={title} footerLeft={footerLeft} footerRight={footerRight} />)
52
- .add("With hoverable date", () => (
53
- <CardColumn
54
- title={title}
55
- footerLeft={footerLeft}
56
- footerRight={
57
- <small className="level-item">
58
- <DateFromNow baseDate={baseDate} date={repository.creationDate} />
59
- </small>
60
- }
61
- />
62
- ));
86
+ const meta: Meta<typeof CardColumn> = {
87
+ title: "Components/CardColumn",
88
+ component: CardColumn,
89
+ decorators: [
90
+ (Story) => <MemoryRouter initialEntries={["/"]}>{Story()}</MemoryRouter>,
91
+ (Story) => <Wrapper>{Story()}</Wrapper>,
92
+ ],
93
+ tags: ["autodocs"],
94
+ };
95
+
96
+ export default meta;
97
+
98
+ type Story = StoryObj<typeof meta>;
99
+
100
+ export const Default: Story = {
101
+ args: {
102
+ link: link,
103
+ avatar: avatar,
104
+ title: title,
105
+ description: "A description can be added here.",
106
+ footerLeft: footerLeft,
107
+ footerRight: footerRight,
108
+ },
109
+ };
110
+
111
+ export const Minimal: Story = {
112
+ args: {
113
+ title: title,
114
+ footerLeft: footerLeft,
115
+ footerRight: footerRight,
116
+ },
117
+ };
118
+
119
+ export const WithHoverableDate: Story = {
120
+ args: {
121
+ title: title,
122
+ footerLeft: footerLeft,
123
+ footerRight: (
124
+ <small className="level-item">
125
+ <DateFromNow baseDate={baseDate} date={repository.creationDate} />
126
+ </small>
127
+ ),
128
+ },
129
+ };