@krrli/cm-designsystem 1.20.1 → 1.20.3
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/dist/cm-designsystem.css +1 -1
- package/dist/components/accessible-button/AccessibleButton.d.ts +32 -0
- package/dist/components/accessible-button/AccessibleButton.js +15 -0
- package/dist/components/accessible-button/AccessibleButton.test.d.ts +1 -0
- package/dist/components/accessible-button/AccessibleButton.test.js +28 -0
- package/dist/components/avatar/Avatar.d.ts +51 -4
- package/dist/components/avatar/Avatar.js +9 -1
- package/dist/components/button/Button.d.ts +27 -15
- package/dist/components/button/Button.js +11 -7
- package/dist/components/button/Button.test.js +3 -3
- package/dist/components/file-upload/FileUpload.js +1 -1
- package/dist/components/icon-button/IconButton.d.ts +24 -5
- package/dist/components/icon-button/IconButton.js +8 -5
- package/dist/components/icon-button/IconButton.test.js +2 -2
- package/dist/components/icons/IconBase.js +2 -2
- package/dist/components/modal/Modal.test.js +2 -2
- package/dist/components/navi-button/NaviButton.d.ts +28 -5
- package/dist/components/navi-button/NaviButton.js +8 -3
- package/dist/components/navi-button/NaviButton.test.js +2 -2
- package/dist/components/navi-user-button/NaviUserButton.d.ts +24 -6
- package/dist/components/navi-user-button/NaviUserButton.js +8 -4
- package/dist/components/round-button/RoundButton.d.ts +23 -4
- package/dist/components/round-button/RoundButton.js +8 -3
- package/dist/components/round-button/RoundButton.test.js +3 -2
- package/dist/components/timed-button/TimedButton.d.ts +29 -6
- package/dist/components/timed-button/TimedButton.js +9 -6
- package/dist/components/timed-button/TimedButton.test.js +6 -5
- package/dist/components/typography/AccessibleTypography.d.ts +33 -0
- package/dist/components/typography/AccessibleTypography.js +11 -0
- package/dist/components/typography/Heading.d.ts +17 -10
- package/dist/components/typography/Heading.js +8 -8
- package/dist/components/typography/Label.d.ts +15 -8
- package/dist/components/typography/Label.js +8 -4
- package/dist/components/typography/Paragraph.d.ts +15 -8
- package/dist/components/typography/Paragraph.js +8 -4
- package/dist/components/typography/Placeholder.d.ts +12 -8
- package/dist/components/typography/Placeholder.js +8 -4
- package/dist/components/typography/ValidationMessage.d.ts +15 -8
- package/dist/components/typography/ValidationMessage.js +8 -6
- package/dist/index.es.js +2925 -3002
- package/package.json +57 -59
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { tv } from "tailwind-variants";
|
|
3
|
+
import { cn, tv } from "tailwind-variants";
|
|
4
|
+
import { AccessibleButton, } from "../accessible-button/AccessibleButton";
|
|
4
5
|
import { Label } from "../typography/Label";
|
|
5
6
|
const naviButtonStyles = tv({
|
|
6
7
|
base: [
|
|
@@ -24,6 +25,10 @@ const naviButtonStyles = tv({
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* A navigation-style button component that combines an accessible,
|
|
30
|
+
* keyboard-friendly button foundation with variant-based styling.
|
|
31
|
+
*/
|
|
32
|
+
export const NaviButton = ({ intent = "secondary", className, ...props }) => {
|
|
33
|
+
return (_jsxs(AccessibleButton, { className: cn(naviButtonStyles({ intent, ...props }), className), ...props, children: [props.icon && _jsx(props.icon, { className: props.iconClassName }), _jsx(Label, { as: "span", size: "md", children: props.children })] }));
|
|
29
34
|
};
|
|
@@ -6,7 +6,7 @@ import { NaviButton } from "./NaviButton";
|
|
|
6
6
|
describe("NaviButton", () => {
|
|
7
7
|
test("should render button with icon", async () => {
|
|
8
8
|
// Arrange
|
|
9
|
-
render(_jsx(NaviButton, {
|
|
9
|
+
render(_jsx(NaviButton, { onClick: vi.fn(), icon: Mumble, children: "button" }));
|
|
10
10
|
// Assert
|
|
11
11
|
expect(screen.getByRole("button")).toBeVisible();
|
|
12
12
|
expect(screen.getByRole("button")).toHaveTextContent("button");
|
|
@@ -15,7 +15,7 @@ describe("NaviButton", () => {
|
|
|
15
15
|
test("should call onClick when clicked", () => {
|
|
16
16
|
// Arrange
|
|
17
17
|
const onClick = vi.fn();
|
|
18
|
-
render(_jsx(NaviButton, {
|
|
18
|
+
render(_jsx(NaviButton, { onClick: onClick, icon: Mumble, children: "button" }));
|
|
19
19
|
fireEvent.click(screen.getByRole("button"));
|
|
20
20
|
expect(onClick).toHaveBeenCalled();
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type BaseAccessibleButtonProps } from "../accessible-button/AccessibleButton";
|
|
3
3
|
declare const naviUserButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
intent: {
|
|
5
5
|
secondary: string[];
|
|
@@ -15,12 +15,30 @@ declare const naviUserButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
15
15
|
}, undefined, string[], unknown, unknown, undefined>>;
|
|
16
16
|
type NaviUserButtonVariants = VariantProps<typeof naviUserButtonStyles>;
|
|
17
17
|
type NaviUserButtonIntent = "secondary";
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Props for the NaviUserButton component.
|
|
20
|
+
*
|
|
21
|
+
* @inheritdoc BaseAccessibleButtonProps
|
|
22
|
+
* @inheritdoc NaviUserButtonVariants
|
|
23
|
+
*/
|
|
24
|
+
interface NaviUserButtonProps extends NaviUserButtonVariants, BaseAccessibleButtonProps {
|
|
25
|
+
/**
|
|
26
|
+
* Visual intent of the button (controls background color, hover, and active styles).
|
|
27
|
+
*/
|
|
20
28
|
intent?: NaviUserButtonIntent;
|
|
29
|
+
/**
|
|
30
|
+
* Source URL for the user avatar image.
|
|
31
|
+
*/
|
|
21
32
|
src: string;
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Accessible alt text describing the avatar.
|
|
35
|
+
* Required for proper screen reader support.
|
|
36
|
+
*/
|
|
37
|
+
alt: string;
|
|
24
38
|
}
|
|
25
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A user-focused navigation button that displays a user avatar and behaves
|
|
41
|
+
* like an accessible, keyboard-friendly button.
|
|
42
|
+
*/
|
|
43
|
+
export declare const NaviUserButton: React.FC<NaviUserButtonProps>;
|
|
26
44
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { cn, tv } from "tailwind-variants";
|
|
3
|
+
import { AccessibleButton, } from "../accessible-button/AccessibleButton";
|
|
4
4
|
import { Avatar } from "../avatar/Avatar";
|
|
5
5
|
const naviUserButtonStyles = tv({
|
|
6
6
|
base: [
|
|
@@ -24,6 +24,10 @@ const naviUserButtonStyles = tv({
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A user-focused navigation button that displays a user avatar and behaves
|
|
29
|
+
* like an accessible, keyboard-friendly button.
|
|
30
|
+
*/
|
|
31
|
+
export const NaviUserButton = ({ intent = "secondary", className, ...props }) => {
|
|
32
|
+
return (_jsx(AccessibleButton, { className: cn(naviUserButtonStyles({ intent, ...props }), className), ...props, children: _jsx(Avatar, { alt: props.alt, size: "sm", src: props.src }) }));
|
|
29
33
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type BaseAccessibleButtonProps } from "../accessible-button/AccessibleButton";
|
|
2
3
|
import type { IconBaseProps } from "../icons/IconBase";
|
|
3
4
|
declare const roundButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
4
5
|
intent: {
|
|
@@ -15,11 +16,29 @@ declare const roundButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
15
16
|
}, undefined, string[], unknown, unknown, undefined>>;
|
|
16
17
|
type RoundButtonVariants = VariantProps<typeof roundButtonStyles>;
|
|
17
18
|
type RoundButtonIntent = "primary";
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Props for the RoundButton component.
|
|
21
|
+
*
|
|
22
|
+
* @inheritdoc BaseAccessibleButtonProps
|
|
23
|
+
* @inheritdoc RoundButtonVariants
|
|
24
|
+
*/
|
|
25
|
+
interface RoundButtonProps extends RoundButtonVariants, BaseAccessibleButtonProps {
|
|
26
|
+
/**
|
|
27
|
+
* Visual intent of the button (controls background color, hover, and active styles).
|
|
28
|
+
*/
|
|
19
29
|
intent?: RoundButtonIntent;
|
|
30
|
+
/**
|
|
31
|
+
* Accessible label for the button, used by screen readers.
|
|
32
|
+
*/
|
|
20
33
|
ariaLabel: string;
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Icon element rendered alongside the button label.
|
|
36
|
+
*/
|
|
37
|
+
icon: React.ComponentType<IconBaseProps>;
|
|
23
38
|
}
|
|
24
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A circular, icon-only button component that provides full accessibility,
|
|
41
|
+
* keyboard interaction, and visual feedback through hover and active states.
|
|
42
|
+
*/
|
|
43
|
+
export declare const RoundButton: React.FC<RoundButtonProps>;
|
|
25
44
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { tv } from "tailwind-variants";
|
|
2
|
+
import { cn, tv } from "tailwind-variants";
|
|
3
|
+
import { AccessibleButton, } from "../accessible-button/AccessibleButton";
|
|
3
4
|
const roundButtonStyles = tv({
|
|
4
5
|
base: [
|
|
5
6
|
"text-white",
|
|
@@ -23,6 +24,10 @@ const roundButtonStyles = tv({
|
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A circular, icon-only button component that provides full accessibility,
|
|
29
|
+
* keyboard interaction, and visual feedback through hover and active states.
|
|
30
|
+
*/
|
|
31
|
+
export const RoundButton = ({ intent = "primary", className, ...props }) => {
|
|
32
|
+
return (_jsx(AccessibleButton, { className: cn(roundButtonStyles({ intent }), className), ...props, children: _jsx(props.icon, {}) }));
|
|
28
33
|
};
|
|
@@ -6,15 +6,16 @@ import { RoundButton } from "./RoundButton";
|
|
|
6
6
|
describe("RoundButton", () => {
|
|
7
7
|
test("should render button with icon", async () => {
|
|
8
8
|
// Arrange
|
|
9
|
-
render(_jsx(RoundButton, { onClick: vi.fn(), ariaLabel: "Mumble",
|
|
9
|
+
render(_jsx(RoundButton, { onClick: vi.fn(), ariaLabel: "Mumble", icon: Mumble }));
|
|
10
10
|
// Assert
|
|
11
11
|
expect(screen.getByRole("button")).toBeVisible();
|
|
12
|
+
expect(screen.getByLabelText("Mumble")).toBeVisible();
|
|
12
13
|
expect(screen.getByText("Mumble")).toBeVisible();
|
|
13
14
|
});
|
|
14
15
|
test("should call onChange when second tab clicked", () => {
|
|
15
16
|
// Arrange
|
|
16
17
|
const onClick = vi.fn();
|
|
17
|
-
render(_jsx(RoundButton, { onClick: onClick, ariaLabel: "Mumble",
|
|
18
|
+
render(_jsx(RoundButton, { onClick: onClick, ariaLabel: "Mumble", icon: Mumble }));
|
|
18
19
|
fireEvent.click(screen.getByRole("button"));
|
|
19
20
|
expect(onClick).toHaveBeenCalled();
|
|
20
21
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type BaseAccessibleButtonProps } from "../accessible-button/AccessibleButton";
|
|
3
|
+
import type { IconBaseProps } from "../icons/IconBase";
|
|
2
4
|
declare const timedButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
3
5
|
pressed: {
|
|
4
6
|
false: {};
|
|
@@ -46,11 +48,32 @@ declare const timedButtonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
46
48
|
label: string[];
|
|
47
49
|
}, undefined, unknown, unknown, undefined>>;
|
|
48
50
|
type TimedButtonVariants = VariantProps<typeof timedButtonStyles>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Props for the TimedButton component.
|
|
53
|
+
*
|
|
54
|
+
* @inheritdoc BaseAccessibleButtonProps
|
|
55
|
+
* @inheritdoc TimedButtonVariants
|
|
56
|
+
*/
|
|
57
|
+
interface TimedButtonProps extends TimedButtonVariants, BaseAccessibleButtonProps {
|
|
58
|
+
/**
|
|
59
|
+
* Optional icon element rendered alongside the button label.
|
|
60
|
+
*/
|
|
61
|
+
icon?: React.ComponentType<IconBaseProps>;
|
|
62
|
+
/**
|
|
63
|
+
* Default label displayed on the button.
|
|
64
|
+
*
|
|
65
|
+
* This is the visible text before the button is clicked or activated.
|
|
66
|
+
*/
|
|
67
|
+
label: string;
|
|
68
|
+
/**
|
|
69
|
+
* Active label displayed temporarily after the button is clicked.
|
|
70
|
+
*
|
|
71
|
+
* Typically used to show feedback, e.g., `"Link copied!"`.
|
|
72
|
+
*/
|
|
73
|
+
labelActive: string;
|
|
54
74
|
}
|
|
55
|
-
|
|
75
|
+
/**
|
|
76
|
+
* A button component that temporarily changes its label when pressed.
|
|
77
|
+
*/
|
|
78
|
+
export declare const TimedButton: React.FC<TimedButtonProps>;
|
|
56
79
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { tv } from "tailwind-variants";
|
|
4
|
-
import {
|
|
3
|
+
import { cn, tv } from "tailwind-variants";
|
|
4
|
+
import { AccessibleButton, } from "../accessible-button/AccessibleButton";
|
|
5
5
|
import { Label } from "../typography/Label";
|
|
6
6
|
const timedButtonStyles = tv({
|
|
7
7
|
slots: {
|
|
@@ -22,7 +22,7 @@ const timedButtonStyles = tv({
|
|
|
22
22
|
"hover:bg-slate-100",
|
|
23
23
|
"overflow-hidden",
|
|
24
24
|
],
|
|
25
|
-
icon: ["inline-flex"],
|
|
25
|
+
icon: ["w-4", "h-4", "inline-flex"],
|
|
26
26
|
label: ["transition-opacity", "duration-350", "ease-in-out"],
|
|
27
27
|
},
|
|
28
28
|
variants: {
|
|
@@ -72,7 +72,10 @@ const timedButtonStyles = tv({
|
|
|
72
72
|
animating: false,
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* A button component that temporarily changes its label when pressed.
|
|
77
|
+
*/
|
|
78
|
+
export const TimedButton = ({ className, onClick, ...props }) => {
|
|
76
79
|
const [pressed, setPressed] = useState(false);
|
|
77
80
|
const [animating, setAnimating] = useState(false);
|
|
78
81
|
const timeoutsRef = useRef([]);
|
|
@@ -88,7 +91,7 @@ export const TimedButton = ({ onClick, icon = _jsx(Share, {}), label = "Copy Lin
|
|
|
88
91
|
// Klick -> Pressed
|
|
89
92
|
setPressed(true);
|
|
90
93
|
setAnimating(true);
|
|
91
|
-
onClick();
|
|
94
|
+
onClick?.();
|
|
92
95
|
// Hover -> Pressed: Dissolve über 350ms
|
|
93
96
|
const timeout1 = setTimeout(() => setAnimating(false), 350);
|
|
94
97
|
timeoutsRef.current.push(timeout1);
|
|
@@ -102,5 +105,5 @@ export const TimedButton = ({ onClick, icon = _jsx(Share, {}), label = "Copy Lin
|
|
|
102
105
|
}, 1000);
|
|
103
106
|
timeoutsRef.current.push(timeout2);
|
|
104
107
|
};
|
|
105
|
-
return (_jsxs(
|
|
108
|
+
return (_jsxs(AccessibleButton, { className: cn(base(props), className), onClick: handleClick, ...props, children: [props.icon && _jsx(props.icon, { className: iconClass(), "aria-hidden": "true" }), _jsx(Label, { as: "span", size: "md", className: labelClass(), children: pressed ? props.labelActive : props.label })] }));
|
|
106
109
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import { describe, expect, test, vi } from "vitest";
|
|
4
|
+
import { Share } from "../icons/generated";
|
|
4
5
|
import { TimedButton } from "./TimedButton";
|
|
5
6
|
describe("TimedButton", () => {
|
|
6
7
|
test("should render icon and label", async () => {
|
|
7
8
|
// Arrange
|
|
8
|
-
render(_jsx(TimedButton, { onClick: function () { }, label: "Copy Link", labelActive: "Link Copied" }));
|
|
9
|
+
render(_jsx(TimedButton, { onClick: function () { }, icon: Share, label: "Copy Link", labelActive: "Link Copied" }));
|
|
9
10
|
const button = screen.getByRole("button");
|
|
10
11
|
expect(button).toBeVisible();
|
|
11
12
|
expect(button).toHaveTextContent("Copy Link");
|
|
12
13
|
// Icon prüfen
|
|
13
|
-
expect(screen.
|
|
14
|
+
expect(screen.getByText("Share")).toBeInTheDocument();
|
|
14
15
|
});
|
|
15
16
|
test("renders initial state and toggles correctly", async () => {
|
|
16
17
|
// Arrange
|
|
17
18
|
const onClick = vi.fn();
|
|
18
|
-
render(_jsx(TimedButton, { onClick: onClick, label: "Copy Link", labelActive: "Link Copied" }));
|
|
19
|
+
render(_jsx(TimedButton, { onClick: onClick, icon: Share, label: "Copy Link", labelActive: "Link Copied" }));
|
|
19
20
|
const button = screen.getByRole("button");
|
|
20
21
|
expect(button).toBeVisible();
|
|
21
22
|
// Initial state with Likes
|
|
22
23
|
expect(button).toHaveTextContent("Copy Link");
|
|
23
|
-
expect(screen.
|
|
24
|
+
expect(screen.getByText("Share")).toBeInTheDocument();
|
|
24
25
|
// Simulate click
|
|
25
26
|
fireEvent.click(button);
|
|
26
27
|
// Immediate state after click: "Liked" label + HeartFilled
|
|
27
28
|
expect(button).toHaveTextContent("Link Copied");
|
|
28
|
-
expect(screen.
|
|
29
|
+
expect(screen.getByText("Share")).toBeInTheDocument();
|
|
29
30
|
expect(onClick).toHaveBeenCalled();
|
|
30
31
|
// Wait for animation + likes count update (1s delay + 350ms animation)
|
|
31
32
|
await waitFor(() => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type JSX } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Typography component.
|
|
4
|
+
*/
|
|
5
|
+
export interface AccessibleTypographyProps {
|
|
6
|
+
/**
|
|
7
|
+
* The HTML tag to render (e.g., "p", "h1", "span").
|
|
8
|
+
* Determines the semantic element used for the text.
|
|
9
|
+
*/
|
|
10
|
+
as?: keyof JSX.IntrinsicElements;
|
|
11
|
+
/**
|
|
12
|
+
* Additional Tailwind or custom class names to apply.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the ARIA role of the element.
|
|
17
|
+
*/
|
|
18
|
+
role?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The accessible label associated with this element.
|
|
21
|
+
* Useful when the visible text isn’t descriptive enough.
|
|
22
|
+
*/
|
|
23
|
+
ariaLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The content to be rendered inside the element.
|
|
26
|
+
*/
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A flexible, semantic, accessible typography component that allows you
|
|
31
|
+
* to set the HTML tag and optionally make it clickable.
|
|
32
|
+
*/
|
|
33
|
+
export declare const AccessibleTypography: React.FC<AccessibleTypographyProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A flexible, semantic, accessible typography component that allows you
|
|
4
|
+
* to set the HTML tag and optionally make it clickable.
|
|
5
|
+
*/
|
|
6
|
+
export const AccessibleTypography = (props) => {
|
|
7
|
+
return createElement(props.as ?? "span", {
|
|
8
|
+
className: props.className,
|
|
9
|
+
"aria-label": props.ariaLabel,
|
|
10
|
+
}, props.children);
|
|
11
|
+
};
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type AccessibleTypographyProps } from "./AccessibleTypography";
|
|
3
3
|
import { headingStyles } from "./styles";
|
|
4
|
+
import type { JSX } from "react";
|
|
4
5
|
type HeadingVariants = VariantProps<typeof headingStyles>;
|
|
5
6
|
type HeadingSize = "1" | "2" | "3" | "4";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Heading component props.
|
|
9
|
+
*
|
|
10
|
+
* @inheritDoc TypographyProps
|
|
11
|
+
* @inheritDoc HeadingVariants
|
|
12
|
+
*/
|
|
13
|
+
interface HeadingProps extends HeadingVariants, AccessibleTypographyProps {
|
|
8
14
|
as: keyof JSX.IntrinsicElements;
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Controls the visual size of the heading.
|
|
17
|
+
*/
|
|
18
|
+
size: HeadingSize;
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, string | import("react").JSXElementConstructor<any>>;
|
|
20
|
+
/**
|
|
21
|
+
* A semantic, accessible Heading component built on top of the AccessibleTypography component.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Heading: React.FC<HeadingProps>;
|
|
17
24
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "tailwind-variants";
|
|
3
|
+
import { AccessibleTypography, } from "./AccessibleTypography";
|
|
4
4
|
import { headingStyles } from "./styles";
|
|
5
|
+
/**
|
|
6
|
+
* A semantic, accessible Heading component built on top of the AccessibleTypography component.
|
|
7
|
+
*/
|
|
5
8
|
export const Heading = ({ as, className, ...props }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"aria-level": props.size,
|
|
9
|
-
className: twMerge(className, headingStyles(props)),
|
|
10
|
-
}, props.children);
|
|
9
|
+
const styles = cn(headingStyles(props), className);
|
|
10
|
+
return _jsx(AccessibleTypography, { as: as, className: styles, ...props });
|
|
11
11
|
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type AccessibleTypographyProps } from "./AccessibleTypography";
|
|
3
3
|
import { labelStyles } from "./styles";
|
|
4
4
|
type LabelVariants = VariantProps<typeof labelStyles>;
|
|
5
5
|
type LabelSize = "xl" | "lg" | "md" | "sm";
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Label component props.
|
|
8
|
+
*
|
|
9
|
+
* @inheritDoc TypographyProps
|
|
10
|
+
* @inheritDoc LabelVariants
|
|
11
|
+
*/
|
|
12
|
+
interface LabelProps extends LabelVariants, AccessibleTypographyProps {
|
|
13
|
+
/**
|
|
14
|
+
* Controls the visual size of the label.
|
|
15
|
+
*/
|
|
7
16
|
size: LabelSize;
|
|
8
|
-
as?: keyof JSX.IntrinsicElements;
|
|
9
|
-
className?: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A semantic, accessible Label component built on top of the AccessibleTypography component.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Label: React.FC<LabelProps>;
|
|
15
22
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "tailwind-variants";
|
|
3
|
+
import { AccessibleTypography, } from "./AccessibleTypography";
|
|
4
4
|
import { labelStyles } from "./styles";
|
|
5
|
+
/**
|
|
6
|
+
* A semantic, accessible Label component built on top of the AccessibleTypography component.
|
|
7
|
+
*/
|
|
5
8
|
export const Label = ({ as = "label", className, ...props }) => {
|
|
6
|
-
|
|
9
|
+
const styles = cn(labelStyles(props), className);
|
|
10
|
+
return _jsx(AccessibleTypography, { as: as, className: styles, ...props });
|
|
7
11
|
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type AccessibleTypographyProps } from "./AccessibleTypography";
|
|
3
3
|
import { paragraphStyles } from "./styles";
|
|
4
4
|
type ParagraphVariants = VariantProps<typeof paragraphStyles>;
|
|
5
5
|
type ParagraphSize = "lg" | "md";
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Paragraph component props.
|
|
8
|
+
*
|
|
9
|
+
* @inheritDoc TypographyProps
|
|
10
|
+
* @inheritDoc ParagraphVariants
|
|
11
|
+
*/
|
|
12
|
+
interface ParagraphProps extends ParagraphVariants, AccessibleTypographyProps {
|
|
13
|
+
/**
|
|
14
|
+
* Controls the visual size of the paragraph.
|
|
15
|
+
*/
|
|
7
16
|
size: ParagraphSize;
|
|
8
|
-
as?: keyof JSX.IntrinsicElements;
|
|
9
|
-
className?: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A semantic, accessible Paragraph component built on top of the AccessibleTypography component.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Paragraph: React.FC<ParagraphProps>;
|
|
15
22
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "tailwind-variants";
|
|
3
|
+
import { AccessibleTypography, } from "./AccessibleTypography";
|
|
4
4
|
import { paragraphStyles } from "./styles";
|
|
5
|
+
/**
|
|
6
|
+
* A semantic, accessible Paragraph component built on top of the AccessibleTypography component.
|
|
7
|
+
*/
|
|
5
8
|
export const Paragraph = ({ as = "p", className, ...props }) => {
|
|
6
|
-
|
|
9
|
+
const styles = cn(paragraphStyles(props), className);
|
|
10
|
+
return _jsx(AccessibleTypography, { as: as, className: styles, ...props });
|
|
7
11
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type AccessibleTypographyProps } from "./AccessibleTypography";
|
|
3
3
|
import { placeholderStyles } from "./styles";
|
|
4
4
|
type PlaceholderVariants = VariantProps<typeof placeholderStyles>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Placeholder component props.
|
|
7
|
+
*
|
|
8
|
+
* @inheritDoc TypographyProps
|
|
9
|
+
* @inheritDoc PlaceholderVariants
|
|
10
|
+
*/
|
|
11
|
+
interface PlaceholderProps extends PlaceholderVariants, AccessibleTypographyProps {
|
|
9
12
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A semantic, accessible Placeholder component built on top of the AccessibleTypography component.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Placeholder: React.FC<PlaceholderProps>;
|
|
13
17
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "tailwind-variants";
|
|
3
|
+
import { AccessibleTypography, } from "./AccessibleTypography";
|
|
4
4
|
import { placeholderStyles } from "./styles";
|
|
5
|
+
/**
|
|
6
|
+
* A semantic, accessible Placeholder component built on top of the AccessibleTypography component.
|
|
7
|
+
*/
|
|
5
8
|
export const Placeholder = ({ as = "span", className, ...props }) => {
|
|
6
|
-
|
|
9
|
+
const styles = cn(placeholderStyles(props), className);
|
|
10
|
+
return _jsx(AccessibleTypography, { as: as, className: styles, ...props });
|
|
7
11
|
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type AccessibleTypographyProps } from "./AccessibleTypography";
|
|
3
3
|
import { validationMessageStyles } from "./styles";
|
|
4
4
|
type ValidationMessageVariants = VariantProps<typeof validationMessageStyles>;
|
|
5
5
|
type ValidationMessageType = "error";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* ValidationMessage component props.
|
|
8
|
+
*
|
|
9
|
+
* @inheritDoc TypographyProps
|
|
10
|
+
* @inheritDoc ValidationMessageVariants
|
|
11
|
+
*/
|
|
12
|
+
interface ValidationMessageProps extends ValidationMessageVariants, AccessibleTypographyProps {
|
|
13
|
+
/**
|
|
14
|
+
* Controls the visual variant of the validation message.
|
|
15
|
+
*/
|
|
8
16
|
type?: ValidationMessageType;
|
|
9
|
-
className?: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A semantic, accessible ValidationMessage component built on top of the AccessibleTypography component.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ValidationMessage: React.FC<ValidationMessageProps>;
|
|
15
22
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "tailwind-variants";
|
|
3
|
+
import { AccessibleTypography, } from "./AccessibleTypography";
|
|
4
4
|
import { validationMessageStyles } from "./styles";
|
|
5
|
+
/**
|
|
6
|
+
* A semantic, accessible ValidationMessage component built on top of the AccessibleTypography component.
|
|
7
|
+
*/
|
|
5
8
|
export const ValidationMessage = ({ as = "span", type = "error", className, ...props }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, props.children);
|
|
9
|
+
const styles = cn(validationMessageStyles({ type, ...props }), className);
|
|
10
|
+
return _jsx(AccessibleTypography, { as: as, className: styles, ...props });
|
|
9
11
|
};
|