@carbonid1/design-system 5.14.0 → 5.15.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/dist/Card/Card.d.ts +27 -0
- package/dist/Card/Card.js +45 -0
- package/dist/Card/Card.types.d.ts +16 -0
- package/dist/Card/Card.types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps } from './Card.types';
|
|
2
|
+
declare const cardVariants: (props?: ({
|
|
3
|
+
elevation?: "raised" | "floating" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Structural content card adapted from the shadcn Card shape to design-system tokens.
|
|
7
|
+
*
|
|
8
|
+
* `Card.Root` is the only surface: `elevation="raised"` (default) rests on the page like
|
|
9
|
+
* paper on the desk; `elevation="floating"` lifts above an already-raised surface — a card
|
|
10
|
+
* rendered inside another card or panel — by stepping up to the popover tier, since the
|
|
11
|
+
* four-tier contract has no card-on-card step and `floating` is the only "above everything"
|
|
12
|
+
* surface. Compose the padded body inside `Card.Content`; `Card.Header` / `Card.Title` /
|
|
13
|
+
* `Card.Description` / `Card.Action` / `Card.Footer` are layout and typography slots meant to
|
|
14
|
+
* sit within it. Full-bleed media goes as a direct child of `Card.Root` above `Card.Content`;
|
|
15
|
+
* pair it with `overflow-hidden` on the root so the media clips to the radius (the root's own
|
|
16
|
+
* shadow renders outside the box and is unaffected).
|
|
17
|
+
*/
|
|
18
|
+
export declare const Card: {
|
|
19
|
+
Root: ({ className, elevation, ...props }: CardRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
Content: ({ className, ...props }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
Header: ({ className, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
Title: ({ className, ...props }: CardTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
Description: ({ className, ...props }: CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
Action: ({ className, ...props }: CardActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
Footer: ({ className, ...props }: CardFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
export { cardVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../helpers/cn/cn';
|
|
4
|
+
const cardVariants = cva('border-border flex min-w-0 flex-col rounded-lg border', {
|
|
5
|
+
variants: {
|
|
6
|
+
elevation: {
|
|
7
|
+
raised: 'bg-card text-card-foreground shadow-card',
|
|
8
|
+
floating: 'bg-popover text-popover-foreground shadow-popover',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: { elevation: 'raised' },
|
|
12
|
+
});
|
|
13
|
+
const Root = ({ className, elevation, ...props }) => (_jsx("div", { className: cn(cardVariants({ elevation }), className), ...props }));
|
|
14
|
+
const Content = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col gap-4 p-4', className), ...props }));
|
|
15
|
+
// The grid stays single-column until a Card.Action is present, at which point the
|
|
16
|
+
// `has-data` query opens a second auto-width column for it; the action spans both
|
|
17
|
+
// rows so an auto-placed title and description still stack down the first column.
|
|
18
|
+
const Header = ({ className, ...props }) => (_jsx("div", { className: cn('grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[card-slot=action]:grid-cols-[1fr_auto]', className), ...props }));
|
|
19
|
+
const Title = ({ className, ...props }) => (_jsx("div", { className: cn('leading-tight font-semibold', className), ...props }));
|
|
20
|
+
const Description = ({ className, ...props }) => (_jsx("div", { className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
21
|
+
const Action = ({ className, ...props }) => (_jsx("div", { "data-card-slot": "action", className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), ...props }));
|
|
22
|
+
const Footer = ({ className, ...props }) => (_jsx("div", { className: cn('flex items-center gap-2', className), ...props }));
|
|
23
|
+
/**
|
|
24
|
+
* Structural content card adapted from the shadcn Card shape to design-system tokens.
|
|
25
|
+
*
|
|
26
|
+
* `Card.Root` is the only surface: `elevation="raised"` (default) rests on the page like
|
|
27
|
+
* paper on the desk; `elevation="floating"` lifts above an already-raised surface — a card
|
|
28
|
+
* rendered inside another card or panel — by stepping up to the popover tier, since the
|
|
29
|
+
* four-tier contract has no card-on-card step and `floating` is the only "above everything"
|
|
30
|
+
* surface. Compose the padded body inside `Card.Content`; `Card.Header` / `Card.Title` /
|
|
31
|
+
* `Card.Description` / `Card.Action` / `Card.Footer` are layout and typography slots meant to
|
|
32
|
+
* sit within it. Full-bleed media goes as a direct child of `Card.Root` above `Card.Content`;
|
|
33
|
+
* pair it with `overflow-hidden` on the root so the media clips to the radius (the root's own
|
|
34
|
+
* shadow renders outside the box and is unaffected).
|
|
35
|
+
*/
|
|
36
|
+
export const Card = {
|
|
37
|
+
Root,
|
|
38
|
+
Content,
|
|
39
|
+
Header,
|
|
40
|
+
Title,
|
|
41
|
+
Description,
|
|
42
|
+
Action,
|
|
43
|
+
Footer,
|
|
44
|
+
};
|
|
45
|
+
export { cardVariants };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import type { cardVariants } from './Card';
|
|
4
|
+
/**
|
|
5
|
+
* `elevation` is the only token-bearing prop: `raised` (default) for a card resting on the
|
|
6
|
+
* page, `floating` for a card that must read as lifted above another raised surface. Every
|
|
7
|
+
* other part is structural and inherits its color from the root.
|
|
8
|
+
*/
|
|
9
|
+
type CardRootProps = ComponentPropsWithoutRef<'div'> & VariantProps<typeof cardVariants>;
|
|
10
|
+
type CardContentProps = ComponentPropsWithoutRef<'div'>;
|
|
11
|
+
type CardHeaderProps = ComponentPropsWithoutRef<'div'>;
|
|
12
|
+
type CardTitleProps = ComponentPropsWithoutRef<'div'>;
|
|
13
|
+
type CardDescriptionProps = ComponentPropsWithoutRef<'div'>;
|
|
14
|
+
type CardActionProps = ComponentPropsWithoutRef<'div'>;
|
|
15
|
+
type CardFooterProps = ComponentPropsWithoutRef<'div'>;
|
|
16
|
+
export type { CardRootProps, CardContentProps, CardHeaderProps, CardTitleProps, CardDescriptionProps, CardActionProps, CardFooterProps, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { Badge, badgeVariants } from './Badge/Badge';
|
|
|
3
3
|
export type { BadgeProps } from './Badge/Badge.types';
|
|
4
4
|
export { Button, buttonVariants } from './Button/Button';
|
|
5
5
|
export type { ButtonProps } from './Button/Button.types';
|
|
6
|
+
export { Card, cardVariants } from './Card/Card';
|
|
7
|
+
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps, } from './Card/Card.types';
|
|
6
8
|
export { Kbd, kbdVariants } from './Kbd/Kbd';
|
|
7
9
|
export type { KbdProps } from './Kbd/Kbd.types';
|
|
8
10
|
export { Text, textVariants } from './Text/Text';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useHotkeysContext as useHotkeysContextHook, useRecordHotkeys as useRecordHotkeysHook, } from 'react-hotkeys-hook';
|
|
2
2
|
export { Badge, badgeVariants } from './Badge/Badge';
|
|
3
3
|
export { Button, buttonVariants } from './Button/Button';
|
|
4
|
+
export { Card, cardVariants } from './Card/Card';
|
|
4
5
|
export { Kbd, kbdVariants } from './Kbd/Kbd';
|
|
5
6
|
export { Text, textVariants } from './Text/Text';
|
|
6
7
|
export { ProgressRing } from './ProgressRing/ProgressRing';
|