@scm-manager/ui-components 4.0.0-REACT18-20250701-125025 → 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 (124) 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/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,12 +14,32 @@
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 SmallLoadingSpinner from "./SmallLoadingSpinner";
20
+ //
21
+ // storiesOf("SmallLoading", module).add("Default", () => (
22
+ // <div>
23
+ // <SmallLoadingSpinner />
24
+ // </div>
25
+ // ));
26
+
18
27
  import React from "react";
28
+ import type { Meta, StoryObj } from "@storybook/react";
29
+
19
30
  import SmallLoadingSpinner from "./SmallLoadingSpinner";
20
31
 
21
- storiesOf("SmallLoading", module).add("Default", () => (
22
- <div>
23
- <SmallLoadingSpinner />
24
- </div>
25
- ));
32
+ const meta: Meta<typeof SmallLoadingSpinner> = {
33
+ title: "Components/SmallLoadingSpinner",
34
+ component: SmallLoadingSpinner,
35
+ parameters: {
36
+ layout: "centered",
37
+ },
38
+ tags: ["autodocs"],
39
+ };
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Default: Story = {};
@@ -14,56 +14,138 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { ReactNode } from "react";
18
- import { storiesOf } from "@storybook/react";
17
+ // import React, { ReactNode } from "react";
18
+ // import { storiesOf } from "@storybook/react";
19
+ // import styled from "styled-components";
20
+ // import SyntaxHighlighter from "./SyntaxHighlighter";
21
+ //
22
+ // import JavaHttpServer from "./__resources__/HttpServer.java";
23
+ // import GoHttpServer from "./__resources__/HttpServer.go";
24
+ // import JsHttpServer from "./__resources__/HttpServer.js";
25
+ // import PyHttpServer from "./__resources__/HttpServer.py";
26
+ // import Markdown from "./__resources__/test-page.md";
27
+ // import { MemoryRouter } from "react-router-dom";
28
+ //
29
+ // const Spacing = styled.div`
30
+ // padding: 1em;
31
+ // `;
32
+ //
33
+ // const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
34
+ //
35
+ // storiesOf("SyntaxHighlighter", module)
36
+ // .addDecorator(RoutingDecorator)
37
+ // // Add async parameter, because the tests needs to render async before snapshot is taken so that
38
+ // // code fragments get highlighted properly
39
+ // .addParameters({ storyshots: { async: true } })
40
+ // .add("Java", () => (
41
+ // <Spacing>
42
+ // <SyntaxHighlighter language="java" value={JavaHttpServer} />
43
+ // </Spacing>
44
+ // ))
45
+ // .add("Go", () => (
46
+ // <Spacing>
47
+ // <SyntaxHighlighter language="go" value={GoHttpServer} />
48
+ // </Spacing>
49
+ // ))
50
+ // .add("Javascript", () => (
51
+ // <Spacing>
52
+ // <SyntaxHighlighter language="javascript" value={JsHttpServer} />
53
+ // </Spacing>
54
+ // ))
55
+ // .add("Python", () => (
56
+ // <Spacing>
57
+ // <SyntaxHighlighter language="python" value={PyHttpServer} />
58
+ // </Spacing>
59
+ // ))
60
+ // .add("Markdown", () => (
61
+ // <Spacing>
62
+ // <SyntaxHighlighter language="markdown" value={Markdown} />
63
+ // </Spacing>
64
+ // ))
65
+ // .add("Without line numbers", () => (
66
+ // <Spacing>
67
+ // <SyntaxHighlighter language="java" value={JavaHttpServer} showLineNumbers={false} />
68
+ // </Spacing>
69
+ // ));
70
+
71
+ import React from "react";
19
72
  import styled from "styled-components";
73
+ import type { Meta, StoryObj } from "@storybook/react";
74
+
20
75
  import SyntaxHighlighter from "./SyntaxHighlighter";
21
76
 
22
77
  import JavaHttpServer from "./__resources__/HttpServer.java";
23
78
  import GoHttpServer from "./__resources__/HttpServer.go";
24
79
  import JsHttpServer from "./__resources__/HttpServer.js";
25
80
  import PyHttpServer from "./__resources__/HttpServer.py";
26
- import Markdown from "./__resources__/test-page.md";
27
81
  import { MemoryRouter } from "react-router-dom";
28
82
 
83
+ // --- Helper Components & Styles ---
84
+
29
85
  const Spacing = styled.div`
30
86
  padding: 1em;
31
87
  `;
32
88
 
33
- const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
34
-
35
- storiesOf("SyntaxHighlighter", module)
36
- .addDecorator(RoutingDecorator)
37
- // Add async parameter, because the tests needs to render async before snapshot is taken so that
38
- // code fragments get highlighted properly
39
- .addParameters({ storyshots: { async: true } })
40
- .add("Java", () => (
41
- <Spacing>
42
- <SyntaxHighlighter language="java" value={JavaHttpServer} />
43
- </Spacing>
44
- ))
45
- .add("Go", () => (
46
- <Spacing>
47
- <SyntaxHighlighter language="go" value={GoHttpServer} />
48
- </Spacing>
49
- ))
50
- .add("Javascript", () => (
51
- <Spacing>
52
- <SyntaxHighlighter language="javascript" value={JsHttpServer} />
53
- </Spacing>
54
- ))
55
- .add("Python", () => (
56
- <Spacing>
57
- <SyntaxHighlighter language="python" value={PyHttpServer} />
58
- </Spacing>
59
- ))
60
- .add("Markdown", () => (
61
- <Spacing>
62
- <SyntaxHighlighter language="markdown" value={Markdown} />
63
- </Spacing>
64
- ))
65
- .add("Without line numbers", () => (
66
- <Spacing>
67
- <SyntaxHighlighter language="java" value={JavaHttpServer} showLineNumbers={false} />
68
- </Spacing>
69
- ));
89
+ // --- Storybook Metadata ---
90
+
91
+ const meta: Meta<typeof SyntaxHighlighter> = {
92
+ title: "Components/SyntaxHighlighter",
93
+ component: SyntaxHighlighter,
94
+ // The Spacing component is now a decorator, applied to all stories
95
+ decorators: [
96
+ (Story) => <MemoryRouter initialEntries={["/"]}>{Story()}</MemoryRouter>,
97
+ (Story) => <Spacing>{Story()}</Spacing>],
98
+ tags: ["autodocs"], // Enables automatic documentation generation
99
+ };
100
+
101
+ export default meta;
102
+
103
+ // --- Story Definitions ---
104
+
105
+ type Story = StoryObj<typeof meta>;
106
+
107
+ export const Java: Story = {
108
+ args: {
109
+ language: "java",
110
+ value: JavaHttpServer,
111
+ },
112
+ };
113
+
114
+ export const Go: Story = {
115
+ args: {
116
+ ...Java.args, // Reuses args from the Java story
117
+ language: "go",
118
+ value: GoHttpServer,
119
+ },
120
+ };
121
+
122
+ export const Javascript: Story = {
123
+ args: {
124
+ ...Java.args,
125
+ language: "javascript",
126
+ value: JsHttpServer,
127
+ },
128
+ };
129
+
130
+ export const Python: Story = {
131
+ args: {
132
+ ...Java.args,
133
+ language: "python",
134
+ value: PyHttpServer,
135
+ },
136
+ };
137
+
138
+ // export const Markdown: Story = {
139
+ // args: {
140
+ // ...Java.args,
141
+ // language: "markdown",
142
+ // value: Markdown,
143
+ // },
144
+ // };
145
+
146
+ export const WithoutLineNumbers: Story = {
147
+ args: {
148
+ ...Java.args,
149
+ showLineNumbers: false,
150
+ },
151
+ };
@@ -14,13 +14,13 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { FC, useEffect, useState } from "react";
17
+ import React, { FC, ReactNode, useEffect, useState } from "react";
18
18
  import Icon from "./Icon";
19
19
  import Tooltip from "./Tooltip";
20
20
  import styled from "styled-components";
21
21
  import copyToClipboard from "./CopyToClipboard";
22
22
  import { useTranslation } from "react-i18next";
23
- import { useHistory, useLocation } from "react-router-dom";
23
+ import { useLocation, useNavigate } from "react-router-dom";
24
24
 
25
25
  const RowContainer = styled.div`
26
26
  span.linenumber + span > span.linenumber {
@@ -73,14 +73,14 @@ type ExternalProps = {
73
73
  };
74
74
 
75
75
  type BaseProps = {
76
- children: React.ReactChild[];
76
+ children?: ReactNode;
77
77
  };
78
78
 
79
79
  type Props = ExternalProps & BaseProps;
80
80
 
81
81
  const SyntaxHighlighterRenderer: FC<Props> = ({ children: rows, createLinePermaLink, showLineNumbers = true }) => {
82
82
  const location = useLocation();
83
- const history = useHistory();
83
+ const navigate = useNavigate();
84
84
  const [focusedLine, setLineToFocus] = useState<number | undefined>(undefined);
85
85
  const [copying, setCopying] = useState(false);
86
86
  const [t] = useTranslation("repos");
@@ -94,14 +94,14 @@ const SyntaxHighlighterRenderer: FC<Props> = ({ children: rows, createLinePermaL
94
94
  }, [location.hash]);
95
95
 
96
96
  const lineNumberClick = (lineNumber: number) => {
97
- history.push(location.pathname + "#line-" + lineNumber);
97
+ navigate(location.pathname + "#line-" + lineNumber);
98
98
  setCopying(true);
99
99
  copyToClipboard(createLinePermaLink(lineNumber)).finally(() => setCopying(false));
100
100
  };
101
101
 
102
102
  return (
103
103
  <>
104
- {rows.map((line: React.ReactNode, i: number) => {
104
+ {React.Children.map(rows, (line: React.ReactNode, i: number) => {
105
105
  const lineNumber = i + 1;
106
106
  return (
107
107
  <RowContainer
@@ -123,7 +123,7 @@ const SyntaxHighlighterRenderer: FC<Props> = ({ children: rows, createLinePermaL
123
123
  </Tooltip>
124
124
  )}
125
125
  <LineNumber
126
- onClick={() => history.push(location.pathname + "#line-" + lineNumber)}
126
+ onClick={() => navigate(location.pathname + "#line-" + lineNumber)}
127
127
  className="linenumber react-syntax-highlighter-line-number"
128
128
  value={lineNumber}
129
129
  />
@@ -14,13 +14,69 @@
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 { storiesOf } from "@storybook/react";
17
+ // import styled from "styled-components";
18
+ // import { storiesOf } from "@storybook/react";
19
+ // import React, { ReactNode } from "react";
20
+ // import Tag from "./Tag";
21
+ // import { MemoryRouter } from "react-router-dom";
22
+ // import { Color, colors, sizes } from "./styleConstants";
23
+ //
24
+ // const Wrapper = styled.div`
25
+ // margin: 2rem;
26
+ // max-width: 400px;
27
+ // `;
28
+ //
29
+ // const Spacing = styled.div`
30
+ // padding: 0.5rem;
31
+ // `;
32
+ //
33
+ // const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
34
+ //
35
+ // storiesOf("Tag", module)
36
+ // .addDecorator(RoutingDecorator)
37
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
38
+ // .add("Default", () => <Tag label="Default tag" />)
39
+ // .add("Rounded", () => <Tag label="Rounded tag" color="dark" rounded={true} />)
40
+ // .add("With Icon", () => <Tag label="System" icon="bolt" />)
41
+ // .add("Colors", () => (
42
+ // <div>
43
+ // {colors.map((color) => (
44
+ // <Spacing key={color}>
45
+ // <Tag color={color} label={color} />
46
+ // </Spacing>
47
+ // ))}
48
+ // </div>
49
+ // ))
50
+ // .add("Outlined", () => (
51
+ // <div>
52
+ // {(["success", "black", "danger"] as Color[]).map((color) => (
53
+ // <Spacing key={color}>
54
+ // <Tag color={color} label={color} outlined={true} />
55
+ // </Spacing>
56
+ // ))}
57
+ // </div>
58
+ // ))
59
+ // .add("With title", () => <Tag label="hover me" title="good job" />)
60
+ // .add("Clickable", () => <Tag label="Click here" onClick={() => alert("Not so fast")} />)
61
+ // .add("Sizes", () => (
62
+ // <div>
63
+ // {sizes.map((size) => (
64
+ // <Spacing key={size}>
65
+ // <Tag size={size} label={size} />
66
+ // </Spacing>
67
+ // ))}
68
+ // </div>
69
+ // ));
70
+
19
71
  import React, { ReactNode } from "react";
72
+ import styled from "styled-components";
73
+ import type { Meta, StoryObj } from "@storybook/react";
74
+
20
75
  import Tag from "./Tag";
21
- import { MemoryRouter } from "react-router-dom";
22
76
  import { Color, colors, sizes } from "./styleConstants";
23
77
 
78
+ // --- Helper Components & Styles ---
79
+
24
80
  const Wrapper = styled.div`
25
81
  margin: 2rem;
26
82
  max-width: 400px;
@@ -28,17 +84,73 @@ const Wrapper = styled.div`
28
84
 
29
85
  const Spacing = styled.div`
30
86
  padding: 0.5rem;
87
+ display: inline-block; // Ensures spacing works for multiple tags in a row
31
88
  `;
32
89
 
33
- const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
90
+ // --- Storybook Metadata ---
91
+
92
+ const meta: Meta<typeof Tag> = {
93
+ title: "Components/Tag",
94
+ component: Tag,
95
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
96
+ argTypes: {
97
+ onClick: { action: "clicked" },
98
+ color: {
99
+ control: "select",
100
+ options: colors,
101
+ },
102
+ size: {
103
+ control: "select",
104
+ options: sizes,
105
+ },
106
+ },
107
+ tags: ["autodocs"],
108
+ };
109
+
110
+ export default meta;
111
+
112
+ // --- Story Definitions ---
34
113
 
35
- storiesOf("Tag", module)
36
- .addDecorator(RoutingDecorator)
37
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
38
- .add("Default", () => <Tag label="Default tag" />)
39
- .add("Rounded", () => <Tag label="Rounded tag" color="dark" rounded={true} />)
40
- .add("With Icon", () => <Tag label="System" icon="bolt" />)
41
- .add("Colors", () => (
114
+ type Story = StoryObj<typeof meta>;
115
+
116
+ export const Default: Story = {
117
+ args: {
118
+ label: "Default tag",
119
+ },
120
+ };
121
+
122
+ export const Rounded: Story = {
123
+ args: {
124
+ label: "Rounded tag",
125
+ color: "dark",
126
+ rounded: true,
127
+ },
128
+ };
129
+
130
+ export const WithIcon: Story = {
131
+ args: {
132
+ label: "System",
133
+ icon: "bolt",
134
+ },
135
+ };
136
+
137
+ export const WithTitle: Story = {
138
+ args: {
139
+ label: "hover me",
140
+ title: "good job",
141
+ },
142
+ };
143
+
144
+ export const Clickable: Story = {
145
+ args: {
146
+ label: "Click here",
147
+ // The onClick prop is automatically handled by argTypes
148
+ },
149
+ };
150
+
151
+ // For stories that showcase multiple variations, we use a custom `render` function.
152
+ export const Colors: Story = {
153
+ render: () => (
42
154
  <div>
43
155
  {colors.map((color) => (
44
156
  <Spacing key={color}>
@@ -46,8 +158,11 @@ storiesOf("Tag", module)
46
158
  </Spacing>
47
159
  ))}
48
160
  </div>
49
- ))
50
- .add("Outlined", () => (
161
+ ),
162
+ };
163
+
164
+ export const Outlined: Story = {
165
+ render: () => (
51
166
  <div>
52
167
  {(["success", "black", "danger"] as Color[]).map((color) => (
53
168
  <Spacing key={color}>
@@ -55,10 +170,11 @@ storiesOf("Tag", module)
55
170
  </Spacing>
56
171
  ))}
57
172
  </div>
58
- ))
59
- .add("With title", () => <Tag label="hover me" title="good job" />)
60
- .add("Clickable", () => <Tag label="Click here" onClick={() => alert("Not so fast")} />)
61
- .add("Sizes", () => (
173
+ ),
174
+ };
175
+
176
+ export const Sizes: Story = {
177
+ render: () => (
62
178
  <div>
63
179
  {sizes.map((size) => (
64
180
  <Spacing key={size}>
@@ -66,4 +182,5 @@ storiesOf("Tag", module)
66
182
  </Spacing>
67
183
  ))}
68
184
  </div>
69
- ));
185
+ ),
186
+ };
package/src/Tag.tsx CHANGED
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { FC } from "react";
17
+ import React, { FC, ReactNode } from "react";
18
18
  import classNames from "classnames";
19
19
  import { Color, Size } from "./styleConstants";
20
20
  import { useTranslation } from "react-i18next";
@@ -30,6 +30,7 @@ type Props = {
30
30
  size?: Size;
31
31
  onClick?: () => void;
32
32
  onRemove?: () => void;
33
+ children?: ReactNode;
33
34
  };
34
35
 
35
36
  const smallClassNames = classNames("p-1", "is-size-7", "has-text-weight-bold");