@cerebruminc/cerebellum 17.1.2 → 17.2.0
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# react-component-lib-boilerplate
|
|
2
2
|
|
|
3
|
+
## [17.2.0](https://github.com/cerebruminc/cerebellum/compare/v17.1.2...v17.2.0) (2026-05-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **button:** add ariaLabel prop to Button component ([896e094](https://github.com/cerebruminc/cerebellum/commit/896e094d16e691a7706e1f1dcd7afc8b2e530bd9))
|
|
9
|
+
|
|
3
10
|
## [17.1.2](https://github.com/cerebruminc/cerebellum/compare/v17.1.1...v17.1.2) (2026-05-27)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -131,6 +131,13 @@ describe("Button", () => {
|
|
|
131
131
|
expect(button).toHaveStyle({ "background-color": customColorFamily.main });
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
test("renders Button with ariaLabel", () => {
|
|
135
|
+
const onClick = jest.fn();
|
|
136
|
+
render(<ThemedButton text="foo" onClick={onClick} ariaLabel="Submit form" colorFamily={ButtonColorFamilyEnum.Blue} />);
|
|
137
|
+
const button = screen.getByRole("button");
|
|
138
|
+
expect(button).toHaveAttribute("aria-label", "Submit form");
|
|
139
|
+
});
|
|
140
|
+
|
|
134
141
|
test("Button in loading mode will render the LoadingEllipsis component", () => {
|
|
135
142
|
const onClick = jest.fn();
|
|
136
143
|
render(<ThemedButton focus text="foo" onClick={onClick} loading={true} />);
|
|
@@ -23,6 +23,7 @@ import { ButtonType } from "./types";
|
|
|
23
23
|
|
|
24
24
|
export const Button: FC<ButtonType> = (props: ButtonType) => {
|
|
25
25
|
const {
|
|
26
|
+
ariaLabel,
|
|
26
27
|
borderRadius,
|
|
27
28
|
boxed = false,
|
|
28
29
|
boxedOutline = false,
|
|
@@ -109,6 +110,7 @@ export const Button: FC<ButtonType> = (props: ButtonType) => {
|
|
|
109
110
|
{...(useA && target ? { target: target } : {})}
|
|
110
111
|
as={useA ? "a" : "button"}
|
|
111
112
|
ref={buttonRef}
|
|
113
|
+
aria-label={ariaLabel}
|
|
112
114
|
$backButton={backButton}
|
|
113
115
|
$borderRadius={borderRadius}
|
|
114
116
|
$boxedOutline={boxedOutline}
|
|
@@ -5,6 +5,8 @@ import { ButtonColorFamilyEnum } from "../../sharedTypes/enums";
|
|
|
5
5
|
import { ColorFamilyType } from "../../sharedTypes/types";
|
|
6
6
|
import { LoadingEllipsisType } from "../LoadingEllipsis";
|
|
7
7
|
export interface ButtonType {
|
|
8
|
+
/** Sets the `aria-label` attribute on the button element */
|
|
9
|
+
ariaLabel?: string;
|
|
8
10
|
/** Adds an arrow pointing left and pushes the text right */
|
|
9
11
|
backButton?: boolean;
|
|
10
12
|
/** The button's border-radius, in px. Default is 8 for BoxedButton and TextButton, and 30 for the others */
|