@scm-manager/ui-components 3.10.4-20250824-132529 → 4.0.0-REACT18-20250824-143504

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 (130) hide show
  1. package/package.json +45 -50
  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/Image.tsx +2 -3
  16. package/src/LinkPaginator.tsx +9 -6
  17. package/src/Loading.stories.tsx +26 -6
  18. package/src/Logo.stories.tsx +44 -13
  19. package/src/Notification.stories.tsx +111 -23
  20. package/src/OverviewPageActions.tsx +5 -5
  21. package/src/Paginator.test.tsx +115 -94
  22. package/src/PdfViewer.stories.tsx +83 -5
  23. package/src/PreformattedCodeBlock.stories.tsx +97 -26
  24. package/src/ProtectedRoute.tsx +14 -39
  25. package/src/SmallLoadingSpinner.stories.tsx +26 -6
  26. package/src/SyntaxHighlighter.stories.tsx +122 -40
  27. package/src/SyntaxHighlighterRenderer.tsx +7 -7
  28. package/src/Tag.stories.tsx +135 -18
  29. package/src/Tag.tsx +2 -1
  30. package/src/Tooltip.stories.tsx +147 -34
  31. package/src/__snapshots__/storyshots.test.ts.snap +21 -144
  32. package/src/avatar/Avatar.ts +1 -1
  33. package/src/avatar/AvatarImage.tsx +2 -2
  34. package/src/avatar/AvatarWrapper.tsx +2 -2
  35. package/src/buttons/Button.stories.tsx +159 -0
  36. package/src/buttons/Button.tsx +5 -5
  37. package/src/config/ConfigurationBinder.tsx +39 -39
  38. package/src/config/ConfigurationForm.tsx +2 -1
  39. package/src/config/TitledSettings.tsx +4 -1
  40. package/src/forms/AddKeyValueEntryToTableField.stories.tsx +60 -25
  41. package/src/forms/Checkbox.stories.tsx +165 -27
  42. package/src/forms/Checkbox.tsx +1 -0
  43. package/src/forms/DropDown.stories.tsx +81 -35
  44. package/src/forms/FileInput.stories.tsx +85 -10
  45. package/src/forms/InputField.stories.tsx +210 -37
  46. package/src/forms/InputField.tsx +1 -0
  47. package/src/forms/Radio.stories.tsx +181 -34
  48. package/src/forms/Radio.tsx +1 -0
  49. package/src/forms/Select.stories.tsx +266 -46
  50. package/src/forms/Select.tsx +1 -0
  51. package/src/forms/Textarea.stories.tsx +99 -53
  52. package/src/forms/Textarea.tsx +1 -0
  53. package/src/forms/index.ts +3 -1
  54. package/src/index.ts +5 -5
  55. package/src/jest-dom.d.ts +17 -0
  56. package/src/layout/Footer.stories.tsx +114 -22
  57. package/src/layout/Footer.tsx +11 -7
  58. package/src/layout/FooterSection.tsx +1 -0
  59. package/src/layout/Header.tsx +2 -1
  60. package/src/layout/Page.tsx +1 -3
  61. package/src/layout/PrimaryContentColumn.tsx +2 -2
  62. package/src/layout/SecondaryNavigationColumn.tsx +3 -3
  63. package/src/layout/SubSubtitle.tsx +2 -1
  64. package/src/layout/Subtitle.tsx +2 -1
  65. package/src/layout/Title.tsx +2 -5
  66. package/src/markdown/LazyMarkdownView.tsx +16 -5
  67. package/src/markdown/MarkdownHeadingRenderer.test.ts +9 -1
  68. package/src/markdown/MarkdownHeadingRenderer.tsx +3 -3
  69. package/src/markdown/MarkdownImageRenderer.test.ts +8 -1
  70. package/src/markdown/MarkdownImageRenderer.tsx +2 -1
  71. package/src/markdown/MarkdownLinkRenderer.test.tsx +9 -0
  72. package/src/markdown/MarkdownLinkRenderer.tsx +6 -4
  73. package/src/markdown/MarkdownView.stories.tsx +224 -72
  74. package/src/markdown/markdownExtensions.ts +6 -4
  75. package/src/modals/ActiveModalCountContextProvider.tsx +2 -2
  76. package/src/modals/ConfirmAlert.stories.tsx +133 -44
  77. package/src/modals/ConfirmAlert.tsx +5 -4
  78. package/src/modals/Modal.stories.tsx +461 -252
  79. package/src/modals/Modal.tsx +12 -11
  80. package/src/modals/useRegisterModal.test.tsx +5 -4
  81. package/src/navigation/MenuContext.tsx +2 -2
  82. package/src/navigation/NavLink.tsx +4 -7
  83. package/src/navigation/PrimaryNavigation.tsx +2 -2
  84. package/src/navigation/PrimaryNavigationLink.tsx +6 -5
  85. package/src/navigation/RoutingProps.ts +1 -3
  86. package/src/navigation/SecondaryNavigation.stories.tsx +157 -45
  87. package/src/navigation/SecondaryNavigation.tsx +17 -16
  88. package/src/navigation/SecondaryNavigationItem.tsx +2 -1
  89. package/src/navigation/SubNavigation.tsx +4 -8
  90. package/src/navigation/useActiveMatch.ts +20 -22
  91. package/src/navigation/useNavigationLock.ts +1 -0
  92. package/src/popover/Popover.stories.tsx +111 -41
  93. package/src/popover/Popover.tsx +2 -5
  94. package/src/repos/Diff.stories.tsx +418 -223
  95. package/src/repos/Diff.tsx +1 -5
  96. package/src/repos/DiffTypes.ts +2 -14
  97. package/src/repos/HunkExpandDivider.tsx +2 -2
  98. package/src/repos/LoadingDiff.tsx +11 -6
  99. package/src/repos/RepositoryEntry.stories.tsx +217 -53
  100. package/src/repos/RepositoryFlag.tsx +2 -1
  101. package/src/repos/TokenizedDiffView.tsx +4 -2
  102. package/src/repos/annotate/Annotate.stories.tsx +225 -111
  103. package/src/repos/annotate/AnnotateLine.tsx +2 -1
  104. package/src/repos/changesets/ChangesetAuthor.tsx +4 -4
  105. package/src/repos/changesets/ChangesetButtonGroup.test.tsx +9 -5
  106. package/src/repos/changesets/ChangesetDiff.test.ts +10 -2
  107. package/src/repos/changesets/Changesets.stories.tsx +388 -197
  108. package/src/repos/changesets/Contributor.tsx +1 -1
  109. package/src/repos/changesets/ContributorRow.tsx +2 -2
  110. package/src/repos/changesets/SignatureIcon.tsx +1 -0
  111. package/src/repos/changesets/SingleChangeset.tsx +0 -1
  112. package/src/repos/diff/DiffFileTree.tsx +37 -89
  113. package/src/repos/diff/styledElements.tsx +4 -3
  114. package/src/repos/index.ts +15 -15
  115. package/src/search/Hit.tsx +3 -2
  116. package/src/search/TextHitField.stories.tsx +131 -43
  117. package/src/search/TextHitField.tsx +3 -2
  118. package/src/search/index.ts +1 -1
  119. package/src/storyshots.test.ts +66 -60
  120. package/src/table/Table.stories.tsx +146 -48
  121. package/src/table/Table.tsx +7 -8
  122. package/src/table/TextColumn.tsx +0 -9
  123. package/src/toast/Toast.tsx +2 -1
  124. package/src/toast/ToastArea.tsx +2 -2
  125. package/src/toast/ToastButton.tsx +2 -1
  126. package/src/toast/ToastButtons.tsx +4 -2
  127. package/src/toast/ToastNotification.tsx +2 -1
  128. package/src/toast/index.stories.tsx +144 -39
  129. package/src/toast/index.ts +1 -1
  130. package/src/buttons/index.stories.tsx +0 -85
@@ -14,54 +14,124 @@
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 React from "react";
19
+ // import styled from "styled-components";
20
+ // import usePopover from "./usePopover";
21
+ // import Popover from "./Popover";
22
+ //
23
+ // const Wrapper = styled.div`
24
+ // width: 100%;
25
+ // margin: 20rem;
26
+ // `;
27
+ //
28
+ // storiesOf("Popover", module)
29
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
30
+ // .add("Default", () =>
31
+ // React.createElement(() => {
32
+ // const { triggerProps, popoverProps } = usePopover();
33
+ //
34
+ // return (
35
+ // <div>
36
+ // <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
37
+ // <p>
38
+ // The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
39
+ // mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
40
+ // which lets the ship pass through every point in every universe simultaneously.
41
+ // </p>
42
+ // </Popover>
43
+ // <button className="button" {...triggerProps}>
44
+ // Trigger
45
+ // </button>
46
+ // </div>
47
+ // );
48
+ // })
49
+ // )
50
+ // .add("Link", () =>
51
+ // React.createElement(() => {
52
+ // const { triggerProps, popoverProps } = usePopover();
53
+ //
54
+ // return (
55
+ // <div>
56
+ // <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
57
+ // <p>
58
+ // The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
59
+ // mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
60
+ // which lets the ship pass through every point in every universe simultaneously.
61
+ // </p>
62
+ // </Popover>
63
+ // <button {...triggerProps}>Trigger</button>
64
+ // </div>
65
+ // );
66
+ // })
67
+ // );
68
+
18
69
  import React from "react";
19
70
  import styled from "styled-components";
20
- import usePopover from "./usePopover";
71
+ import type { Meta, StoryObj } from "@storybook/react";
72
+
21
73
  import Popover from "./Popover";
74
+ import usePopover from "./usePopover";
22
75
 
23
76
  const Wrapper = styled.div`
24
- width: 100%;
77
+ /* A large margin is used to ensure the popover has space to render in all directions */
25
78
  margin: 20rem;
79
+ width: 100%;
26
80
  `;
27
81
 
28
- storiesOf("Popover", module)
29
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
30
- .add("Default", () =>
31
- React.createElement(() => {
32
- const { triggerProps, popoverProps } = usePopover();
82
+ const popoverContent = (
83
+ <p>
84
+ The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks mirror
85
+ its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive, which lets the
86
+ ship pass through every point in every universe simultaneously.
87
+ </p>
88
+ );
89
+
90
+ const meta: Meta<typeof Popover> = {
91
+ title: "Components/Popover",
92
+ component: Popover,
93
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
94
+ tags: ["autodocs"],
95
+ };
96
+
97
+ export default meta;
98
+
99
+ type Story = StoryObj<typeof meta>;
100
+
101
+ export const Default: Story = {
102
+ render: (args) => {
103
+ // eslint-disable-next-line react-hooks/rules-of-hooks
104
+ const { triggerProps, popoverProps } = usePopover();
33
105
 
34
- return (
35
- <div>
36
- <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
37
- <p>
38
- The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
39
- mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
40
- which lets the ship pass through every point in every universe simultaneously.
41
- </p>
42
- </Popover>
43
- <button className="button" {...triggerProps}>
44
- Trigger
45
- </button>
46
- </div>
47
- );
48
- })
49
- )
50
- .add("Link", () =>
51
- React.createElement(() => {
52
- const { triggerProps, popoverProps } = usePopover();
106
+ return (
107
+ <div>
108
+ <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
109
+ {popoverContent}
110
+ </Popover>
111
+ {/* @ts-ignore */}
112
+ <button className="button" {...triggerProps}>
113
+ Trigger
114
+ </button>
115
+ </div>
116
+ );
117
+ },
118
+ };
53
119
 
54
- return (
55
- <div>
56
- <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
57
- <p>
58
- The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
59
- mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
60
- which lets the ship pass through every point in every universe simultaneously.
61
- </p>
62
- </Popover>
63
- <button {...triggerProps}>Trigger</button>
64
- </div>
65
- );
66
- })
67
- );
120
+ export const WithLinkTrigger: Story = {
121
+ name: "With Link as Trigger",
122
+ render: () => {
123
+ // eslint-disable-next-line react-hooks/rules-of-hooks
124
+ const { triggerProps, popoverProps } = usePopover();
125
+ return (
126
+ <div>
127
+ <Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
128
+ {popoverContent}
129
+ </Popover>
130
+ {/* @ts-ignore */}
131
+ <a href="#" {...triggerProps}>
132
+ Trigger
133
+ </a>
134
+ </div>
135
+ );
136
+ },
137
+ };
@@ -26,6 +26,7 @@ type Props = {
26
26
  offsetLeft?: number;
27
27
  show: boolean;
28
28
  dispatch: Dispatch<Action>;
29
+ children?: ReactNode;
29
30
  };
30
31
 
31
32
  type ContainerProps = {
@@ -73,7 +74,7 @@ const Popover: FC<Props> = (props) => {
73
74
  return <InnerPopover {...props} />;
74
75
  };
75
76
 
76
- const InnerPopover: FC<Props> = ({ title, show, width, offsetTop, offsetLeft, dispatch, children }) => {
77
+ const InnerPopover: FC<Props> = ({ title, show, width = 120, offsetTop, offsetLeft, dispatch, children }) => {
77
78
  const [height, setHeight] = useState(125);
78
79
  const ref = useRef<HTMLDivElement>(null);
79
80
  useLayoutEffect(() => {
@@ -112,8 +113,4 @@ const InnerPopover: FC<Props> = ({ title, show, width, offsetTop, offsetLeft, di
112
113
  );
113
114
  };
114
115
 
115
- Popover.defaultProps = {
116
- width: 120,
117
- };
118
-
119
116
  export default Popover;