@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,9 +14,66 @@
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 { storiesOf } from "@storybook/react";
19
+ // import styled from "styled-components";
20
+ // import Icon from "./Icon";
21
+ //
22
+ // const Wrapper = styled.div`
23
+ // * {
24
+ // margin: 0.5rem;
25
+ // }
26
+ // `;
27
+ //
28
+ // const colors = ["primary", "link", "info", "success", "warning", "danger", "white", "light", "dark", "black", "text"];
29
+ // const sizing = ["xs", "sm", "lg", "2x", "3x", "5x", "7x", "10x"];
30
+ //
31
+ // storiesOf("Icon", module)
32
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
33
+ // .add("Default", () => (
34
+ // <>
35
+ // <Icon name="cat" />
36
+ // <Icon title="Download" name="download" color="info" />
37
+ // <Icon title="Pull Request" name="code-branch fa-rotate-180" color="warning" />
38
+ // <Icon title="Star" iconStyle="far" name="star" color="inherit" />
39
+ // </>
40
+ // ))
41
+ // .add("Colors", () => (
42
+ // <>
43
+ // <Icon title="default color" name="cat" />
44
+ // {colors.map((color) => (
45
+ // <Icon key={color} title={color} name="cat" color={color} />
46
+ // ))}
47
+ // </>
48
+ // ))
49
+ // .add("Sizing", () => (
50
+ // <>
51
+ // <Icon title="default size" name="cat" />
52
+ // {sizing.map((size) => (
53
+ // <Icon key={size} title={"fa-" + size} name={"cat fa-" + size} />
54
+ // ))}
55
+ // </>
56
+ // ))
57
+ // .add("Icon styles", () => (
58
+ // <>
59
+ // <Icon title="solid style" name="star" color="inherit" />
60
+ // <Icon title="regular style" iconStyle="far" name="star" color="inherit" />
61
+ // <Icon title="brand style" iconStyle="fab" name="react" color="inherit" />
62
+ // </>
63
+ // ))
64
+ // .add("More options", () => (
65
+ // <>
66
+ // <Icon title="rotate-270" name="snowboarding fa-rotate-270" />
67
+ // <Icon title="spin" name="spinner fa-spin" />
68
+ // <Icon title="custom sizing" name="cat" className="is-size-4" />
69
+ // <Icon title="custom background" name="hand-sparkles" className="has-background-primary-25" />
70
+ // </>
71
+ // ));
72
+
17
73
  import React from "react";
18
- import { storiesOf } from "@storybook/react";
19
74
  import styled from "styled-components";
75
+ import type { Meta, StoryObj } from "@storybook/react";
76
+
20
77
  import Icon from "./Icon";
21
78
 
22
79
  const Wrapper = styled.div`
@@ -28,44 +85,67 @@ const Wrapper = styled.div`
28
85
  const colors = ["primary", "link", "info", "success", "warning", "danger", "white", "light", "dark", "black", "text"];
29
86
  const sizing = ["xs", "sm", "lg", "2x", "3x", "5x", "7x", "10x"];
30
87
 
31
- storiesOf("Icon", module)
32
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
33
- .add("Default", () => (
88
+ const meta: Meta<typeof Icon> = {
89
+ title: "Components/Icon",
90
+ component: Icon,
91
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
92
+ tags: ["autodocs"], // Enables automatic documentation generation
93
+ };
94
+
95
+ export default meta;
96
+
97
+ type Story = StoryObj<typeof meta>;
98
+
99
+ export const Default: Story = {
100
+ render: () => (
34
101
  <>
35
102
  <Icon name="cat" />
36
103
  <Icon title="Download" name="download" color="info" />
37
104
  <Icon title="Pull Request" name="code-branch fa-rotate-180" color="warning" />
38
105
  <Icon title="Star" iconStyle="far" name="star" color="inherit" />
39
106
  </>
40
- ))
41
- .add("Colors", () => (
107
+ ),
108
+ };
109
+
110
+ export const Colors: Story = {
111
+ render: () => (
42
112
  <>
43
113
  <Icon title="default color" name="cat" />
44
114
  {colors.map((color) => (
45
115
  <Icon key={color} title={color} name="cat" color={color} />
46
116
  ))}
47
117
  </>
48
- ))
49
- .add("Sizing", () => (
118
+ ),
119
+ };
120
+
121
+ export const Sizing: Story = {
122
+ render: () => (
50
123
  <>
51
124
  <Icon title="default size" name="cat" />
52
125
  {sizing.map((size) => (
53
126
  <Icon key={size} title={"fa-" + size} name={"cat fa-" + size} />
54
127
  ))}
55
128
  </>
56
- ))
57
- .add("Icon styles", () => (
129
+ ),
130
+ };
131
+
132
+ export const IconStyles: Story = {
133
+ render: () => (
58
134
  <>
59
135
  <Icon title="solid style" name="star" color="inherit" />
60
136
  <Icon title="regular style" iconStyle="far" name="star" color="inherit" />
61
137
  <Icon title="brand style" iconStyle="fab" name="react" color="inherit" />
62
138
  </>
63
- ))
64
- .add("More options", () => (
139
+ ),
140
+ };
141
+
142
+ export const MoreOptions: Story = {
143
+ render: () => (
65
144
  <>
66
145
  <Icon title="rotate-270" name="snowboarding fa-rotate-270" />
67
146
  <Icon title="spin" name="spinner fa-spin" />
68
147
  <Icon title="custom sizing" name="cat" className="is-size-4" />
69
148
  <Icon title="custom background" name="hand-sparkles" className="has-background-primary-25" />
70
149
  </>
71
- ));
150
+ ),
151
+ };
@@ -23,11 +23,14 @@ type Props = {
23
23
  collection: PagedCollection;
24
24
  page: number;
25
25
  filter?: string;
26
+ baseUrl: string;
26
27
  };
27
28
 
28
- const LinkPaginator: FC<Props> = ({ collection, page, filter }) => {
29
+ const LinkPaginator: FC<Props> = ({ collection, page, filter, baseUrl }) => {
29
30
  const [t] = useTranslation("commons");
30
- const addFilterToLink = (link: string) => {
31
+
32
+ const createLink = (pageNumber: string | number) => {
33
+ const link = `/${baseUrl}/${pageNumber}`;
31
34
  if (filter) {
32
35
  return `${link}?q=${filter}`;
33
36
  }
@@ -35,7 +38,7 @@ const LinkPaginator: FC<Props> = ({ collection, page, filter }) => {
35
38
  };
36
39
 
37
40
  const renderFirstButton = () => {
38
- return <Button className="pagination-link" label={"1"} disabled={false} link={addFilterToLink("1")} />;
41
+ return <Button className="pagination-link" label={"1"} disabled={false} link={createLink("1")} />;
39
42
  };
40
43
 
41
44
  const renderPreviousButton = (className: string, label?: string) => {
@@ -46,7 +49,7 @@ const LinkPaginator: FC<Props> = ({ collection, page, filter }) => {
46
49
  className={className}
47
50
  label={label ? label : previousPage.toString()}
48
51
  disabled={!hasLink("prev")}
49
- link={addFilterToLink(`${previousPage}`)}
52
+ link={createLink(`${previousPage}`)}
50
53
  />
51
54
  );
52
55
  };
@@ -62,7 +65,7 @@ const LinkPaginator: FC<Props> = ({ collection, page, filter }) => {
62
65
  className={className}
63
66
  label={label ? label : nextPage.toString()}
64
67
  disabled={!hasLink("next")}
65
- link={addFilterToLink(`${nextPage}`)}
68
+ link={createLink(`${nextPage}`)}
66
69
  />
67
70
  );
68
71
  };
@@ -73,7 +76,7 @@ const LinkPaginator: FC<Props> = ({ collection, page, filter }) => {
73
76
  className="pagination-link"
74
77
  label={`${collection.pageTotal}`}
75
78
  disabled={false}
76
- link={addFilterToLink(`${collection.pageTotal}`)}
79
+ link={createLink(`${collection.pageTotal}`)}
77
80
  />
78
81
  );
79
82
  };
@@ -14,12 +14,32 @@
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 { storiesOf } from "@storybook/react";
19
+ // import Loading from "./Loading";
20
+ //
21
+ // storiesOf("Loading", module).add("Default", () => (
22
+ // <div>
23
+ // <Loading />
24
+ // </div>
25
+ // ));
26
+
17
27
  import React from "react";
18
- import { storiesOf } from "@storybook/react";
28
+ import type { Meta, StoryObj } from "@storybook/react";
29
+
19
30
  import Loading from "./Loading";
20
31
 
21
- storiesOf("Loading", module).add("Default", () => (
22
- <div>
23
- <Loading />
24
- </div>
25
- ));
32
+ const meta: Meta<typeof Loading> = {
33
+ title: "Components/Loading",
34
+ component: Loading,
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,25 +14,56 @@
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 { storiesOf } from "@storybook/react";
19
+ // import styled from "styled-components";
20
+ // import Logo from "./Logo";
21
+ //
22
+ // const Wrapper = styled.div`
23
+ // padding: 2em;
24
+ // background-color: black;
25
+ // height: 100%;
26
+ // `;
27
+ //
28
+ // storiesOf("Logo", module)
29
+ // .add("Default", () => (
30
+ // <Wrapper>
31
+ // <Logo />
32
+ // </Wrapper>
33
+ // ))
34
+ // .add("WithoutText", () => (
35
+ // <Wrapper>
36
+ // <Logo withText={false} />
37
+ // </Wrapper>
38
+ // ));
39
+
17
40
  import React from "react";
18
- import { storiesOf } from "@storybook/react";
19
41
  import styled from "styled-components";
42
+ import type { Meta, StoryObj } from "@storybook/react";
43
+
20
44
  import Logo from "./Logo";
21
45
 
22
46
  const Wrapper = styled.div`
23
47
  padding: 2em;
24
48
  background-color: black;
25
- height: 100%;
49
+ height: 100vh;
26
50
  `;
27
51
 
28
- storiesOf("Logo", module)
29
- .add("Default", () => (
30
- <Wrapper>
31
- <Logo />
32
- </Wrapper>
33
- ))
34
- .add("WithoutText", () => (
35
- <Wrapper>
36
- <Logo withText={false} />
37
- </Wrapper>
38
- ));
52
+ const meta: Meta<typeof Logo> = {
53
+ title: "Components/Logo",
54
+ component: Logo,
55
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
56
+ tags: ["autodocs"],
57
+ };
58
+
59
+ export default meta;
60
+
61
+ type Story = StoryObj<typeof meta>;
62
+
63
+ export const Default: Story = {};
64
+
65
+ export const WithoutText: Story = {
66
+ args: {
67
+ withText: false,
68
+ },
69
+ };
@@ -14,11 +14,58 @@
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, useState } from "react";
20
+ // import { MemoryRouter } from "react-router-dom";
21
+ // import { storiesOf } from "@storybook/react";
22
+ // import Notification from "./Notification";
23
+ //
24
+ // const Wrapper = styled.div`
25
+ // margin: 2rem;
26
+ // max-width: 400px;
27
+ // `;
28
+ //
29
+ // const content =
30
+ // "Cleverness nuclear genuine static irresponsibility invited President Zaphod\n" +
31
+ // "Beeblebrox hyperspace ship. Another custard through computer-generated universe\n" +
32
+ // "shapes field strong disaster parties Russell’s ancestors infinite colour\n" +
33
+ // "imaginative generator sweep.";
34
+ //
35
+ // const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
36
+ //
37
+ // storiesOf("Notification", module)
38
+ // .addDecorator(RoutingDecorator)
39
+ // .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
40
+ // .add("Primary", () => <Notification type="primary">{content}</Notification>)
41
+ // .add("Success", () => <Notification type="success">{content}</Notification>)
42
+ // .add("Info", () => <Notification type="info">{content}</Notification>)
43
+ // .add("Warning", () => <Notification type="warning">{content}</Notification>)
44
+ // .add("Danger", () => <Notification type="danger">{content}</Notification>)
45
+ // .add("Closeable", () => <Closeable />);
46
+ //
47
+ // const Closeable = () => {
48
+ // const [show, setShow] = useState(true);
49
+ //
50
+ // const hide = () => {
51
+ // setShow(false);
52
+ // };
53
+ //
54
+ // if (!show) {
55
+ // return null;
56
+ // }
57
+ //
58
+ // return (
59
+ // <Notification type="warning" onClose={() => hide()}>
60
+ // {content}
61
+ // </Notification>
62
+ // );
63
+ // };
64
+
65
+ import React, { ReactNode, useState } from "react";
17
66
  import styled from "styled-components";
18
- import * as React from "react";
19
- import { ReactNode, useState } from "react";
20
- import { MemoryRouter } from "react-router-dom";
21
- import { storiesOf } from "@storybook/react";
67
+ import type { Meta, StoryObj } from "@storybook/react";
68
+
22
69
  import Notification from "./Notification";
23
70
 
24
71
  const Wrapper = styled.div`
@@ -32,32 +79,73 @@ const content =
32
79
  "shapes field strong disaster parties Russell’s ancestors infinite colour\n" +
33
80
  "imaginative generator sweep.";
34
81
 
35
- const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
36
-
37
- storiesOf("Notification", module)
38
- .addDecorator(RoutingDecorator)
39
- .addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
40
- .add("Primary", () => <Notification type="primary">{content}</Notification>)
41
- .add("Success", () => <Notification type="success">{content}</Notification>)
42
- .add("Info", () => <Notification type="info">{content}</Notification>)
43
- .add("Warning", () => <Notification type="warning">{content}</Notification>)
44
- .add("Danger", () => <Notification type="danger">{content}</Notification>)
45
- .add("Closeable", () => <Closeable />);
46
-
47
- const Closeable = () => {
82
+ const CloseableExample = () => {
48
83
  const [show, setShow] = useState(true);
49
84
 
50
- const hide = () => {
51
- setShow(false);
52
- };
53
-
54
85
  if (!show) {
55
- return null;
86
+ return <p>Notification has been closed.</p>;
56
87
  }
57
88
 
58
89
  return (
59
- <Notification type="warning" onClose={() => hide()}>
90
+ <Notification type="warning" onClose={() => setShow(false)}>
60
91
  {content}
61
92
  </Notification>
62
93
  );
63
94
  };
95
+
96
+ const meta: Meta<typeof Notification> = {
97
+ title: "Components/Notification",
98
+ component: Notification,
99
+ decorators: [(Story) => <Wrapper>{Story()}</Wrapper>],
100
+ argTypes: {
101
+ type: {
102
+ control: "select",
103
+ options: ["primary", "success", "info", "warning", "danger"],
104
+ },
105
+ onClose: { action: "closed" },
106
+ },
107
+ tags: ["autodocs"],
108
+ };
109
+
110
+ export default meta;
111
+
112
+ type Story = StoryObj<typeof meta>;
113
+
114
+ export const Primary: Story = {
115
+ args: {
116
+ type: "primary",
117
+ children: content,
118
+ },
119
+ };
120
+
121
+ export const Success: Story = {
122
+ args: {
123
+ ...Primary.args, // Reuses args from Primary
124
+ type: "success",
125
+ },
126
+ };
127
+
128
+ export const Info: Story = {
129
+ args: {
130
+ ...Primary.args,
131
+ type: "info",
132
+ },
133
+ };
134
+
135
+ export const Warning: Story = {
136
+ args: {
137
+ ...Primary.args,
138
+ type: "warning",
139
+ },
140
+ };
141
+
142
+ export const Danger: Story = {
143
+ args: {
144
+ ...Primary.args,
145
+ type: "danger",
146
+ },
147
+ };
148
+
149
+ export const Closeable: Story = {
150
+ render: () => <CloseableExample />,
151
+ };
@@ -15,18 +15,18 @@
15
15
  */
16
16
 
17
17
  import React, { FC, useState } from "react";
18
- import { useHistory, useLocation } from "react-router-dom";
18
+ import { useNavigate, useLocation } from "react-router-dom";
19
19
  import classNames from "classnames";
20
20
  import { Button, urls } from "./index";
21
21
  import { FilterInput, Select } from "./forms";
22
22
 
23
23
  type Props = {
24
24
  showCreateButton: boolean;
25
- currentGroup: string;
25
+ currentGroup?: string;
26
26
  groups?: string[];
27
27
  link: string;
28
28
  createLink?: string;
29
- groupSelected: (namespace: string) => void;
29
+ groupSelected?: (namespace: string) => void;
30
30
  label?: string;
31
31
  testId?: string;
32
32
  searchPlaceholder?: string;
@@ -49,7 +49,7 @@ const OverviewPageActions: FC<Props> = ({
49
49
  searchPlaceholder,
50
50
  groupAriaLabelledby,
51
51
  }) => {
52
- const history = useHistory();
52
+ const navigate = useNavigate();
53
53
  const location = useLocation();
54
54
  const [filterValue, setFilterValue] = useState(urls.getQueryStringFromLocation(location) || "");
55
55
  const link = createAbsoluteLink(inputLink);
@@ -80,7 +80,7 @@ const OverviewPageActions: FC<Props> = ({
80
80
  const filter = (q: string) => {
81
81
  if (q !== filterValue) {
82
82
  setFilterValue(q);
83
- history.push(`${link}?q=${q}`);
83
+ navigate(`${link}?q=${q}`);
84
84
  }
85
85
  };
86
86