@fabio.caffarello/react-design-system 3.3.1 → 3.5.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.
@@ -1,26 +1,33 @@
1
- import type { HTMLAttributes } from "react";
2
- interface Props extends HTMLAttributes<HTMLDivElement> {
1
+ import { type FC, type HTMLAttributes } from "react";
2
+ import { CardHeader } from "./CardHeader";
3
+ import { CardTitle } from "./CardTitle";
4
+ import { CardSubtitle } from "./CardSubtitle";
5
+ import { CardActions } from "./CardActions";
6
+ import { CardBody } from "./CardBody";
7
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
3
8
  variant?: "default" | "hover" | "selected";
4
9
  padding?: "none" | "small" | "medium" | "large";
5
10
  onClick?: () => void;
6
11
  "aria-label"?: string;
7
12
  "aria-labelledby"?: string;
13
+ /**
14
+ * Render the root as a semantic `<section>` instead of `<div>`.
15
+ * When `true`, the Card becomes a landmark — a screen-reader-visible
16
+ * region in the document outline — so it MUST carry an accessible
17
+ * name (either `aria-labelledby` pointing to a `Card.Title` `id` or
18
+ * `aria-label`). A dev-only warning is emitted when this contract
19
+ * isn't met; an anonymous landmark hurts navigation by announcing
20
+ * "region" without a name.
21
+ * @default false
22
+ */
23
+ asSection?: boolean;
8
24
  }
9
- /**
10
- * Card Component
11
- *
12
- * A versatile card component for displaying content in containers.
13
- * Follows Atomic Design principles as a Molecule component.
14
- * Can be used to replace BoxWrapper in many cases with more flexibility.
15
- * Optimized with React.memo to prevent unnecessary re-renders.
16
- *
17
- * @example
18
- * ```tsx
19
- * <Card variant="hover" padding="large">
20
- * <h3>Card Title</h3>
21
- * <p>Card content</p>
22
- * </Card>
23
- * ```
24
- */
25
- declare const Card: import("react").MemoExoticComponent<({ variant, padding, className, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, ...props }: Props) => import("react").JSX.Element>;
25
+ type CardCompound = FC<CardProps> & {
26
+ Header: typeof CardHeader;
27
+ Title: typeof CardTitle;
28
+ Subtitle: typeof CardSubtitle;
29
+ Actions: typeof CardActions;
30
+ Body: typeof CardBody;
31
+ };
32
+ declare const Card: CardCompound;
26
33
  export default Card;
@@ -0,0 +1,21 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ export interface CardActionsProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ }
5
+ /**
6
+ * CardActions — wrapper that hosts consumer-supplied action buttons
7
+ * within a `Card.Header`.
8
+ *
9
+ * The `data-card-actions` attribute is the structural marker `CardHeader`
10
+ * uses (via Tailwind v4 `:has()` selectors) to switch its grid layout
11
+ * from a single column to `[1fr auto]` when actions are present, so
12
+ * Title/Subtitle stack in column 1 and the action row spans both rows
13
+ * in column 2. Consumers should not override this attribute.
14
+ *
15
+ * This component is presentational: it emits no handlers on the DOM
16
+ * itself. The action elements (typically `<Button>`) are consumer-supplied
17
+ * and React's RSC boundary keeps them as client references — the
18
+ * wrapper stays server-safe.
19
+ */
20
+ export declare function CardActions({ children, className, ...props }: CardActionsProps): import("react").JSX.Element;
21
+ export default CardActions;
@@ -0,0 +1,6 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ export interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ }
5
+ export declare function CardBody({ children, className, ...props }: CardBodyProps): import("react").JSX.Element;
6
+ export default CardBody;
@@ -0,0 +1,6 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ }
5
+ export declare function CardHeader({ children, className, ...props }: CardHeaderProps): import("react").JSX.Element;
6
+ export default CardHeader;
@@ -0,0 +1,6 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ export interface CardSubtitleProps extends HTMLAttributes<HTMLParagraphElement> {
3
+ children: ReactNode;
4
+ }
5
+ export declare function CardSubtitle({ children, className, ...props }: CardSubtitleProps): import("react").JSX.Element;
6
+ export default CardSubtitle;
@@ -0,0 +1,22 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ export type CardTitleAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
3
+ export interface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {
4
+ children: ReactNode;
5
+ /**
6
+ * Optional icon rendered before the title text.
7
+ */
8
+ icon?: ReactNode;
9
+ /**
10
+ * Optional badge rendered after the title text.
11
+ */
12
+ badge?: ReactNode;
13
+ /**
14
+ * Heading level. Default `h2` — the typical depth for a card title
15
+ * inside a page that already has an `h1`. Use `h3` (or deeper) when
16
+ * the card sits inside a nested section.
17
+ * @default 'h2'
18
+ */
19
+ as?: CardTitleAs;
20
+ }
21
+ export declare function CardTitle({ children, icon, badge, as: As, className, ...props }: CardTitleProps): import("react").JSX.Element;
22
+ export default CardTitle;
@@ -1 +1,13 @@
1
1
  export { default } from "./Card";
2
+ export { default as Card } from "./Card";
3
+ export type { CardProps } from "./Card";
4
+ export { CardHeader } from "./CardHeader";
5
+ export type { CardHeaderProps } from "./CardHeader";
6
+ export { CardTitle } from "./CardTitle";
7
+ export type { CardTitleProps, CardTitleAs } from "./CardTitle";
8
+ export { CardSubtitle } from "./CardSubtitle";
9
+ export type { CardSubtitleProps } from "./CardSubtitle";
10
+ export { CardActions } from "./CardActions";
11
+ export type { CardActionsProps } from "./CardActions";
12
+ export { CardBody } from "./CardBody";
13
+ export type { CardBodyProps } from "./CardBody";
@@ -24,6 +24,17 @@ export type { StackProps } from "./layouts/Stack/Stack";
24
24
  export { default as Breadcrumb } from "./components/Breadcrumb/Breadcrumb";
25
25
  export type { BreadcrumbItem } from "./components/Breadcrumb/Breadcrumb";
26
26
  export { default as Card } from "./components/Card/Card";
27
+ export type { CardProps } from "./components/Card/Card";
28
+ export { CardHeader } from "./components/Card/CardHeader";
29
+ export type { CardHeaderProps } from "./components/Card/CardHeader";
30
+ export { CardTitle } from "./components/Card/CardTitle";
31
+ export type { CardTitleProps, CardTitleAs } from "./components/Card/CardTitle";
32
+ export { CardSubtitle } from "./components/Card/CardSubtitle";
33
+ export type { CardSubtitleProps } from "./components/Card/CardSubtitle";
34
+ export { CardActions } from "./components/Card/CardActions";
35
+ export type { CardActionsProps } from "./components/Card/CardActions";
36
+ export { CardBody } from "./components/Card/CardBody";
37
+ export type { CardBodyProps } from "./components/Card/CardBody";
27
38
  export { DialogHeader } from "./components/Dialog/DialogHeader";
28
39
  export type { DialogHeaderProps } from "./components/Dialog/DialogHeader";
29
40
  export { DialogFooter } from "./components/Dialog/DialogFooter";
@@ -40,6 +51,8 @@ export { default as MenuSeparator } from "./components/Menu/MenuSeparator";
40
51
  export type { MenuSeparatorProps } from "./components/Menu/MenuSeparator";
41
52
  export { default as NavbarSeparator } from "./components/SideNavbar/components/Navbar/NavbarSeparator";
42
53
  export type { NavbarSeparatorProps } from "./components/SideNavbar/types";
54
+ export { default as PageHeader } from "./components/PageHeader/PageHeader";
55
+ export type { PageHeaderProps, PageHeaderVariant, } from "./components/PageHeader/types";
43
56
  export { default as TableCell } from "./components/Table/TableCell";
44
57
  export type { TableCellProps } from "./components/Table/TableCell";
45
58
  export { default as Timeline } from "./components/Timeline/Timeline";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fabio.caffarello/react-design-system",
3
3
  "private": false,
4
- "version": "3.3.1",
4
+ "version": "3.5.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",