@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
@@ -14,14 +14,100 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
+ // import styled from "styled-components";
18
+ // import * as React from "react";
19
+ // import { ReactNode } from "react";
20
+ // import { MemoryRouter } from "react-router-dom";
21
+ // import { storiesOf } from "@storybook/react";
22
+ // import Tooltip, { TooltipLocation } from "./Tooltip";
23
+ // import Button from "./buttons/Button";
24
+ //
25
+ // const Wrapper = styled.div`
26
+ // margin: 2rem;
27
+ // width: 100%;
28
+ // `;
29
+ //
30
+ // const Spacing = styled.div`
31
+ // padding: 2em 6em;
32
+ // width: 50%;
33
+ // margin: 0 auto;
34
+ // `;
35
+ //
36
+ // const positions: TooltipLocation[] = ["right", "top", "left", "bottom"];
37
+ //
38
+ // const message = "Heart of Gold";
39
+ //
40
+ // const mutltiline = `Characters:
41
+ //
42
+ // - Arthur Dent
43
+ // - Ford Prefect
44
+ // - Zaphod Beeblebrox
45
+ // - Marvin the Paranoid Android
46
+ // - Trillian
47
+ // - Slartibartfast`;
48
+ //
49
+ // const shortMultiline = `* a
50
+ // * b
51
+ // * c`;
52
+ //
53
+ // const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
54
+ //
55
+ // storiesOf("Tooltip", module)
56
+ // .addDecorator(RoutingDecorator)
57
+ // .add("Default", () => (
58
+ // <Wrapper>
59
+ // {positions.map((position) => (
60
+ // <Spacing>
61
+ // <Tooltip message={message} location={position}>
62
+ // <Button label={position} color="info" />{" "}
63
+ // </Tooltip>
64
+ // </Spacing>
65
+ // ))}
66
+ // </Wrapper>
67
+ // ))
68
+ // .add("Multiline", () => (
69
+ // <Wrapper>
70
+ // {positions.map((position) => (
71
+ // <Spacing>
72
+ // <Tooltip message={mutltiline} location={position}>
73
+ // <Button label={position} color="info" />{" "}
74
+ // </Tooltip>
75
+ // </Spacing>
76
+ // ))}
77
+ // </Wrapper>
78
+ // ))
79
+ // .add("Short Multiline", () => (
80
+ // <Wrapper>
81
+ // {positions.map((position) => (
82
+ // <Spacing>
83
+ // <Tooltip message={shortMultiline} location={position}>
84
+ // <Button label={position} color="info" />{" "}
85
+ // </Tooltip>
86
+ // </Spacing>
87
+ // ))}
88
+ // </Wrapper>
89
+ // ))
90
+ // .add("Styled", () => (
91
+ // <Wrapper>
92
+ // {positions.map((position) => (
93
+ // <Spacing>
94
+ // <Tooltip message={message} location={position} className={"has-text-warning"}>
95
+ // <Button label={position} color="info" />{" "}
96
+ // </Tooltip>
97
+ // </Spacing>
98
+ // ))}
99
+ // </Wrapper>
100
+ // ));
101
+
102
+ import React from "react";
17
103
  import styled from "styled-components";
18
- import * as React from "react";
19
- import { ReactNode } from "react";
20
- import { MemoryRouter } from "react-router-dom";
21
- import { storiesOf } from "@storybook/react";
104
+ import type { Meta, StoryObj } from "@storybook/react";
105
+
22
106
  import Tooltip, { TooltipLocation } from "./Tooltip";
23
107
  import Button from "./buttons/Button";
24
108
 
109
+ // --- Helper Components & Mock Data (preserved from your original story) ---
110
+
25
111
  const Wrapper = styled.div`
26
112
  margin: 2rem;
27
113
  width: 100%;
@@ -31,13 +117,14 @@ const Spacing = styled.div`
31
117
  padding: 2em 6em;
32
118
  width: 50%;
33
119
  margin: 0 auto;
120
+ text-align: center; // Center the button for better display
34
121
  `;
35
122
 
36
123
  const positions: TooltipLocation[] = ["right", "top", "left", "bottom"];
37
124
 
38
125
  const message = "Heart of Gold";
39
126
 
40
- const mutltiline = `Characters:
127
+ const multiline = `Characters:
41
128
 
42
129
  - Arthur Dent
43
130
  - Ford Prefect
@@ -50,51 +137,77 @@ const shortMultiline = `* a
50
137
  * b
51
138
  * c`;
52
139
 
53
- const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
140
+ // --- Storybook Metadata ---
141
+
142
+ const meta: Meta<typeof Tooltip> = {
143
+ title: "Components/Tooltip",
144
+ component: Tooltip,
145
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
146
+ tags: ["autodocs"],
147
+ };
148
+
149
+ export default meta;
150
+
151
+ // --- Story Definitions ---
54
152
 
55
- storiesOf("Tooltip", module)
56
- .addDecorator(RoutingDecorator)
57
- .add("Default", () => (
58
- <Wrapper>
153
+ type Story = StoryObj<typeof meta>;
154
+
155
+ // Since these stories showcase multiple components at once, we use
156
+ // a custom `render` function instead of the `args` object.
157
+
158
+ export const Default: Story = {
159
+ render: () => (
160
+ <>
59
161
  {positions.map((position) => (
60
- <Spacing>
162
+ <Spacing key={position}>
61
163
  <Tooltip message={message} location={position}>
62
- <Button label={position} color="info" />{" "}
164
+ <Button label={position} color="info" />
63
165
  </Tooltip>
64
166
  </Spacing>
65
167
  ))}
66
- </Wrapper>
67
- ))
68
- .add("Multiline", () => (
69
- <Wrapper>
168
+ </>
169
+ ),
170
+ };
171
+
172
+ export const Multiline: Story = {
173
+ render: () => (
174
+ <>
70
175
  {positions.map((position) => (
71
- <Spacing>
72
- <Tooltip message={mutltiline} location={position}>
73
- <Button label={position} color="info" />{" "}
176
+ <Spacing key={position}>
177
+ <Tooltip message={multiline} location={position}>
178
+ <Button label={position} color="info" />
74
179
  </Tooltip>
75
180
  </Spacing>
76
181
  ))}
77
- </Wrapper>
78
- ))
79
- .add("Short Multiline", () => (
80
- <Wrapper>
182
+ </>
183
+ ),
184
+ };
185
+
186
+ export const ShortMultiline: Story = {
187
+ name: "Short Multiline", // Explicit name to maintain spacing
188
+ render: () => (
189
+ <>
81
190
  {positions.map((position) => (
82
- <Spacing>
191
+ <Spacing key={position}>
83
192
  <Tooltip message={shortMultiline} location={position}>
84
- <Button label={position} color="info" />{" "}
193
+ <Button label={position} color="info" />
85
194
  </Tooltip>
86
195
  </Spacing>
87
196
  ))}
88
- </Wrapper>
89
- ))
90
- .add("Styled", () => (
91
- <Wrapper>
197
+ </>
198
+ ),
199
+ };
200
+
201
+ export const Styled: Story = {
202
+ render: () => (
203
+ <>
92
204
  {positions.map((position) => (
93
- <Spacing>
94
- <Tooltip message={message} location={position} className={"has-text-warning"}>
95
- <Button label={position} color="info" />{" "}
205
+ <Spacing key={position}>
206
+ <Tooltip message={message} location={position} className="has-text-warning">
207
+ <Button label={position} color="info" />
96
208
  </Tooltip>
97
209
  </Spacing>
98
210
  ))}
99
- </Wrapper>
100
- ));
211
+ </>
212
+ ),
213
+ };